dimanche 5 décembre 2021

Add Two Numbers With Neural Network and Educating it

I am trying to create neural network that returns 1 when the sum of two numbers is positive and -1 when negative.

Datas And Targets

I writed the x1's and x2's into a 2D array and I tried to create random weights in a NeuralNetwork class. But I have no idea about generating random double weights between [-1,1] and educate the neuron. I coded a lil bit but I do not now how to execute the remaning part. I have been researching this for 5 days but I only learned sth about sigmoid functions. Here is my starting point.

import numpy as np from numpy import exp, array, random, dot, tanh

# Class to create a neural
# network
class NeuralNetwork():

        weights = [random.random(), random.random(),]
                     # weights generated in a list
        inputs = [[6, 5], [2, 4], [-3, -5], [-1, -1], [1, 1], [-2, 7], [-4, -2], [-6, 3]]

I am pretty new on ANN. Thanks a lot for the help.




Aucun commentaire:

Enregistrer un commentaire