{"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":"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)\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-05-11T22:15:27.113457Z","iopub.execute_input":"2022-05-11T22:15:27.113734Z","iopub.status.idle":"2022-05-11T22:15:29.351442Z","shell.execute_reply.started":"2022-05-11T22:15:27.113708Z","shell.execute_reply":"2022-05-11T22:15:29.350720Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\nimport numpy as np \nimport pandas as pd\n\nimport glob\nimport itertools\n\nimport matplotlib.pyplot as plt\nimport numpy as np \nimport pandas as pd\nimport plotly.express as px\nimport seaborn\n\nimport warnings\nwarnings.filterwarnings('ignore')\n\n%matplotlib inline\n\nDATA_PATH = \"../input/smartphone-decimeter-2022/\"","metadata":{"execution":{"iopub.status.busy":"2022-05-11T23:00:37.004214Z","iopub.execute_input":"2022-05-11T23:00:37.004805Z","iopub.status.idle":"2022-05-11T23:00:38.856845Z","shell.execute_reply.started":"2022-05-11T23:00:37.004756Z","shell.execute_reply":"2022-05-11T23:00:38.855824Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"s = pd.read_csv(DATA_PATH + \"sample_submission.csv\")\ns.head()","metadata":{"execution":{"iopub.status.busy":"2022-05-11T23:01:12.718523Z","iopub.execute_input":"2022-05-11T23:01:12.719023Z","iopub.status.idle":"2022-05-11T23:01:12.842498Z","shell.execute_reply.started":"2022-05-11T23:01:12.718975Z","shell.execute_reply":"2022-05-11T23:01:12.841904Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_sample_trail_gt = pd.read_csv(DATA_PATH + \"train/2020-05-15-US-MTV-1/GooglePixel4XL/ground_truth.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-05-11T23:01:41.464143Z","iopub.execute_input":"2022-05-11T23:01:41.464435Z","iopub.status.idle":"2022-05-11T23:01:41.484816Z","shell.execute_reply.started":"2022-05-11T23:01:41.464405Z","shell.execute_reply":"2022-05-11T23:01:41.484004Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"FILE_NAME = '2020-05-15-US-MTV-1'\ndef visualize_trafic(df, center, zoom=8):\n    fig = px.scatter_mapbox(df,\n                            zoom=zoom,\n                            center=center,\n                            \n                            lat=\"LatitudeDegrees\",\n                            lon=\"LongitudeDegrees\",\n                            color=\"MessageType\",\n                            labels='Provider',\n                            \n                            height=600,\n                            width=800)\n    fig.update_layout(mapbox_style='stamen-terrain')\n    fig.show()\ndf_sample_trail_gt = pd.read_csv(DATA_PATH + \"train/{}/GooglePixel4XL/ground_truth.csv\".format(FILE_NAME))\n\ncenter = {\"lat\":37.42, \"lon\":-122.1}\nvisualize_trafic(df_sample_trail_gt, center)","metadata":{"execution":{"iopub.status.busy":"2022-05-11T23:02:23.673767Z","iopub.execute_input":"2022-05-11T23:02:23.674083Z","iopub.status.idle":"2022-05-11T23:02:24.857628Z","shell.execute_reply.started":"2022-05-11T23:02:23.674050Z","shell.execute_reply":"2022-05-11T23:02:24.856878Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2020 = pd.read_csv ('../input/smartphone-decimeter-2022/test/2021-04-28-US-MTV-2/SamsungGalaxyS20Ultra/device_gnss.csv')\ndf2020.head (10)","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:29.359330Z","iopub.execute_input":"2022-05-11T22:15:29.359555Z","iopub.status.idle":"2022-05-11T22:15:30.418948Z","shell.execute_reply.started":"2022-05-11T22:15:29.359526Z","shell.execute_reply":"2022-05-11T22:15:30.417981Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2021 = pd.read_csv ('../input/smartphone-decimeter-2022/train/2021-08-04-US-SJC-1/SamsungGalaxyS20Ultra/device_gnss.csv')\ndf2021.head (10)","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:30.421501Z","iopub.execute_input":"2022-05-11T22:15:30.421779Z","iopub.status.idle":"2022-05-11T22:15:31.422459Z","shell.execute_reply.started":"2022-05-11T22:15:30.421742Z","shell.execute_reply":"2022-05-11T22:15:31.421706Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2020.describe()","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:31.423918Z","iopub.execute_input":"2022-05-11T22:15:31.424395Z","iopub.status.idle":"2022-05-11T22:15:31.696556Z","shell.execute_reply.started":"2022-05-11T22:15:31.424356Z","shell.execute_reply":"2022-05-11T22:15:31.695693Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2021.describe()","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:31.698109Z","iopub.execute_input":"2022-05-11T22:15:31.698593Z","iopub.status.idle":"2022-05-11T22:15:31.945981Z","shell.execute_reply.started":"2022-05-11T22:15:31.698547Z","shell.execute_reply":"2022-05-11T22:15:31.944994Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2020.shape","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:31.947189Z","iopub.execute_input":"2022-05-11T22:15:31.947552Z","iopub.status.idle":"2022-05-11T22:15:31.953727Z","shell.execute_reply.started":"2022-05-11T22:15:31.947521Z","shell.execute_reply":"2022-05-11T22:15:31.952613Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2021.shape","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:31.956029Z","iopub.execute_input":"2022-05-11T22:15:31.956896Z","iopub.status.idle":"2022-05-11T22:15:31.969876Z","shell.execute_reply.started":"2022-05-11T22:15:31.956847Z","shell.execute_reply":"2022-05-11T22:15:31.968909Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2020.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:31.971971Z","iopub.execute_input":"2022-05-11T22:15:31.972300Z","iopub.status.idle":"2022-05-11T22:15:32.018805Z","shell.execute_reply.started":"2022-05-11T22:15:31.972257Z","shell.execute_reply":"2022-05-11T22:15:32.017669Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2021.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:32.022161Z","iopub.execute_input":"2022-05-11T22:15:32.022518Z","iopub.status.idle":"2022-05-11T22:15:32.058957Z","shell.execute_reply.started":"2022-05-11T22:15:32.022435Z","shell.execute_reply":"2022-05-11T22:15:32.057953Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2020 = pd.get_dummies (df2020)\ndf2020.columns","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:32.060292Z","iopub.execute_input":"2022-05-11T22:15:32.060620Z","iopub.status.idle":"2022-05-11T22:15:32.115441Z","shell.execute_reply.started":"2022-05-11T22:15:32.060588Z","shell.execute_reply":"2022-05-11T22:15:32.114439Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2021 = pd.get_dummies (df2021)\ndf2021.columns","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:32.116619Z","iopub.execute_input":"2022-05-11T22:15:32.116887Z","iopub.status.idle":"2022-05-11T22:15:32.168478Z","shell.execute_reply.started":"2022-05-11T22:15:32.116849Z","shell.execute_reply":"2022-05-11T22:15:32.167456Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df20_sample = df2020.sample (n = 3000)\n\ndf21_sample = df2021.sample (n = 3000)","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:15:32.169796Z","iopub.execute_input":"2022-05-11T22:15:32.170514Z","iopub.status.idle":"2022-05-11T22:15:32.223438Z","shell.execute_reply.started":"2022-05-11T22:15:32.170470Z","shell.execute_reply":"2022-05-11T22:15:32.222600Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y=df20_sample[['utcTimeMillis', 'TimeNanos', 'LeapSecond', 'FullBiasNanos',\n       'BiasNanos', 'BiasUncertaintyNanos', 'DriftNanosPerSecond',\n       'DriftUncertaintyNanosPerSecond', 'HardwareClockDiscontinuityCount',\n       'Svid', 'TimeOffsetNanos', 'State', 'ReceivedSvTimeNanos',\n       'ReceivedSvTimeUncertaintyNanos', 'Cn0DbHz',\n       'PseudorangeRateMetersPerSecond',\n       'PseudorangeRateUncertaintyMetersPerSecond',\n       'AccumulatedDeltaRangeState', 'AccumulatedDeltaRangeMeters',\n       'AccumulatedDeltaRangeUncertaintyMeters', 'CarrierFrequencyHz',\n       'MultipathIndicator', 'ConstellationType',\n       'ChipsetElapsedRealtimeNanos', 'ArrivalTimeNanosSinceGpsEpoch',\n       'RawPseudorangeMeters', 'RawPseudorangeUncertaintyMeters',\n       'ReceivedSvTimeNanosSinceGpsEpoch', 'SvPositionXEcefMeters',\n       'SvPositionYEcefMeters', 'SvPositionZEcefMeters', 'SvElevationDegrees',\n       'SvAzimuthDegrees', 'SvVelocityXEcefMetersPerSecond',\n       'SvVelocityYEcefMetersPerSecond', 'SvVelocityZEcefMetersPerSecond',\n       'SvClockBiasMeters', 'SvClockDriftMetersPerSecond', 'IsrbMeters',\n       'IonosphericDelayMeters', 'TroposphericDelayMeters',\n       'WlsPositionXEcefMeters', 'WlsPositionYEcefMeters',\n       'WlsPositionZEcefMeters', 'MessageType_Raw', 'CodeType_C', 'CodeType_I',\n       'CodeType_X', 'SignalType_BDS_B1I', 'SignalType_GAL_E1',\n       'SignalType_GAL_E5A', 'SignalType_GLO_G1', 'SignalType_GPS_L1',\n       'SignalType_GPS_L5', 'SignalType_QZS_J1', 'SignalType_QZS_J5']]","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:19:07.414380Z","iopub.execute_input":"2022-05-11T22:19:07.415280Z","iopub.status.idle":"2022-05-11T22:19:07.424533Z","shell.execute_reply.started":"2022-05-11T22:19:07.415219Z","shell.execute_reply":"2022-05-11T22:19:07.423507Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X=df21_sample[['utcTimeMillis', 'TimeNanos', 'LeapSecond', 'FullBiasNanos',\n       'BiasNanos', 'BiasUncertaintyNanos', 'DriftNanosPerSecond',\n       'DriftUncertaintyNanosPerSecond', 'HardwareClockDiscontinuityCount',\n       'Svid', 'TimeOffsetNanos', 'State', 'ReceivedSvTimeNanos',\n       'ReceivedSvTimeUncertaintyNanos', 'Cn0DbHz',\n       'PseudorangeRateMetersPerSecond',\n       'PseudorangeRateUncertaintyMetersPerSecond',\n       'AccumulatedDeltaRangeState', 'AccumulatedDeltaRangeMeters',\n       'AccumulatedDeltaRangeUncertaintyMeters', 'CarrierFrequencyHz',\n       'MultipathIndicator', 'ConstellationType',\n       'ChipsetElapsedRealtimeNanos', 'ArrivalTimeNanosSinceGpsEpoch',\n       'RawPseudorangeMeters', 'RawPseudorangeUncertaintyMeters',\n       'ReceivedSvTimeNanosSinceGpsEpoch', 'SvPositionXEcefMeters',\n       'SvPositionYEcefMeters', 'SvPositionZEcefMeters', 'SvElevationDegrees',\n       'SvAzimuthDegrees', 'SvVelocityXEcefMetersPerSecond',\n       'SvVelocityYEcefMetersPerSecond', 'SvVelocityZEcefMetersPerSecond',\n       'SvClockBiasMeters', 'SvClockDriftMetersPerSecond', 'IsrbMeters',\n       'IonosphericDelayMeters', 'TroposphericDelayMeters',\n       'WlsPositionXEcefMeters', 'WlsPositionYEcefMeters',\n       'WlsPositionZEcefMeters', 'MessageType_Raw', 'CodeType_C', 'CodeType_I',\n       'CodeType_X', 'SignalType_BDS_B1I', 'SignalType_GAL_E1',\n       'SignalType_GAL_E5A', 'SignalType_GLO_G1', 'SignalType_GPS_L1',\n       'SignalType_GPS_L5']]","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:20:02.521284Z","iopub.execute_input":"2022-05-11T22:20:02.521801Z","iopub.status.idle":"2022-05-11T22:20:02.531092Z","shell.execute_reply.started":"2022-05-11T22:20:02.521683Z","shell.execute_reply":"2022-05-11T22:20:02.530013Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\n\nfig, ax = plt.subplots (figsize = (10,12))\nX.ConstellationType.plot (kind = \"hist\", ax = ax,color=\"purple\")","metadata":{"execution":{"iopub.status.busy":"2022-05-11T22:59:33.719511Z","iopub.execute_input":"2022-05-11T22:59:33.719828Z","iopub.status.idle":"2022-05-11T22:59:33.951940Z","shell.execute_reply.started":"2022-05-11T22:59:33.719794Z","shell.execute_reply":"2022-05-11T22:59:33.950966Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}