Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Neural Network Implementation (using just NumPy)

This Python module (NeuralNetwork.py) provides a basic implementation of a neural network. It includes various activation functions, dropout functionality, and layer management. Below, we’ll explore the key components of this neural network.

Components

    1. Activation Functions:
    • The module defines several activation functions:
      • ReLU (Rectified Linear Unit): Used for hidden layers.
      • Softmax: Typically used for the output layer in multiclass classification problems. (in my implementation will work only as such)
      • Sigmoid: Commonly used for binary classification.
      • Tanh (Hyperbolic Tangent): Another option for hidden layers.
    2. Layer Class:
    • The Layer class represents a single layer in the neural network.
    • It includes methods for forward and backward propagation.
    • Dropout functionality can be enabled or disabled for each layer.
    3. NeuralNetwork Class:
    • The NeuralNetwork class manages the entire network.
    • You can add layers, set dropout probabilities, and train the network.
    • It supports both random and fixed dropout during training.

Usage

1. Creating a Neural Network:

from NeuralNetwork import NeuralNetwork, Relu, Softmax

nn = NeuralNetwork(alpha=0.01, input_size=10, dropout_probability=0.3)
nn.add_layer(n=64, activation_function=Relu())
nn.add_layer(n=32, activation_function=Relu())
nn.add_layer(n=3, activation_function=Softmax())

2. Training the Network:

#Add training data (input-output pairs)
nn.add_series(input_data, output_data)

#Train for a specified number of epochs
nn.do_epochs(epochs=10)

3. Making Predictions:

input_sample = [0.1, 0.2, ..., 0.9]
predicted_output = nn.predict(input_sample)

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages