Functional Programming with F#

Learn how to create and release your own library and take your first steps with machine learning
4.2 (23 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.
167 students enrolled
Instructed by Mark Gray IT & Software / Other
$19
$30
37% off
Take This Course
  • Lectures 27
  • Length 3 hours
  • Skill Level All Levels
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works

Discover

Find online courses made by experts from around the world.

Learn

Take your courses with you and learn anywhere, anytime.

Master

Learn and practice real-world skills and achieve your goals.

About This Course

Published 2/2016 English

Course Description

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.

What are the requirements?

  • 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

What am I going to get from this course?

  • 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

What 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

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.

Curriculum

Section 1: Releasing an F# library
00:43

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.

02:21

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
07:07

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.

06:37

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.

06:30

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.

14:55

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.

07:05

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#

11:41

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.

06:58

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.

03:28

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.

12:54

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.

Quiz Time!
11 questions
01:00

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.

Section 2: Filtering Spam with Bayes' Theorem in F#
01:04
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.
04:00

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.

08:13

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.

09:57

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.

07:38
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.
08:31

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.

08:35
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.
08:54

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.

08:39
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'.
09:19
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#.
05:27
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.
10:44

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.

07:09

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.

12:57

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.

Spam filtering with Bayes' Theorem
13 questions
01:31
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.

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

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.

Ready to start learning?
Take This Course