Supervised And Un-Supervised Learning Flashcards
(32 cards)
Supervised learning
Task: learns from labelled training data (each sample/instance/data point consists of an input and a desired output)
Goal: find/train a model to match the output
Algorithms: linear regression, decision tree, ANN
Unsupervised learning
Task: learns form unlabelled data to describe hidden structure/pattern
Goal: task dependent (eg. Group data points, find the distribution)
Algorithms: K-means, Apriori algorithm
Reinforcement learning
Learns over time via trial and error using feedback/awards from actions
Goal: learn a policy to make decisions (to maximise rewards)
Algorithms: deep neural networks, Q-learning, deep Q-networks
Training data is used to…
Learn the parameters of the model
What is the process for supervised learning
Prepare the training data
There should be input and output datasets
Partition the dataset into two subsets
70% training - 30% testing
Train the model on the relevant training data
Test and evaluate the models on the test set
How accurate the trained model works on the test set
What is the test set used for
How to generalise to new data
Unbiased estimate of how well the model works
What does data pre-processing involve
Processing data into a suitable format for machine learning
Use pandas data frame library
Improve model accuracy
Reduce noise and bias
Data collection and data transformation
What is data collection
Gathering relevant data from sources
What is data transformation
Encode categorical values
Normalise numerical data
Split data (training, testing)
What is data cleaning
Handling missing data, imputation
Removing, outliers and duplicates
What is clustering
Unsupervised learning
Group similar objects
Given: un-labelled dataset D and similarity/distance metric
Goal: find natural partitioning, or groups of similar data points
K-means clustering
Choose number of clusters ‘k’
Initialise k cluster centroids randomly
Repeat until a max number of iterations
A. Assign each data point to the nearest centroid (based on distance metric)
B. Update the centroids by computing the mean of all their data points assigned
Output the final cluster assignments and cnetroids
Association Rules
Unsupervised learning
Discover correlation between two or more given variables
Given: a set of records containing items
Goal: produce dependency rules, to predict the occurrence of variable X with variable(s) Y
Algorithms: Apriori algorithm, frequent pattern growth
Steps of building a k-means clustering model (unsupervised learning example)
Prepare the training
Data preparation
Understand the problem (which approaches will you use)
Read in the dataset
Observe/visualise the dataset
Training a k-means model
- Prepare the training data x
- Create a k-means clustering model
Results
What are the k centres
Show the centroids
Categorical vs continuous supervised learning
These are labels
If the data is categorical we use classification
If the data is continuous we use regression
Regression models
Show the relationship between y and x
Regression training
Based on the given data find the function that minimises its mean squared error to ‘fit’ the samples
Polynomial linear regression cons
Can run into issues of overfitting, fits too well with noise/outliers/errors
Pros and cons of regression
Short training time
Easy to interpret
Easy to implement
Sensitive to noises and outliers
Cannot handle complicated relationships
What is classification
Learn to predict to which set an instance belongs based on pre-labels (classified) instances
Decision tree - internal nodes
Decision rules on features (decision variables, input)
Decision tree - branches
Course of decision or action
Decision tree - leaf nodes
A predicted class label (output)
Pros and cons of decision tree
Reasonable training time
Can handle large number of features
Easy to implement
Easy to interpret
Only simple decision boundaries
Problems with lots of missing data
Cannot handle complicated relationships
Over-complex tree : overfitting