{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Setup Libraries and Environment","metadata":{}},{"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 matplotlib.pyplot as plt\n%matplotlib inline\nimport seaborn as sns\n#import sklearn as ...  #Which methods from the SK library will be determined later.\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.ensemble import RandomForestRegressor \nfrom sklearn.metrics import mean_absolute_error\n\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","execution":{"iopub.status.busy":"2022-06-07T15:54:27.501464Z","iopub.execute_input":"2022-06-07T15:54:27.502818Z","iopub.status.idle":"2022-06-07T15:54:27.52302Z","shell.execute_reply.started":"2022-06-07T15:54:27.502742Z","shell.execute_reply":"2022-06-07T15:54:27.521713Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#  Read Datasets\n","metadata":{}},{"cell_type":"code","source":"train_data_filepath = \"/kaggle/input/challenge-datascience-wind-turbine-cs/training_set.csv\" #store the file-path for the training data\ntest_data_filepath = \"/kaggle/input/challenge-datascience-wind-turbine-cs/test_set.csv\" #store the file-path for the test data\n\n# Uncomment when first running or to reload original data\ntraining_data = pd.read_csv(train_data_filepath)  #read the training data in ","metadata":{"execution":{"iopub.status.busy":"2022-06-07T15:54:27.525476Z","iopub.execute_input":"2022-06-07T15:54:27.526777Z","iopub.status.idle":"2022-06-07T15:54:36.885696Z","shell.execute_reply.started":"2022-06-07T15:54:27.526722Z","shell.execute_reply":"2022-06-07T15:54:36.884699Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_data = pd.read_csv(test_data_filepath)","metadata":{"execution":{"iopub.status.busy":"2022-06-07T15:54:36.886894Z","iopub.execute_input":"2022-06-07T15:54:36.888067Z","iopub.status.idle":"2022-06-07T15:54:39.943509Z","shell.execute_reply.started":"2022-06-07T15:54:36.888023Z","shell.execute_reply":"2022-06-07T15:54:39.941869Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Investigate Date_time column  Time to figure out if this is a time series.","metadata":{}},{"cell_type":"code","source":"#training_data.Date_time.describe()  # This line woudl provide summary statistics against date time\n\nsns.scatterplot(x = training_data.Date_time, y=training_data.ID)  #Looks like there are indeed 4 time series here.  Probably the MAC_CODE","metadata":{"execution":{"iopub.status.busy":"2022-06-07T15:54:39.946012Z","iopub.execute_input":"2022-06-07T15:54:39.946483Z","iopub.status.idle":"2022-06-07T15:54:41.006478Z","shell.execute_reply.started":"2022-06-07T15:54:39.94643Z","shell.execute_reply":"2022-06-07T15:54:41.004761Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.lineplot(x=training_data.Date_time, y = training_data.TARGET, hue= training_data.MAC_CODE)\nplt.xlim(1500, 4000)","metadata":{"execution":{"iopub.status.busy":"2022-06-07T15:54:41.008721Z","iopub.execute_input":"2022-06-07T15:54:41.009195Z","iopub.status.idle":"2022-06-07T15:54:59.491894Z","shell.execute_reply.started":"2022-06-07T15:54:41.009159Z","shell.execute_reply":"2022-06-07T15:54:59.490328Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.lineplot(x=training_data.Date_time, y = training_data.TARGET, hue= training_data.MAC_CODE)\nplt.xlim(4000, 8000)","metadata":{"execution":{"iopub.status.busy":"2022-06-07T15:54:59.493924Z","iopub.execute_input":"2022-06-07T15:54:59.494529Z","iopub.status.idle":"2022-06-07T15:55:18.674272Z","shell.execute_reply.started":"2022-06-07T15:54:59.494475Z","shell.execute_reply":"2022-06-07T15:55:18.673332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"I think isolating the line plots of both the generator speed and TARGET of each of these might give us a clearer picture.","metadata":{}},{"cell_type":"code","source":"Grouped = training_data.groupby(training_data.MAC_CODE)\ngroup_WT1 = Grouped.get_group(\"WT1\")\ngroup_WT2 = Grouped.get_group(\"WT2\")\ngroup_WT3 = Grouped.get_group(\"WT3\")\ngroup_WT4 = Grouped.get_group(\"WT4\")\n","metadata":{"execution":{"iopub.status.busy":"2022-06-07T15:55:18.675559Z","iopub.execute_input":"2022-06-07T15:55:18.676098Z","iopub.status.idle":"2022-06-07T15:55:18.973294Z","shell.execute_reply.started":"2022-06-07T15:55:18.676054Z","shell.execute_reply":"2022-06-07T15:55:18.972037Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"group_WT1.describe()","metadata":{"execution":{"iopub.status.busy":"2022-06-07T15:55:18.97495Z","iopub.execute_input":"2022-06-07T15:55:18.97551Z","iopub.status.idle":"2022-06-07T15:55:19.569392Z","shell.execute_reply.started":"2022-06-07T15:55:18.97546Z","shell.execute_reply":"2022-06-07T15:55:19.568616Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.lineplot(x=group_WT1.Date_time, y = group_WT1.Generator_speed)\nsns.lineplot(x=group_WT1.Date_time, y = group_WT1.TARGET)\nplt.xlim(2000, 8000)\nplt.gcf().set_size_inches(15, 8)\n","metadata":{"execution":{"iopub.status.busy":"2022-06-07T15:55:19.570848Z","iopub.execute_input":"2022-06-07T15:55:19.571517Z","iopub.status.idle":"2022-06-07T15:55:27.852792Z","shell.execute_reply.started":"2022-06-07T15:55:19.57147Z","shell.execute_reply":"2022-06-07T15:55:27.851069Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Next steps:\n\nInvestigate how the time series fit together (are they all the same days?  Different days?)</br>\nInvestigate how the time series fit with the test dataset.</br>\nSet up a cross validation strategy for time series</br>\nApply time series methods (AR, MA, VAR, kernal density smoothing, etc...) to interpolate missing data.</br>","metadata":{}}]}