Refactor code for improved readability and consistency across multiple Jupyter notebooks

- Added missing commas in various print statements and function calls for better syntax.
- Reformatted code to enhance clarity, including breaking long lines and aligning parameters.
- Updated function signatures to use float type for sigma parameters instead of int for better precision.
- Cleaned up comments and documentation strings for clarity and consistency.
- Ensured consistent formatting in plotting functions and data handling.
This commit is contained in:
2025-12-13 23:38:17 +01:00
parent f89ff4a016
commit d5a6bfd339
50 changed files with 779 additions and 449 deletions

View File

@@ -37,6 +37,7 @@
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"from sklearn import datasets\n",
"\n",
"iris = datasets.load_iris(as_frame=True)"
@@ -402,7 +403,10 @@
"from sklearn.neighbors import KNeighborsClassifier\n",
"\n",
"X_train, X_test, y_train, y_test = train_test_split(\n",
" X, y, test_size=0.33, random_state=42\n",
" X,\n",
" y,\n",
" test_size=0.33,\n",
" random_state=42,\n",
")\n",
"knn_clf = KNeighborsClassifier(n_neighbors=5)\n",
"knn_clf.fit(X_train, y_train)\n",
@@ -583,7 +587,11 @@
],
"source": [
"X_train_strat, X_test_strat, y_train_strat, y_test_strat = train_test_split(\n",
" X, y, test_size=0.33, random_state=42, stratify=y\n",
" X,\n",
" y,\n",
" test_size=0.33,\n",
" random_state=42,\n",
" stratify=y,\n",
")\n",
"\n",
"y_test_strat.value_counts()"