<jupyter_start><jupyter_text>CSV  Read json fileThe wrapper obj reads the "input.json" which contains parameters for manipulating the data and running the different models on it.<jupyter_code>obj = Wrapper()
obj.read_json(file_name='input.json')

# Dumps output to "results" folder
obj.write_json()<jupyter_output><empty_output><jupyter_text>SearchThe wrapper obj read the "input.json" which contains parameters for manipulating the data and in addition to running different models, it also tries different time features (year, month, week, dow, tod) & resampling frequencies (15min, hour, day) and finds the optimal model.<jupyter_code>obj = Wrapper()
obj.search(file_name='input.json')

# Dumps output to "results" folder
obj.write_json()<jupyter_output><empty_output><jupyter_text>ProgressiveThis is the recommended way to use the library. In this case, instead of filling all the arguments in a single json file, you can run each function and check if it returns correct data before moving on to the next function.<jupyter_code># Custom function: Can use this function if user wants to test how a particular model performs against the others.
def func(X, y):
    from sklearn.linear_model import LinearRegression
    from sklearn.model_selection import cross_val_score
    model = LinearRegression()
    model.fit(X, y)
    return model.predict(X)

obj = Wrapper()

imported_data = obj.import_data(folder_name='../data/', head_row=[5,5,0], save_file=False)

cleaned_data = obj.clean_data(imported_data, 
                              resampler='max',
                              high_bound=9998,
                              rename_col=['OAT','RelHum_Avg', 'CHW_Elec', 'Elec', 'Gas', 'HW_Heat'],
                              drop_col='Elec',
                              save_file=False)

preprocessed_data = obj.preprocess_data(cleaned_data, week=True, tod=True, normalize=True, save_file=False)

obj.model(preprocessed_data, dep_col='HW_Heat', alphas=np.logspace(-4,1,5), figsize=(18,5),
          cv=5,
          baseline_period=["2014-01","2014-12"], 
          projection_period=["2015-01","2015-12", "2016-01","2016-12"],
          exclude_time_period=[],
          custom_model_func=func)

# Dumps output to "results" folder
obj.write_json()<jupyter_output><empty_output><jupyter_text>MDALSample code to get data from MDAL. Once you have the imported_data, you can use the above "Progressive" method to clean, pre-process and run models on it.<jupyter_code>site = "south-berkeley-senior-center"

# NOTE: time can be in one of 2 formats only (other formats will result in error),
# 1. '2018-09-01T00:00:00Z' (UTC)
# 2. '2018-09-01T00:00:00-08:00' (Local Time)

start = '2018-09-01T00:00:00Z'
end = '2018-11-19T00:00:00Z'
mdal_obj = Import_MDAL()
result = mdal_obj.get_meter(site=site, start=start, end=end, var='meter', agg='RAW', 
                            window=None, aligned=True, return_names=True)
imported_data = result.df
imported_data.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10977644310977644, 'fraction_numerical': 0.03837170503837171, 'mean_word_length': 4.005008347245409, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '172136', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 1030, 'n_tokens_neox': 944, 'n_words': 263, 'path': 'apps/Data_quality_analysis/Main.ipynb', 'repo_name': 'phgupta/XBOS', 'size': '2997'}