mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
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:
parent
e6aae1cf66
commit
b6b45eb1ce
|
@ -196,7 +196,7 @@ class TwoHiddenLayerNeuralNetwork:
|
|||
>>> output_val = numpy.array(([0], [1], [1]), dtype=float)
|
||||
>>> nn = TwoHiddenLayerNeuralNetwork(input_val, output_val)
|
||||
>>> nn.train(output_val, 1000, False)
|
||||
>>> nn.predict([0,1,0]) in (0, 1)
|
||||
>>> nn.predict([0, 1, 0]) in (0, 1)
|
||||
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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user