0% found this document useful (0 votes)
4 views22 pages

Regression Part 2: Machine Learning

Uploaded by

dadymouh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views22 pages

Regression Part 2: Machine Learning

Uploaded by

dadymouh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

REGRESSION PART 2

MACHINE LEARNING
CONTENT

SVR

Decision tree

Random forest
SUPPORT VECTOR REGRESSION
SVR

 1- upper bound
 2- lower bound
 3- margin
NOTES

 1. Support vector machine is mostly used for classification.


 2. It needs to be scaled
 3. works with both linear and non linear data
 4. kernels needs to be changed according to the type of the data
 5. the steps are the same as linear regression
SVR WITH PYTHON

 from sklearn.svm import SVR


 model = SVR()
 model.fit(x, y)
 Note: rbf is the non linear kernel
 There is a kernel for liner data called linear
DECISION TREE REGRESSION
HOW THE DATA LOOKS
DECISION TREE REGRESSION
NOTES

 It’s used when data are not following a specific sequence


 The average between the points in the same spot is taken and drawn as a line
 Doesn’t need scaler
 Works with both linear and non linear data
DECISION TREE WITH PYTHON

 from sklearn.tree import DecisionTreeRegressor


 model = DecisionTreeRegressor()
 model.fit(x, y)
RANDOM FOREST REGRESSION
RANDOM FOREST
RANDOM FOREST CONCEPT
HOW IT WORKS
NOTES

 Each tree will predict a value, the output value will be the average of all the predicted values of all the
trees.
WHAT MAKES RANDOM FOREST SO SPECIAL

 Random forest is much more stable than the others, for example: if we want to predict the salary of a
random job in the united states, there are some millionaires that may represent only 0.1% of the
people and some poor that may represent only 2% of the people, so the random forest would not be
affected by them, but other models would.
RANDOM FOREST WITH PYTHON

 from sklearn.ensemble import RandomForestRegressor


 model = RandomForestRegressor(n_estimators=100)
 model.fit(x, y)
 y_pred = model.predict(x)
NOTE

 The n_estimators are the number of trees you want to create for the model.

You might also like