MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / example

Function example

neural_network/back_propagation_neural_network.py:177–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

175
176
177def example():
178 rng = np.random.default_rng()
179 x = rng.normal(size=(10, 10))
180 y = np.asarray(
181 [
182 [0.8, 0.4],
183 [0.4, 0.3],
184 [0.34, 0.45],
185 [0.67, 0.32],
186 [0.88, 0.67],
187 [0.78, 0.77],
188 [0.55, 0.66],
189 [0.55, 0.43],
190 [0.54, 0.1],
191 [0.1, 0.5],
192 ]
193 )
194 model = BPNN()
195 for i in (10, 20, 30, 2):
196 model.add_layer(DenseLayer(i))
197 model.build()
198 model.summary()
199 model.train(xdata=x, ydata=y, train_round=100, accuracy=0.01)
200
201
202if __name__ == "__main__":

Calls 6

add_layerMethod · 0.95
buildMethod · 0.95
summaryMethod · 0.95
trainMethod · 0.95
BPNNClass · 0.85
DenseLayerClass · 0.85

Tested by

no test coverage detected