SynaptIX logoSynaptIX

Neural Networks

v0.1.7

MLP, CNN and LSTM networks over Keras/TensorFlow with training history plots and forecasting. Requires the dl extra — lazy imports keep the core light.

Requirements

bash
pip install 'synaptix[dl]'   # installs tensorflow

Imports are lazy: import synaptix works without TensorFlow; only synaptix.neural requires it. Note: TensorFlow is not available in the browser playground.

MLP Classifier

mlp.py
import synaptix as sx

df = sx.load_dataset("iris")
X, y = df.drop(columns="species"), df["species"]

net = sx.neural.MLP(hidden_layers=(64, 32), epochs=100)
net.fit(X, y, validation_split=0.2)
net.evaluate(X, y)
net.plot_history()   # loss + accuracy curves

LSTM Forecasting

lstm.py
import synaptix as sx
import numpy as np

series = np.sin(np.linspace(0, 40, 500)) + np.random.default_rng(0).normal(0, 0.05, 500)

net = sx.neural.LSTMNet(window=24, units=64)
net.fit(series, epochs=30)
forecast = net.forecast(steps=12)
net.plot_history()

Networks

MLP

Dense network for tabular classification/regression.

CNN

Convolutional network for image-shaped inputs.

LSTMNet

Recurrent network for sequences with .forecast().

All three share fit, evaluate, plot_history and forecast (LSTM).