diff --git a/docs/examples.md b/docs/examples.md index 95d5f3a8ad..eecba6a075 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -257,7 +257,7 @@ TSFresh transform ::: :::{grid-item-card} -:img-top: images/logo/aeon-logo-blue-2-transparent.png +:img-top: examples/transformations/img/catch22.png :class-img-top: aeon-card-image-m :link: /examples/transformations/catch22.ipynb :link-type: ref @@ -279,7 +279,7 @@ Rocket transform ::: :::{grid-item-card} -:img-top: images/logo/aeon-logo-blue-2-transparent.png +:img-top: examples/transformations/img/mini_rocket.png :class-img-top: aeon-card-image-m :link: /examples/transformations/minirocket.ipynb :link-type: ref @@ -290,7 +290,7 @@ MiniRocket transform ::: :::{grid-item-card} -:img-top: images/logo/aeon-logo-blue-2-transparent.png +:img-top: examples/transformations/img/sast.png :class-img-top: aeon-card-image-m :link: /examples/transformations/sast.ipynb :link-type: ref diff --git a/examples/transformations/catch22.ipynb b/examples/transformations/catch22.ipynb index 340880cefa..6bdd09a5c1 100644 --- a/examples/transformations/catch22.ipynb +++ b/examples/transformations/catch22.ipynb @@ -155,8 +155,12 @@ "outputs": [ { "data": { - "text/plain": "Catch22()", - "text/html": "
Catch22()
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + "text/html": [ + "
Catch22()
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ], + "text/plain": [ + "Catch22()" + ] }, "execution_count": 21, "metadata": {}, @@ -217,8 +221,12 @@ "outputs": [ { "data": { - "text/plain": "Catch22Classifier(random_state=0)", - "text/html": "
Catch22Classifier(random_state=0)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + "text/html": [ + "
Catch22Classifier(random_state=0)
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ], + "text/plain": [ + "Catch22Classifier(random_state=0)" + ] }, "execution_count": 23, "metadata": {}, @@ -232,7 +240,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2020-12-19T14:30:08.553299Z", @@ -241,19 +249,21 @@ "shell.execute_reply": "2020-12-19T14:30:08.561821Z" } }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "C22F Accuracy: 0.86\n" - ] - } - ], + "outputs": [], "source": [ "c22f_preds = c22f.predict(IPD_X_test)\n", "print(\"C22F Accuracy: \" + str(metrics.accuracy_score(IPD_y_test, c22f_preds)))" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### References\n", + "\n", + "[1] Carl H Lubba, Sarab S Sethi, Philip Knaute, Simon R Schultz, Ben D Fulcher*, Nick S Jones*. catch22: CAnonical Time-series CHaracteristics (2019)\n", + "\n" + ] } ], "metadata": { @@ -272,7 +282,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.10" + "version": "3.11.5" }, "toc": { "base_numbering": 1, diff --git a/examples/transformations/img/catch22.png b/examples/transformations/img/catch22.png new file mode 100644 index 0000000000..5874deb9e0 Binary files /dev/null and b/examples/transformations/img/catch22.png differ diff --git a/examples/transformations/img/mini_rocket.png b/examples/transformations/img/mini_rocket.png new file mode 100644 index 0000000000..016064daba Binary files /dev/null and b/examples/transformations/img/mini_rocket.png differ diff --git a/examples/transformations/img/sast.png b/examples/transformations/img/sast.png new file mode 100644 index 0000000000..ef97ea96cc Binary files /dev/null and b/examples/transformations/img/sast.png differ diff --git a/examples/transformations/minirocket.ipynb b/examples/transformations/minirocket.ipynb index 9598547485..2f402be86f 100644 --- a/examples/transformations/minirocket.ipynb +++ b/examples/transformations/minirocket.ipynb @@ -94,7 +94,9 @@ "outputs": [ { "data": { - "text/plain": "(36, 9996)" + "text/plain": [ + "(36, 9996)" + ] }, "execution_count": 3, "metadata": {}, @@ -142,8 +144,18 @@ "outputs": [ { "data": { - "text/plain": "RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n 4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n 2.15443469e+02, 1.00000000e+03]))", - "text/html": "
RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n       4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n       2.15443469e+02, 1.00000000e+03]))
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + "text/html": [ + "
RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n",
+       "       4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n",
+       "       2.15443469e+02, 1.00000000e+03]))
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ], + "text/plain": [ + "RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n", + " 4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n", + " 2.15443469e+02, 1.00000000e+03]))" + ] }, "execution_count": 4, "metadata": {}, @@ -204,7 +216,9 @@ "outputs": [ { "data": { - "text/plain": "0.8742857142857143" + "text/plain": [ + "0.8742857142857143" + ] }, "execution_count": 6, "metadata": {}, @@ -218,14 +232,14 @@ }, { "cell_type": "markdown", + "metadata": { + "collapsed": false + }, "source": [ "## 2 Multivariate Time Series\n", "\n", "We can use MiniRocket with multivariate time series.\n" - ], - "metadata": { - "collapsed": false - } + ] }, { "cell_type": "markdown", @@ -298,8 +312,18 @@ "outputs": [ { "data": { - "text/plain": "RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n 4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n 2.15443469e+02, 1.00000000e+03]))", - "text/html": "
RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n       4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n       2.15443469e+02, 1.00000000e+03]))
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + "text/html": [ + "
RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n",
+       "       4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n",
+       "       2.15443469e+02, 1.00000000e+03]))
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ], + "text/plain": [ + "RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n", + " 4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n", + " 2.15443469e+02, 1.00000000e+03]))" + ] }, "execution_count": 9, "metadata": {}, @@ -360,7 +384,9 @@ "outputs": [ { "data": { - "text/plain": "1.0" + "text/plain": [ + "1.0" + ] }, "execution_count": 11, "metadata": {}, @@ -396,10 +422,10 @@ "evalue": "name 'make_pipeline' is not defined", "output_type": "error", "traceback": [ - "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", - "\u001B[1;31mNameError\u001B[0m Traceback (most recent call last)", - "Cell \u001B[1;32mIn[1], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m minirocket_pipeline \u001B[38;5;241m=\u001B[39m \u001B[43mmake_pipeline\u001B[49m(\n\u001B[0;32m 2\u001B[0m MiniRocket(),\n\u001B[0;32m 3\u001B[0m StandardScaler(with_mean\u001B[38;5;241m=\u001B[39m\u001B[38;5;28;01mFalse\u001B[39;00m),\n\u001B[0;32m 4\u001B[0m RidgeClassifierCV(alphas\u001B[38;5;241m=\u001B[39mnp\u001B[38;5;241m.\u001B[39mlogspace(\u001B[38;5;241m-\u001B[39m\u001B[38;5;241m3\u001B[39m, \u001B[38;5;241m3\u001B[39m, \u001B[38;5;241m10\u001B[39m)),\n\u001B[0;32m 5\u001B[0m )\n", - "\u001B[1;31mNameError\u001B[0m: name 'make_pipeline' is not defined" + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[1], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m minirocket_pipeline \u001b[38;5;241m=\u001b[39m \u001b[43mmake_pipeline\u001b[49m(\n\u001b[0;32m 2\u001b[0m MiniRocket(),\n\u001b[0;32m 3\u001b[0m StandardScaler(with_mean\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m),\n\u001b[0;32m 4\u001b[0m RidgeClassifierCV(alphas\u001b[38;5;241m=\u001b[39mnp\u001b[38;5;241m.\u001b[39mlogspace(\u001b[38;5;241m-\u001b[39m\u001b[38;5;241m3\u001b[39m, \u001b[38;5;241m3\u001b[39m, \u001b[38;5;241m10\u001b[39m)),\n\u001b[0;32m 5\u001b[0m )\n", + "\u001b[1;31mNameError\u001b[0m: name 'make_pipeline' is not defined" ] } ], @@ -437,10 +463,10 @@ "evalue": "name 'load_arrow_head' is not defined", "output_type": "error", "traceback": [ - "\u001B[1;31m---------------------------------------------------------------------------\u001B[0m", - "\u001B[1;31mNameError\u001B[0m Traceback (most recent call last)", - "Cell \u001B[1;32mIn[2], line 1\u001B[0m\n\u001B[1;32m----> 1\u001B[0m X_train, y_train \u001B[38;5;241m=\u001B[39m \u001B[43mload_arrow_head\u001B[49m(split\u001B[38;5;241m=\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mtrain\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m 3\u001B[0m \u001B[38;5;66;03m# it is necessary to pass y_train to the pipeline\u001B[39;00m\n\u001B[0;32m 4\u001B[0m \u001B[38;5;66;03m# y_train is not used for the transform, but it is used by the classifier\u001B[39;00m\n\u001B[0;32m 5\u001B[0m minirocket_pipeline\u001B[38;5;241m.\u001B[39mfit(X_train, y_train)\n", - "\u001B[1;31mNameError\u001B[0m: name 'load_arrow_head' is not defined" + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[1;32mIn[2], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m X_train, y_train \u001b[38;5;241m=\u001b[39m \u001b[43mload_arrow_head\u001b[49m(split\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtrain\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 3\u001b[0m \u001b[38;5;66;03m# it is necessary to pass y_train to the pipeline\u001b[39;00m\n\u001b[0;32m 4\u001b[0m \u001b[38;5;66;03m# y_train is not used for the transform, but it is used by the classifier\u001b[39;00m\n\u001b[0;32m 5\u001b[0m minirocket_pipeline\u001b[38;5;241m.\u001b[39mfit(X_train, y_train)\n", + "\u001b[1;31mNameError\u001b[0m: name 'load_arrow_head' is not defined" ] } ], @@ -473,7 +499,9 @@ "outputs": [ { "data": { - "text/plain": "0.8457142857142858" + "text/plain": [ + "0.8457142857142858" + ] }, "execution_count": 15, "metadata": {}, @@ -558,8 +586,39 @@ }, { "data": { - "text/plain": "Pipeline(steps=[('minirocketmultivariatevariable',\n MiniRocketMultivariateVariable(max_dilations_per_kernel=16,\n pad_value_short_series=-10.0,\n random_state=42)),\n ('standardscaler', StandardScaler(with_mean=False)),\n ('ridgeclassifiercv',\n RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n 4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n 2.15443469e+02, 1.00000000e+03])))])", - "text/html": "
Pipeline(steps=[('minirocketmultivariatevariable',\n                 MiniRocketMultivariateVariable(max_dilations_per_kernel=16,\n                                                pad_value_short_series=-10.0,\n                                                random_state=42)),\n                ('standardscaler', StandardScaler(with_mean=False)),\n                ('ridgeclassifiercv',\n                 RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n       4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n       2.15443469e+02, 1.00000000e+03])))])
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + "text/html": [ + "
Pipeline(steps=[('minirocketmultivariatevariable',\n",
+       "                 MiniRocketMultivariateVariable(max_dilations_per_kernel=16,\n",
+       "                                                pad_value_short_series=-10.0,\n",
+       "                                                random_state=42)),\n",
+       "                ('standardscaler', StandardScaler(with_mean=False)),\n",
+       "                ('ridgeclassifiercv',\n",
+       "                 RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n",
+       "       4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n",
+       "       2.15443469e+02, 1.00000000e+03])))])
In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
" + ], + "text/plain": [ + "Pipeline(steps=[('minirocketmultivariatevariable',\n", + " MiniRocketMultivariateVariable(max_dilations_per_kernel=16,\n", + " pad_value_short_series=-10.0,\n", + " random_state=42)),\n", + " ('standardscaler', StandardScaler(with_mean=False)),\n", + " ('ridgeclassifiercv',\n", + " RidgeClassifierCV(alphas=array([1.00000000e-03, 4.64158883e-03, 2.15443469e-02, 1.00000000e-01,\n", + " 4.64158883e-01, 2.15443469e+00, 1.00000000e+01, 4.64158883e+01,\n", + " 2.15443469e+02, 1.00000000e+03])))])" + ] }, "execution_count": 17, "metadata": {}, @@ -596,7 +655,9 @@ "outputs": [ { "data": { - "text/plain": "0.9945945945945946" + "text/plain": [ + "0.9945945945945946" + ] }, "execution_count": 18, "metadata": {}, @@ -608,6 +669,14 @@ "\n", "minirocket_mv_var_pipeline.score(X_test_jv, y_test_jv)" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### References\n", + "[1] Angus Dempster, Daniel F. Schmidt, Geoffrey I. Webb. A Very Fast (Almost) Deterministic Transform for Time Series Classification" + ] } ], "metadata": { diff --git a/examples/transformations/sast.ipynb b/examples/transformations/sast.ipynb index 318effbdf9..6f4b3a7fe5 100644 --- a/examples/transformations/sast.ipynb +++ b/examples/transformations/sast.ipynb @@ -517,7 +517,10 @@ { "cell_type": "markdown", "metadata": {}, - "source": [] + "source": [ + "### References\n", + "[1] Michael F Mbouopda •, Engelbert Mephu. Scalable and Accurate Subsequence Transform." + ] } ], "metadata": {