Skip to content

Instantly share code, notes, and snippets.

@risenW
Created July 10, 2019 11:54
Show Gist options
  • Save risenW/49f1201aef0b935b0667e99e10626bd3 to your computer and use it in GitHub Desktop.
Save risenW/49f1201aef0b935b0667e99e10626bd3 to your computer and use it in GitHub Desktop.
#get the data sets
X_train, X_val, y_train, y_val = get_split_data(german_cred, target_name='age_yrs')
#fit base models
linear_reg.fit(X_train, y_train)
knn_reg.fit(X_train, y_train)
svr_reg.fit(X_train, y_train)
#make predictions with trained models
pred1 = linear_reg.predict(X_val)
pred2 = knn_reg.predict(X_val)
pred3 = svr_reg.predict(X_val)
#Take average as final prediction
avgpred = (pred1 + pred2 + pred3) / 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment