Structuring Machine learning projects
Structuring Machine learning projects
Orthogonalization:
Knowing what parameter/ hyperparameter to tune in the model, in o
some change in the model, we know what parameter to tune to bring
Example: For Supervised learning, for every step we have the followin
1. Fit the training set well on the cost function -> (Bigger network,
2. Fit dev set well on the cost function --> (Regularization, bigger tr
3. Fit test set well on the cost function --> (Bigger dev set, etc.)
4. Performs well in the real world. --> (Change the dev set, or the c
𝑻𝒓𝒖𝒆 𝒑𝒐𝒔𝒊𝒕𝒊𝒗𝒆𝒔
𝑷𝒓𝒆𝒄𝒊𝒔𝒊𝒐𝒏 =
𝑻𝒓𝒖𝒆 𝒑𝒐𝒔𝒊𝒕𝒊𝒗𝒆𝒔 + 𝑭𝒂𝒍𝒔𝒆 𝒑𝒐𝒔𝒊𝒕𝒊𝒗𝒆𝒔
Amongst all the examples classified as positive, how many did it class
Example - A classifier has 95% precision. If it classifies something as a c
actually a cat.
𝑻𝒓𝒖𝒆 𝒑𝒐𝒔𝒊𝒕𝒊𝒗𝒆𝒔
𝑹𝒆𝒄𝒂𝒍𝒍 =
𝑻𝒓𝒖𝒆 𝒑𝒐𝒔𝒊𝒕𝒊𝒗𝒆𝒔 + 𝑭𝒂𝒍𝒔𝒆 𝒏𝒆𝒈𝒂𝒕𝒊𝒗𝒆𝒔
Amongst all positives it got in the data, how much did it identify corre
Example - A classifier has 98% recall. If we give the classifier 100 examp
correctly.
the project ?
sify correctly ?
cat, then there is 95% chance that it is
ectly?
ples, it should identify about 98 of them
2
𝐹1 𝑠𝑐𝑜𝑟𝑒 = (𝐻𝑎𝑟𝑚𝑜𝑛𝑖𝑐 𝑀𝑒𝑎𝑛)
1 1
𝑃+𝑅
The advantage is that even if one of them is low, the F1 score will be l
F1 score.
Another example.
If we have 2 classifiers that work differently for different geographies
better overall ? Just take the average of each classifier over all the geo
the 2 classifiers.
Dev and test set should come from the same distribution.
• For small Datasets, say ≤ 500,000 examples
○ 70% training, 30% dev
○ 60% training, 20% dev, 20% test
• But if very large datasets, say 1,000,000 examples
○ 98% train, 1%dev, 1% test
Set you test set to be big enough to give high confidence on the overal
mprove accordingly.
Look at the difference between:
1. Human Level Error
2. Training Error
3. Dev Error
This will give you the Avoidable bias / Variance trade-off ! You can im
For Avoiding Avoidable bias: Train bigger model, Train longer, Use be
architecture, perform a hyperparameter search.
Error Analysis
Sometimes, through manual Error analysis, we get a lot of insights on
e NN architecture, do hyperparameters
n what to do next.
To find this out, pull out some data from the training set and some fro
(before training). We will call this data the train-dev set. It's the mixtu
Train the ML model on the training data alone.
Find out the train-dev set error, dev-set error
Consider the following cases:
Human Level err ~0% ~0% ~0% ~0%
Tr err 1% 1% 10% 10%
Tr-dev err 1.5% 9% 11% 11%
Dev Err 10% 10% 12% 20%
Comments Data mismatch High variance High Bias High Bi
Data m
What to do in case of high difference between training & dev set data?
1. Collect more training data similar to the dev set data
2. Artificial Data Synthesis (example data augmentation, appending
the rear view mirror problem)--- Just keep in mind that you shou
for a large possible examples.
Transfer Learning:
Learning to recognize cats, and then using that network to read x-ray
Using a model trained on some data (pre-training), and using that m
tuning).
Particularly useful when you have a relatively small dataset.
Multi-task learning:
Training multiple models and using all of them to train the final mode
n Training data & dev Data or because
ias,
mismatch
y scans.
model to train some other data (Fine-
el
Multi-task learning:
Training multiple models and using all of them to train the final mode
Training models to detect cars, stop signs, pedestrians, etc. And using