Spaces:
Sleeping
Sleeping
File size: 1,335 Bytes
4013eed | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | from fastapi import APIRouter
router = APIRouter(tags=["presets"])
@router.get("/presets/algorithms")
def list_algorithms():
return {
"algorithms": [
{"key": "kmeans", "label": "KMeans", "params": {"n_clusters": 4}},
{"key": "mini_batch_kmeans", "label": "MiniBatchKMeans", "params": {"n_clusters": 4, "batch_size": 1024}},
{"key": "agglomerative", "label": "Agglomerative", "params": {"n_clusters": 4}},
{"key": "birch", "label": "Birch", "params": {"n_clusters": 4, "threshold": 0.5}},
{"key": "dbscan", "label": "DBSCAN", "params": {"eps": 0.5, "min_samples": 5}},
{"key": "optics", "label": "OPTICS", "params": {"min_samples": 5}},
{"key": "mean_shift", "label": "Mean Shift", "params": {}},
{"key": "spectral", "label": "Spectral Clustering", "params": {"n_clusters": 4, "affinity": "nearest_neighbors"}},
{"key": "gaussian_mixture", "label": "Gaussian Mixture", "params": {"n_components": 4}},
{"key": "affinity_propagation", "label": "Affinity Propagation", "params": {}},
{"key": "bisecting_kmeans", "label": "Bisecting KMeans", "params": {"n_clusters": 4}},
{"key": "hdbscan", "label": "HDBSCAN", "params": {"min_cluster_size": 10, "min_samples": 5}}
]
}
|