model.py
def polyreg_predictions(X_tr_top, X_te_top, y_train):
    '''
    Runs the polynomial regression model we used
    with the combo features and returns the predictions
    on the test data and the model itself for later use
    '''
    # Using the polynomial function to plot regression
    from sklearn.preprocessing import PolynomialFeatures
    # create polynomial features object
    pf = PolynomialFeatures(degree=2).fit(X_tr_top)
    
    # fit and transform the train data
    X_train_sq = pf.transform(X_tr_top)
    # transform the validate data
    #X_validate_sq = pf.transform(X_v_top)
    # transform the validate data
    X_test_sq = pf.transform(X_te_top)

    # create the linear regression model
    lm_sq = LinearRegression()
    # fit the model to the training data
    lm_sq.fit(X_train_sq, y_train)

    y_pred_test = lm_sq.predict(X_test_sq)
    return lm_sq, y_pred_test, pf

    Runs the polynomial regression model we used
    with the combo features and returns the predictions
    on the test data and the model itself for later use
    
Runs the polynomial regression model we used
with the combo features and returns the predictions
on the test data and the model itself for later use
Runs the polynomial regression model we used with the combo features and returns the predictions on the test data and the model itself for later use
def polyreg_predictions(X_tr_top, X_te_top, y_train):
    from sklearn.preprocessing import PolynomialFeatures
    pf = PolynomialFeatures(degree=2).fit(X_tr_top)
    X_train_sq = pf.transform(X_tr_top)
    X_test_sq = pf.transform(X_te_top)
    lm_sq = LinearRegression()
    lm_sq.fit(X_train_sq, y_train)
    y_pred_test = lm_sq.predict(X_test_sq)
    return lm_sq, y_pred_test, pf
def polyreg_predictions ( X_tr_top , X_te_top , y_train ) : from sklearn . preprocessing import PolynomialFeatures pf = PolynomialFeatures ( degree = 2 ) . fit ( X_tr_top ) X_train_sq = pf . transform ( X_tr_top ) X_test_sq = pf . transform ( X_te_top ) lm_sq = LinearRegression ( ) lm_sq . fit ( X_train_sq , y_train ) y_pred_test = lm_sq . predict ( X_test_sq ) return lm_sq , y_pred_test , pf
Runs the polynomial regression model we used
with the combo features and returns the predictions
on the test data and the model itself for later use
Runs the polynomial regression model we used with the combo features and returns the predictions on the test data and the model itself for later use
'''
    Runs the polynomial regression model we used
    with the combo features and returns the predictions
    on the test data and the model itself for later use
    ''' # Using the polynomial function to plot regression # create polynomial features object # fit and transform the train data # transform the validate data #X_validate_sq = pf.transform(X_v_top) # transform the validate data # create the linear regression model # fit the model to the training data
X_tr_top
X_te_top
y_train