Backpropagation
Backpropagation
Aim
To implement an Artificial Neural Network (ANN) using the Backpropagation
Algorithm and evaluate its performance on the Iris dataset.
Algorithm
Program
import numpy as np
import pandas as pd
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OneHotEncoder
hidden_layer_error =
output_delta.dot(self.weights_hidden_output.T)
hidden_layer_delta = hidden_layer_error *
self.sigmoid_derivative(self.hidden_layer_output)
# Calculate accuracy
accuracy = np.mean(predictions == y_test_labels)
print(f'Accuracy: {accuracy:.4f}')
Output
Accuracy:
Result
The implemented Artificial Neural Network (ANN) using the Backpropagation algorithm
achieved an accuracy of on the Iris dataset.