mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 18:38:39 +00:00
Update decision_tree.py
This commit is contained in:
parent
2816c62c38
commit
6aa0287ba2
@ -155,16 +155,19 @@ class TestDecisionTree:
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""
|
"""
|
||||||
In this demonstration first we are generating x which is a numpy array containing values starting
|
In this demonstration first we are generating x which is a numpy array
|
||||||
from -1 to 1 with an interval of 0.005 i.e [-1,-0.995,....,0.995,1] this is what we are
|
containing values starting from -1 to 1 with an interval of 0.005
|
||||||
getting by applying arange function of numpy.Then the we are generating y by applying sin function
|
i.e [-1,-0.995,....,0.995,1] this is what we are getting by applying arange
|
||||||
on x which is an array containing values from -1 to 1 with difference of 0.005 i.e we are getting
|
function of numpy.Then the we are generating y by applying sin function
|
||||||
an array y which contains sin of each value of x. We then train a decision tree on the data set
|
on x which is an array containing values from -1 to 1 with difference
|
||||||
and use the decision tree to predict the label of 10 different test values. Here we should prefer
|
of 0.005 i.e we are getting an array y which contains sin of each value
|
||||||
calculating Root Mean Squared Error over Mean Sqaured error beacause RMSE should be used
|
of x. We then train a decision tree on the data set and use the decision tree
|
||||||
when you need to communicate your results in an understandable way to end users or when
|
to predict the label of 10 different test values. Here we should prefer
|
||||||
penalising outliers is less of a priority.Interpretation will be easy in this case.
|
calculating Root Mean Squared Error over Mean Sqaured error because RMSE
|
||||||
You can check out these https://stephenallwright.com/rmse-vs-mse/ to know the reason for this.
|
should be used when you need to communicate your results in an understandable
|
||||||
|
way to end users or when penalising outliers is less of a priority.Interpretation
|
||||||
|
will be easy in this case. You can check out https://stephenallwright.com/rmse-vs-mse/ to
|
||||||
|
know more.
|
||||||
"""
|
"""
|
||||||
x = np.arange(-1.0, 1.0, 0.005)
|
x = np.arange(-1.0, 1.0, 0.005)
|
||||||
y = np.sin(x)
|
y = np.sin(x)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user