AI_Zig/src/activations.zig
2026-02-04 18:32:41 +01:00

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);
}
};