@@ -69,7 +69,7 @@ def __init__(
69
69
if len (node_list ) < 2 :
70
70
raise ValueError ("node_list must contain at least 2 elements." )
71
71
if not isinstance (bias , bool ):
72
- raise TypeError (f "bias must be a bool (True or False)." )
72
+ raise TypeError ("bias must be a bool (True or False)." )
73
73
if np .shape (X )[1 ] != (node_list [0 ] - bias ):
74
74
raise ValueError (f"The number of columns in X must equal { node_list [0 ] - bias } ." )
75
75
if np .shape (y )[1 ] != node_list [- 1 ]:
@@ -79,27 +79,27 @@ def __init__(
79
79
if learning_rate <= 0 :
80
80
raise ValueError ("learning_rate must be greater than 0." )
81
81
82
- self .X = X
83
- self .y_true = y
84
- self .node_list = node_list
85
- self .activation = activation
86
- self .bias = bias
87
- self .is_classifier = is_classifier
88
- self .learning_rate = learning_rate
82
+ self .X : np . ndarray = X
83
+ self .y_true : np . ndarray = y
84
+ self .node_list : list [ int ] = node_list
85
+ self .activation : Callable = activation
86
+ self .bias : bool = bias
87
+ self .is_classifier : bool = is_classifier
88
+ self .learning_rate : float = learning_rate
89
89
90
90
if self .is_classifier :
91
- self .loss = skm .log_loss
92
- self .output_activation = act .sigmoid if np .shape (self .y_true )[1 ] == 1 else act .softmax
91
+ self .loss : skm . log_loss = skm .log_loss
92
+ self .output_activation : Callable = act .sigmoid if np .shape (self .y_true )[1 ] == 1 else act .softmax
93
93
else :
94
- self .loss = skm .mean_squared_error
95
- self .output_activation = act .identity
94
+ self .loss : skm . mean_squared_error = skm .mean_squared_error
95
+ self .output_activation : Callable = act .identity
96
96
97
- self .inputs_list = []
98
- self .y_pred = y
99
- self .weights = []
100
- self .prob_type = "continuous"
97
+ self .inputs_list : list [ np . ndarray ] = []
98
+ self .y_pred : np . ndarray = y
99
+ self .weights : list [ np . ndarray ] = []
100
+ self .prob_type : str = "continuous"
101
101
102
- self .nodes = sum (node_list [i ] * node_list [i + 1 ] for i in range (len (node_list ) - 1 ))
102
+ self .nodes : int = sum (node_list [i ] * node_list [i + 1 ] for i in range (len (node_list ) - 1 ))
103
103
104
104
def evaluate (self , state : np .ndarray ) -> float :
105
105
"""
0 commit comments