Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Last active Jun 7, 2021
Embed
What would you like to do?
from mlxtend.evaluate import bias_variance_decomp
linear_regression = LinearRegression()
linear_regression.fit(xtrain, ytrain)
y_pred = linear_regression.predict(xtest)
mse, bias, variance = bias_variance_decomp(linear_regression, xtrain, ytrain, xtest, ytest, loss='mse', num_rounds=200, random_seed=123)
print("Average Bias : ", bias)
print("Average Variance : ", variance)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment