Python Machine Learning Snippets (pymls)
Python Machine Learning Snippets (pymls) is my ongoing pet project where I try out different machine learning models. This project contains various machine learning examples as Jupyter notebooks with scikit-learn, statsmodel, numpy and other libraries.
Note: This is an ongoing project and far away from complete.
All the required Python packages can be installed with
First you nee to install
$ pip install --user pipenv
Install all the required packages
$ pipenv install --dev
Run the Notebook
You can start
jupyter-lab to play around with the Juypter notebooks.
pipenv run jupyter-lab
Run the Tests (nbval)
To test the Jupyter notebooks this project uses nbval, which is a
plugin for validating Jupyter notebooks.
This will check all Jupyter notebooks for errors.
pipenv run py.test --nbval-lax
Upgrade Python Packages
Check which packages have changed.
pipenv update --outdated
This will upgrade everything.
CI Build (GitHub Actions)
See the GitHub Actions build.yml file for more details.
Export the Jupyter Notebooks
To export the Jupyter notebooks to Markdonw the export-notebooks.sh script can be used.
This scrip uses
nbconvert to convert the Jupyter notebooks.
The following machine learning snippets are available as Jupyter Notebook.
- Centroid-based clustering
- K-means (scikit-learn)
- Density-based clustering
- Connectivity based clustering
- Agglomerative Clustering (Hierarchical Clustering) (scikit-learn)
- Hierarchical Clustering (SciPy)
- Distribution-based clustering
- Gaussian Mixture Model (scikit-learn)