No project description provided
Project description
VERSION
MAJOR.MINOR.PATCH
USAGE EXAMPLES
VIDEO
- to be inserted
EXAMPLE
from Pynapse import Dense, Activation_Sigmoid, Network, Net_Save, Activation_ReLU, Bin_Round
import numpy as np
layers = [
Dense(2, 10), # 2 inputs, 10 output connections
Activation_ReLU(), # ReLU activation function
Dense(10, 1), # 10 inputs (output from previous layer), 1 output neuron
Activation_Sigmoid() # Sigmoid activation function for output to be between 1 and 0
]
net = Network(layers) # Set the network to use the provided layers
X = np.array([[0,0], [0,1], [1,0], [1,1]]) # Training data for a simple OR function
y = np.array([[0],[1],[1],[1]]) # Results to aim for
net.train(X, y, epochs=200, lr=0.1) # Train the network with the provided data
Net_Save.save('model.json', layers) # Save the network to a json file
print(net.forward(np.array([[1,0]]))) # Putting data through the network, result should be near one based off the data e.g. [[0.91807402]]
print(net.forward(np.array([[1,0]]))[0][0]) # You can remove brackets like this e.g. 0.9180740216494526
prediction = net.forward(np.array([[1,0]]))[0][0] # You can remove brackets in a variable like this
print(prediction)
prediction = Bin_Round.Bin_Round(net.forward(np.array([[1,0]])))
print(prediction) # Round the output of the output of the output layer to binary 1 or 0 e.g. 1
WHY CALLED "Pynapse"
This module has been called "Pynapse" meaning Python and Synapse
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pynapse-0.5.0.tar.gz
(2.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pynapse-0.5.0.tar.gz.
File metadata
- Download URL: pynapse-0.5.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00e640e33c55ea463e2f27b19e8f1eeba78546663a249204a7d1d28d4fac2761
|
|
| MD5 |
0692e6447321858d60e6641042648ca6
|
|
| BLAKE2b-256 |
0368801646b7aea392a910c31ad2f09646127162b410ee7e3470a677aca4d051
|
File details
Details for the file Pynapse-0.5.0-py3-none-any.whl.
File metadata
- Download URL: Pynapse-0.5.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfaa7878abc183475591b5b108154e542fa7298336d4c7dafb8a6112f1b1e7d4
|
|
| MD5 |
891caac165da7ca31f5a7bb5e31e249b
|
|
| BLAKE2b-256 |
3686c4217bafde85fecb68dfd124ce1739498a2232311935cb4a8a1be62ac033
|