{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":35297,"databundleVersionId":3589144,"sourceType":"competition"}],"dockerImageVersionId":30191,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nimport plotly.express as px\nimport plotly.graph_objs as go\n\nimport plotly\nplotly.offline.init_notebook_mode(connected=True)\n\n#Ignore warnings\nimport warnings\nwarnings.filterwarnings('ignore')\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-11-18T17:57:13.369590Z","iopub.execute_input":"2024-11-18T17:57:13.369931Z","iopub.status.idle":"2024-11-18T17:57:15.760499Z","shell.execute_reply.started":"2024-11-18T17:57:13.369849Z","shell.execute_reply":"2024-11-18T17:57:15.757611Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/energy-anomaly-detection/train.csv\", delimiter=',', encoding='utf8')\npd.set_option('display.max_columns', None)\ndf.tail()","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:57:15.762995Z","iopub.execute_input":"2024-11-18T17:57:15.765233Z","iopub.status.idle":"2024-11-18T17:57:17.267146Z","shell.execute_reply.started":"2024-11-18T17:57:15.765173Z","shell.execute_reply":"2024-11-18T17:57:17.265347Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:57:17.268735Z","iopub.execute_input":"2024-11-18T17:57:17.269022Z","iopub.status.idle":"2024-11-18T17:57:17.400218Z","shell.execute_reply.started":"2024-11-18T17:57:17.268992Z","shell.execute_reply":"2024-11-18T17:57:17.399290Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['timestamp'] = pd.to_datetime(df['timestamp'])\ndf.tail()","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:57:17.401890Z","iopub.execute_input":"2024-11-18T17:57:17.402130Z","iopub.status.idle":"2024-11-18T17:57:17.662298Z","shell.execute_reply.started":"2024-11-18T17:57:17.402099Z","shell.execute_reply":"2024-11-18T17:57:17.661467Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['year'] = df['timestamp'].dt.year\ndf['month'] = df['timestamp'].dt.month\ndf['day'] = df['timestamp'].dt.day\ndf['hour'] = df['timestamp'].dt.hour\ndf['minute'] = df['timestamp'].dt.minute\ndf['second'] = df['timestamp'].dt.second\ndf = df.drop(['timestamp'], axis=1)\ndf.tail()","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:57:17.663544Z","iopub.execute_input":"2024-11-18T17:57:17.663787Z","iopub.status.idle":"2024-11-18T17:57:18.812033Z","shell.execute_reply.started":"2024-11-18T17:57:17.663755Z","shell.execute_reply":"2024-11-18T17:57:18.810991Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Energy Consumption by month","metadata":{}},{"cell_type":"code","source":"df[\"month\"].plot(figsize=(20,4));","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:57:18.813428Z","iopub.execute_input":"2024-11-18T17:57:18.813756Z","iopub.status.idle":"2024-11-18T17:57:19.356573Z","shell.execute_reply.started":"2024-11-18T17:57:18.813715Z","shell.execute_reply":"2024-11-18T17:57:19.355686Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = px.scatter(df, x=\"meter_reading\", y=\"anomaly\",color_discrete_sequence=['#4257f5'], title=\"Energy Anomaly Detection\" )\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:57:19.357682Z","iopub.execute_input":"2024-11-18T17:57:19.357897Z","iopub.status.idle":"2024-11-18T17:57:28.707342Z","shell.execute_reply.started":"2024-11-18T17:57:19.357871Z","shell.execute_reply":"2024-11-18T17:57:28.706352Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import scipy.stats as ss\nfrom mlxtend.frequent_patterns import apriori, association_rules\nimport networkx as nx\nimport os\nimport json\nfrom datetime import datetime\nfrom itertools import combinations, groupby\nfrom collections import Counter\n\nimport itertools\nimport networkx as nx","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:57:28.709029Z","iopub.execute_input":"2024-11-18T17:57:28.709989Z","iopub.status.idle":"2024-11-18T17:57:28.873305Z","shell.execute_reply.started":"2024-11-18T17:57:28.709935Z","shell.execute_reply":"2024-11-18T17:57:28.872084Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def cramers_v(confusion_matrix):\n    \"\"\" \n    Calculate Cramers V statistic for categorial-categorial association.\n    Considering items & their occurences here as categories.\n    \n    \"\"\"\n    chi2 = ss.chi2_contingency(confusion_matrix)[0]\n    n = confusion_matrix.sum()\n    phi2 = chi2 / n\n    r, k = confusion_matrix.shape\n    phi2corr = max(0, phi2 - ((k-1)*(r-1))/(n-1))\n    rcorr = r - ((r-1)**2)/(n-1)\n    kcorr = k - ((k-1)**2)/(n-1)\n    return np.sqrt(phi2corr / min((kcorr-1), (rcorr-1)))","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:57:28.875468Z","iopub.execute_input":"2024-11-18T17:57:28.876138Z","iopub.status.idle":"2024-11-18T17:57:28.886730Z","shell.execute_reply.started":"2024-11-18T17:57:28.876078Z","shell.execute_reply":"2024-11-18T17:57:28.885649Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def find_association(method, data, columns, plot = True, returnCorr= False):\n    \"\"\"\n    Finding associations b/w different metrics based on Cramer's rule.\n    \"\"\"\n    \n    df = data\n    cols = columns\n    corrM = np.zeros((len(cols),len(cols)))\n    np.fill_diagonal(corrM, 1)\n\n    for col1, col2 in itertools.combinations(cols, 2):\n        idx1, idx2 = cols.index(col1), cols.index(col2)\n        corrM[idx1, idx2] = cramers_v((pd.crosstab(df[col1], df[col2])).values)\n        corrM[idx2, idx1] = corrM[idx1, idx2]\n\n    corr = pd.DataFrame(corrM, index=cols, columns=cols)\n    \n    corr = round(corr, 2)\n    mask = np.triu(np.ones_like(corr, dtype=bool))\n    \n    if plot:\n        fig, ax = plt.subplots(figsize=(20, 20))\n        ax = sns.heatmap(corr, cmap='coolwarm', annot=True, ax=ax, mask=mask, \n                         vmax=1.0, vmin=-1.0, linewidths=0.1,\n                        annot_kws={\"size\": 9}, square=True, cbar=True); \n        ax.set_title(\"Correlation between Variables\");\n\n        plt.savefig(\"association.png\", dpi = 300);\n        plt.show()\n    \n    if returnCorr:\n        return corr","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:57:28.890268Z","iopub.execute_input":"2024-11-18T17:57:28.891188Z","iopub.status.idle":"2024-11-18T17:57:28.906774Z","shell.execute_reply.started":"2024-11-18T17:57:28.891133Z","shell.execute_reply":"2024-11-18T17:57:28.905647Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def drawNetworkGraph(df, startNode, nCols = 9):\n    \"\"\"\n    Takes input DataFrame & plots network graph based on Association.\n    Edges are weighted using correlation.\n    df : Transactional DataFrame\n    StartNode : \n    \n    \"\"\"\n    weightDict = {}\n    cols = (df.sum() / df.shape[0]).sort_values(ascending=False).head(9).index.tolist()\n    corrDf = find_association(\"cramers_v\", df, cols, plot=False, returnCorr=True)\n    weights = corrDf[startNode].sort_values(ascending=False)\n\n    for key, value in zip(weights.index.tolist(), weights.values.tolist()):\n        weightDict[key] = value\n\n    combs = [x for x in itertools.combinations(weightDict.keys(), 2)]\n    \n    edge_width = [round(45 * corrDf[u][v] , 3) for u, v in combs]\n    \n    G = nx.Graph()\n    plt.figure(figsize =(10, 7))\n    G.add_node(startNode)\n    for items in weightDict.keys():\n        G.add_node(items)\n\n    for items in combs:\n        G.add_edge(items[0], items[1])\n    \n    pos = nx.fruchterman_reingold_layout(G)\n\n    nx.draw_networkx(G, pos, with_labels = True, arrowstyle='-|>',\n                     alpha = 0.7, width = edge_width,\n                     arrows=True, node_size = weights * 500,\n                     edge_color ='.7', cmap = plt.cm.Blues, node_color ='green') \n    \n    plt.axis('off')\n    plt.tight_layout();\n    \ndrawNetworkGraph(df, startNode = 'anomaly', nCols = 9)","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:57:28.908728Z","iopub.execute_input":"2024-11-18T17:57:28.909043Z","iopub.status.idle":"2024-11-18T17:58:20.549458Z","shell.execute_reply.started":"2024-11-18T17:57:28.909004Z","shell.execute_reply":"2024-11-18T17:58:20.548558Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Replacing Missing Values.","metadata":{}},{"cell_type":"code","source":"numerical_nan = [feature for feature in df.columns if df[feature].isna().sum()>1 and df[feature].dtypes!='O']\nnumerical_nan","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:20.550576Z","iopub.execute_input":"2024-11-18T17:58:20.550792Z","iopub.status.idle":"2024-11-18T17:58:20.580735Z","shell.execute_reply.started":"2024-11-18T17:58:20.550766Z","shell.execute_reply":"2024-11-18T17:58:20.579720Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[numerical_nan].isna().sum()","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-11-18T17:58:20.582122Z","iopub.execute_input":"2024-11-18T17:58:20.582410Z","iopub.status.idle":"2024-11-18T17:58:20.601477Z","shell.execute_reply.started":"2024-11-18T17:58:20.582370Z","shell.execute_reply":"2024-11-18T17:58:20.600297Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for feature in numerical_nan:\n    ## We will replace by using median since there are outliers\n    median_value=df[feature].median()\n    \n    df[feature].fillna(median_value,inplace=True)\n    \ndf[numerical_nan].isnull().sum()","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-11-18T17:58:20.603069Z","iopub.execute_input":"2024-11-18T17:58:20.603323Z","iopub.status.idle":"2024-11-18T17:58:20.665457Z","shell.execute_reply.started":"2024-11-18T17:58:20.603288Z","shell.execute_reply":"2024-11-18T17:58:20.664519Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#imports \nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LinearRegression, Ridge, Lasso, ElasticNet\nfrom sklearn.tree import DecisionTreeRegressor\n\nfrom sklearn import metrics\n\nfrom sklearn.model_selection import cross_validate","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:20.666594Z","iopub.execute_input":"2024-11-18T17:58:20.666845Z","iopub.status.idle":"2024-11-18T17:58:20.948531Z","shell.execute_reply.started":"2024-11-18T17:58:20.666811Z","shell.execute_reply":"2024-11-18T17:58:20.947368Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X = df[\"meter_reading\"]  # numpy array\ny = df[\"anomaly\"] # numpy array","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:20.949825Z","iopub.execute_input":"2024-11-18T17:58:20.950079Z","iopub.status.idle":"2024-11-18T17:58:20.954942Z","shell.execute_reply.started":"2024-11-18T17:58:20.950048Z","shell.execute_reply":"2024-11-18T17:58:20.953911Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = LinearRegression() #instantiate model\n\nX_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.2) #20% for testing \n\n#required reshaping to fit and predict for the model\nX_train_reshape = X_train.values.reshape(-1,1)\nX_test_reshape = X_test.values.reshape(-1,1)","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:20.956351Z","iopub.execute_input":"2024-11-18T17:58:20.956683Z","iopub.status.idle":"2024-11-18T17:58:21.233490Z","shell.execute_reply.started":"2024-11-18T17:58:20.956639Z","shell.execute_reply":"2024-11-18T17:58:21.232532Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(X_train_reshape.shape)\nprint(y_train.shape)\n\nprint(X_test_reshape.shape)\nprint(y_test.shape)","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:21.234613Z","iopub.execute_input":"2024-11-18T17:58:21.234842Z","iopub.status.idle":"2024-11-18T17:58:21.241112Z","shell.execute_reply.started":"2024-11-18T17:58:21.234816Z","shell.execute_reply":"2024-11-18T17:58:21.240167Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.fit(X_train_reshape, y_train)","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:21.242762Z","iopub.execute_input":"2024-11-18T17:58:21.243580Z","iopub.status.idle":"2024-11-18T17:58:21.310279Z","shell.execute_reply.started":"2024-11-18T17:58:21.243533Z","shell.execute_reply":"2024-11-18T17:58:21.308904Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predictions = model.predict(X_test_reshape)","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:21.311904Z","iopub.execute_input":"2024-11-18T17:58:21.312876Z","iopub.status.idle":"2024-11-18T17:58:21.325349Z","shell.execute_reply.started":"2024-11-18T17:58:21.312816Z","shell.execute_reply":"2024-11-18T17:58:21.324178Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for y, y_pred in list(zip(y_test, predictions))[:5]:\n    print(\"Real value: {:.3f} Estimated value: {:.5f}\".format(y, y_pred))","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:21.326920Z","iopub.execute_input":"2024-11-18T17:58:21.327462Z","iopub.status.idle":"2024-11-18T17:58:21.483427Z","shell.execute_reply.started":"2024-11-18T17:58:21.327385Z","shell.execute_reply":"2024-11-18T17:58:21.482418Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rsq = metrics.r2_score(y_test, predictions)\nprint(f\"the R-squaared score is {rsq}\")\n\nmse = metrics.mean_squared_error(y_test, predictions)\nprint(f\"the Mean Absolute Error is {mse}\")\n\nrmse = np.sqrt(metrics.mean_squared_error(y_test, predictions))\nprint(f\"the Root Mean Squared Error is {rmse}\")","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:21.484711Z","iopub.execute_input":"2024-11-18T17:58:21.485059Z","iopub.status.idle":"2024-11-18T17:58:21.502996Z","shell.execute_reply.started":"2024-11-18T17:58:21.485026Z","shell.execute_reply":"2024-11-18T17:58:21.502122Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"results = {} #to store results ","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:21.504326Z","iopub.execute_input":"2024-11-18T17:58:21.505135Z","iopub.status.idle":"2024-11-18T17:58:21.509536Z","shell.execute_reply.started":"2024-11-18T17:58:21.505086Z","shell.execute_reply":"2024-11-18T17:58:21.508635Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def evaluate_model(estimator, X, y):\n    cv_results = cross_validate(estimator,\n                    X=X,\n                    y=y,\n                    scoring=\"neg_mean_squared_error\",\n                          n_jobs=-1, cv=50,\n                     return_train_score=True)\n    return pd.DataFrame(cv_results).abs().mean().to_dict()","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:21.510720Z","iopub.execute_input":"2024-11-18T17:58:21.511017Z","iopub.status.idle":"2024-11-18T17:58:21.523506Z","shell.execute_reply.started":"2024-11-18T17:58:21.510985Z","shell.execute_reply":"2024-11-18T17:58:21.522493Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"linreg  = LinearRegression()\ndtree   = DecisionTreeRegressor()\nelastic = ElasticNet()\nlasso   = Lasso()\nridge   = Ridge()","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:21.524813Z","iopub.execute_input":"2024-11-18T17:58:21.525057Z","iopub.status.idle":"2024-11-18T17:58:21.536070Z","shell.execute_reply.started":"2024-11-18T17:58:21.525026Z","shell.execute_reply":"2024-11-18T17:58:21.535076Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"results[\"linear reg\"] = evaluate_model(linreg, X_train_reshape, y_train)\nresults[\"tree\"] = evaluate_model(dtree, X_train_reshape, y_train)\nresults[\"elasticnet\"] = evaluate_model(elastic, X_train_reshape, y_train)\nresults[\"lasso\"] = evaluate_model(lasso, X_train_reshape, y_train)\nresults[\"ridge\"] = evaluate_model(ridge, X_train_reshape, y_train)\n\npd.DataFrame.from_dict(results).T","metadata":{"execution":{"iopub.status.busy":"2024-11-18T17:58:21.537209Z","iopub.execute_input":"2024-11-18T17:58:21.537483Z","iopub.status.idle":"2024-11-18T18:00:42.167973Z","shell.execute_reply.started":"2024-11-18T17:58:21.537421Z","shell.execute_reply":"2024-11-18T18:00:42.166703Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from scipy.stats import norm\nimport statsmodels.api as sm\nimport matplotlib.pyplot as plt\n\nfrom statsmodels.tsa.seasonal import seasonal_decompose\nfrom statsmodels.tsa.stattools import adfuller","metadata":{"execution":{"iopub.status.busy":"2024-11-18T18:00:42.169757Z","iopub.execute_input":"2024-11-18T18:00:42.170072Z","iopub.status.idle":"2024-11-18T18:00:42.967743Z","shell.execute_reply.started":"2024-11-18T18:00:42.170035Z","shell.execute_reply":"2024-11-18T18:00:42.966625Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.scatterplot(df[\"anomaly\"],df[\"meter_reading\"] );","metadata":{"execution":{"iopub.status.busy":"2024-11-18T18:00:42.971657Z","iopub.execute_input":"2024-11-18T18:00:42.971960Z","iopub.status.idle":"2024-11-18T18:00:46.500548Z","shell.execute_reply.started":"2024-11-18T18:00:42.971912Z","shell.execute_reply":"2024-11-18T18:00:46.499642Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_model_data = df[[\"anomaly\"]]\ntrain = train_model_data.iloc[0:(len(train_model_data)-53)].copy()\ntest = train_model_data.iloc[len(train):(len(train_model_data) -1)].copy()","metadata":{"execution":{"iopub.status.busy":"2024-11-18T18:00:46.501662Z","iopub.execute_input":"2024-11-18T18:00:46.501906Z","iopub.status.idle":"2024-11-18T18:00:46.513873Z","shell.execute_reply.started":"2024-11-18T18:00:46.501875Z","shell.execute_reply":"2024-11-18T18:00:46.512695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.shape","metadata":{"execution":{"iopub.status.busy":"2024-11-18T18:00:46.515274Z","iopub.execute_input":"2024-11-18T18:00:46.515648Z","iopub.status.idle":"2024-11-18T18:00:46.525171Z","shell.execute_reply.started":"2024-11-18T18:00:46.515586Z","shell.execute_reply":"2024-11-18T18:00:46.524097Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ax = train.plot(figsize=(25,4))\ntest.plot(ax=ax);","metadata":{"execution":{"iopub.status.busy":"2024-11-18T18:00:46.526551Z","iopub.execute_input":"2024-11-18T18:00:46.526884Z","iopub.status.idle":"2024-11-18T18:00:53.144252Z","shell.execute_reply.started":"2024-11-18T18:00:46.526840Z","shell.execute_reply":"2024-11-18T18:00:53.143142Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sm.graphics.tsa.plot_pacf(train,lags=30)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2024-11-18T18:00:53.145480Z","iopub.execute_input":"2024-11-18T18:00:53.145754Z","iopub.status.idle":"2024-11-18T18:00:55.952741Z","shell.execute_reply.started":"2024-11-18T18:00:53.145719Z","shell.execute_reply":"2024-11-18T18:00:55.951633Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Acknowledgements: \n\nAbhishek Sharma https://www.kaggle.com/code/anotherbadcode/apriori-analysis\n\nDasmehdixtr https://www.kaggle.com/code/dasmehdixtr/energy-anomally-detection-65-test-set-accuracy/notebook\n\nJulie Tian  https://www.kaggle.com/julietian/predicting-steam-usage-per-location\n\nClayton Miller https://www.kaggle.com/claytonmiller/weather-influence-on-energy-consumption-example","metadata":{}}]}