ML Algorithms for Beginners


This image provides a high level overview on the different types of ML algorithms and how to select them

Loading output library...

Import Packages

Loading output library...

Get the labels and assign it to a labels variable

Loading output library...

Split the dataset into training and testing set

  • X is a matrix, hence it is represented in uppercase
  • y is a vector, hence it is represented in lowercase
  • test_size is 20%, that means train_size is 80%
  • random state is for reproducibility

Initialize a TFidfVectorizer, fit and transform the train set and transform the test set


Initialize a PassiveAggressiveClassifier and Predict on the test set

Loading output library...

Print the Classification Report, Confusion Matrix and Accuracy

  • TP: 589
  • TN: 587
  • FP: 49
  • FN: 43