@@ -97,32 +97,22 @@ def initialize_weights(self) -> None:
97
97
Initialize the weights and biases for the LSTM network.
98
98
"""
99
99
100
- self .wf = self .init_weights (
101
- self .char_size + self .hidden_dim , self .hidden_dim
102
- )
100
+ self .wf = self .init_weights (self .char_size + self .hidden_dim , self .hidden_dim )
103
101
self .bf = np .zeros ((self .hidden_dim , 1 ))
104
102
105
- self .wi = self .init_weights (
106
- self .char_size + self .hidden_dim , self .hidden_dim
107
- )
103
+ self .wi = self .init_weights (self .char_size + self .hidden_dim , self .hidden_dim )
108
104
self .bi = np .zeros ((self .hidden_dim , 1 ))
109
105
110
- self .wc = self .init_weights (
111
- self .char_size + self .hidden_dim , self .hidden_dim
112
- )
106
+ self .wc = self .init_weights (self .char_size + self .hidden_dim , self .hidden_dim )
113
107
self .bc = np .zeros ((self .hidden_dim , 1 ))
114
108
115
- self .wo = self .init_weights (
116
- self .char_size + self .hidden_dim , self .hidden_dim
117
- )
109
+ self .wo = self .init_weights (self .char_size + self .hidden_dim , self .hidden_dim )
118
110
self .bo = np .zeros ((self .hidden_dim , 1 ))
119
111
120
112
self .wy = self .init_weights (self .hidden_dim , self .char_size )
121
113
self .by = np .zeros ((self .char_size , 1 ))
122
114
123
- def init_weights (
124
- self , input_dim : int , output_dim : int
125
- ) -> np .ndarray :
115
+ def init_weights (self , input_dim : int , output_dim : int ) -> np .ndarray :
126
116
"""
127
117
Initialize weights with random values.
128
118
@@ -367,7 +357,6 @@ def test(self) -> None:
367
357
print (f"Accuracy: { round (accuracy * 100 / len (self .train_X ), 2 )} %" )
368
358
369
359
370
-
371
360
if __name__ == "__main__" :
372
361
data = """Long Short-Term Memory (LSTM) networks are a type
373
362
of recurrent neural network (RNN) capable of learning "
0 commit comments