refactor: move things around
This commit is contained in:
@@ -0,0 +1,198 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"toc": true
|
||||
},
|
||||
"source": [
|
||||
"# WS 09 Tune AdaBoostRegressor"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"* es wurde festgestellt, dass z.B. AdaBoostRegressor unter Standard-Parametrisierung ein unbrauchbares Ergebnis liefert\n",
|
||||
"* untersuchen Sie das Potential von Parameter-Tuning für diesen Regressor\n",
|
||||
"* konzentrieren Sie sich auf folgende Parameter\n",
|
||||
" * learning_rate, Parameter von AdaBoostRegressor\n",
|
||||
" * max_depth, interner Parameter des Basis-Estimators, hier DecisionTreeRegressor\n",
|
||||
"* falls Zeit übrig, untersuchen Sie noch andere Regressoren Ihrer Wahl dahingehend"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"## prepare env, read and prepare data\n",
|
||||
"import pandas as pd\n",
|
||||
"import numpy as np\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"import seaborn as sns; sns.set()\n",
|
||||
"\n",
|
||||
"codepath = '../2_code' ## for import of user defined module\n",
|
||||
"datapath = '../3_data'\n",
|
||||
"#codepath = '.././2_code' ## for import of user defined module\n",
|
||||
"#datapath = '../../3_data'\n",
|
||||
"\n",
|
||||
"from sys import path; path.insert(1, codepath)\n",
|
||||
"from os import chdir; chdir(datapath)\n",
|
||||
"\n",
|
||||
"from bfh_cas_pml import prep_data\n",
|
||||
"X_train, X_test, y_train, y_test = prep_data('melb_data_prep.csv', target='Price', seed=1234)\n",
|
||||
"\n",
|
||||
"from bfh_cas_pml import test_regression_model"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2020-04-08T10:06:45.098899Z",
|
||||
"start_time": "2020-04-08T10:06:44.257283Z"
|
||||
}
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"R2 = -0.3023\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"## baseline\n",
|
||||
"from sklearn.ensemble import AdaBoostRegressor\n",
|
||||
"this_model = test_regression_model(\n",
|
||||
" AdaBoostRegressor(random_state=1234), \n",
|
||||
" X_train, y_train, X_test, y_test,\n",
|
||||
" show_plot=False)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"## tune learning_rate\n",
|
||||
"## tbd: find parameter range here\n",
|
||||
"\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"## tune max_depth\n",
|
||||
"from sklearn.tree import DecisionTreeRegressor\n",
|
||||
"## tbd: find parameter range here\n",
|
||||
"\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"## best combination of single parameters\n",
|
||||
"## tbd\n",
|
||||
"\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Fazit**:\n",
|
||||
"* tbd"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.7"
|
||||
},
|
||||
"toc": {
|
||||
"base_numbering": "1",
|
||||
"nav_menu": {},
|
||||
"number_sections": false,
|
||||
"sideBar": true,
|
||||
"skip_h1_title": true,
|
||||
"title_cell": "WS 11 Regression - mit FE - solution",
|
||||
"title_sidebar": "Contents",
|
||||
"toc_cell": true,
|
||||
"toc_position": {
|
||||
"height": "calc(100% - 180px)",
|
||||
"left": "10px",
|
||||
"top": "150px",
|
||||
"width": "195.933px"
|
||||
},
|
||||
"toc_section_display": true,
|
||||
"toc_window_display": true
|
||||
},
|
||||
"varInspector": {
|
||||
"cols": {
|
||||
"lenName": 16,
|
||||
"lenType": 16,
|
||||
"lenVar": 40
|
||||
},
|
||||
"kernels_config": {
|
||||
"python": {
|
||||
"delete_cmd_postfix": "",
|
||||
"delete_cmd_prefix": "del ",
|
||||
"library": "var_list.py",
|
||||
"varRefreshCmd": "print(var_dic_list())"
|
||||
},
|
||||
"r": {
|
||||
"delete_cmd_postfix": ") ",
|
||||
"delete_cmd_prefix": "rm(",
|
||||
"library": "var_list.r",
|
||||
"varRefreshCmd": "cat(var_dic_list()) "
|
||||
}
|
||||
},
|
||||
"position": {
|
||||
"height": "321.85px",
|
||||
"left": "785px",
|
||||
"right": "20px",
|
||||
"top": "118px",
|
||||
"width": "350px"
|
||||
},
|
||||
"types_to_exclude": [
|
||||
"module",
|
||||
"function",
|
||||
"builtin_function_or_method",
|
||||
"instance",
|
||||
"_Feature"
|
||||
],
|
||||
"window_display": false
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
Reference in New Issue
Block a user