Skip to content

Statistical/Machine Learning using Randomized and Quasi-Randomized (neural) networks (currently Python & R)

License

Notifications You must be signed in to change notification settings

Techtonique/nnetsauce

Repository files navigation

nnetsauce

nnetsauce logo


Randomized and Quasi-Randomized (neural) networks.

PyPI PyPI - License Downloads Downloads HitCount CodeFactor Documentation

Contents

Installing for Python and R | Package description | Quick start | Contributing | Tests | Dependencies | Citing nnetsauce | API Documentation | References | License

Installing (for Python and R)

Python

  • 1st method: by using pip at the command line for the stable version
pip install nnetsauce
  • 2nd method: using conda (Linux and macOS only for now)
conda install -c conda-forge nnetsauce 

(Note to self or developers: https://github.com/conda-forge/nnetsauce-feedstock and https://conda-forge.org/docs/maintainer/adding_pkgs.html#step-by-step-instructions and https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#the-whole-ci-cd-workflow)

  • 3rd method: from Github, for the development version
pip install git+https://github.com/Techtonique/nnetsauce.git

or

git clone https://github.com/Techtonique/nnetsauce.git
cd nnetsauce
make install

R

From GitHub

remotes::install_github("Techtonique/nnetsauce_r") # the repo is in this organization

From R-universe

install.packages('nnetsauce', repos = c('https://techtonique.r-universe.dev',
'https://cloud.r-project.org'))

General rule for using the package in R: object accesses with .'s are replaced by $'s. R Examples can be found in the package, once installed, by typing (in R console):

?nnetsauce::MultitaskClassifier

For a list of available models, visit https://techtonique.github.io/nnetsauce/.

Package description

A package for Statistical/Machine Learning using Randomized and Quasi-Randomized (neural) networks. See next section.

Quick start

There are multiple examples here on GitHub, plus notebooks (including R Markdown notebooks).

You can also read these blog posts.

Lazy Deep (quasi-randomized neural) networks example

!pip install nnetsauce --upgrade
import os
import nnetsauce as ns
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
from time import time

data = load_breast_cancer()
X = data.data
y= data.target
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = .2, random_state = 123)

clf = ns.LazyDeepClassifier(n_layers=3, verbose=0, ignore_warnings=True)
start = time()
models, predictions = clf.fit(X_train, X_test, y_train, y_test)
print(f"\n\n Elapsed: {time()-start} seconds \n")

model_dictionary = clf.provide_models(X_train, X_test, y_train, y_test)

display(models)

Contributing

Your contributions are welcome, and valuable. Please, make sure to read the Code of Conduct first. If you're not comfortable with Git/Version Control yet, please use this form to provide a feedback.

In Pull Requests, let's strive to use black for formatting files:

pip install black
black --line-length=80 file_submitted_for_pr.py

A few things that we could explore are:

  • Enrich the tests
  • Any benchmarking of nnetsauce models can be stored in demo (notebooks) or examples (flat files), with the following naming convention: yourgithubname_yyyymmdd_shortdescriptionofdemo.[py|ipynb|R|Rmd]

Tests

Ultimately, tests for nnetsauce's features will be located here. In order to run them and obtain tests' coverage (using nose2), you'll do:

  • Install packages required for testing:
pip install nose2
pip install coverage
  • Run tests (in cloned repo) and print coverage:
make run-tests
make coverage

API Documentation

Citation (BibTeX entry)

Replace Version x.x.x by the version number you've used.

@misc{moudiki2019nnetsauce,
author={Moudiki, T.},
title={nnetsauce, {A} package for {S}tatistical/{M}achine {L}earning using {R}andomized and {Q}uasi-{R}andomized (neural) networks.},
howpublished={\url{https://github.com/thierrymoudiki/nnetsauce}},
note={BSD 3-Clause Clear License. Version x.x.x},
year={2019--2024}
}}

References

License

BSD 3-Clause © Thierry Moudiki, 2019.