Skip to main content

A neural network Framework

Project description

SJNET is a Neural Network Framewrork

These can be used to create and train custom neural network

Install SJNET

pip install SJNET

Import SJNET

from SJNET import Network ,Layer

A new Network can be initialized by

# provide the dataset X and Y
# each element is Y must be an array [] , Y = [[y1..y1n],[y2..y2n]...[yN..yNn]]

network = Network(X=X,Y=Y,learningRate=0.0002,epoch=1000,errorThresh=3)

Declare or initialize layers with its coresponding arguments

  • neuronCount : number of neurons required in the layer

  • position : position of layer in network

    • Note : (1 for input layer and -1 for output layer)
  • activation : required activation function , avilable("linear","relu","sigmoid")

#Note: position must be (1 for input layer and -1 for output layer)
inputLayer = Layer(neuronCount=2,position=1)
hidden = Layer(neuronCount=10,position=2,activation="linear")
hidden2 = Layer(neuronCount=4,position=3,activation="linear")
output = Layer(neuronCount=1,position=-1,activation="linear")

Add declared layers into the network

#add them in order (inputLayer->first , outputLayer->last)
network.add(layer=inputLayer)
network.add(layer=hidden)
network.add(layer=hidden2)
network.add(layer=output)

Compile or initilise the network setup

network.compile()

Train the model

network.Train()

Save the model

# saved as json
network.save(name="testModel")

Load the model

network = Network()
Model = {}
with open('./savedmodels/testModel.json', 'r') as file:
    Model = json.load(file)

#Loads the  network with weights and biases 
network.loadNetwork(network=Model)

predict with model

pred_val = network.predict(inputvals=[3.1, 2.5])

How to train and save a model -> Training_and_Saving_Model.py

How to load and use the model -> Loading_Pre_Trained_Model.py

It uses stochastic gradient descent, just in case you are curious.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SJNET-2.0.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

SJNET-2.0.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file SJNET-2.0.0.tar.gz.

File metadata

  • Download URL: SJNET-2.0.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for SJNET-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ffb5ee46bc4ea58a09ea2ec652521634a6a5a10a7e8ffccc204f9fc98a032a27
MD5 8f43e3f9a34a6e5c7331aeceff22d614
BLAKE2b-256 cccfdce1bc71e0449c275a15453516f2edea96ae21f79eda65580a512e508ffe

See more details on using hashes here.

File details

Details for the file SJNET-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: SJNET-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for SJNET-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f048a0be699e8bfcc45b6c5543106cea800fb257d305c55dcaa828190ab032de
MD5 1d394be32defac56b21bc187ab4b4329
BLAKE2b-256 bad088dc710ab0d28a0ed73b7f7cba972a9a4b6482dbf14c9e95418a5fe822df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page