Skip to content

Commit

Permalink
updated data loading functionalities
Browse files Browse the repository at this point in the history
  • Loading branch information
mloning committed Mar 21, 2019
1 parent 12a7a8e commit 9d4746e
Show file tree
Hide file tree
Showing 7 changed files with 871 additions and 199 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include *.rst
recursive-include examples *
recursive-include sktime *.c *.h *.pyx *.pxd *.pxi
recursive-include sktime/datasets *.csv *.csv.gz *.arff *.arff.gz *.txt
recursive-include sktime/datasets *.csv *.csv.gz *.arff *.arff.gz *.txt *.ts
455 changes: 401 additions & 54 deletions examples/Example - Shapelet Transform.ipynb

Large diffs are not rendered by default.

106 changes: 64 additions & 42 deletions examples/highlevel-walkthrough.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": 1,
"metadata": {},
"outputs": [
{
Expand All @@ -38,7 +38,7 @@
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -59,7 +59,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand All @@ -78,7 +78,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand All @@ -102,50 +102,80 @@
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>x_axis</th>\n",
" <th>label</th>\n",
" <th>dim_0</th>\n",
" <th>class_val</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>[-0.6478854, -0.64199155, -0.63818632, -0.6382...</td>\n",
" <td>0 -0.64789\n",
"1 -0.64199\n",
"2 -0.63819\n",
"3...</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>[-0.64442658, -0.64540093, -0.64705511, -0.647...</td>\n",
" <td>0 -0.64443\n",
"1 -0.64540\n",
"2 -0.64706\n",
"3...</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>[-0.77835282, -0.77827907, -0.77715084, -0.777...</td>\n",
" <td>0 -0.77835\n",
"1 -0.77828\n",
"2 -0.77715\n",
"3...</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>[-0.75006044, -0.7481029, -0.746164, -0.745925...</td>\n",
" <td>0 -0.75006\n",
"1 -0.74810\n",
"2 -0.74616\n",
"3...</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>[-0.59953861, -0.59742191, -0.59926903, -0.598...</td>\n",
" <td>0 -0.59954\n",
"1 -0.59742\n",
"2 -0.59927\n",
"3...</td>\n",
" <td>2</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" x_axis label\n",
"0 [-0.6478854, -0.64199155, -0.63818632, -0.6382... 2\n",
"1 [-0.64442658, -0.64540093, -0.64705511, -0.647... 2\n",
"2 [-0.77835282, -0.77827907, -0.77715084, -0.777... 1\n",
"3 [-0.75006044, -0.7481029, -0.746164, -0.745925... 1\n",
"4 [-0.59953861, -0.59742191, -0.59926903, -0.598... 2"
" dim_0 class_val\n",
"0 0 -0.64789\n",
"1 -0.64199\n",
"2 -0.63819\n",
"3... 2\n",
"1 0 -0.64443\n",
"1 -0.64540\n",
"2 -0.64706\n",
"3... 2\n",
"2 0 -0.77835\n",
"1 -0.77828\n",
"2 -0.77715\n",
"3... 1\n",
"3 0 -0.75006\n",
"1 -0.74810\n",
"2 -0.74616\n",
"3... 1\n",
"4 0 -0.59954\n",
"1 -0.59742\n",
"2 -0.59927\n",
"3... 2"
]
},
"execution_count": 17,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -164,28 +194,28 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'_case': 'TSC',\n",
" '_target': 'label',\n",
" '_features': Index(['x_axis'], dtype='object'),\n",
" '_target': 'class_val',\n",
" '_features': Index(['dim_0'], dtype='object'),\n",
" '_meta': {'nrow': 50,\n",
" 'ncol': 2,\n",
" 'target_type': {'label': int},\n",
" 'feature_type': {'x_axis': {numpy.ndarray}}}}"
" 'target_type': {'class_val': str},\n",
" 'feature_type': {'dim_0': {pandas.core.series.Series}}}}"
]
},
"execution_count": 18,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"task = Task(case='TSC', data=train, target='label')\n",
"task = Task(case='TSC', data=train, target='class_val')\n",
"task.__dict__"
]
},
Expand All @@ -198,7 +228,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -215,18 +245,9 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CPU times: user 1.59 s, sys: 8.38 ms, total: 1.6 s\n",
"Wall time: 1.6 s\n"
]
}
],
"outputs": [],
"source": [
"strategy.fit(task, train)"
]
Expand All @@ -240,7 +261,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -249,21 +270,22 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.9733333333333334"
"0.9533333333333334"
]
},
"execution_count": 12,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y_test = test['class_val']\n",
"accuracy_score(y_test, y_pred)"
]
}
Expand All @@ -284,7 +306,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
"version": "3.7.1"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 9d4746e

Please sign in to comment.