ML Unit-3 - RTU
ML Unit-3 - RTU
Model Selection→
Model selection is the process of choosing the best ml model for a given task. It is done by
comparing various model candidates on chosen evaluation metrics calculated on a designed
evaluation schema. Choosing the correct evaluation schema, whether a simple train test split
or a complex cross-validation strategy, is the crucial first step of building any machine learning
solution.
Model Evaluation→
Model evaluation is a process of assessing the model’s performance on a chosen evaluation
setup. It is done by calculating quantitative performance metrics like F1 score or RMSE or
assessing the results qualitatively by the subject matter experts. The machine
learning evaluation metrics you choose should reflect the business metrics you want to
optimize with the machine learning solution.
Steps for Model Selection and Evaluation:
Step 1: Choose a proper validation strategy. Without a reliable way to validate your model
performance, no amount of hyperparameter tuning and state-of-the-art models will help you.
Step 2: Choose the right evaluation metric. Figure out the business case behind your model and
try to use the machine learning metric that correlates with that. Typically, no one metric is ideal
for the problem. So, calculate multiple metrics and make your decisions based on that.
Sometimes you need to combine classic ML metrics with a subject matter expert evaluation.
And that is ok.
Step 3: Keep track of your experiment results. Whether you use a spreadsheet or a
dedicated experiment tracker, make sure to log all the important metrics, learning curves,
dataset versions, and configurations. You will thank yourself later.
Step 4: Compare experiments and pick a winner. Regardless of the metrics and validation
strategy you choose, at the end of the day, you want to find the best model. But no model is
really best, but some are good enough.
It can be applied to most generic problems but is not very useful when it comes to unbalanced
datasets.
3. Precision-
Precision is the metric used to identify the correctness of classification.
Intuitively, this equation is the ratio of correct positive classifications to the total number of
predicted positive classifications. The greater the fraction, the higher is the precision, which
means better is the ability of the model to correctly classify the positive class.
4. Recall-
Recall tells us the number of positive cases correctly identified out of the total number of
positive cases.
5. F1 Score-
F1 score is the harmonic mean of Recall and Precision and therefore, balances out the strengths
of each.
It is useful in cases where both recall and precision can be valuable – like in the identification
of plane parts that might require repairing. Here, precision will be required to save on the
company’s cost (because plane parts are extremely expensive) and recall will be required to
ensure that the machinery is stable and not a threat to human lives.
6. AUC-ROC-
ROC curve is a plot of true positive rate (recall) against false positive rate (TN / (TN+FP)).
AUC-ROC stands for Area Under the Receiver Operating Characteristics and the higher the
area, the better is the model performance.
If the curve is somewhere near the 50% diagonal line, it suggests that the model randomly
predicts the output variable.
MSE is very sensitive to outliers and will show a very high error value even if a few outliers
are present in the otherwise well-fitted model predictions.
8. Root Mean Squared Error or RMSE-
RMSE is the root of MSE and is beneficial because it helps to bring down the scale of the errors
closer to the actual values, making it more interpretable.
9. Mean Absolute Error or MAE
MAE is the mean of the absolute error values (actuals – predictions).
If one wants to ignore the outlier values to a certain degree, MAE is the choice since it reduces
the penalty of the outliers significantly with the removal of the square terms.
10. R-Squared-
R-Square helps to identify the proportion of variance of the target variable that can be captured
with the help of the independent variables or predictors.
The denominator here is the magic element which increases with the increase in the number of
features. Therefore, a significant increase in R2 is required to increase the overall value.