m Machine Learning F# and Accord.net
Alena Dzenisenka Software architect at Luxoft Poland Member of F# Software Foundation Board of Trustees Researcher in the field of mathematical theoretical possible in modern programming concepts Speaker and active software engineering community lenadroid
Machine Learning
Why machine learning? What is the data? How? Questions
Data Questions.
Data reality :\
Path to grasping machine learning and data science…
Contents Multiple Linear Regression Logistic Regression Classification Neural Networks Classification K Means Clustering What’s next?
F# for machine learning and data science!
Linear Regression
MATH
How to predict? 1.Make a guess. 2.Measure how wrong the guess is. 3.Fix the error.
Make a guess!
Make a guess? What does it mean?... Hypothesis /guess : weights
Find out our mistake… Cost function/ Mistake function: … and minimize it:
Mistake function looks like… Global minimums
How to reduce the mistake? Update each slope parameter until Mistake Function minimum is reached: Simultaneously Alpha Learning rate Derivative Direction of moving
Fix the error
Multiple Linear Regression X [ ] – Predictors: Statistical data about bike rentals for previous years or months. Y – Output: Amount of bike rentals we should expect today or some other day in the future. * Y is not nominal, here it’s numerical continuous range.
Make a guess!
Fix the error
Multiple linear regression: Bike rentals demand “Talk is cheap. Show me the code.”
What to remember? 1.Simplest regression algorithm 2.Very fast, runs in constant time 3.Good at numerical data with lots of features 4. Output from numerical continuous range 5. Linear hypothesis 6. Uses gradient descent Linear Regression
Logistic Regression
Hypothesis function Estimated probability that Y = 1 on input X
Mistake function Mistake function is the cost for a single training data example h(x)
Full mistake function 1. Uses the principle of maximum likelihood estimation. 2. We minimize it same way as with Linear Regression
“Talk is cheap. Show me the code.” Logistic Regression Classification Example
What to remember? Classification algorithm Classification algorithm Output is the binary value, either 1 or 0 Output is the binary value, either 1 or 0 Relatively small number of predictors Relatively small number of predictors Uses logistics function for hypothesis Uses logistics function for hypothesis Has the cost function that is convex Has the cost function that is convex Uses gradient descent for correcting the mistake Uses gradient descent for correcting the mistake Logistic Regression
At this point…
Machine Learning What society thinks I do…What other programmers think I do…
What I really do is…
Neural Networks
Neuron
Neural Networks
Layer transitions! InputWeightsActivation function Activation unit (value which is computed and outputted by the node)
Activation function? Step activation function Used in binary classification Sigmoid activation function Uses logistic function to perform the activation
Forward propagation x x x x a a a a a a a X = X X = a 1 X = a 2 Hypothetic Outputs! Activation Computational Nodes! Predictors
Multi class? OR x x x a a a a a x x x a a a a a
Cost function? x x x Looks difficult? No, it’s really not so complicated… 1.Outputs the vector with size == number of output classes 2.Similar to Logistic Regression cost function 3.Finds the mistake of our hypothesis and real outputs
Minimize the error! x x x x Error value And then… recalculate weights!
“Talk is cheap. Show me the code.” Neural Networks Classification Example.
What to remember? Extremely powerful Extremely powerful Slow learning / Fast prediction Slow learning / Fast prediction Big number of predictors Big number of predictors Complex hierarchical relationships Complex hierarchical relationships No need to understand the data No need to understand the data Wide applications Wide applications Neural Networks
K-Means
Clustering
Birth-death percentage rates
… with clustering K = 2
… with clustering K = 3
… with clustering K = 4
What’s next?
I’m
Thank you!