Forked from oguiza/Multivariate Time Series Classification - LSST.ipynb
Created
December 4, 2018 10:12
-
-
Save miguel-data-sc/a54b93c47feb0dae48b77838ed43f0cb to your computer and use it in GitHub Desktop.
UCR_Time_Series_Classification_Univariate_Datasets.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "metadata": {}, | |
| "cell_type": "markdown", | |
| "source": "# UEA & UCR Time Series Classification Multivariate Datasets*: LSST\n\n*A. Bagnall, J. Lines, W. Vickers and E. Keogh, The UEA & UCR Time Series Classification Repository,\nwww.timeseriesclassification.com" | |
| }, | |
| { | |
| "metadata": {}, | |
| "cell_type": "markdown", | |
| "source": "## Import libraries" | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2018-11-28T11:43:51.534347Z", | |
| "end_time": "2018-11-28T11:43:52.273256Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "%reload_ext autoreload\n%autoreload 2\n%matplotlib inline", | |
| "execution_count": 1, | |
| "outputs": [] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2018-11-28T11:43:53.072660Z", | |
| "end_time": "2018-11-28T11:43:56.540531Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "from fastai import *\nfrom fastai.vision import *\nimport fastai\nfastai.__version__", | |
| "execution_count": 2, | |
| "outputs": [ | |
| { | |
| "output_type": "execute_result", | |
| "execution_count": 2, | |
| "data": { | |
| "text/plain": "'1.0.28'" | |
| }, | |
| "metadata": {} | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2018-11-28T11:43:56.543538Z", | |
| "end_time": "2018-11-28T11:43:56.565324Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "import warnings\nwarnings.filterwarnings(\"ignore\")", | |
| "execution_count": 3, | |
| "outputs": [] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2018-11-28T11:43:56.567566Z", | |
| "end_time": "2018-11-28T11:43:56.685719Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "from tslearn.datasets import extract_from_zip_url", | |
| "execution_count": 4, | |
| "outputs": [] | |
| }, | |
| { | |
| "metadata": {}, | |
| "cell_type": "markdown", | |
| "source": "## Prepare time series data" | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2018-11-28T11:43:56.688851Z", | |
| "end_time": "2018-11-28T11:43:56.712070Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "source_dir = 'http://www.timeseriesclassification.com/Downloads/'\ntarget_dir='my_data/Downloads'\nSEL_DATASET = 'LSST'", | |
| "execution_count": 5, | |
| "outputs": [] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2018-11-28T11:43:56.813050Z", | |
| "end_time": "2018-11-28T11:44:00.025449Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "extract_from_zip_url(\n source_dir + SEL_DATASET + '.zip',\n target_dir=target_dir + SEL_DATASET,\n verbose=True)", | |
| "execution_count": 6, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "text": "Successfully extracted file /tmp/tmp5awyosy8/LSST.zip to path my_data/DownloadsLSST\n", | |
| "name": "stdout" | |
| }, | |
| { | |
| "output_type": "execute_result", | |
| "execution_count": 6, | |
| "data": { | |
| "text/plain": "'my_data/DownloadsLSST'" | |
| }, | |
| "metadata": {} | |
| } | |
| ] | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2018-11-28T11:44:35.863131Z", | |
| "end_time": "2018-11-28T11:44:35.885674Z" | |
| } | |
| }, | |
| "cell_type": "markdown", | |
| "source": "There are 6 dimensions" | |
| }, | |
| { | |
| "metadata": { | |
| "ExecuteTime": { | |
| "start_time": "2018-11-28T11:46:47.664929Z", | |
| "end_time": "2018-11-28T11:46:47.737398Z" | |
| }, | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "from scipy.io import arff\ntrain1 = pd.DataFrame(arff.loadarff('my_data/Downloads/LSST/LSSTDimension1_TRAIN.arff')[0])", | |
| "execution_count": 9, | |
| "outputs": [] | |
| }, | |
| { | |
| "metadata": { | |
| "trusted": true | |
| }, | |
| "cell_type": "code", | |
| "source": "", | |
| "execution_count": null, | |
| "outputs": [] | |
| } | |
| ], | |
| "metadata": { | |
| "_draft": { | |
| "nbviewer_url": "https://gist.github.com/26020067f499d48dc52e5bcb8f5f1c57" | |
| }, | |
| "gist": { | |
| "id": "26020067f499d48dc52e5bcb8f5f1c57", | |
| "data": { | |
| "description": "UCR_Time_Series_Classification_Univariate_Datasets.ipynb", | |
| "public": true | |
| } | |
| }, | |
| "kernelspec": { | |
| "name": "fastai-v1", | |
| "display_name": "fastai-v1", | |
| "language": "python" | |
| }, | |
| "language_info": { | |
| "name": "python", | |
| "version": "3.7.0", | |
| "mimetype": "text/x-python", | |
| "codemirror_mode": { | |
| "name": "ipython", | |
| "version": 3 | |
| }, | |
| "pygments_lexer": "ipython3", | |
| "nbconvert_exporter": "python", | |
| "file_extension": ".py" | |
| }, | |
| "notify_time": "30", | |
| "toc": { | |
| "nav_menu": {}, | |
| "number_sections": true, | |
| "sideBar": true, | |
| "skip_h1_title": false, | |
| "base_numbering": 1, | |
| "title_cell": "Table of Contents", | |
| "title_sidebar": "Contents", | |
| "toc_cell": false, | |
| "toc_position": {}, | |
| "toc_section_display": true, | |
| "toc_window_display": false | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment