generated from scikit-learn-contrib/project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
[ci skip] Initial commit 37431d8
0 parents
commit 6989629
Showing
109 changed files
with
16,103 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: f51136111eba58b7ed8810f833e65d91 | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Empty file.
Binary file not shown.
41 changes: 41 additions & 0 deletions
41
_downloads/084669b45b226af6f637ab8457c8c5aa/plot_classifier.py
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,41 @@ | ||
""" | ||
============================ | ||
Plotting Template Classifier | ||
============================ | ||
An example plot of :class:`skltemplate.template.TemplateClassifier` | ||
""" | ||
|
||
# %% | ||
# Train our classifier on very simple dataset | ||
from skltemplate import TemplateClassifier | ||
|
||
X = [[0, 0], [1, 1]] | ||
y = [0, 1] | ||
clf = TemplateClassifier().fit(X, y) | ||
|
||
# %% | ||
# Create a test dataset | ||
import numpy as np | ||
|
||
rng = np.random.RandomState(13) | ||
X_test = rng.rand(500, 2) | ||
|
||
# %% | ||
# Use scikit-learn to display the decision boundary | ||
from sklearn.inspection import DecisionBoundaryDisplay | ||
|
||
disp = DecisionBoundaryDisplay.from_estimator(clf, X_test) | ||
disp.ax_.scatter( | ||
X_test[:, 0], | ||
X_test[:, 1], | ||
c=clf.predict(X_test), | ||
s=20, | ||
edgecolors="k", | ||
linewidths=0.5, | ||
) | ||
disp.ax_.set( | ||
xlabel="Feature 1", | ||
ylabel="Feature 2", | ||
title="Template Classifier Decision Boundary", | ||
) |
18 changes: 18 additions & 0 deletions
18
_downloads/2844e15e96683b9e78e43f57c6f47e9e/plot_template.py
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,18 @@ | ||
""" | ||
=========================== | ||
Plotting Template Estimator | ||
=========================== | ||
An example plot of :class:`skltemplate.template.TemplateEstimator` | ||
""" | ||
import numpy as np | ||
from matplotlib import pyplot as plt | ||
|
||
from skltemplate import TemplateEstimator | ||
|
||
X = np.arange(100).reshape(100, 1) | ||
y = np.zeros((100,)) | ||
estimator = TemplateEstimator() | ||
estimator.fit(X, y) | ||
plt.plot(estimator.predict(X)) | ||
plt.show() |
43 changes: 43 additions & 0 deletions
43
_downloads/33e3b8fda2687ae96879282d905830b7/plot_template.ipynb
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,43 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Plotting Template Estimator\n\nAn example plot of :class:`skltemplate.template.TemplateEstimator`\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\nfrom matplotlib import pyplot as plt\n\nfrom skltemplate import TemplateEstimator\n\nX = np.arange(100).reshape(100, 1)\ny = np.zeros((100,))\nestimator = TemplateEstimator()\nestimator.fit(X, y)\nplt.plot(estimator.predict(X))\nplt.show()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
27 changes: 27 additions & 0 deletions
27
_downloads/35939d2f12dbb3de2b921c8a33dd72c2/plot_transformer.py
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,27 @@ | ||
""" | ||
============================= | ||
Plotting Template Transformer | ||
============================= | ||
An example plot of :class:`skltemplate.template.TemplateTransformer` | ||
""" | ||
import numpy as np | ||
from matplotlib import pyplot as plt | ||
|
||
from skltemplate import TemplateTransformer | ||
|
||
X = np.arange(50, dtype=np.float64).reshape(-1, 1) | ||
X /= 50 | ||
estimator = TemplateTransformer() | ||
X_transformed = estimator.fit_transform(X) | ||
|
||
plt.plot(X.flatten(), label="Original Data") | ||
plt.plot(X_transformed.flatten(), label="Transformed Data") | ||
plt.title("Plots of original and transformed data") | ||
|
||
plt.legend(loc="best") | ||
plt.grid(True) | ||
plt.xlabel("Index") | ||
plt.ylabel("Value of Data") | ||
|
||
plt.show() |
43 changes: 43 additions & 0 deletions
43
_downloads/5b2cebfab9d8cca4393d66b1e4b8a8e7/plot_transformer.ipynb
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,43 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Plotting Template Transformer\n\nAn example plot of :class:`skltemplate.template.TemplateTransformer`\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\nfrom matplotlib import pyplot as plt\n\nfrom skltemplate import TemplateTransformer\n\nX = np.arange(50, dtype=np.float64).reshape(-1, 1)\nX /= 50\nestimator = TemplateTransformer()\nX_transformed = estimator.fit_transform(X)\n\nplt.plot(X.flatten(), label=\"Original Data\")\nplt.plot(X_transformed.flatten(), label=\"Transformed Data\")\nplt.title(\"Plots of original and transformed data\")\n\nplt.legend(loc=\"best\")\nplt.grid(True)\nplt.xlabel(\"Index\")\nplt.ylabel(\"Value of Data\")\n\nplt.show()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Binary file added
BIN
+5.09 KB
_downloads/6f1e7a639e0699d6164445b55e6c116d/auto_examples_jupyter.zip
Binary file not shown.
86 changes: 86 additions & 0 deletions
86
_downloads/fed3e85cac62fc93e088aa8cb008d467/plot_classifier.ipynb
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,86 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"\n# Plotting Template Classifier\n\nAn example plot of :class:`skltemplate.template.TemplateClassifier`\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Train our classifier on very simple dataset\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from skltemplate import TemplateClassifier\n\nX = [[0, 0], [1, 1]]\ny = [0, 1]\nclf = TemplateClassifier().fit(X, y)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Create a test dataset\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n\nrng = np.random.RandomState(13)\nX_test = rng.rand(500, 2)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Use scikit-learn to display the decision boundary\n\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": { | ||
"collapsed": false | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from sklearn.inspection import DecisionBoundaryDisplay\n\ndisp = DecisionBoundaryDisplay.from_estimator(clf, X_test)\ndisp.ax_.scatter(\n X_test[:, 0],\n X_test[:, 1],\n c=clf.predict(X_test),\n s=20,\n edgecolors=\"k\",\n linewidths=0.5,\n)\ndisp.ax_.set(\n xlabel=\"Feature 1\",\n ylabel=\"Feature 2\",\n title=\"Template Classifier Decision Boundary\",\n)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.12.3" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 0 | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.