Is this course for you?

  • Do you want to understand how to 'do' machine learning?
  • Would you like to implement algorithms from a textbook in a programming language?
  • Get started here!

What other students say..

  • "Excellent teaching skills!" - Jean-François Héon
  • "To the point f# examples + stuff that you can do with it" - Michal Lacko
  • This course is aimed at those with a beginner to intermediate level of skill in F#
  • Basic understanding of the F# syntax would be beneficial.
  • If you're not sure, please complete our free Introduction to F# course.

Course highlights

This course introduces you to testing in F# and teaches you how to deploy your own F# library. We’ll complete an F# project together, creating a predictive text engine and deploying it to Nuget, while learning how to write some basic unit tests in FsUnit. In addition to this, we'll get started with some machine learning in F#.

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 concepts as we progress.

Then we will use Bayes' Theorem to classify spam messages using real world data.

We'll build a command line application so that we can use our program on the command line.

Content listing

Section 1: Releasing an F# library

  • Lecture 1

    We'll build a command line application and parse command line arguments so that we can use our program on the command line.

  • Lecture 2

    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
  • Lecture 3

    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.

  • Lecture 4

    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.

  • Lecture 5

    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.

  • Lecture 6

    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.

  • Lecture 7

    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#

  • Lecture 8

    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.

  • Lecture 9

    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.

  • Lecture 10

    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.

  • Lecture 11

    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.

  • Lecture Quiz 1:

  • Lecture 12

    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#

  • Lecture 13

    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.

  • Lecture 14

    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.

  • Lecture 15

    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.

  • Lecture 16

    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.

  • Lecture 17

    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.

  • Lecture 18

    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.

  • Lecture 19

    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.

  • Lecture 20

    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.

  • Lecture 21

    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'.

  • Lecture 22

    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#.

  • Lecture 23

  • Lecture 24

    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.

  • Lecture 25

    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.

  • Lecture 26

    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.

  • Lecture 27

    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.

Functional programming with F#

26 lectures

3 hours of course content

Average 4.3 Star rating

You should allow
for 7 hours of
challenge time

Sign up for F# programming news, tips & tools!