• Stars
    star
    1,461
  • Rank 30,894 (Top 0.7 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created over 4 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿค– Interactive Machine Learning experiments: ๐Ÿ‹๏ธmodels training + ๐ŸŽจmodels demo

๐Ÿค– Interactive Machine Learning Experiments

๐Ÿ‡บ๐Ÿ‡ฆ UKRAINE IS BEING ATTACKED BY RUSSIAN ARMY. CIVILIANS ARE GETTING KILLED. RESIDENTIAL AREAS ARE GETTING BOMBED.


This is a collection of interactive machine-learning experiments. Each experiment consists of ๐Ÿ‹๏ธ Jupyter/Colab notebook (to see how a model was trained) and ๐ŸŽจ demo page (to see a model in action right in your browser).

โš ๏ธ This repository contains machine learning experiments and not a production ready, reusable, optimised and fine-tuned code and models. This is rather a sandbox or a playground for learning and trying different machine learning approaches, algorithms and data-sets. Models might not perform well and there is a place for overfitting/underfitting.

Experiments

Most of the models in these experiments were trained using TensorFlow 2 with Keras support.

Supervised Machine Learning

Supervised learning is when you have input variables X and an output variable Y and you use an algorithm to learn the mapping function from the input to the output: Y = f(X). The goal is to approximate the mapping function so well that when you have new input data X that you can predict the output variables Y for that data. It is called supervised learning because the process of an algorithm learning from the training dataset can be thought of as a teacher supervising the learning process.

Multilayer Perceptron (MLP) or simple Neural Network (NN)

A multilayer perceptron (MLP) is a class of feedforward artificial neural network (ANN). Multilayer perceptrons are sometimes referred to as "vanilla" neural networks (composed of multiple layers of perceptrons), especially when they have a single hidden layer. It can distinguish data that is not linearly separable.

Experiment Model demo & training Tags Dataset
Handwritten digits recognition (MLP) Handwritten Digits Recognition (MLP) Launch demo Open in Binder Open in Colab MLP MNIST
Handwritten sketch recognition (MLP) Handwritten Sketch Recognition (MLP) Launch demo Open in Binder Open in Colab MLP QuickDraw

Convolutional Neural Networks (CNN)

A convolutional neural network (CNN, or ConvNet) is a class of deep neural networks, most commonly applied to analyzing visual imagery (photos, videos). They are used for detecting and classifying objects on photos and videos, style transfer, face recognition, pose estimation etc.

Experiment Model demo & training Tags Dataset
Handwritten digits recognition (CNN) Handwritten Digits Recognition (CNN) Launch demo Open in Binder Open in Colab CNN MNIST
Handwritten sketch recognition (CNN) Handwritten Sketch Recognition (CNN) Launch demo Open in Binder Open in Colab CNN QuickDraw
Rock Paper Scissors Rock Paper Scissors (CNN) Launch demo Open in Binder Open in Colab CNN RPS
Rock Paper Scissors Rock Paper Scissors (MobilenetV2) Launch demo Open in Binder Open in Colab MobileNetV2, Transfer learning, CNN RPS , ImageNet
Objects detection Objects Detection (MobileNetV2) Launch demo Open in Binder Open in Colab MobileNetV2, SSDLite, CNN COCO
Objects detection Image Classification (MobileNetV2) Launch demo Open in Binder Open in Colab MobileNetV2, CNN ImageNet

Recurrent Neural Networks (RNN)

A recurrent neural network (RNN) is a class of deep neural networks, most commonly applied to sequence-based data like speech, voice, text or music. They are used for machine translation, speech recognition, voice synthesis etc.

Experiment Model demo & training Tags Dataset
Numbers summation (RNN) Numbers Summation (RNN) Launch demo Open in Binder Open in Colab LSTM, Sequence-to-sequence Auto-generated
Shakespeare Text Generation (RNN) Shakespeare Text Generation (RNN) Launch demo Open in Binder Open in Colab LSTM, Character-based RNN Shakespeare
Wikipedia Text Generation (RNN) Wikipedia Text Generation (RNN) Launch demo Open in Binder Open in Colab LSTM, Character-based RNN Wikipedia
Recipe Generation (RNN) Recipe Generation (RNN) Launch demo Open in Binder Open in Colab LSTM, Character-based RNN Recipe box

Unsupervised Machine Learning

Unsupervised learning is when you only have input data X and no corresponding output variables. The goal for unsupervised learning is to model the underlying structure or distribution in the data in order to learn more about the data. These are called unsupervised learning because unlike supervised learning above there is no correct answers and there is no teacher. Algorithms are left to their own to discover and present the interesting structure in the data.

Generative Adversarial Networks (GANs)

A generative adversarial network (GAN) is a class of machine learning frameworks where two neural networks contest with each other in a game. Two models are trained simultaneously by an adversarial process. For example a generator ("the artist") learns to create images that look real, while a discriminator ("the art critic") learns to tell real images apart from fakes.

Experiment Model demo & training Tags Dataset
Clothes Generation (DCGAN) Clothes Generation (DCGAN) Launch demo Open in Binder Open in Colab DCGAN Fashion MNIST

How to use this repository locally

Setup virtual environment for Experiments

# Create "experiments" environment (from the project root folder).
python3 -m venv .virtualenvs/experiments

# Activate environment.
source .virtualenvs/experiments/bin/activate
# or if you use Fish...
source .virtualenvs/experiments/bin/activate.fish

To quit an environment run deactivate.

Install dependencies

# Upgrade pip and setuptools to the latest versions.
pip install --upgrade pip setuptools

# Install packages
pip install -r requirements.txt

To install new packages run pip install package-name. To add new packages to the requirements run pip freeze > requirements.txt.

Launch Jupyter locally

In order to play around with Jupyter notebooks and see how models were trained you need to launch a Jupyter Notebook server.

# Launch Jupyter server.
jupyter notebook

Jupyter will be available locally at http://localhost:8888/. Notebooks with experiments may be found in experiments folder.

Launch demos locally

Demo application is made on React by means of create-react-app.

# Switch to demos folder from project root.
cd demos

# Install all dependencies.
yarn install

# Start demo server on http. 
yarn start

# Or start demo server on https (for camera access in browser to work on localhost).
yarn start-https

Demos will be available locally at http://localhost:3000/ or at https://localhost:3000/.

Convert models

The converter environment is used to convert the models that were trained during the experiments from .h5 Keras format to Javascript understandable formats (tfjs_layers_model or tfjs_graph_model formats with .json and .bin files) for further usage with TensorFlow.js in Demo application.

# Create "converter" environment (from the project root folder).
python3 -m venv .virtualenvs/converter

# Activate "converter" environment.
source .virtualenvs/converter/bin/activate
# or if you use Fish...
source .virtualenvs/converter/bin/activate.fish

# Install converter requirements.
pip install -r requirements.converter.txt

The conversion of keras models to tfjs_layers_model/tfjs_graph_model formats is done by tfjs-converter:

For example:

tensorflowjs_converter --input_format keras \
  ./experiments/digits_recognition_mlp/digits_recognition_mlp.h5 \
  ./demos/public/models/digits_recognition_mlp

โš ๏ธ Converting the models to JS understandable formats and loading them to the browser directly might not be a good practice since in this case the user might need to load tens or hundreds of megabytes of data to the browser which is not efficient. Normally the model is being served from the back-end (i.e. TensorFlow Extended) and instead of loading it all to the browser the user will do a lightweight HTTP request to do a prediction. But since the Demo App is just an experiment and not a production-ready app and for the sake of simplicity (to avoid having an up and running back-end) we're converting the models to JS understandable formats and loading them directly into the browser.

Requirements

Recommended versions:

  • Python: > 3.7.3.
  • Node: >= 12.4.0.
  • Yarn: >= 1.13.0.

In case if you have Python version 3.7.3 you might experience RuntimeError: dictionary changed size during iteration error when trying to import tensorflow (see the issue).

You might also be interested in

Articles

Author

More Repositories

1

javascript-algorithms

๐Ÿ“ Algorithms and data structures implemented in JavaScript with explanations and links to further readings
JavaScript
173,558
star
2

homemade-machine-learning

๐Ÿค– Python examples of popular machine learning algorithms with interactive Jupyter demos and math being explained
Jupyter Notebook
21,617
star
3

learn-python

๐Ÿ“š Playground and cheatsheet for learning Python. Collection of Python scripts that are split by topics and contain code examples with explanations.
Python
14,972
star
4

state-of-the-art-shitcode

๐Ÿ’ฉState-of-the-art shitcode principles your project should follow to call it a proper shitcode
4,789
star
5

nano-neuron

๐Ÿค– NanoNeuron is 7 simple JavaScript functions that will give you a feeling of how machines can actually "learn"
JavaScript
2,192
star
6

promote-your-next-startup

๐Ÿš€ Free resources you may use to promote your next startup
2,000
star
7

js-image-carver

๐ŸŒ… Content-aware image resizer and object remover based on Seam Carving algorithm
TypeScript
1,504
star
8

machine-learning-octave

๐Ÿค– MatLab/Octave examples of popular machine learning algorithms with code examples and mathematics being explained
MATLAB
796
star
9

self-parking-car-evolution

๐Ÿงฌ Training the car to do self-parking using a genetic algorithm
TypeScript
688
star
10

use-position

๐ŸŒ React hook usePosition() for fetching and following a browser geolocation
JavaScript
298
star
11

covid-19

๐Ÿ“ˆ Coronavirus (COVID-19) dashboard to show the dynamics of ะกoronavirus distribution per country
JavaScript
265
star
12

nodejs-master-class

๐Ÿ›  This repository contains the homework assignment for Node.js Master Class that is focused on building a RESTful API, web app GUI, and a CLI in plain Node JS with no NPM or 3rd-party libraries
JavaScript
235
star
13

angular-library-seed

๐ŸŒพ Seed project for Angular libraries that are AOT/JIT compatible and that use external SCSS-styles and HTML-templates
TypeScript
203
star
14

okso-app

โœ๐Ÿป The drawing app to express, grasp, and organize your thoughts and ideas. Draw to explain. Draw to grasp.
198
star
15

links-detector

๐Ÿ“– ๐Ÿ‘†๐Ÿป Links Detector makes printed links clickable via your smartphone camera. No need to type a link in, just scan and click on it.
TypeScript
184
star
16

trekhleb.github.io

๐Ÿงฌ My personal website with a list of my projects that help people learn and blog posts about life, web-development, and machine-learning.
TypeScript
176
star
17

hello-docker

๐Ÿณ Example Docker project that is used as illustration for automated continuous delivery flow with DockerCloud and DigitalOcean
Python
48
star
18

micrograd-ts

๐Ÿค– A TypeScript version of karpathy/micrograd โ€” a tiny scalar-valued autograd engine and a neural net on top of it
TypeScript
42
star
19

giphygram

๐Ÿ”Ž Experimental React application for searching GIF images on GIPHY
JavaScript
24
star
20

vscode-search-tree

๐Ÿ”Ž (Draft!) VSCode extension to show the search results in a tree view
TypeScript
21
star
21

trekhleb

๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป My GitHub profile intro
15
star