Commit b9ac1201 authored by Hirunika R.A.S.'s avatar Hirunika R.A.S.

Time series class added

parents 66534d3b 2a73121e
# -*- coding: utf-8 -*-
"""time_series_model_builder.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1AWprgehWA_xbBKM_Lr1rWc6wv2BxIhAZ
##Class
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
color_pal = sns.color_palette()
plt.style.use('fivethirtyeight')
import xgboost as xgb
from sklearn.metrics import mean_squared_error
class TimeSeriesModel:
def __init__(self , dataset_link , model_name):
self.dataset_link = dataset_link
self.model_name = model_name
self.train_test_split_date = '2021-08.-01'
self.feature_dataframes = {}
self.feature_train_dataframes = {}
self.features_test_dataframes = {}
self.train = None
self.test = None
self.ts_models = {}
self.model_x_tests = {}
print(" =========== {} Object Instantiated ===========".format(self.model_name))
def set_details(self , split_date):
'''
Provide the Date in format YYYY-MM-DD as a String
Example :- '2021-08.-01'
'''
self.train_test_split_date = split_date
def read_data_to_df(self):
import pandas as pd
df = tempDF = pd.read_excel(self.dataset_link)
self.df = df
print(" =========== Data Stored In a Pandas DataFrame ===========)")
print(" Number of Rows --> {}".format(df.shape[0]))
print(" Number of Columns --> {}".format(df.shape[1]))
def handle_invalid_values(self):
'''Convert all No Numeric Values to Nan '''
import pandas as pd
for column in self.df.columns[1:]:
self.df[column] = pd.to_numeric(self.df[column] , errors = 'coerce')
print(" =========== Non Numeric Values Set to Nan ===========")
\ No newline at end of file
......@@ -73,7 +73,11 @@ Because of this, the gardener does not need to keep an eye on his crops constant
Here, by installing speakers at selected locations around the gardening, the security camera system can identify the relevant animal and
emit sounds necessary to drive away the relevant animal.
(Ex: making a blast sound to drive away animals like peacocks, monkeys, and pigs and making the sound of bees to drive away wild elephants)
<<<<<<< HEAD
This measure will be able to reduce the damage caused to crops, especially by animals like elephants, peacocks, monkeys, cows and
=======
This measure will be able to reduce the damage caused to crops, especially by animals like elephants, peacocks, monkeys, cows
>>>>>>> 2a73121ebbda9d8040172a86c2353eb1ec34d682
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment