Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC ] Added examples to docstrings for K-Means and K-Medoids #4736

Merged
merged 5 commits into from Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions .all-contributorsrc
Expand Up @@ -2190,6 +2190,15 @@
"contributions": [
"code"
]
},
{
"login": "CTFallon",
"name": "Colin Fallon",
"avatar_url": "https://avatars.githubusercontent.com/u/19725980?v=4",
"profile": "https://github.com/CTFallon",
"contributions": [
"doc"
]
}
]
}
11 changes: 11 additions & 0 deletions sktime/clustering/k_means.py
Expand Up @@ -64,6 +64,17 @@ class TimeSeriesKMeans(TimeSeriesLloyds):
the sample weights if provided.
n_iter_: int
Number of iterations run.

Examples
--------
>>> from sktime.datasets import load_arrow_head
>>> from sktime.clustering.k_means import TimeSeriesKMeans
>>> X_train, y_train = load_arrow_head(split="train")
>>> X_test, y_test = load_arrow_head(split="test")
>>> clusterer = TimeSeriesKMeans(n_clusters=3) # doctest: +SKIP
>>> clusterer.fit(X_train) # doctest: +SKIP
TimeSeriesKMeans(n_clusters=3)
>>> y_pred = clusterer.predict(X_test) # doctest: +SKIP
"""

_tags = {"python_dependencies": "numba"}
Expand Down
11 changes: 11 additions & 0 deletions sktime/clustering/k_medoids.py
Expand Up @@ -58,6 +58,17 @@ class TimeSeriesKMedoids(TimeSeriesLloyds):
the sample weights if provided.
n_iter_: int
Number of iterations run.

Examples
--------
>>> from sktime.datasets import load_arrow_head
>>> from sktime.clustering.k_medoids import TimeSeriesKMedoids
>>> X_train, y_train = load_arrow_head(split="train")
>>> X_test, y_test = load_arrow_head(split="test")
>>> clusterer = TimeSeriesKMedoids(n_clusters=3) # doctest: +SKIP
>>> clusterer.fit(X_train) # doctest: +SKIP
TimeSeriesKMedoids(n_clusters=3)
>>> y_pred = clusterer.predict(X_test) # doctest: +SKIP
"""

_tags = {"python_dependencies": "numba"}
Expand Down