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.2.0.tar.gz (4.8 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.2.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for SJNET-2.2.0.tar.gz
Algorithm Hash digest
SHA256 6b76ae8dc16e3a249648928068ca1cf48fd7095d2c7c093d9a44c74911c69408
MD5 ad0abc96764af128b1e9de909d0c548b
BLAKE2b-256 29dead326d04f692897d25f83ed3f610d0925203bfd133eee4b4c201be40bb39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: SJNET-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 28e78d721f42651f8d70ba70c6335a8c7a0ca0636b293eadfa4e0ca51fe0eaf6
MD5 0cd6955e5dfcb2ae7223dfcbe8ef0e5d
BLAKE2b-256 0823ffb1482ca807f4712e8a7af6b0ddbfefc18a22aecc356ee1250cfa9b21f0

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