m machine learning f# and accord.net. alena hall software architect, ms in computer science member...
TRANSCRIPT
![Page 1: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/1.jpg)
m
Machine Learning F# and Accord.net
![Page 2: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/2.jpg)
Alena Hall• Software architect, MS in Computer
Science
• Member of F# Software Foundation Board of Trustees
• Researcher in the field of mathematical theoretical abstractions possible in modern programming concepts
• Speaker and active software engineering community member
@lenadroid
![Page 3: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/3.jpg)
Machine Learning
![Page 4: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/4.jpg)
• Why machine learning?
• What is the data?
• How?
Questions
![Page 5: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/5.jpg)
Data Questions.
![Page 6: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/6.jpg)
Data reality :\
![Page 7: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/7.jpg)
Path to grasping machine learning and data science…
![Page 8: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/8.jpg)
Contents• Multiple Linear
Regression• Logistic Regression
Classification• K Means
Clustering• What’s next?
![Page 9: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/9.jpg)
F# for machine learningand data science!
![Page 10: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/10.jpg)
Why F#?1. Exploratory programming, interactive
environment
2. Functional programming, referential transparency
3. Data pipelines
4. Algebraic data types and pattern matching
5. Strong typing, type inference, Type Providers
6. Units of measure
7. Concurrent, distributed and cloud programming
![Page 11: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/11.jpg)
Data pipelines
![Page 12: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/12.jpg)
Algebraic data types
// Discriminated Union
![Page 13: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/13.jpg)
Pattern matching
![Page 14: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/14.jpg)
Type Providers
![Page 15: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/15.jpg)
Units of measure
![Page 16: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/16.jpg)
![Page 17: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/17.jpg)
Linear Regression
![Page 18: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/18.jpg)
How to predict?1. Make a guess.2. Measure how wrong the guess
is.3. Fix the error.
![Page 19: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/19.jpg)
Make a guess!
![Page 20: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/20.jpg)
MATH
![Page 21: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/21.jpg)
Make a guess?What does it mean?...
Hypothesis /guess :
weights
![Page 22: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/22.jpg)
Find out our mistake…
Cost function/ Mistake function:
… and minimize it:
![Page 23: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/23.jpg)
Mistake function looks like…
Global minimums
![Page 24: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/24.jpg)
How to reduce the mistake?Update each slope parameter
until Mistake Functionminimum is reached:
Simultaneously
Alpha Learning rate
Derivative Direction of moving
![Page 25: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/25.jpg)
Fix the error
![Page 26: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/26.jpg)
Multiple Linear RegressionX [ ] – 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.
![Page 27: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/27.jpg)
Make a guess!
![Page 28: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/28.jpg)
Fix the error
![Page 29: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/29.jpg)
Multiple linear regression: Bike rentals demand
“Talk is cheap. Show me the code.”
![Page 30: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/30.jpg)
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
![Page 31: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/31.jpg)
Logistic Regression
![Page 32: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/32.jpg)
Hypothesis function
Estimated probability that Y = 1 on input X
![Page 33: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/33.jpg)
Mistake function
Mistake function is the cost for a single training data example
h(x)
![Page 34: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/34.jpg)
Full mistake function
1. Uses the principle of maximum likelihood estimation.
2. We minimize it same way as with Linear Regression
![Page 35: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/35.jpg)
“Talk is cheap. Show me the code.”
Logistic Regression Classification Example
![Page 36: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/36.jpg)
What to remember?
• Classification algorithm
• Relatively small number of predictors
• Uses logistics function for hypothesis
• Has the cost function that is convex
• Uses gradient descent for correcting the mistake
Logistic Regression
![Page 37: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/37.jpg)
At this point…
![Page 38: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/38.jpg)
Machine Learning
What society thinks I do…
What other programmers think I do…
![Page 39: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/39.jpg)
What I really do is…
![Page 40: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/40.jpg)
K-Means
![Page 41: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/41.jpg)
![Page 42: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/42.jpg)
Clustering
![Page 43: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/43.jpg)
![Page 44: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/44.jpg)
What’s next?
![Page 45: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/45.jpg)
![Page 46: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/46.jpg)
I’m Lena@lenadroid
![Page 47: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/47.jpg)
Thank you!
![Page 48: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/48.jpg)
What if it doesn’t work?
![Page 49: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/49.jpg)
• Try more data• Try more features• Try less features• Try feature combinations• Try polynomial features• …
Algorithm debugging tips
![Page 50: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/50.jpg)
What else can go wrong?
![Page 51: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/51.jpg)
Ideally... the hypothesis will… just fit the model
![Page 52: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/52.jpg)
Underfitting … Overfitting
![Page 53: M Machine Learning F# and Accord.net. Alena Hall Software architect, MS in Computer Science Member of F# Software Foundation Board of Trustees Researcher](https://reader035.vdocuments.us/reader035/viewer/2022062315/5697bfba1a28abf838ca0741/html5/thumbnails/53.jpg)
• Regularization…?• Too big regularization
parameter? -> underfitting - the line is over-smoothed• Too small regularization
parameter? -> overfitting - too optimized for train data
Try out different values for the regularization parameter.