preprocessing.py
def rfe(X, y, n):
    '''
    This function creates a list of n features which the
    recursive feature elimination algorithm determines will 
    perform best on a model
    '''
    from sklearn.feature_selection import RFE
    from sklearn.linear_model import LinearRegression
    # create the lr model object
    lm = LinearRegression()
    # create the rfe object
    rfe = RFE(lm, n)
    # fit and transform to the data
    X_rfe = rfe.fit_transform(X, y)
    # get the feature support boolean mask list
    mask = rfe.support_
    # reduce the dataframe to just those features
    X_reduced_scaled_rfe = X.iloc[:,mask]
    # create list of features
    f_feature = X_reduced_scaled_rfe.columns.tolist()
    return f_feature

    This function creates a list of n features which the
    recursive feature elimination algorithm determines will 
    perform best on a model
    
This function creates a list of n features which the
recursive feature elimination algorithm determines will
perform best on a model
This function creates a list of n features which the recursive feature elimination algorithm determines will perform best on a model
def rfe(X, y, n):
    from sklearn.feature_selection import RFE
    from sklearn.linear_model import LinearRegression
    lm = LinearRegression()
    rfe = RFE(lm, n)
    X_rfe = rfe.fit_transform(X, y)
    mask = rfe.support_
    X_reduced_scaled_rfe = X.iloc[:,mask]
    f_feature = X_reduced_scaled_rfe.columns.tolist()
    return f_feature
def rfe ( X , y , n ) : from sklearn . feature_selection import RFE from sklearn . linear_model import LinearRegression lm = LinearRegression ( ) rfe = RFE ( lm , n ) X_rfe = rfe . fit_transform ( X , y ) mask = rfe . support_ X_reduced_scaled_rfe = X . iloc [ : , mask ] f_feature = X_reduced_scaled_rfe . columns . tolist ( ) return f_feature
This function creates a list of n features which the
recursive feature elimination algorithm determines will
perform best on a model
This function creates a list of n features which the recursive feature elimination algorithm determines will perform best on a model
'''
    This function creates a list of n features which the
    recursive feature elimination algorithm determines will 
    perform best on a model
    ''' # create the lr model object # create the rfe object # fit and transform to the data # get the feature support boolean mask list # reduce the dataframe to just those features # create list of features
X
y
n