Skip to main content
Loss of provenance

A previous release had provenance metadata, but this release does not. View details.

easy_model

A tiny, dependency-free, sklearn-style neural network classifier in pure Python, backed by the fast C++ engine neuralnetwork-cpp, plus pandas-like CSV reading, train_test_split, and six bundled classic datasets.

from easy_model import NeuralNetworkCPPClassifier, train_test_split, load_iris

Features

  • NeuralNetworkCPPClassifier - a scikit-learn compatible classifier (fit / predict / predict_proba / score, get_params / set_params).
  • read_csv - read CSV files (including .gz) with pandas-like behavior.
  • train_test_split - split data into train/test, with shuffle, random seeding, and stratification, just like sklearn.
  • Bundled datasets - iris, wine, breast cancer, diabetes, digits, and linnerud, loaded the sklearn way with return_X_y support.
  • No pandas or numpy required - everything is plain Python lists.

Installation

Install from PyPI (this pulls in the only dependency automatically):

pip install nn-easy-model

Or clone the repository and run it directly:

git clone https://github.com/Mohamedboukerche22/easy_model.git
cd easy_model
pip install .            # optional: install the package
python main.py           # runs the demos

Quickstart

from easy_model import NeuralNetworkCPPClassifier, train_test_split, load_iris

# 1. Load a dataset
X, y = load_iris(return_X_y=True)

# 2. Split into train / test
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.3, random_state=42, stratify=y,
)

# 3. Train
clf = NeuralNetworkCPPClassifier(
    hidden_layer_sizes=(16, 8),
    learning_rate=0.01,
    max_iter=200,
    batch_size=8,
    random_state=42,
)
clf.fit(X_train, y_train)

# 4. Evaluate and predict
print('train accuracy:', clf.score(X_train, y_train))
print('test  accuracy:', clf.score(X_test, y_test))
print('predicted:', clf.predict(X_test[:3]))

API

NeuralNetworkCPPClassifier

Main parameters:

Parameter Description
hidden_layer_sizes tuple of hidden layer sizes, e.g. (128, 64)
activation 'relu', 'tanh', 'sigmoid', 'leaky_relu', 'linear'
learning_rate optimizer learning rate
max_iter number of training epochs
batch_size mini-batch size
optimizer 'adam', 'sgd', 'momentum'
loss 'cross_entropy', 'binary_cross_entropy', 'mse'
shuffle shuffle samples each epoch (bool)
random_state seed for reproducibility
verbose 1 to print training loss per epoch

Methods: fit(X, y), predict(X), predict_proba(X), score(X, y), get_params(), set_params(**params).

Fitted attributes: classes_, n_features_in_, n_classes_, loss_curve_, history_, fit_time_seconds_.

read_csv

from easy_model import read_csv, DATA_DIR

header, rows = read_csv(f'{DATA_DIR}/iris.csv')
# header -> [150, 4, 'setosa', 'versicolor', 'virginica']
# rows   -> [[5.1, 3.5, 1.4, 0.2, 0], ...]

read_csv(path, sep=',', header=0) auto-decompresses .gz files, converts numeric cells to int/float, and keeps strings as strings. Pass header=None to treat every line as data.

train_test_split

X_train, X_test, y_train, y_test = train_test_split(
    X, y,
    test_size=0.3,       # fraction, or an int number of samples
    train_size=None,     # mutually exclusive with test_size
    random_state=42,     # reproducibility
    shuffle=True,
    stratify=y,          # keep class proportions in both splits
)

Bundled datasets

Loader Samples Features Target
load_iris() 150 4 3-class species
load_wine() 178 13 3-class wine cultivar
load_breast_cancer() 569 30 binary (malignant/benign)
load_diabetes() 442 10 regression target
load_digits() 1797 64 10-class digits (0-9)
load_linnerud() 20 3 multi-output exercise counts

Each loader returns a Bunch (sklearn-style attributes) or, with return_X_y=True, a (X, y) tuple:

bunch = load_wine()
bunch.data, bunch.target, bunch.target_names, bunch.feature_names

X, y = load_wine(return_X_y=True)

Full example

from easy_model import NeuralNetworkCPPClassifier, train_test_split, load_digits

X, y = load_digits(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.25, random_state=0, stratify=y,
)

clf = NeuralNetworkCPPClassifier(
    hidden_layer_sizes=(128, 64), learning_rate=0.003,
    max_iter=10, batch_size=64, random_state=123,
)
clf.fit(X_train, y_train)

print('accuracy:', clf.score(X_test, y_test))

Requirements

License

MIT

Metadata

Release files for nn-easy-model 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Loss of provenance

These files do not have provenance metadata, despite files in a prior release including this data.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for nn-easy-model 0.1.2
File Size Uploaded Provenance Actions
nn_easy_model-0.1.2.tar.gz 136.1 kB Without provenance Details for nn_easy_model-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nn-easy-model 0.1.2
File Interpreter ABI Platform Actions
nn_easy_model-0.1.2-py3-none-any.whl Python 3 none any Details for nn_easy_model-0.1.2-py3-none-any.whl

Total release size: 269.4 kB

Release files / nn_easy_model-0.1.2.tar.gz

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL nn_easy_model-0.1.2.tar.gz
Size 136.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4f2330ce29f3a3be69ede68ac39c7377dba16c380dd7727cf311c5fff153e2b3
BLAKE2b-256 checksum
How to use checksums
c9ddc4099dd67fe4e1d9808aedb447f996277e3206ffccd72ad40881fa2ce8ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / nn_easy_model-0.1.2-py3-none-any.whl

Loss of provenance

This file belongs to a release without provenance metadata, despite a prior release including this data.

We recommend further investigation before installing this file. View details.

Download URL nn_easy_model-0.1.2-py3-none-any.whl
Size 133.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
012c429e2a0af322deaabdfaecfd4761e0a6e3dd3516f6f65958ab441b5fda22
BLAKE2b-256 checksum
How to use checksums
cc4261d7b9072512658251c1dc1b9dedf4e13292fc222fbf7a21c46fb871955c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for nn-easy-model 0.1.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.

Loss of provenance

A previous release of these files had provenance metadata, but this release does not.

While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.

Release comparison

  • Removed 0.1.1 2 files With provenance
  • Added 0.1.2 2 files Without provenance

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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files Loss of provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page