INNER CODE UNIT · Python

update_algorithm_or_clusters

burkesquires/python_biologist · 06_data_vis_python/bokeh/server/app/clustering/main.py:159

def update_algorithm_or_clusters(attrname, old, new):
    global X

    algorithm = algorithm_select.value
    n_clusters = int(clusters_slider.value)

    X, y_pred = clustering(X, algorithm, n_clusters)
    colors = [spectral[i] for i in y_pred]

    source.data = dict(colors=colors, x=X[:, 0], y=X[:, 1])

    plot.title.text = algorithm

def update_samples_or_dataset(attrname, old, new):
    global X, y

    dataset = dataset_select.value
    algorithm = algorithm_select.value

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…