Machine Learning

Типичные задчи решаемые при помощи ML

  • NLP

  • Prediction

  • Anomaly Detection

  • Sentiment Analysis

  • Topic Identifications

  • Text Generation

Ключевые фреймворки для машинного обучения

  • Jupyter Notebook - IDE для программирования машинного обучения https://jupyter.org/

  • TensorFlow - Движок для машинного обучения. TensorFlow’s highlights: It runs not only on Windows, Linux, and macOS, but also on mobile devices, including both iOS and Android. It provides a very simple Python API called TF.Learn2 (tensorflow.contrib.learn), compatible with Scikit-Learn. Several other high-level APIs have been built independently on top of TensorFlow, such as Keras (now available in tensorflow.contrib.keras) or Pretty Tensor.

  • Keras - Нейросети https://www.asozykin.ru/courses/nnpython

  • Pandas - Анализ данных

  • Scikit-Learn - Анализ данных

  • Matplotlib

  • Microsoft CNTK

  • Caffe

  • PyTorch

  • Theano

  • DeepLearning4j

  • cuDNN

  • NVidia CUDA Toolkit

ML differentiates

  1. Whether or not they are trained with human supervision (supervised, unsupervised, semisupervised, and Reinforcement Learning)

  2. Whether or not they can learn incrementally on the fly (online versus batch learning)

  3. Whether they work by simply comparing new data points to known data points, or instead detect patterns in the training data and build a predictive model, much like scientists do (instance-based versus model-based learning)

Изучение ML лучше всего начинать с базовых алгоритмов и типовых задач которые решаются с их помощью. (Попытки начинать с синтаксиса R или TensorFlow как при изучении языка программирования не лучший вариант) The most common learning algorithms: Linear and Polynomial Regression, Logistic Regression, k-Nearest Neighbors, Support Vector Machines, Decision Trees, Random Forests, and Ensemble methods.

The most common supervised learning tasks are regression (predicting values) and classification (predicting classes).

Typical task is to predict a target numeric value, such as the price of a car, given a set of features (mileage, age, brand, etc.) called predictors. This sort of task is called regression

Multivariate regression problem since the system will use multiple features to make a prediction (it will use the district’s population, the median income, etc.). Univariate regression is one factor. Logistic Regression (вероятность пренадлежности к классу в процентах) is commonly used for classification, as it can output a value that corresponds to the probability of belonging to a given class (e.g., “Logistic Regression is commonly used for classification, as it can output a value that corresponds to the probability of belonging to a given class (e.g., 20% chance of being spam).”

Attribute = Type (Film) Feature = Type + Value (Film->13 Floor)

Supervised learning algorithms (указываем при обучении правильные значения labels)

-- k-Nearest Neighbors -- Linear Regression - регрессия вероятность принадлежности к классу -- Logistic Regression - вероятность принадлежности к классу в процентах -- Support Vector Machines (SVMs) -- Decision Trees and Random Forests -- Neural networks

Unsupervised learning (правильные ответы системе не передаются) например задача определения групп пользователей со схожими интересами

Clustering (например поиск похожих людей на фото) -- k-Means -- Hierarchical Cluster Analysis (HCA) -- Expectation Maximization Visualization and dimensionality reduction -- Principal Component Analysis (PCA) -- Kernel PCA -- Locally-Linear Embedding (LLE) -- t-distributed Stochastic Neighbor Embedding (t-SNE) Association rule learning -- Apriori -- Eclat

Unsupervised Tasks: dimensionality reduction - упросить данные без потери важной информации (уменьшить объем данных, но оставить модель) это может быть сделано при помощи feature extraction (пробег связан со сроком выпуска, поэтому алгоритм может их объединить в одну feature) anomaly detection - fraud detection, etc

Association rule learning - выявление реляций между сущностями (Running an association rule on your sales logs may reveal that people who purchase barbecue sauce and potato chips also tend to buy steak. Thus, you may want to place these items close to each other.)

Semisupervised learning - только часть данных промаркирована (обычно меньшая). Например гугл распознает лица на фото, но человек говорит, что это Петя

Reinforcement Learning - в системе есть правила которые определяют качество стратегии и либо дают ревард или пеналти. Полиси определяет действие для определенной ситуации. (навигация автомобиля)

По типу обучение Batch learning - обучаем в офлайне и используем обученную модель Online learning - добрасываем порции данных до обучая модель

Predictions There are two main approaches to generalization: -- instance-based learning - Например спам фильтр может считать спамом все что пользователи отметили как спам. Алгоритм использует measure of similarity для пометки подобных (похожих на спам) писем -- model-based learning - когда мы определяем функцию над данными e.g. Linear Regression - в рандомных данных линейные функции выглядят подобными. Поэтому определяется utility/fitness функция которая определяет насколько хороша модель.

Sampling bias - некачественные данные (As the saying goes: garbage in, garbage out). Опрос на выборах затронул обеспеченных американцев. часть не ответила overfitting - модель хорошо себя ведет на тестовой выборке, но плохо генерализирует другие данные. Если определить много параметров могут возникнуть шумовые реляции (все странны в которых есть буква б склонны к падению ВВП) решение упростить модель уменьшить количество аргументов (regularization)

Complex models such as deep neural networks can detect subtle patterns in the data, but if the training set is noisy, or if it is too small (which introduces sampling noise), then the model is likely to detect patterns in the noise itself.

Делим данные на две группы. Используем одну группу для обучения 80% а вторую для тестирования 20%. If the training error is low (i.e., your model makes few mistakes on the training set) but the generalization error is high, it means that your model is overfitting the training data.

Где брать данные MNIST dataset, which is a set of 70,000 small images of digits handwritten by high school students and employees of the US Census Bureau

Terminology Multi-Layer Perceptrons (MLPs) Artificial Neural Networks (ANNs) Collaborative filtering (CF) Content-based (CN)

https://github.com/grahamjenson/list_of_recommender_systems/blob/master/README.md https://mxnet.incubator.apache.org

Анализ данных, предсказание Модель со всеми переменными протестировали на нескольких алгоритмах, в том числе GBM (gradient boosted machines), RF (random forest), SVM (support vector machines) и kNN (K-nearest neighbors). По итогу была составлена многослойная нейросеть.

Алгоритмы машинного обучения https://m.habr.com/ru/post/467825/ Визуализация данных https://m.habr.com/ru/post/468295/

Дополнительные источники

Last updated