Fix numpy deprecation warning in 2_hidden_layers_neural_network.py (#10424)
* updating DIRECTORY.md
* updating DIRECTORY.md
* updating DIRECTORY.md
* updating DIRECTORY.md
* Fix deprecation warning in 2_hidden_layers_neural_network.py
Fix numpy deprecation warning:
DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
---------
Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@@ -196,7 +196,7 @@ class TwoHiddenLayerNeuralNetwork:
|
|||||||
>>> output_val = numpy.array(([0], [1], [1]), dtype=float)
|
>>> output_val = numpy.array(([0], [1], [1]), dtype=float)
|
||||||
>>> nn = TwoHiddenLayerNeuralNetwork(input_val, output_val)
|
>>> nn = TwoHiddenLayerNeuralNetwork(input_val, output_val)
|
||||||
>>> nn.train(output_val, 1000, False)
|
>>> nn.train(output_val, 1000, False)
|
||||||
>>> nn.predict([0,1,0]) in (0, 1)
|
>>> nn.predict([0, 1, 0]) in (0, 1)
|
||||||
True
|
True
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ class TwoHiddenLayerNeuralNetwork:
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return int(self.layer_between_second_hidden_layer_and_output > 0.6)
|
return int((self.layer_between_second_hidden_layer_and_output > 0.6)[0])
|
||||||
|
|
||||||
|
|
||||||
def sigmoid(value: numpy.ndarray) -> numpy.ndarray:
|
def sigmoid(value: numpy.ndarray) -> numpy.ndarray:
|
||||||
|
|||||||
Reference in New Issue
Block a user