Skip to main content

ML Tutor : Learn Machine Learning while never leaving the conform of your Python IDE (Jupyter Notebook or Google Colab)

Project description

ML Tutor v1.0.3

Downloads

ML Tutor is a Python library created to help people learn Machine Learning (ML).

Machine Learning (ML) is pretty hard and especially if you are just starting (been there done that)! I've created this library to help anybody interested in learning ML. ML Tutor provides visual training for every algorithm inside it so you can visualize what's happening with your data in real-time! Besides that, for every algorithm, there is a theory on how it works and interview questions.

Happy learning! ^_^

Use ML Tutor if you are looking to:

  • Learn most popular Machine Learning algorithms directly from Jupyter Notebook or Google Colab
  • Visualize what's happening with your data (Educational purpose only)

Usage

To demonstrate what you can do with ML Tutor, we will need a dataset. You can use your own dataset or some classic dataset (such as Iris).

Let's use the Iris dataset from the Sklearn library and split it into the training and testing subsets.

from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split

dataset = load_iris()
X_train, X_test, y_train, y_test = train_test_split(dataset.data, dataset.target, test_size=0.2)

Training/Prediction

Clustering

For the clustering example, let's import KMeans and demonstrate how to use it with the ML Tutor library. Notice that you can train/test it just like any sklearn algorithm.

Each algorithm has several arguments you can provide, but the unique one across all of them is visual_training. If you set this to True, you will see the whole training process inside your IDE.

from ml_tutor.clustering.kmeans import KMeans

clf = KMeans(n_clusters=3, visual_training=True)
clf.fit(X_train)

Classification

For the classification example, let's use KNeighbourClassifier (KNN).

Because the KNN just stores data when you call the .fit() function on it, the visualization part comes in the prediction time.

from ml_tutor.classification.knn import KNeighbourClassifier

clf = KNeighbourClassifier(n_neighbors=5, visual_training=True, number_of_visual_steps=2)
clf.fit(X_train, y_train)

predictions = clf.predict(X_test)

How an algorithm works? (theory)

Every algorithm has method .how_it_works() which generates a blog post directly inside your IDE. Every blog is written by somebody from the community, not myself, and in the end, they get a shout out for the great material.

from ml_tutor.classification.knn import KNeighbourClassifier

clf = KNeighbourClassifier()
clf.how_it_works()

What if I prefer video instead of reading tutorial?

I've got you covered! Just place video=True inside the method how_it_works(), and it will open a YouTube video for you.

from ml_tutor.classification.knn import KNeighbourClassifier

clf = KNeighbourClassifier()
clf.how_it_works(video=True)

Interview questions

If you call .interview_questions() on any algorithm, it will generate resources with interview questions for the algorithm.

from ml_tutor.classification.knn import KNeighbourClassifier

clf = KNeighbourClassifier()
clf.interview_questions()

Sklearn code

Since this is the library for education and not for production, you'll need to learn how to use these algorithms with the battle-tested library sklearn. Just call .sklearn_version() on any algorithm, and it will generate code for you!

NOTE: For now, this method only works in Jupyter Notebook!

from ml_tutor.classification.knn import KNeighbourClassifier

clf = KNeighbourClassifier()
clf.sklearn_version()

Supported IDEs

For now this library is fully supported for Jupyter Notebook and partially supported for Google Colab (read Sklearn code section for more details).

Installation

Installation with pip

You can install ML Tutor directly from the PyPi repository using pip (or pip3):

pip install ml-tutor

Manual installation

If you prefer to install it from source:

  1. Clone this repository
git clone https://github.com/lucko515/ml-tutor
  1. Go to the library folder and run
pip install .

TODO

If you want to contribute to the ML Tutor, here is what's on the TODO list:

  • .sklearn_version() is not working in Google Colab
  • Logistic Regression visualization needs a re-do, currently it's not showing how the classification lines moves over time
  • Interview questions should be added to each algorithm (take the knn.py as a reference)
  • Visualization export to .gif and/or .mp4
  • Additional algorithms (e.g. NaiveBayes)
  • Support for other IDEs (e.g. regular Python Shell)

Contact

Add me on LinkedIn.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ml_tutor-1.0.3.tar.gz (26.3 kB view details)

Uploaded Source

File details

Details for the file ml_tutor-1.0.3.tar.gz.

File metadata

  • Download URL: ml_tutor-1.0.3.tar.gz
  • Upload date:
  • Size: 26.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.9

File hashes

Hashes for ml_tutor-1.0.3.tar.gz
Algorithm Hash digest
SHA256 585ecde93a2a214d9fc8acebe6a956e42cb9fc382ef9fc5f82d3d24a319abb03
MD5 fedd2d2356df5faddd53ce949a83bdcd
BLAKE2b-256 bc9db9c0fb7574b684abcc704248001d52d968d3ce5ac9438688cf399e9b4d42

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page