37. A computer program is said to learn from experience E
with respect to some class of tasks T and performance
measure P if its performance at tasks in T, as measured
by P, improves with experience E
Tom M. Mitchell
61. Raw Data Collection
Pre-processing
Sampling
Training Dataset
Algorithm Training
Optimization
Post-processing
Final model
Pre-processingFeature Selection
Feature Scaling
Dimensionality Reduction
Performance Metrics
Model Selection
Test Dataset
CrossValidation
Final Model
Evaluation
Pre-processing Classification
Missing Data
Feature Extraction
Data
Split
Data
62. Raw Data Collection
Pre-processing
Sampling
Training Dataset
Algorithm Training
Optimization
Final model
Pre-processingFeature Selection
Feature Scaling
Dimensionality Reduction
Performance Metrics
Model Selection
Test Dataset
CrossValidation
Final Model
Evaluation
Pre-processing Classification
Missing Data
Feature Extraction
Data
Split
Post-processing
Data
63. Classification algorithms
Linear Classification
Logistic Regression
Linear Discriminant Analysis
PLS Discriminant Analysis
Non-Linear Classification
Mixture Discriminant Analysis
Quadratic Discriminant Analysis
Regularized Discriminant Analysis
Neural Networks
Flexible Discriminant Analysis
Support Vector Machines
k-Nearest Neighbor
Naive Bayes
Decission Trees for Classification
Classification and Regression Trees
C4.5
PART
Bagging CART
Random Forest
Gradient Booster Machines
Boosted 5.0
64. Regression algorithms
Linear Regiression
Ordinary Least Squares Regression
Stepwise Linear Regression
Prinicpal Component Regression
Partial Least Squares Regression
Non-Linear Regression /
Penalized Regression
Ridge Regression
Least Absolute Shrinkage
ElasticNet
Multivariate Adaptive Regression
Support Vector Machines
k-Nearest Neighbor
Neural Network
Decission Trees for Regression
Classification and Regression Trees
Conditional Decision Tree
Rule System
Bagging CART
Random Forest
Gradient Boosted Machine
Cubist
72. Does it do well on
the training data?
Does it do well on
the test data?
Better features /
Better parameters
More data
Done!
No No
Yes
by Andrew Ng
Yes
75. import org.apache.spark.mllib.classification.{SVMModel, SVMWithSGD}
import org.apache.spark.mllib.evaluation.BinaryClassificationMetrics
import org.apache.spark.mllib.util.MLUtils
// Load training data in LIBSVM format.
val data = MLUtils.loadLibSVMFile(sc, "data/mllib/sample_libsvm_data.txt")
// Split data into training (60%) and test (40%).
val splits = data.randomSplit(Array(0.6, 0.4), seed = 11L)
val training = splits(0).cache()
val test = splits(1)
// Run training algorithm to build the model
val numIterations = 100
val model = SVMWithSGD.train(training, numIterations)
// Clear the default threshold.
model.clearThreshold()
// Compute raw scores on the test set.
val scoreAndLabels = test.map { point =>
val score = model.predict(point.features)
(score, point.label)
}
// Get evaluation metrics.
val metrics = new BinaryClassificationMetrics(scoreAndLabels)
val auROC = metrics.areaUnderROC()
println("Area under ROC = " + auROC)
// Save and load model
model.save(sc, "myModelPath")
val sameModel = SVMModel.load(sc, "myModelPath")