logo
Loading...

cluster參數設定 - Cupoy

教練好,Day058的練習中,想詢問一下程式碼的意思,default_base = {'n_neig...

ml100,ml100-d58

cluster參數設定

2020/06/24 08:17 AM
機器學習新手論壇
Shengzhi Lin
觀看數:0
回答數:3
收藏數:0
ml100
ml100-d58

教練好,

Day058的練習中,想詢問一下程式碼的意思,


default_base = {'n_neighbors': 10, 'n_clusters': 3}

datasets = [(noisy_moons, {'n_clusters': 2}), 

            (blobs, {'n_neighbors':2}), 

            (no_structure, {'n_neighbors':2})]


for i_dataset, (dataset, algo_params) in enumerate(datasets):

    params = default_base.copy()

    params.update(algo_params)

    X, y = dataset

    X = StandardScaler().fit_transform(X)

    

    ward = cluster.AgglomerativeClustering(n_clusters = params['n_clusters'], linkage = 'ward')

    complete = cluster.AgglomerativeClustering(n_clusters=params['n_clusters'], linkage="complete")

    average = cluster.AgglomerativeClustering(n_clusters=params['n_clusters'], linkage="average")

    clustering_algorithms = (

        ('Average Linkage', average),

        ('Complete Linkage', complete),

        ('Ward Linkage', ward))


想詢問

(1)為什麼要不同的clustering再額外的參數,不能用原先的default_base嗎?

(2)為什麼要有default_base的設定呢?

(3)為什麼有些要更改n_cluster(noisy_moons),而有些要改n_neighbors(blobs與no_structure)?

(4)而兩者卻沒有同時更改呢?