Skip to content

Commit

Permalink
notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyBagnall committed Nov 5, 2024
1 parent 9f8bed6 commit 63d22ff
Showing 1 changed file with 31 additions and 45 deletions.
76 changes: 31 additions & 45 deletions examples/forecasting/forecasting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 1,
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -104,15 +104,15 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 2,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Possible data structures for input to forecaster ['pd.Series', 'pd.DataFrame', 'np.ndarray']\n",
"\n",
" Tags for BaseForecaster: {'python_version': None, 'python_dependencies': None, 'cant_pickle': False, 'non_deterministic': False, 'algorithm_type': None, 'capability:missing_values': False, 'capability:multithreading': False, 'capability:univariate': True, 'capability:multivariate': False, 'X_inner_type': 'np.ndarray', 'y_inner_type': 'np.ndarray', 'fit_is_empty': False, 'requires_y': True}\n"
" Tags for BaseForecaster: {'python_version': None, 'python_dependencies': None, 'cant_pickle': False, 'non_deterministic': False, 'algorithm_type': None, 'capability:missing_values': False, 'capability:multithreading': False, 'capability:univariate': True, 'capability:multivariate': False, 'X_inner_type': 'np.ndarray', 'fit_is_empty': False}\n"
]
}
],
Expand All @@ -138,13 +138,13 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 3,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'pandas.core.series.Series'>\n"
"<class 'numpy.ndarray'>\n"
]
}
],
Expand All @@ -155,7 +155,7 @@
"\n",
"y = load_airline()\n",
"print(type(y))\n",
"y2 = y.to_numpy()\n",
"y2 = pd.Series(y)\n",
"y3 = pd.DataFrame(y)"
],
"metadata": {
Expand All @@ -179,14 +179,18 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 4,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"np.ndarray\n",
"432.0\n"
"ename": "ValueError",
"evalue": "Tag with name y_inner_type could not be found.",
"output_type": "error",
"traceback": [
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[1;31mValueError\u001B[0m Traceback (most recent call last)",
"Cell \u001B[1;32mIn[4], line 5\u001B[0m\n\u001B[0;32m 2\u001B[0m \u001B[38;5;28;01mfrom\u001B[39;00m \u001B[38;5;21;01maeon\u001B[39;00m\u001B[38;5;21;01m.\u001B[39;00m\u001B[38;5;21;01mforecasting\u001B[39;00m \u001B[38;5;28;01mimport\u001B[39;00m DummyForecaster\n\u001B[0;32m 4\u001B[0m d \u001B[38;5;241m=\u001B[39m DummyForecaster()\n\u001B[1;32m----> 5\u001B[0m \u001B[38;5;28mprint\u001B[39m(\u001B[43md\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget_tag\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43my_inner_type\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m)\n\u001B[0;32m 6\u001B[0m d\u001B[38;5;241m.\u001B[39mfit(y)\n\u001B[0;32m 7\u001B[0m p \u001B[38;5;241m=\u001B[39m d\u001B[38;5;241m.\u001B[39mpredict()\n",
"File \u001B[1;32mC:\\Code\\aeon\\aeon\\base\\_base.py:269\u001B[0m, in \u001B[0;36mBaseAeonEstimator.get_tag\u001B[1;34m(self, tag_name, raise_error, tag_value_default)\u001B[0m\n\u001B[0;32m 266\u001B[0m tag_value \u001B[38;5;241m=\u001B[39m collected_tags\u001B[38;5;241m.\u001B[39mget(tag_name, tag_value_default)\n\u001B[0;32m 268\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m raise_error \u001B[38;5;129;01mand\u001B[39;00m tag_name \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;129;01min\u001B[39;00m collected_tags\u001B[38;5;241m.\u001B[39mkeys():\n\u001B[1;32m--> 269\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mValueError\u001B[39;00m(\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mTag with name \u001B[39m\u001B[38;5;132;01m{\u001B[39;00mtag_name\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m could not be found.\u001B[39m\u001B[38;5;124m\"\u001B[39m)\n\u001B[0;32m 271\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m tag_value\n",
"\u001B[1;31mValueError\u001B[0m: Tag with name y_inner_type could not be found."
]
}
],
Expand All @@ -206,16 +210,8 @@
},
{
"cell_type": "code",
"execution_count": 17,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"432.0\n"
]
}
],
"execution_count": null,
"outputs": [],
"source": [
"# forecast is equivalent to fit_predict in other estimators\n",
"p2 = d.forecast(y)\n",
Expand All @@ -242,18 +238,8 @@
},
{
"cell_type": "code",
"execution_count": 19,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[451.67541971]\n",
"[505.91690237]\n",
"[505.91690237]\n"
]
}
],
"execution_count": null,
"outputs": [],
"source": [
"from aeon.forecasting import RegressionForecaster\n",
"\n",
Expand Down Expand Up @@ -285,17 +271,8 @@
},
{
"cell_type": "code",
"execution_count": 20,
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[5.38765716] ,\n",
" [17.05612701]\n"
]
}
],
"execution_count": null,
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
Expand All @@ -317,6 +294,15 @@
"metadata": {
"collapsed": false
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
}
}
],
"metadata": {
Expand Down

0 comments on commit 63d22ff

Please sign in to comment.