I have to compare Support Vector Machine and Random Forest algorithm , but i'm confused how it can be compared, like support vector machine is supervised learning algorithm and random forest is ensemble learning . Help me out how i can compare it on which point like - in clasification , in regression .
$\begingroup$
$\endgroup$
2
-
$\begingroup$ Are you saying that Random Forest is not supervised learning? $\endgroup$– Bruno LubascherCommented Apr 17, 2020 at 18:17
-
$\begingroup$ No i am not syaing but random forest comes under ensemble learning method and ensemble learning method is a technique which is used in supervised learning. $\endgroup$– Satish SainiCommented Apr 17, 2020 at 18:40
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
3
TL;DR
Since both SVM and Random Forest are supervised algorithms, you can compare the two like you would compare any other two supervised algorithms.
The fact that a Random Forest is an ensemble classifier doesn't really matter as long as you treat all trees in the forest as a single model.
Comparing two supervised algorithms
The simplest way to compare supervised algorithms is with a train/test split:
- Split all your data into two sets, namely a training and a testing set (a common ratio is 0.8/0.2).
- Train both models independently with the data from the training set.
- Use your models to predict the data from the testing set.
- Give a score to the predictions by comparing what the model predicted vs the true value from the testing set. If you have a classification problem, you could use the F1 score. If you have a regression problem, you could use the R-square score.
- Pick the model with the best score.
Other ways of comparing two supervised algorithms
- Instead of a train/test split, you could look into cross-validation.
- Instead of a random train/test split, you could look into stratified or time splits.
- Instead of comparing two different algorithms, you could compare the same algorithm against itself but with different hyper-parameters (i.e. Hyper-parameter optimization).
- Instead of F1 score or R-squared you could use a metric that best fits your business case.
-
$\begingroup$ @BrunuGL - What is the difference between a train/test split and a random train/test split? Additionally, what is a time split? $\endgroup$– nwaldoCommented Apr 17, 2020 at 19:59
-
1$\begingroup$ @nwaldo train/test split is a quite generic term that could mean a "uniformly distributed sampling for train/test split", or "stratified sampling train/test split", or "time based train/test split", etc... Then random train/test split, at least how I used it, it implies "uniformly distributed sampling for train/test split" which is a quite dangerous approach specially for unbalanced datasets, but since it is quite simple it is seen pretty often. Good question though! $\endgroup$ Commented Apr 17, 2020 at 20:05
-