def __init__(self, df, input_col, output_col, alphas, cv,
                exclude_time_period, baseline_period, projection_period=None):
        """ Constructor.

        To Do
        -----
        1. Remove alphas as a parameter.

        Parameters
        ----------
        df                      : pd.DataFrame()
            Dataframe to model.
        input_col               : list(str)
            Independent column(s) of dataframe. Defaults to all columns except the last.
        output_col              : str
            Dependent column of dataframe.
        alphas                  : list(int)
            List of alphas to run regression on.
        cv                      : int
            Number of folds for cross-validation. 
        exclude_time_period     : list(str)
            List of time periods to exclude for modeling.
        baseline_period         : list(str)
            List of time periods to split the data into baseline period. It needs to have a start and an end date.
        projection_period       : list(str)
            List of time periods to split the data into projection period. It needs to have a start and an end date.

        """

        self.original_data = df
        self.cv = cv

        # Populate input columns (indepdent columns)
        if not input_col: # Using all columns except the last as input_col
            input_col = list(self.original_data.columns)
            input_col.remove(output_col)
            self.input_col = input_col
        elif not isinstance(list):
            raise TypeError('Input column should be a list.')
        else:
            self.input_col = input_col

        # Populate output column (dependent column)
        if not output_col:
            raise TypeError('Please provide the target column.')
        elif not isinstance(output_col, str):
            raise TypeError('Target column should be a string.')
        else:
            self.output_col = output_col

        # Validate the type of alphas
        if not isinstance(alphas, list) and not isinstance(alphas, np.ndarray):
            raise TypeError('alphas should be a list of int\'s or numpy ndarray.')
        else:
            self.alphas = alphas

        # Validate the type of baseline_period, projection_period & exclude_time_period
        if (len(baseline_period) % 2 != 0):
            raise ValueError('baseline period needs to be a multiple of 2 (i.e. have a start and end date)')
        else:
            self.baseline_period = baseline_period
        if exclude_time_period and (len(exclude_time_period) % 2 != 0):
            raise ValueError('exclude time period needs to be a multiple of 2 (i.e. have a start and end date)')
        else:
            self.exclude_time_period = exclude_time_period
        if projection_period and (len(projection_period) % 2 != 0):
            raise ValueError('projection period needs to be a multiple of 2 (i.e. have a start and end date)')
        else:
            self.projection_period = projection_period

        self.baseline_in        = pd.DataFrame()    # Baseline's indepndent columns
        self.baseline_out       = pd.DataFrame()    # Baseline's dependent column

        self.best_model         = None              # Best Model
        self.best_model_name    = None              # Best Model's name
        self.y_pred             = pd.DataFrame()    # Best Model's predictions
        self.y_true             = pd.DataFrame()    # Testing set's true values
        self.best_metrics       = {}

        self.models             = []                # List of models
        self.model_names        = []                # List of model names
        self.max_scores         = []                # List of max scores of each model
        self.metrics            = {}
def __init__ ( self , df , input_col , output_col , alphas , cv , exclude_time_period , baseline_period , projection_period = None ) : self . original_data = df self . cv = cv if not input_col : input_col = list ( self . original_data . columns ) input_col . remove ( output_col ) self . input_col = input_col elif not isinstance ( list ) : raise TypeError ( 'Input column should be a list.' ) else : self . input_col = input_col if not output_col : raise TypeError ( 'Please provide the target column.' ) elif not isinstance ( output_col , str ) : raise TypeError ( 'Target column should be a string.' ) else : self . output_col = output_col if not isinstance ( alphas , list ) and not isinstance ( alphas , np . ndarray ) : raise TypeError ( 'alphas should be a list of int\'s or numpy ndarray.' ) else : self . alphas = alphas if ( len ( baseline_period ) % 2 != 0 ) : raise ValueError ( 'baseline period needs to be a multiple of 2 (i.e. have a start and end date)' ) else : self . baseline_period = baseline_period if exclude_time_period and ( len ( exclude_time_period ) % 2 != 0 ) : raise ValueError ( 'exclude time period needs to be a multiple of 2 (i.e. have a start and end date)' ) else : self . exclude_time_period = exclude_time_period if projection_period and ( len ( projection_period ) % 2 != 0 ) : raise ValueError ( 'projection period needs to be a multiple of 2 (i.e. have a start and end date)' ) else : self . projection_period = projection_period self . baseline_in = pd . DataFrame ( ) self . baseline_out = pd . DataFrame ( ) self . best_model = None self . best_model_name = None self . y_pred = pd . DataFrame ( ) self . y_true = pd . DataFrame ( ) self . best_metrics = { } self . models = [ ] self . model_names = [ ] self . max_scores = [ ] self . metrics = { }
Constructor.

        To Do
        -----
        1. Remove alphas as a parameter.

        Parameters
        ----------
        df                      : pd.DataFrame()
            Dataframe to model.
        input_col               : list(str)
            Independent column(s) of dataframe. Defaults to all columns except the last.
        output_col              : str
            Dependent column of dataframe.
        alphas                  : list(int)
            List of alphas to run regression on.
        cv                      : int
            Number of folds for cross-validation. 
        exclude_time_period     : list(str)
            List of time periods to exclude for modeling.
        baseline_period         : list(str)
            List of time periods to split the data into baseline period. It needs to have a start and an end date.
        projection_period       : list(str)
            List of time periods to split the data into projection period. It needs to have a start and an end date.