© Mathias Brandewinder / @brandewinder
Machine Learning on
.NET
F# FTW!
© Mathias Brandewinder / @brandewinder
A few words about me
»Mathias Brandewinder / @brandewinder
»Background: economics, ...
© Mathias Brandewinder / @brandewinder
I am assuming…
»Few familiar with F#
»Mostly unfamiliar with Data Science / Machine...
© Mathias Brandewinder / @brandewinder
Why this talk
»Machine Learning, Data
Science are red-hot topics
› ... and relevant...
© Mathias Brandewinder / @brandewinder
My goal
»Can’t introduce F#, Machine Learning under 1h
»Give you a sense for what M...
© Mathias Brandewinder / @brandewinder
What is F#?
»Functional first, statically typed language
»Cross-platform: Windows, ...
© Mathias Brandewinder / @brandewinder
What is Machine Learning?
»"A computer program is said to learn from
experience E w...
© Mathias Brandewinder / @brandewinder
In English, please?
»Program performs a Task using Data
»The more Data, the better ...
© Mathias Brandewinder / @brandewinder
The plan
»Classification
»Regression
»Unsupervised
»Type Providers
»Existing .NET l...
© Mathias Brandewinder / @brandewinder
Classification & Regression
© Mathias Brandewinder / @brandewinder
Goal
»What does “a day of Machine Learning” look like?
»Illustrate Classification a...
© Mathias Brandewinder / @brandewinder
Classification, Regression
»Classification = using data to classify items
› Ex: Spa...
© Mathias Brandewinder / @brandewinder
Support Vector Machine
»Classic algorithm
»Tries to separate the 2
classes by the w...
© Mathias Brandewinder / @brandewinder
Demo: Kaggle Digit Recognizer
© Mathias Brandewinder / @brandewinder
Take-Aways
»F# is a first-class citizen in .NET
»Good libraries: Accord.NET, Math.N...
© Mathias Brandewinder / @brandewinder
Unsupervised
© Mathias Brandewinder / @brandewinder
Goal
»Illustrate unsupervised learning
»Functional programming and ML are a great f...
© Mathias Brandewinder / @brandewinder
Writing your own
»Usually not advised
»Useful for ML because
› Active research: you...
© Mathias Brandewinder / @brandewinder
Most ML algorithms are the same
»Read data
»Transform into Features
»Learn a Model ...
© Mathias Brandewinder / @brandewinder
Translates well to FP
»Read data
»Transform into Features -> Map
»Learn a Model fro...
© Mathias Brandewinder / @brandewinder
Focus on transforms, not objects
»Need to transform rapidly Features
› Don’t force ...
© Mathias Brandewinder / @brandewinder
What is Unsupervised Learning?
»“Tell me something about my data”
»Example: Cluster...
© Mathias Brandewinder / @brandewinder
Example: clustering (1)
© Mathias Brandewinder / @brandewinder
Example: clustering (2)
“Assign to closest Centroid”
[Map Distance]
© Mathias Brandewinder / @brandewinder
Example: clustering (3)
“Update Centroids based on Cluster”
[Reduce]
© Mathias Brandewinder / @brandewinder
Example: clustering (4)
“Stop when no change”
[Recursion]
© Mathias Brandewinder / @brandewinder
Demo
© Mathias Brandewinder / @brandewinder
Type Providers
© Mathias Brandewinder / @brandewinder
No data, no learning
»Most of ML effort is spent acquiring data
»Most of the World ...
© Mathias Brandewinder / @brandewinder
Demo
»http://www.youtube.com/watch?v=cCuGgA9Yqrs
© Mathias Brandewinder / @brandewinder
Conclusion
© Mathias Brandewinder / @brandewinder
F# is a perfect fit for ML on .NET
»Functional style fits very well with ML
»REPL/i...
© Mathias Brandewinder / @brandewinder
My recommendation
»Take a look at Machine Learning, Data Science
»Do it with a func...
© Mathias Brandewinder / @brandewinder
Getting involved
»Very dynamic community
»FSharp.org, the F# Foundation
»#fsharp on...
Upcoming SlideShare
Loading in …5
×

Machine learning-with-f sharp

590 views
419 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
590
On SlideShare
0
From Embeds
0
Number of Embeds
58
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Machine learning-with-f sharp

  1. 1. © Mathias Brandewinder / @brandewinder Machine Learning on .NET F# FTW!
  2. 2. © Mathias Brandewinder / @brandewinder A few words about me »Mathias Brandewinder / @brandewinder »Background: economics, operations research ».NET developer for 10~ years (C#, F#) »Bay.Net San Francisco, SFSharp.org »www.clear-lines.com/blog
  3. 3. © Mathias Brandewinder / @brandewinder I am assuming… »Few familiar with F# »Mostly unfamiliar with Data Science / Machine Learning »Mostly familiar with OO languages (C#, Java) »Some familiar with Functional Languages
  4. 4. © Mathias Brandewinder / @brandewinder Why this talk »Machine Learning, Data Science are red-hot topics › ... and relevant to developers ».NET is under-represented »ML is also for developers!
  5. 5. © Mathias Brandewinder / @brandewinder My goal »Can’t introduce F#, Machine Learning under 1h »Give you a sense for what Machine Learning is › Highlight some differences with “standard” development › Mostly live code »Illustrate why I think F# is a great fit
  6. 6. © Mathias Brandewinder / @brandewinder What is F#? »Functional first, statically typed language »Cross-platform: Windows, iOS, Linux »Open-source (www.github.com/fsharp) »Think lighter Scala? Python with types? »Very friendly community (Twitter #fsharp)
  7. 7. © Mathias Brandewinder / @brandewinder What is Machine Learning? »"A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E“ [Tom M. Mitchell]
  8. 8. © Mathias Brandewinder / @brandewinder In English, please? »Program performs a Task using Data »The more Data, the better it gets »Rooted in statistics, math »A Computer Science problem as well › Used in live software, with changing data
  9. 9. © Mathias Brandewinder / @brandewinder The plan »Classification »Regression »Unsupervised »Type Providers »Existing .NET libraries »Algebra »Functional fit
  10. 10. © Mathias Brandewinder / @brandewinder Classification & Regression
  11. 11. © Mathias Brandewinder / @brandewinder Goal »What does “a day of Machine Learning” look like? »Illustrate Classification and Regression
  12. 12. © Mathias Brandewinder / @brandewinder Classification, Regression »Classification = using data to classify items › Ex: Spam vs. Ham, Character Recognition, … »Regression = predicting a number › Ex: predict price of item given attributes, … »Both belong to Supervised Learning › You know what question you are trying to answer › You use data to fit a predictive model
  13. 13. © Mathias Brandewinder / @brandewinder Support Vector Machine »Classic algorithm »Tries to separate the 2 classes by the widest possible margin »Using Accord.NET implementation
  14. 14. © Mathias Brandewinder / @brandewinder Demo: Kaggle Digit Recognizer
  15. 15. © Mathias Brandewinder / @brandewinder Take-Aways »F# is a first-class citizen in .NET »Good libraries: Accord.NET, Math.NET, Alea.cuBase, … »Interactive experience with the REPL »Syntax matters! »Classification, Regression, Cross-Validation
  16. 16. © Mathias Brandewinder / @brandewinder Unsupervised
  17. 17. © Mathias Brandewinder / @brandewinder Goal »Illustrate unsupervised learning »Functional programming and ML are a great fit
  18. 18. © Mathias Brandewinder / @brandewinder Writing your own »Usually not advised »Useful for ML because › Active research: you might not have a library yet › As you learn your domain, you may need a custom model
  19. 19. © Mathias Brandewinder / @brandewinder Most ML algorithms are the same »Read data »Transform into Features »Learn a Model from the Features »Evaluate Model quality
  20. 20. © Mathias Brandewinder / @brandewinder Translates well to FP »Read data »Transform into Features -> Map »Learn a Model from the Features -> Recursion »Evaluate Model quality -> Fold/Reduce
  21. 21. © Mathias Brandewinder / @brandewinder Focus on transforms, not objects »Need to transform rapidly Features › Don’t force domain to fit algorithm › Morph around the shape of the data, pass functions › Algorithms need to be generic »FP is fantastic for code reuse
  22. 22. © Mathias Brandewinder / @brandewinder What is Unsupervised Learning? »“Tell me something about my data” »Example: Clustering › Find groups of “similar” entities in my dataset
  23. 23. © Mathias Brandewinder / @brandewinder Example: clustering (1)
  24. 24. © Mathias Brandewinder / @brandewinder Example: clustering (2) “Assign to closest Centroid” [Map Distance]
  25. 25. © Mathias Brandewinder / @brandewinder Example: clustering (3) “Update Centroids based on Cluster” [Reduce]
  26. 26. © Mathias Brandewinder / @brandewinder Example: clustering (4) “Stop when no change” [Recursion]
  27. 27. © Mathias Brandewinder / @brandewinder Demo
  28. 28. © Mathias Brandewinder / @brandewinder Type Providers
  29. 29. © Mathias Brandewinder / @brandewinder No data, no learning »Most of ML effort is spent acquiring data »Most of the World is not in your Type System »Unpleasant trade-off: › Dynamic: easy hacking but runtime exceptions › Static: safer, but straight-jacket
  30. 30. © Mathias Brandewinder / @brandewinder Demo »http://www.youtube.com/watch?v=cCuGgA9Yqrs
  31. 31. © Mathias Brandewinder / @brandewinder Conclusion
  32. 32. © Mathias Brandewinder / @brandewinder F# is a perfect fit for ML on .NET »Functional style fits very well with ML »REPL/interactive experience is crucial »Smooth integration with all of .NET »Flexible exploration, performance in production »Type Providers: static types, without the pain
  33. 33. © Mathias Brandewinder / @brandewinder My recommendation »Take a look at Machine Learning, Data Science »Do it with a functional language »… and preferably, do it using F#
  34. 34. © Mathias Brandewinder / @brandewinder Getting involved »Very dynamic community »FSharp.org, the F# Foundation »#fsharp on Twitter

×