model.py
def lasso_lars(X_tr, y_tr, X_v, y_v, X_te, y_te, **kwargs):
    '''
    This function runs the lasso lars model on train, validate, 
    and test data with the option to include key word arguments
    '''
    # create lasso lars model
    lars = LassoLars(**kwargs)
    # fit the model to train data
    lars.fit(X_tr, y_tr)
    
    # fit the model to train data
    lars_pred = lars.predict(X_tr)
    # calculate the rmse on the train data    
    lars_rmse = sqrt(mean_squared_error(y_tr, lars_pred))
    
    # predict the popularity on the validate data
    lars_pred_v = lars.predict(X_v)
    # calculate the rmse on the validate data
    lars_rmse_v = sqrt(mean_squared_error(y_v, lars_pred_v))
    
    # predict the popularity on the test data
    lars_pred_t = lars.predict(X_te)
    # calculate the rmse on the test data
    lars_rmse_t = sqrt(mean_squared_error(y_te, lars_pred_t))
    # print the train rmse
    print('RMSE for LASSO + LARS \n')
    print('On train data:\n', round(lars_rmse, 6), '\n') 
    return lars_rmse, lars_rmse_v, lars_rmse_t

    This function runs the lasso lars model on train, validate, 
    and test data with the option to include key word arguments
    
This function runs the lasso lars model on train, validate,
and test data with the option to include key word arguments
This function runs the lasso lars model on train validate and test data with the option to include key word arguments
def lasso_lars(X_tr, y_tr, X_v, y_v, X_te, y_te, **kwargs):
    lars = LassoLars(**kwargs)
    lars.fit(X_tr, y_tr)
    lars_pred = lars.predict(X_tr)
    lars_rmse = sqrt(mean_squared_error(y_tr, lars_pred))
    lars_pred_v = lars.predict(X_v)
    lars_rmse_v = sqrt(mean_squared_error(y_v, lars_pred_v))
    lars_pred_t = lars.predict(X_te)
    lars_rmse_t = sqrt(mean_squared_error(y_te, lars_pred_t))
    print('RMSE for LASSO + LARS \n')
    print('On train data:\n', round(lars_rmse, 6), '\n') 
    return lars_rmse, lars_rmse_v, lars_rmse_t
def lasso_lars ( X_tr , y_tr , X_v , y_v , X_te , y_te , ** kwargs ) : lars = LassoLars ( ** kwargs ) lars . fit ( X_tr , y_tr ) lars_pred = lars . predict ( X_tr ) lars_rmse = sqrt ( mean_squared_error ( y_tr , lars_pred ) ) lars_pred_v = lars . predict ( X_v ) lars_rmse_v = sqrt ( mean_squared_error ( y_v , lars_pred_v ) ) lars_pred_t = lars . predict ( X_te ) lars_rmse_t = sqrt ( mean_squared_error ( y_te , lars_pred_t ) ) print ( 'RMSE for LASSO + LARS \n' ) print ( 'On train data:\n' , round ( lars_rmse , 6 ) , '\n' ) return lars_rmse , lars_rmse_v , lars_rmse_t
This function runs the lasso lars model on train, validate,
and test data with the option to include key word arguments
This function runs the lasso lars model on train validate and test data with the option to include key word arguments
'''
    This function runs the lasso lars model on train, validate, 
    and test data with the option to include key word arguments
    ''' # create lasso lars model # fit the model to train data # fit the model to train data # calculate the rmse on the train data     # predict the popularity on the validate data # calculate the rmse on the validate data # predict the popularity on the test data # calculate the rmse on the test data # print the train rmse
X_tr
y_tr
X_v
y_v
X_te
y_te