Module Expr Str Print NameLoad Import alias identifier Import alias identifier ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad Num Num body Expr Str Assign NameStore AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr TupleLoad Call NameLoad NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Assign NameStore Call NameLoad keyword Num keyword NameLoad keyword NameLoad For TupleStore NameStore NameStore Call NameLoad NameLoad body For NameStore Call NameLoad NameLoad body If CompareIs NameLoad NameLoad body Assign NameStore Call NameLoad keyword Num keyword NameLoad keyword NameLoad Assign NameStore Call NameLoad keyword Num keyword NameLoad keyword NameLoad Assign SubscriptStore NameLoad Index TupleLoad NameLoad NameLoad Call NameLoad NameLoad NameLoad Return NameLoad decorator_list Assign NameStore ListLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Num Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Num NameLoad Num attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Num Assign NameStore ListLoad Assign NameStore ListLoad For NameStore NameLoad body Print BinOpMod Str TupleLoad AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Print BinOpMod Str BinOpSub Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad keyword Num Call AttributeLoad NameLoad attr keyword Num Index Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr keyword Num keyword Num Assign NameStore Num Assign NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Num Num Num attr AttributeLoad NameLoad attr Assign NameStore Num Expr Call AttributeLoad NameLoad attr Num Assign NameStore ListLoad Assign NameStore ListLoad For NameStore NameLoad body Print BinOpMod Str TupleLoad AttributeLoad NameLoad attr Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad keyword NameLoad Print BinOpMod Str BinOpSub Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr keyword Num Call AttributeLoad NameLoad attr keyword Num Index Num Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr keyword Num keyword Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Expr Call AttributeLoad NameLoad attr
N/A N/A 
==========================================================
Adjustment for chance in clustering performance evaluation
==========================================================

The following plots demonstrate the impact of the number of clusters and
number of samples on various clustering performance evaluation metrics.

Non-adjusted measures such as the V-Measure show a dependency between
the number of clusters and the number of samples: the mean V-Measure
of random labeling increases significantly as the number of clusters is
closer to the total number of samples used to compute the measure.

Adjusted for chance measure such as ARI display some random variations
centered around a mean score of 0.0 for any number of samples and
clusters.

Only adjusted measures can hence safely be used as a consensus index
to evaluate the average stability of clustering algorithms for a given
value of k on various overlapping sub-samples of the dataset.

 N/A __doc__ N/A numpy np N/A matplotlib.pyplot plt time time sklearn metrics uniform_labelings_scores N/A N/A score_func n_samples n_clusters_range fixed_n_classes n_runs seed N/A None 5 42 N/A N/A Compute score for 2 random uniform cluster labelings.

    Both random labelings have the same number of clusters for each value
    possible value in ``n_clusters_range``.

    When fixed_n_classes is not None the first labeling is considered a ground
    truth class assignment with fixed number of classes.
     N/A random_labels N/A N/A N/A N/A np random RandomState seed randint N/A scores N/A N/A np zeros N/A N/A len n_clusters_range n_runs N/A N/A fixed_n_classes None N/A N/A labels_a N/A random_labels low 0 high fixed_n_classes size n_samples N/A N/A i k N/A enumerate n_clusters_range N/A N/A j N/A range n_runs N/A N/A N/A fixed_n_classes None N/A N/A labels_a N/A random_labels low 0 high k size n_samples N/A labels_b N/A random_labels low 0 high k size n_samples N/A N/A scores N/A N/A i j N/A score_func labels_a labels_b N/A scores N/A N/A score_funcs N/A N/A metrics adjusted_rand_score N/A metrics v_measure_score N/A metrics adjusted_mutual_info_score N/A metrics mutual_info_score N/A n_samples 100 N/A n_clusters_range N/A N/A N/A N/A np linspace 2 n_samples 10 astype N/A np int N/A N/A N/A plt figure 1 N/A plots N/A N/A names N/A N/A score_func score_funcs N/A N/A N/A Computing %s for %d values of n_clusters and n_samples=%d N/A N/A score_func __name__ N/A len n_clusters_range n_samples N/A t0 N/A time N/A scores N/A uniform_labelings_scores score_func n_samples n_clusters_range N/A N/A done in %0.3fs N/A N/A time t0 N/A N/A N/A plots append N/A N/A N/A plt errorbar n_clusters_range N/A N/A np median scores axis 1 N/A N/A scores std axis 1 N/A 0 N/A N/A N/A names append N/A score_func __name__ N/A N/A N/A plt title Clustering measures for 2 random uniform labelings
with equal number of clusters N/A N/A N/A plt xlabel N/A Number of clusters (Number of samples is fixed to %d) n_samples N/A N/A N/A plt ylabel Score value N/A N/A N/A plt legend plots names N/A N/A N/A plt ylim ymin -0.05 ymax 1.05 N/A n_samples 1000 N/A n_clusters_range N/A N/A N/A N/A np linspace 2 100 10 astype N/A np int N/A n_classes 10 N/A N/A N/A plt figure 2 N/A plots N/A N/A names N/A N/A score_func score_funcs N/A N/A N/A Computing %s for %d values of n_clusters and n_samples=%d N/A N/A score_func __name__ N/A len n_clusters_range n_samples N/A t0 N/A time N/A scores N/A uniform_labelings_scores score_func n_samples n_clusters_range fixed_n_classes n_classes N/A N/A done in %0.3fs N/A N/A time t0 N/A N/A N/A plots append N/A N/A N/A plt errorbar n_clusters_range N/A N/A scores mean axis 1 N/A N/A scores std axis 1 N/A 0 N/A N/A N/A names append N/A score_func __name__ N/A N/A N/A plt title N/A Clustering measures for random uniform labeling
against reference assignment with %d classes n_classes N/A N/A N/A plt xlabel N/A Number of clusters (Number of samples is fixed to %d) n_samples N/A N/A N/A plt ylabel Score value N/A N/A N/A plt ylim ymin -0.05 ymax 1.05 N/A N/A N/A plt legend plots names N/A N/A N/A plt show