Skip to content

Commit 8b31579

Browse files
committed
modified: neural_network/artificial_neural_network.py
1 parent 23e3ce2 commit 8b31579

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

neural_network/artificial_neural_network.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,13 @@ class SimpleANN:
1111
- Example demonstrates solving the XOR problem.
1212
"""
1313

14-
<<<<<<< HEAD
15-
def __init__(self, input_size: int, hidden_size: int, output_size: int,
16-
learning_rate: float = 0.1) -> None:
17-
=======
1814
def __init__(
1915
self,
2016
input_size: int,
2117
hidden_size: int,
2218
output_size: int,
2319
learning_rate: float = 0.1,
2420
) -> None:
25-
>>>>>>> 79fed0c49891c60d2134ee45c6f6592c19f4cef5
2621
"""
2722
Initialize the neural network with random weights and biases.
2823
@@ -103,14 +98,9 @@ def feedforward(self, inputs: np.ndarray) -> np.ndarray:
10398
self.final_output = self.sigmoid(self.final_input)
10499
return self.final_output
105100

106-
<<<<<<< HEAD
107-
def backpropagation(self, inputs: np.ndarray, targets: np.ndarray,
108-
outputs: np.ndarray) -> None:
109-
=======
110101
def backpropagation(
111102
self, inputs: np.ndarray, targets: np.ndarray, outputs: np.ndarray
112103
) -> None:
113-
>>>>>>> 79fed0c49891c60d2134ee45c6f6592c19f4cef5
114104
"""
115105
Perform backpropagation to adjust the weights and biases.
116106
@@ -138,25 +128,14 @@ def backpropagation(
138128
np.sum(output_gradient, axis=0, keepdims=True) * self.learning_rate
139129
)
140130

141-
<<<<<<< HEAD
142-
self.weights_input_hidden += (
143-
inputs.T.dot(hidden_gradient) * self.learning_rate
144-
)
145-
=======
146131
self.weights_input_hidden += inputs.T.dot(hidden_gradient) * self.learning_rate
147-
>>>>>>> 79fed0c49891c60d2134ee45c6f6592c19f4cef5
148132
self.bias_hidden += (
149133
np.sum(hidden_gradient, axis=0, keepdims=True) * self.learning_rate
150134
)
151135

152-
<<<<<<< HEAD
153-
def train(self, inputs: np.ndarray, targets: np.ndarray,
154-
epochs: int = 10000, verbose: bool = False) -> None:
155-
=======
156136
def train(
157137
self, inputs: np.ndarray, targets: np.ndarray, epochs: int = 10000
158138
) -> None:
159-
>>>>>>> 79fed0c49891c60d2134ee45c6f6592c19f4cef5
160139
"""
161140
Train the neural network on the given input and target data.
162141

0 commit comments

Comments
 (0)