Machine learning can be branched out into the following categories:

  • Supervised Learning
  • Unsupervised Learning

Supervised Learning is where the data is labeled and the program learns to predict the output from the input data. For instance, a supervised learning algorithm for credit card fraud detection would take as input a set of recorded transactions. For each transaction, the program would predict if it is fraudulent or not.

Supervised learning problems can be further grouped into regression and classification problems.


In regression problems, we are trying to predict a continuous-valued output. Examples are:

  • What is the housing price in Neo York?
  • What is the value of cryptocurrencies?


In classification problems, we are trying to predict a discrete number of values. Examples are:

  • Is this a picture of a human or a picture of an AI?
  • Is this email spam?

For a quick preview, we will show you an example of supervised learning.



NYBD (Neo York Bot Department) wants to analyze how Neo Yorkers are talking to one another so that they can determine who is being negative.

They have built a Naive Bayes classifier that predicts whether an intercepted text is good or bad, based on the frequency that a word is used in a good training example or a bad one.

Run the code to see if the model classifies the sentence "This hot dog was awful!" as a negative sentiment.


The NYBD wants to know what its citizens are saying.

Put in the sentence "I love my government." in intercepted_text and see if the classifier predicts a positive sentiment!


Put a sentence of your own in intercepted_text and see if the classifier predicts a positive sentiment!

Note: This Naive Bayes classifier won’t always get the sentiment correct!

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?