Buying for a Team? Gift This Course
Wishlisted Wishlist

Please confirm that you want to add Functional Programming with F# to your Wishlist.

Add to Wishlist

Functional Programming with F#

Learn how to create and release your own library and take your first steps with machine learning
4.3 (28 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
207 students enrolled
Created by Mark Gray
Last updated 4/2016
$10 $30 67% off
4 days left at this price!
30-Day Money-Back Guarantee
  • 3 hours on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Have a coupon?

This course aimed at students with beginner to intermediate skill in F#, basic understanding of the F# syntax and a light functional understanding would be beneficial. You'll also need a computer with Linux, OSX or Windows with F# installed and an internet connection.

Have you wanted to understand how to 'do' machine learning or implement algorithms from a textbook in a programming language, or deploy a library to Nuget? Well, this course includes sections on machine learning using a mathematical theorem known as Bayes' Theorem.

What will we do?
We will complete two F# project together,

  1. We will start by creating a predictive text engine and deploy it to Nuget, while learning how to write some basic unit tests in FsUnit. We will explore every line of code together and point out all the important programming concept as we progress.
  2. Then we will use Bayes' Theorem to classify spam messages using real world data. We'll build a command line application and parse command line arguments so that we can use our program on the command line.

What is f#?
F# is a mature, functional-first language especially well suited to computer science, machine learning, distributed computing and web applications too. There really is no limit to what F# can do for you!

We’ve structured the course to make learning all the material as easy and accessible as possible. We’ll challenge you to complete an F# programming task in every video to make sure you’ve got a great grip on all the concepts. But don’t worry, because after every challenge, we’ll also walk you through a solution line by line.

We have structured the course to introduce you to some computer science concepts, but to also encourage you to spend your own time to gain further insights into the concepts we introduce you to.

If you want to program with a language that has computer science at its heart and want to future proof your learning then this course is for you.

Who is the target audience?
  • This course is ideal if you want to grow your functional programming skills
  • This course is ideal if you want to take your first steps with Machine Learning
  • This course is not ideal for the absolute beginner
Students Who Viewed This Course Also Viewed
What Will I Learn?
Create libraries that can be used in other .Net languages
Share your libraries publicly on NuGet
Gain machine learning knowledge and skills
Understand the magic behind mailbox spam filtering
View Curriculum
  • You should already have a basic understanding of the F# syntax, comfortable creating your own functions and using the pipe operator (|>)
  • To get the most from this course you should already have at least version 3.1 of F# install and ready to go on your computer
Curriculum For This Course
Expand All 27 Lectures Collapse All 27 Lectures 03:13:57
Releasing an F# library
12 Lectures 01:21:19

Welcome to the section where you will learn how to use some of the common building blocks that the .Net ecosystem can provide. Not only will you be exposed to F# but you will also get a taste for some unit testing with a popular F# unit testing library and NUnit. You will learn how to publish your very own library to Nuget too.

Preview 00:43

In this section, you’ll learn how to handle text based data while writing a shareable predictive text library in F#, we will cover the following areas:

  • requirements of the problem and restrictions of the solution
  • prefix searching to locate candidate words
  • how to write rudimentary unit tests around your code
  • and how to publish your library to Nuget
Preview 02:21

In this lecture we explain how you can load text in the an array of strings and you will end up loading the entire dictionary of 100000 words.

Preview 07:07

Being able to find words within this large block of text is essential if we are going to be able to predict what words a user is trying to type. In this video, we demonstrate how to use the Array.filter <’T’> higher order function to filter words by prefix and show you how to create the API function signature to enable autocomplete. We’ll turn the code into a module and see the solution work in the FSI.

Filtering words by prefix

When you write code that will be used by other developers it is useful for them to recognise common conventions because they have an idea how the code should be used. In this lecture we show a few of the conventions that are useful for .Net developers who will expect your code to conform to these conventions.

Writing an idiomatic module

During the course of this lecture we will give you a taste of the FsUnit testing library that you can obtain via Nuget, you will be up and testing in no time.

Testing our module

We said that you can use your F# code within other .Net projects, in the lecture we demonstrate this. You will have your library running in VB.Net and C#

Using our module

In this lecture we walk you through the steps required to begin creating a Nuget library that you can share with other developers, setting up your account, and accessing your own API key to start pushing your very own packages to Nuget.

Prepare for Nuget

Now you are ready to start pushing your library to Nuget, so others can benefit from your efforts. Follow along with this walkthrough and learn to deploy to Nuget.

Release on Nuget

So now you have your library up in Nuget world, let's download it to a series of projects in different languages and use it.

Adding our library from Nuget

We have downloaded our library from Nuget, now it is time to write a test harness around it and use the command line to query our predictive text library.

Using console commands

Quiz Time!
11 questions

Well done! You have completed this course, let's take a moment to reflect on what we have done and find out where to go next to build upon this platform.

Filtering Spam with Bayes' Theorem in F#
15 Lectures 01:52:38
In this video we explain what we are going to achieve. We introduce you to the concept of spam filtering and implement a spam filtering program using Bayes’ Theorem, which we will also describe and help you understand.
Filtering spam with Bayes' Theorem

In this video you’ll learn the basics for writing a program that can be trained to recognise spam based on the features of spam. We define a clear interface to work from by creating a new project for our classifier, defining the type of our main classification method, and by clearly defining the boundaries of our project.

Defining the problem

This lecture shows you the steps you’ll need to take to measure the accuracy of the classifier and how to write the algorithm to make it possible. You'll learn how to measure the output of the classifier and how to compare those results against the already pre-labelled messages.

Measuring the accuracy

In this video we learn how to test the accuracy rate of our dummy classifier using real world data. You will be challenged to use the real dataset we downloaded earlier to test our classifier.

Using real world data

Bayes theorem is a powerful tool that can be used to help discriminate over multiple problems of which spam is one of the most obvious. We describe how Bayes’ Theorem works and how it can be applied. You’ll be challenged with a fun example to get you up and running and ready to implement the technique in your own spam classifier.
Introducing Bayes' Theorem

Care needs be taken when training your classifier to ensure that it does not become too reliant on the training sample. In this lecture we explain the problem and show you how to avoid biasing your classifier toward your training sample.

Splitting the spam collection

In the previous lectures we have labelled the messages with 'HAM' or 'SPAM' but in order to calculate using Bayes' Theorem we need to find tokens and calculate the frequencies of the occurences of the tokens. This lecture will explain why we are labelling our words to form tokens in preparation to calculating their frequencies.
Labelling words

For Bayes' Theorem to be applied to our dataset we will need our words, or tokens, to be labelled appropriately with 'HAM' or 'SPAM' so we can calculate their occurring frequences. This lecture explains why this is needed and how to write the working set of functions to make it possible.

Calculating frequencies

In this video we show you how to create a corpus, or structured body of text. The reason why we are doing this is so that we have some vital statistics available regarding the corpus that we can use later with the Bayes' Theorem to calculate the probability of our messages being either 'HAM' or 'SPAM'.
Creating a corpus record

In this video we finally implement Bayes' Theorem using some crude functions to emphasise the simplicity of Bayes' Theorem. We have left a lot of room for improvement which will go over in later lectures, but for now the main focus is on implementing Bayes' Theorem in F#.
Calculating simple probabilities

In this video we'll be looking at how we can use Bayes' Theorem to combine probabilities of individual words to calculate the probability of an entire sentence occuring. After this video you'll be able to use Bayes' Theorem to combine probabilities when fighting spam and in other use cases.
Combining Probabilities

In this video, we finish the classifier by using the probability functions we have developed so far. We then test our classifier for accuracy and discuss how high the accuracy is and some of the things we could do to improve it further.

Completing the classifier

In this video we import the Argu package, which we will use later to parse command line arguments, and we then clean up the code to prepare for the changes needed to control our program using command line arguments.

Preparing for command line arguments

In this video, we use the Argu package to parse command line arguments and accept a message to classify on the command line. This completes our project.

Accepting command line arguments

Spam filtering with Bayes' Theorem
13 questions

Well done! You have completed this course, let's take a moment to reflect on what we have done and find out where to go next to build upon this platform.
About the Instructor
4.3 Average rating
147 Reviews
5,797 Students
3 Courses

I have been a passionate software engineer since 2002 and have worked for companies such as The AA, Volkswagen Financial Services and Compare the Market, to name but a few.

I discovered programming when I was 18 and taught myself web development and Java and then moved into the .NET world in 2003. I now run the Cambridge F# User Group and co-organise the Cambridge DDD Nights User Group, both meet on a monthly basis.

My love of programming has given me the opportunity to experience various programming languages but I have happily settled on F# and I am now a proud sustaining member of the F# Software Foundation.

Report Abuse