mirror of
https://github.com/helblazer811/ManimML.git
synced 2025-05-28 19:51:06 +08:00
Added sigmoid activation, and ability to do activation above linear layers.
This commit is contained in:
15
manim_ml/neural_network/activation_functions/sigmoid.py
Normal file
15
manim_ml/neural_network/activation_functions/sigmoid.py
Normal file
@ -0,0 +1,15 @@
|
||||
from manim import *
|
||||
import numpy as np
|
||||
|
||||
from manim_ml.neural_network.activation_functions.activation_function import (
|
||||
ActivationFunction,
|
||||
)
|
||||
|
||||
class SigmoidFunction(ActivationFunction):
|
||||
"""Sigmoid Activation Function"""
|
||||
|
||||
def __init__(self, function_name="Sigmoid", x_range=[-5, 5], y_range=[0, 1]):
|
||||
super().__init__(function_name, x_range, y_range)
|
||||
|
||||
def apply_function(self, x_val):
|
||||
return 1 / (1 + np.exp(-1 * x_val))
|
Reference in New Issue
Block a user