July 2017
Intermediate to advanced
360 pages
8h 26m
English
If we want to have an analytical expression of our model (a hyperplane), LinearRegression offers two instance variables, intercept_ and coef_:
>>> print('y = ' + str(lr.intercept_) + ' ')>>> for i, c in enumerate(lr.coef_): print(str(c) + ' * x' + str(i))y = 38.0974166342 -0.105375005552 * x00.0494815380304 * x10.0371643549528 * x23.37092201039 * x3-18.9885299511 * x43.73331692311 * x50.00111437695492 * x6-1.55681538908 * x70.325992743837 * x8-0.01252057277 * x9-0.978221746439 * x100.0101679515792 * x11-0.550117114635 * x12
As for any other model, a prediction can be obtained through the method predict(X). As an experiment, we can try to add some Gaussian noise to our training data and predict the value:
Read now
Unlock full access