November 2017
Intermediate to advanced
374 pages
10h 19m
English
The TheilSenRegressor is a robust estimator that performs well in the presence of outliers. It uses the measurement of medians, which is more robust to outliers. In OLS regression, errors are squared, and thus a squared error can decrease good results.
You can try several robust estimators in scikit-learn Version 0.19.0:
from sklearn.linear_model import Ridge, LinearRegression, TheilSenRegressor, RANSACRegressor, ElasticNet, HuberRegressorfrom sklearn.metrics import r2_score, mean_absolute_errornamed_estimators = [('OLS ', LinearRegression()),('Ridge ', Ridge()),('TSR ', TheilSenRegressor()),('RANSAC', RANSACRegressor()),('ENet ',ElasticNet()),('Huber ',HuberRegressor())]for num_index, est in enumerate(named_estimators):Read now
Unlock full access