-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- parallelization - l-step lookahead
- Loading branch information
Stefan Heid
committed
Aug 8, 2023
1 parent
af3671b
commit d5807b9
Showing
4 changed files
with
140 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "f101aee3-ac9c-45c2-8d67-b729f22ea8b0", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from sklearn.datasets import load_breast_cancer\n", | ||
"from sklearn.model_selection import cross_val_score, ShuffleSplit\n", | ||
"\n", | ||
"from skpsl import ProbabilisticScoringList, MinEntropyBinarizer" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "0b07fa87-3c3c-40d4-bca7-605cfe5052c9", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# Generating synthetic data with continuous features and a binary target variable\n", | ||
"\n", | ||
"data = load_breast_cancer()\n", | ||
"X = MinEntropyBinarizer().fit_transform(data.data,data.target)\n", | ||
"y = data.target" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"id": "3e77f88f-8aa7-4794-9c19-aa9fc73bbb99", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"0.9599\n", | ||
"CPU times: user 163 ms, sys: 96.5 ms, total: 259 ms\n", | ||
"Wall time: 14min 11s\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"%%time\n", | ||
"clf = ProbabilisticScoringList([-1, 1, 2])\n", | ||
"print(f\"{cross_val_score(clf, X, y, fit_params=dict(l=2), cv=ShuffleSplit(100, test_size=.2, random_state=42), n_jobs=-1).mean():.4f}\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "eb1d191d-38b6-4f1c-8740-7101c9bd192c", | ||
"metadata": {}, | ||
"source": [ | ||
"### 0.2.0\n", | ||
"- l=2 14min 11s, 0.9599\n", | ||
"- l=1 30s, 0.9604\n", | ||
"\n", | ||
"### 0.1.0\n", | ||
"- 30s, 0.9604" | ||
] | ||
} | ||
], | ||
"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.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters