Exemplo n.º 1
0
from neuralpy.layers.linear import Dense
from neuralpy.layers.activation_functions import ReLU
from neuralpy.loss_functions import MSELoss
from neuralpy.optimizer import Adam
import numpy as np


# Creating  Model
'''
This example will create an ann(Artifical Neural Network)
for a 3 input XOR logic

'''

model = Sequential()
model.add(Dense(n_nodes=1, n_inputs=3))
model.add(ReLU())
model.add(Dense(n_nodes=2))
model.add(ReLU())
model.add(Dense(n_nodes=1))
model.add(ReLU())

# Building the Model
model.build()

# Compiling
model.compile(optimizer=Adam(), loss_function=MSELoss(), metrics=["accuracy"])
print(model.summary())

# Data for XOR