How to Select the Best Machine Learning Model: A Beginner's Guide

Akansha Yadav walks through how to pick a machine learning model by first identifying your problem type, then weighing dataset size, feature count, and interpretability needs. Use at least a 70-30 train-test split, consider ensemble methods like random forest if single models fail, and regularization techniques like L1 and L2 to prevent overfitting.
Chapters
Ladies and gentlemen, hello everyone, welcome back to my YouTube channel. In today's video, we are going to discuss about very important topic where everybody is confusing in 2024. So the topic is that when we see a lot of machine learning algorithm, if I talk about supervised learning, then there are certain sets of machine learning algorithm which you can use in different, different projects. So in today's video, we will discuss about how we can choose the right model for our problems. We will be discussing about several factors that you should consider before choosing any machine learning model for your project. Let's get back— so let's get back on the screen and see that how we can do this, how we can achieve the skill of choosing the right model for our project. All right, so it's a complete beginner guide, guide where you are going to learn about how to choose the right machine learning algorithm. So let's move on. So there are multiple factors that you should consider depending like data size, linear— linearity of relationship between variables, how you are going to interpret it, or you are going to use the computational resources which are available. So there are different multiple factors to consider before, uh, choosing the right algorithm for your project. So let's see those factors. So there are multiple factors. So for considering it, first you have to choose is the problem type. What's the problem type? What is the nature of your problem that you are trying to solve? There are different models which are suited for the different tasks. If I talk about classification task where we have to classify it, suppose a basic example would be that I have a project, I have to work on the project where I have to classify the images whether it is of a dog or it is of a cat. So for this purpose, what I can do is I can use models like SVM, logistic regression, and decision tree. If I take an example of regression task where I can opt for the models like linear regression, random forest, or polynomial regression. So there are multiple models under the regression task as well. So first you have to do is you have to check the nature of your problem. What's the nature of your problem? What your problem is trying to resolve, whether it is trying to classify, it's going to cluster, or what exactly. So once you know the nature of your problem, the second parameter that you should check is the dataset size. The size of the dataset plays a crucial role in model selection. Why I'm saying this is because, uh, there are two things, machine learning and deep learning models. Both are same. Both are same machine learning models and deep learning models, but they do vary in terms of dataset size. If I talk about the simple problem, then you can use the machine learning model. But if I'm talking about the complex model where you have the large dataset and you have to work on that, what you can do is you can choose the deep learning model. So larger models may benefit from more complex model, but while smaller datasets may require simpler models. The third parameter is the feature dimensionality, basically. So what you have to do is you have to choose— you have to check for that. So what you can do is high-dimensional data may benefit from the techniques like dimensionality reduction. If there is a data where you have the high dimensionals, so what you can do is you can go with the dimensional reduction. If I'm talking about interpretance, suppose I wanted to interpret something, I wanted to see how your model is. In, in case of linear regression, I can interpret it. I can show you how linear regression is working, what was the input given, how it was trained and everything. But in case of deep neural network, which is a part of deep learning model, deep neural network, it is not possible to be that interpretable basically. So you have to choose it. If, if the client is considering, if the client is asking for interpretability of that particular project, then you should look for something which is interpretable. If the client is more focused about the accuracy and other parameters, then you can go with any a model as per the problem type and the dataset size. Another parameter to consider is the model complexity. Simpler models are less prone to overfitting. Overfitting is something where your model is gonna burst for you. So what you have to do is you have to choose for the simpler model if you are facing any problem related to overfitting. So overfitting is something simpler model can take but have limited expressiveness. So another is the complex model, just like deep learning, which can capture intricate patterns and may overfit with the small data. So you have to consider simpler one if you are dealing with the simple projects. If you are going with that advanced one, you can go with the complex model. Another is you should do a validation and the cross-validation using the technique cross-validation to assess the model performance basically. So model performance is very important metrics that you have to, uh, plot or you have to print. Avoid evaluating models only on the training date. What you have to do is you have to do cross-validation. You have to divide your data into two parts. Take one part as a training, another part as a testing. Make sure that both the datas are different. You can divide it in the ratio like 70-30 or 80-20 like this, and then keep both the datas different. And then evaluate your model on the basis of both training also and testing also, because testing data is something which has not been given yet to the model. So testing data is gonna give you more genuine results. Another thing that you should do is you should go for the regularization technique. Suppose in starting what you have done is on the basis of the problem type, on the data size and the interpretability, or like whatever the client is requesting you to. After doing that, you have selected 3 models. On the basis of 3 models, you have to choose which one works well for your project, which one is giving you good accuracy, which one is able to get trained on the training data which you are providing. Make sure you are doing cross-validation. You are dividing your data into 70-30 or 80-20, whichever works well with you. It, uh, it— there is no fixed ratio, but just make sure that the ratio is above 70. Like 70-30 is the minimum one which you can take. You can go with the 80-20 or 90-10. There are 3 possibilities which you can go with. You can even take the 45-75 or that, like. So the minimum one is that I'm telling you that it is 70. So after doing that, what you can do is you can check your model under the testing data so that whether it is giving you the optimist results or not, or it is giving you the best metrics like whatever you are looking for, good accuracy or other parameters as per your project. And then you can go with the regularization technique, which considers that L1 and L2 regularization, where you have— basically our goal is to prevent overfitting. Overfitting is such a case, as I told you, it's gonna burst your model. It's, it's not good, basically. So it can help you with the model complex. If you are training a complex model, you have a larger dataset, you have selected deep learning, and you are at this stage, so consider doing this. If you're not sure what to use, or you know about the nature of the problem, I would request you, like, I would suggest you to go with the ensemble method. Ensemble method is like random forest or gradient boosting, which combines multiple models for better performance. If you're not okay with one, if the one of the model, any model is not giving you good accuracy, go with the random forest or gradient boosting models. It will give you the best performance, and it can also reduce the bias and the variance in the data. Apart from this, there is one thing that you should consider and that you should work on, that what whatever domain you are working in. If you are into e-commerce, then get the complete knowledge of deep, uh, that particular domain, e-commerce domain, how things works in e-commerce, what are the problems the companies are facing. Complete domain knowledge is very important. Understand the problem domain, like what type of problem, how is it occurring. Everything should be related to the problem first before choosing any model. The nature of the problem is very, very important. So I hope you like this video. Make sure to rewatch it and implement the skills. We'll meet in the next video.










