I am working on Cross validation for k-fold using ridge regression. I want to do y_pred using ridge_regression_sklearn and got the error message that 'ridge_regression_sklearn' is not defined.
Some can please help me how to fix it. I didn't found the right import for it. May be that is the problem???
NameError Traceback (most recent call last)
<ipython-input-131-34a4b717d52b> in <module>
1 alphas = np.logspace(-7,7,100)
----> 2 mse_cv = ridgeCV(X_train, y_train, n_folds=10, alphas=alphas)
<ipython-input-130-fea3c1471177> in ridgeCV(X, y, n_folds, alphas)
33 for k in range(len(alphas)):
---> 35 weights, y_pred = ridge_regression_sklearn(test_X, training_X, training_y, alphas[k])
36 cv_results_mse[i][k] = mean_squared_error(test_y, y_pred)
37
NameError: name 'ridge_regression_sklearn' is not defined
I have the following imports for the project i am working
%matplotlib notebook
%matplotlib inline
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np from scipy.io import loadmat from scipy import stats import copy import pylab from sklearn import linear_model from sklearn.metrics import mean_squared_error, r2_score from sklearn.linear_model import LinearRegression