12 lines
218 B
Zig
12 lines
218 B
Zig
const std = @import("std");
|
|
|
|
pub const Sigmoid = struct {
|
|
pub fn apply(x: f32) f32 {
|
|
return 1.0 / (1.0 + std.math.exp(-x));
|
|
}
|
|
|
|
pub fn derivative(y: f32) f32 {
|
|
return y * (1.0 - y);
|
|
}
|
|
};
|