daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Oct 12th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from sklearn.linear_model import LinearRegression
  2. from sklearn.metrics import mean_absolute_error
  3. lr_model=LinearRegression()
  4. lr_model.fit(X_train,y_train)
  5. lr_predictions = lr_model.predict(X_test)
  6. mae = mean_absolute_error(y_test, lr_predictions)
  7. mae
  8. 16.029773809312484
  9.  
  10. from sklearn.ensemble import RandomForestRegressor
  11. rf_model=RandomForestRegressor(n_estimators=150, max_depth=5, min_samples_split=5)
  12. rf_model.fit(X_train,y_train)
  13. rf_predictions = rf_model.predict(X_test)
  14. mae = mean_absolute_error(y_test,rf_predictions)
  15. mae
  16. 365.7303688636672
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top