Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on 2024-07-19 19:52:59 Friday | |
| @author: Nikhil Kapila | |
| """ | |
| # import os, pickle, torch | |
| # import matplotlib.pyplot as plt | |
| # from sklearn.metrics import mean_absolute_percentage_error | |
| # def plot_graph(y, predicted): | |
| # plt.figure(figsize=(14, 7)) | |
| # plt.plot(y, label='Actual Values') | |
| # plt.plot(predicted, label='Predicted Values', linestyle='dashed') | |
| # plt.xlabel('Date') | |
| # plt.ylabel('Value') | |
| # plt.title('Actual vs Predicted Values') | |
| # plt.legend() | |
| # # plt.show() | |
| # return plt | |
| # def model_folder_name(ft, type): | |
| # return f'bgd_{type}_{ft}_LSTM' | |
| # def fetch_model(ft, type, dir='metaflow_models'): | |
| # file = f'{dir}/{model_folder_name(ft,type)}/{model_folder_name(ft,type)}.pth' | |
| # return torch.load(file) | |
| # def fetch_scaler(ft, type, dir='metaflow_models'): | |
| # scaler_dir = f'{dir}/{model_folder_name(ft,type)}/scaler_{model_folder_name(ft, type)}.pkl' | |
| # print(scaler_dir) | |
| # # scaler_dir = f'{dir}/{scaler_name}' | |
| # with open(scaler_dir, 'rb') as file: | |
| # scaler = pickle.load(file) | |
| # return scaler | |
| # def mape(y_true, y_pred): | |
| # return mean_absolute_percentage_error(y_true=y_true, y_pred=y_pred)*100 | |