Spaces:
Sleeping
Sleeping
File size: 1,245 Bytes
964e116 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #!/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
|