SlideShare a Scribd company logo
1 of 34
© Mathias Brandewinder / @brandewinder
Machine Learning on
.NET
F# FTW!
© 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
© 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
© 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!
© 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
© 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)
© 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]
© 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
© Mathias Brandewinder / @brandewinder
The plan
»Classification
»Regression
»Unsupervised
»Type Providers
»Existing .NET libraries
»Algebra
»Functional fit
© Mathias Brandewinder / @brandewinder
Classification & Regression
© Mathias Brandewinder / @brandewinder
Goal
»What does “a day of Machine Learning” look like?
»Illustrate Classification and Regression
© 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
© Mathias Brandewinder / @brandewinder
Support Vector Machine
»Classic algorithm
»Tries to separate the 2
classes by the widest
possible margin
»Using Accord.NET
implementation
© 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.NET, Alea.cuBase,
…
»Interactive experience with the REPL
»Syntax matters!
»Classification, Regression, Cross-Validation
© Mathias Brandewinder / @brandewinder
Unsupervised
© Mathias Brandewinder / @brandewinder
Goal
»Illustrate unsupervised learning
»Functional programming and ML are a great fit
© 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
© Mathias Brandewinder / @brandewinder
Most ML algorithms are the same
»Read data
»Transform into Features
»Learn a Model from the Features
»Evaluate Model quality
© 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
© 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
© Mathias Brandewinder / @brandewinder
What is Unsupervised Learning?
»“Tell me something about my data”
»Example: Clustering
› Find groups of “similar” entities in my dataset
© 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 is not in your Type System
»Unpleasant trade-off:
› Dynamic: easy hacking but runtime exceptions
› Static: safer, but straight-jacket
© 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/interactive experience is crucial
»Smooth integration with all of .NET
»Flexible exploration, performance in production
»Type Providers: static types, without the pain
© 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#
© Mathias Brandewinder / @brandewinder
Getting involved
»Very dynamic community
»FSharp.org, the F# Foundation
»#fsharp on Twitter

More Related Content

Similar to Machine learning-with-f sharp

Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Mark Windholtz
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introductionwojtek_s
 
Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)IT Arena
 
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...BA and Beyond
 
Andrii Belas "Modern approaches to working with categorical data in machine l...
Andrii Belas "Modern approaches to working with categorical data in machine l...Andrii Belas "Modern approaches to working with categorical data in machine l...
Andrii Belas "Modern approaches to working with categorical data in machine l...Lviv Startup Club
 
2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use it2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use itMark Windholtz
 
IC-SDV 2019: Down-to-earth machine learning: What you always wanted your data...
IC-SDV 2019: Down-to-earth machine learning: What you always wanted your data...IC-SDV 2019: Down-to-earth machine learning: What you always wanted your data...
IC-SDV 2019: Down-to-earth machine learning: What you always wanted your data...Dr. Haxel Consult
 
From SQL to Python - A Beginner's Guide to Making the Switch
From SQL to Python - A Beginner's Guide to Making the SwitchFrom SQL to Python - A Beginner's Guide to Making the Switch
From SQL to Python - A Beginner's Guide to Making the SwitchRachel Berryman
 
Finding balance of DDD while your application grows
Finding balance of DDD while your application growsFinding balance of DDD while your application grows
Finding balance of DDD while your application growsCarolina Karklis
 
Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignNaeem Sarfraz
 
The Semantic Knowledge Graph
The Semantic Knowledge GraphThe Semantic Knowledge Graph
The Semantic Knowledge GraphTrey Grainger
 
Excavating the knowledge of our ancestors
Excavating the knowledge of our ancestorsExcavating the knowledge of our ancestors
Excavating the knowledge of our ancestorsUwe Friedrichsen
 
OSCON 2014: Data Workflows for Machine Learning
OSCON 2014: Data Workflows for Machine LearningOSCON 2014: Data Workflows for Machine Learning
OSCON 2014: Data Workflows for Machine LearningPaco Nathan
 
[db tech showcase Tokyo 2018] #dbts2018 #B36 『Design Your Databases straight ...
[db tech showcase Tokyo 2018] #dbts2018 #B36 『Design Your Databases straight ...[db tech showcase Tokyo 2018] #dbts2018 #B36 『Design Your Databases straight ...
[db tech showcase Tokyo 2018] #dbts2018 #B36 『Design Your Databases straight ...Insight Technology, Inc.
 
Model Driven Architectures
Model Driven ArchitecturesModel Driven Architectures
Model Driven ArchitecturesLalit Kale
 
Agile, Automated, Aware: How to Model for Success
Agile, Automated, Aware: How to Model for SuccessAgile, Automated, Aware: How to Model for Success
Agile, Automated, Aware: How to Model for SuccessInside Analysis
 
Big Data for Data Scientists - Info Session
Big Data for Data Scientists - Info SessionBig Data for Data Scientists - Info Session
Big Data for Data Scientists - Info SessionWeCloudData
 
Architecting ASP.NET MVC Applications
Architecting ASP.NET MVC ApplicationsArchitecting ASP.NET MVC Applications
Architecting ASP.NET MVC ApplicationsGunnar Peipman
 
How to start your data career
How to start your data careerHow to start your data career
How to start your data careerAdwait Bhave
 

Similar to Machine learning-with-f sharp (20)

Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15Domain Driven Design - Distillation - Chapter 15
Domain Driven Design - Distillation - Chapter 15
 
All the cool kids....
All the cool kids....All the cool kids....
All the cool kids....
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)Domain-Driven Design (Artur Trosin Product Stream)
Domain-Driven Design (Artur Trosin Product Stream)
 
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...
BA and Beyond 20 - Elke Steegmans and David Vandenbroeck - Behaviour-driven d...
 
Andrii Belas "Modern approaches to working with categorical data in machine l...
Andrii Belas "Modern approaches to working with categorical data in machine l...Andrii Belas "Modern approaches to working with categorical data in machine l...
Andrii Belas "Modern approaches to working with categorical data in machine l...
 
2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use it2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use it
 
IC-SDV 2019: Down-to-earth machine learning: What you always wanted your data...
IC-SDV 2019: Down-to-earth machine learning: What you always wanted your data...IC-SDV 2019: Down-to-earth machine learning: What you always wanted your data...
IC-SDV 2019: Down-to-earth machine learning: What you always wanted your data...
 
From SQL to Python - A Beginner's Guide to Making the Switch
From SQL to Python - A Beginner's Guide to Making the SwitchFrom SQL to Python - A Beginner's Guide to Making the Switch
From SQL to Python - A Beginner's Guide to Making the Switch
 
Finding balance of DDD while your application grows
Finding balance of DDD while your application growsFinding balance of DDD while your application grows
Finding balance of DDD while your application grows
 
Modelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven DesignModelling a complex domain with Domain-Driven Design
Modelling a complex domain with Domain-Driven Design
 
The Semantic Knowledge Graph
The Semantic Knowledge GraphThe Semantic Knowledge Graph
The Semantic Knowledge Graph
 
Excavating the knowledge of our ancestors
Excavating the knowledge of our ancestorsExcavating the knowledge of our ancestors
Excavating the knowledge of our ancestors
 
OSCON 2014: Data Workflows for Machine Learning
OSCON 2014: Data Workflows for Machine LearningOSCON 2014: Data Workflows for Machine Learning
OSCON 2014: Data Workflows for Machine Learning
 
[db tech showcase Tokyo 2018] #dbts2018 #B36 『Design Your Databases straight ...
[db tech showcase Tokyo 2018] #dbts2018 #B36 『Design Your Databases straight ...[db tech showcase Tokyo 2018] #dbts2018 #B36 『Design Your Databases straight ...
[db tech showcase Tokyo 2018] #dbts2018 #B36 『Design Your Databases straight ...
 
Model Driven Architectures
Model Driven ArchitecturesModel Driven Architectures
Model Driven Architectures
 
Agile, Automated, Aware: How to Model for Success
Agile, Automated, Aware: How to Model for SuccessAgile, Automated, Aware: How to Model for Success
Agile, Automated, Aware: How to Model for Success
 
Big Data for Data Scientists - Info Session
Big Data for Data Scientists - Info SessionBig Data for Data Scientists - Info Session
Big Data for Data Scientists - Info Session
 
Architecting ASP.NET MVC Applications
Architecting ASP.NET MVC ApplicationsArchitecting ASP.NET MVC Applications
Architecting ASP.NET MVC Applications
 
How to start your data career
How to start your data careerHow to start your data career
How to start your data career
 

Recently uploaded

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Recently uploaded (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Machine learning-with-f sharp

  • 1. © Mathias Brandewinder / @brandewinder Machine Learning on .NET F# FTW!
  • 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. © 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. © 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. © 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. © 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. © 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. © 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. © Mathias Brandewinder / @brandewinder The plan »Classification »Regression »Unsupervised »Type Providers »Existing .NET libraries »Algebra »Functional fit
  • 10. © Mathias Brandewinder / @brandewinder Classification & Regression
  • 11. © Mathias Brandewinder / @brandewinder Goal »What does “a day of Machine Learning” look like? »Illustrate Classification and Regression
  • 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. © Mathias Brandewinder / @brandewinder Support Vector Machine »Classic algorithm »Tries to separate the 2 classes by the widest possible margin »Using Accord.NET implementation
  • 14. © Mathias Brandewinder / @brandewinder Demo: Kaggle Digit Recognizer
  • 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. © Mathias Brandewinder / @brandewinder Unsupervised
  • 17. © Mathias Brandewinder / @brandewinder Goal »Illustrate unsupervised learning »Functional programming and ML are a great fit
  • 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. © Mathias Brandewinder / @brandewinder Most ML algorithms are the same »Read data »Transform into Features »Learn a Model from the Features »Evaluate Model quality
  • 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. © 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. © Mathias Brandewinder / @brandewinder What is Unsupervised Learning? »“Tell me something about my data” »Example: Clustering › Find groups of “similar” entities in my dataset
  • 23. © Mathias Brandewinder / @brandewinder Example: clustering (1)
  • 24. © Mathias Brandewinder / @brandewinder Example: clustering (2) “Assign to closest Centroid” [Map Distance]
  • 25. © Mathias Brandewinder / @brandewinder Example: clustering (3) “Update Centroids based on Cluster” [Reduce]
  • 26. © Mathias Brandewinder / @brandewinder Example: clustering (4) “Stop when no change” [Recursion]
  • 27. © Mathias Brandewinder / @brandewinder Demo
  • 28. © Mathias Brandewinder / @brandewinder Type Providers
  • 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. © Mathias Brandewinder / @brandewinder Demo »http://www.youtube.com/watch?v=cCuGgA9Yqrs
  • 31. © Mathias Brandewinder / @brandewinder Conclusion
  • 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. © 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. © Mathias Brandewinder / @brandewinder Getting involved »Very dynamic community »FSharp.org, the F# Foundation »#fsharp on Twitter