homemade-machine-learning README

The project's README from github.com/trekhleb/homemade-machine-learning. As one markdown file: README.md.

Homemade Machine Learning

🇺🇦 UKRAINE IS BEING ATTACKED BY RUSSIAN ARMY. CIVILIANS ARE GETTING KILLED. RESIDENTIAL AREAS ARE GETTING BOMBED.


Binder

Read this in other languages: Español

You might be interested in:

For Octave/MatLab version of this repository please check machine-learning-octave project.

This repository contains examples of popular machine learning algorithms implemented in Python with mathematics behind them being explained. Each algorithm has interactive Jupyter Notebook demo that allows you to play with training data, algorithms configurations and immediately see the results, charts and predictions right in your browser. In most cases the explanations are based on this great machine learning course by Andrew Ng.

The purpose of this repository is not to implement machine learning algorithms by using 3rd party library one-liners but rather to practice implementing these algorithms from scratch and get better understanding of the mathematics behind each algorithm. That's why all algorithms implementations are called "homemade" and not intended to be used for production.

Supervised Learning

In supervised learning we have a set of training data as an input and a set of labels or "correct answers" for each training set as an output. Then we're training our model (machine learning algorithm parameters) to map the input to the output correctly (to do correct prediction). The ultimate purpose is to find such model parameters that will successfully continue correct input→output mapping (predictions) even for new input examples.

Regression

In regression problems we do real value predictions. Basically we try to draw a line/plane/n-dimensional plane along the training examples.

Usage examples: stock price forecast, sales analysis, dependency of any number, etc.

🤖 Linear Regression

Classification

In classification problems we split input examples by certain characteristic.

Usage examples: spam-filters, language detection, finding similar documents, handwritten letters recognition, etc.

🤖 Logistic Regression

Unsupervised Learning

Unsupervised learning is a branch of machine learning that learns from test data that has not been labeled, classified or categorized. Instead of responding to feedback, unsupervised learning identifies commonalities in the data and reacts based on the presence or absence of such commonalities in each new piece of data.

Clustering

In clustering problems we split the training examples by unknown characteristics. The algorithm itself decides what characteristic to use for splitting.

Usage examples: market segmentation, social networks analysis, organize computing clusters, astronomical data analysis, image compression, etc.

🤖 K-means Algorithm

Anomaly Detection

Anomaly detection (also outlier detection) is the identification of rare items, events or observations which raise suspicions by differing significantly from the majority of the data.

Usage examples: intrusion detection, fraud detection, system health monitoring, removing anomalous data from the dataset etc.

🤖 Anomaly Detection using Gaussian Distribution

Neural Network (NN)

The neural network itself isn't an algorithm, but rather a framework for many different machine learning algorithms to work together and process complex data inputs.

Usage examples: as a substitute of all other algorithms in general, image recognition, voice recognition, image processing (applying specific style), language translation, etc.

🤖 Multilayer Perceptron (MLP)

Machine Learning Map

Machine Learning Map

The source of the following machine learning topics map is this wonderful blog post

Prerequisites

Installing Python

Make sure that you have Python installed on your machine.

You might want to use venv standard Python library to create virtual environments and have Python, pip and all dependent packages to be installed and served from the local project directory to avoid messing with system wide packages and their versions.

Installing Dependencies

Install all dependencies that are required for the project by running:

pip install -r requirements.txt

Launching Jupyter Locally

All demos in the project may be run directly in your browser without installing Jupyter locally. But if you want to launch Jupyter Notebook locally you may do it by running the following command from the root folder of the project:

jupyter notebook

After this Jupyter Notebook will be accessible by http://localhost:8888.

Launching Jupyter Remotely

Each algorithm section contains demo links to Jupyter NBViewer. This is fast online previewer for Jupyter notebooks where you may see demo code, charts and data right in your browser without installing anything locally. In case if you want to change the code and experiment with demo notebook you need to launch the notebook in Binder. You may do it by simply clicking the "Execute on Binder" link in top right corner of the NBViewer.

Datasets

The list of datasets that is being used for Jupyter Notebook demos may be found in data folder.

Supporting the project

You may support this project via ❤️️ GitHub or ❤️️ Patreon.

Author

homemade-machine-learning (trekhleb/homemade-machine-learning)

Searching Database…

这是什么?这是一个收集了多种常用机器学习算法的项目,每种算法都用 Python 从零实现,并配有可交互的 Jupyter Notebook 演示,以及对其背后数学原理的讲解。
这是我可以导入使用的库,还是别的东西?它不是用于生产环境的库,而是一个教学用的代码集合(即“手写”实现),每个算法都配有对应的演示 Notebook。
我该如何运行这些演示?无需在本地安装任何东西,就可以通过 Jupyter NBViewer 和 Binder 链接在浏览器中直接查看并运行每个演示;也可以安装 Python 和依赖,然后在项目根目录下本地启动 Jupyter Notebook。
我需要先安装 Python 吗?需要,你得先安装 Python。安装项目依赖之前,建议使用 venv 创建一个虚拟环境。
这些算法实现可以用在真实项目中吗?不可以。它们明确是“手写”的学习性实现,并不适用于生产环境。
涵盖了哪些算法?包括监督学习(线性回归和逻辑回归)、无监督学习(K-means 聚类、基于高斯分布的异常检测),以及一个基础神经网络示例(多层感知机)。每个算法都在 Iris、MNIST 和 Fashion MNIST 等数据集上做了演示。
这些内容基于哪门课程或资料?大部分讲解基于 Andrew Ng 著名的机器学习课程。
有没有 Octave/MatLab 版本?有。作者另外维护了一个 machine-learning-octave 项目,其中包含相同示例的 Octave/MatLab 版本。
我能在线交互式地试验这些代码吗?可以。每个演示都链接到 NBViewer,方便快速预览;你也可以点击 “Execute on Binder” 直接在浏览器中运行并实时编辑 Notebook。
Creator
trekhleb
Size
14.1 MB
Stars
24.8K
Updated
CommitNov 23
Age
7y
Commits · 90 Days