The post has been translated automatically. Original language: Russian
Get closer to the data!
Almost any machine learning model uses optimization algorithms under the hood. There are many optimization methods themselves. To assess how big it is, take a look at the book on convex optimization by Boyd and Vandenberg or their course of the same name at Stanford.
In addition to convex optimization, numerical optimization is also very often used in the world of Machine Learning. And not many data analysts are well-versed in the mathematics of optimization problems. If you love mathematics and want to stand out in the field of data analysis (to gain a competitive advantage in the labor market), then this is your strong suit!
The analyst who doesn't want to become a data scientist is bad. And to become one, you need to understand at least at a basic level the ideology of optimization, be able to take the derivative and go down the anti-gradient (without pathos: in the direction of the negative derivative). Independent implementation of optimization algorithms in the ML world is a rarity. But their use is a necessity. To refresh your memories and learn how to optimize functions in Python, we recommend that you familiarize yourself with the scipy module for scientific computing and the minimize function.:
from scipy.optimize import minimize
Task #1
Find at least one local minimum of a function of one variable analytically:
f(x) = 3 * x^6 - 5 * x^4 + 2 * x - 1
Then try to find the minimum using scipy. Try different algorithms (for example, Nelder-Mead), evaluate their convergence, and compare the results.
Task #2
A common mistake is to forget to check the boundary cases and the convergence of the algorithm. For example, try to solve one of the homework problems of a Practical Machine Learning Course.
Find the minimum of a function of two variables:
f(x, y) = 3 * x * y + 3 * x^2 - 4 * y + 7 - 5 * x^5
Useful information
Read first: Part 1 introduction to ML and ML libraries for Python
Previous issue: Part 4 Exploratory data analysis and statistical integration
BigData Team: the way you learn best
Ближе к данным!
Практически любая модель машинного обучения под капотом использует алгоритмы оптимизации. Самих методов оптимизации существует большое множество. Чтобы оценить насколько большое — посмотрите хотя бы на кирпич по выпуклой оптимизации Бойда и Ванденберга или их одноименный курс в Stanford.
Помимо выпуклой оптимизации в мире Machine Learning очень часто используется еще и численная оптимизация. И не так много специалистов по анализу данных хорошо знакомы с математикой задач оптимизации. Если вы любите математику и хотите выделиться в сфере анализа данных (получить конкурентное преимущество на рынке труда) — то это ваш конек!
Плох тот аналитик, который не хочет стать data scientist'ом. А чтобы им стать, вам необходимо хотя бы на базовом уровне понимать идеологию оптимизации, уметь взять производную и спуститься по антиградиенту (без пафоса: в направлении минус-производной). Самостоятельная реализация алгоритмов оптимизации в мире ML — это большая редкость. А вот их использование — сама необходимость. Чтобы освежить воспоминания и научиться оптимизировать функции в Python мы рекомендуем познакомиться с модулем для научных вычислений scipy и функцией minimize:
from scipy.optimize import minimize
Задача #1
Найдите хотя бы один локальный минимум функции от одной переменной аналитически:
f(x) = 3 * x^6 - 5 * x^4 + 2 * x - 1
Затем попробуйте найти минимум с помощью scipy. Попробуйте разные алгоритмы (например, Nelder-Mead), оцените их сходимость и сравните результаты.
Задача #2
Частая ошибка: забыть проверить граничные случаи и сходимость работы алгоритма. Например, попробуйте решить одну из задач домашнего задания Практического курса по Machine Learning.
Найдите минимум функции от двух переменных:
f(x, y) = 3 * x * y + 3 * x^2 - 4 * y + 7 - 5 * x^5
Полезная информация
Читать сначала: ч.1 введение в ML и библиотеки ML для Python
Предыдущий выпуск: ч.4 разведочный анализ данных и статистические интеграции
BigData Team: the way you learn best