NNFunction
A simple package for modelling multidimensional non-linear functions using artificial neural networks.
Installation
Install from pip3:
pip3 install --user NNFunction
Or by cloning this repository:
#clone the repo
git clone https://github.com/mattkjames7/NNFunction
cd NNFunction
#Either create a wheel and use pip: (X.X.X should be replaced with the current version)
python3 setup.py bdist_wheel
pip3 install --user dists/NNFunction-X.X.X-py3-none-any.whl
#Or by using setup.py directly
python3 setup.py install --user
Usage
Start by training training a network:
import NNFunction as nnf
#create the network, defining the activation functions and the number of nodes in each layer
net = nnf.NNFunction(s,AF='softplus',Output='linear')
#note that s should be a list, where each element denotes the number of nodes in each layer
#input training data
net.AddData(X,y)
#Input matrix X should be of the shape (m,n) - where m is the number of samples and n is the number of input features
#Output hypothesis matrix y should have the shape (m,k) - where k is the number of output nodes
#optionally add validation and test data
net.AddValidationData(Xv,yv)
#Note that validation data is ignored if kfolds > 1 during training
net.AddTestData(Xt,yt)
#Train the network
net.Train(nEpoch,kfolds=k)
#nEpoch is the number of training epochs
#kfolds is the number of kfolds to do - if kfolds > 1 then the training data are split
#into kfold sets, each of which has a turn at being the validation set. This results in
#kfold networks being trained in total (net.model)
#see docstring net.Train? to see more options
After training, the cost function may be plotted:
net.PlotCost(k=k)
We can use the network on other data:
#X in this case is a new matrix
y = net.Predict(X)
The networks can be saved and reloaded:
#save
net.Save(fname='networkname.bin')
#reload
net = nnf.LoadANN(fname='networkname.bin')
The animation below demonstrates the training of a neural network used to reproduce four different functions simultaneously. It was produced using NNFunction.TrainNN4.
Metadata
Release files for NNFunction 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| NNFunction-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for NNFunction-0.0.2-py3-none-any.whl |
Release files / NNFunction-0.0.2-py3-none-any.whl
| Download URL | NNFunction-0.0.2-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7173cacc5a23f5a6065e6e6da5f3db85a585521bd0c3396e0459066877c3d9b9
|
|
BLAKE2b-256 checksum How to use checksums |
88611588c7096ce09d6bc1042e65ed43a49217974cd97be39f5c00480b6d9386
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4
|
Security for NNFunction 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.