Skip to content

SnoScience

SnoScience is a Python package created for educational purposes and is able to leverage multiprocessing to train neural networks. Sequential, feed-forward, neural networks with an arbitrary number of layers and neurons can be trained. Both regressions and classifications are supported.

Installation

The package can be installed easily with pip:

pip install snoscience

Getting started

The code snippet below gives an introduction to training neural networks with the SnoScience package:

from numpy import array
from snoscience import SimpleNeuralNetwork

# define datasets here
x_train, y_train, x_test, y_test = array([]), array([]), array([]), array([])

# define model hyperparameters here
samples = 32
epochs = 1000
rate = 0.01

# number of inputs and outputs per sample
_, inputs = x_train.shape
_, outputs = y_train.shape

# create a model with 1 hidden layer with 2 neurons and 1 output layer
model = SimpleNeuralNetwork(loss="mse", optimiser="sgd")
model.add_layer(neurons=2, activation="sigmoid")
model.add_layer(neurons=outputs, activation="sigmoid")

# train the model
model.train(x=x_train, y=y_train, epochs=epochs, samples=samples, rate=rate)

# predict regressions
model.predict(x=x_test, classify=False)

# predict classifications
model.predict(x=x_test, classify=True)

For details about more advanced features, see the tutorials page. The full code documentation can be found on the reference page.