Exemple #1
0
def test_graph_dict_basic():
    cluster_object = MaxPRegionsExact()
    cluster_object.fit_from_networkx(graph, attr_dict,
                                     spatially_extensive_attr_dict,
                                     threshold=threshold)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #2
0
def test_graph_dict_multi_attr():
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_networkx(graph, double_attr_dict, n_regions=2)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
def test_geodataframe_multi_attr():
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_geodataframe(gdf, double_attr_str, n_regions=2)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
def test_dict_multi_attr():
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_dict(neighbors_dict, double_attr_dict, n_regions=2)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
def test_scipy_sparse_matrix_multi_attr():
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_scipy_sparse_matrix(adj, double_attr, n_regions=2)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #6
0
def test_w_basic():
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_w(w, attr, n_regions=2)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
def test_graph_dict_multi_attr():
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_networkx(graph, double_attr_dict, n_regions=2)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #8
0
def test_dict_basic():
    cluster_object = MaxPRegionsHeu()
    cluster_object.fit_from_dict(neighbors_dict, attr_dict,
                                 spatially_extensive_attr_dict,
                                 threshold=threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #9
0
def test_graph_dict_basic():
    cluster_object = MaxPRegionsHeu()
    cluster_object.fit_from_networkx(graph, attr_dict,
                                     spatially_extensive_attr_dict,
                                     threshold=threshold)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #10
0
def test_w_multi_attr():
    print(double_threshold)
    cluster_object = MaxPRegionsHeu()
    cluster_object.fit_from_w(w, double_attr, double_spatially_extensive_attr,
                              threshold=double_threshold)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #11
0
def test_geodataframe_basic():
    cluster_object = MaxPRegionsHeu()
    cluster_object.fit_from_geodataframe(gdf, attr_str,
                                         spatially_extensive_attr_str,
                                         threshold=threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #12
0
def test_scipy_sparse_matrix_multi_attr():
    cluster_object = MaxPRegionsExact()
    cluster_object.fit_from_scipy_sparse_matrix(
            adj, double_attr, double_spatially_extensive_attr,
            threshold=double_threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #13
0
def test_scipy_sparse_matrix():
    cluster_object = MaxPRegionsHeu(random_state=0)
    cluster_object.fit_from_scipy_sparse_matrix(adj, attr,
                                                spatially_extensive_attr,
                                                threshold=threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #14
0
def test_w_multi_attr():
    print(double_threshold)
    cluster_object = MaxPRegionsHeu(random_state=0)
    cluster_object.fit_from_w(w, double_attr, double_spatially_extensive_attr,
                              threshold=double_threshold)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #15
0
def test_scipy_sparse_matrix_multi_attr():
    cluster_object = MaxPRegionsHeu()
    cluster_object.fit_from_scipy_sparse_matrix(
            adj, double_attr, double_spatially_extensive_attr,
            threshold=double_threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
def test_w_basic():
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_w(w, attr, n_regions=2)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
def test_geodataframe_multi_attr():
    cluster_object = AZPReactiveTabu(max_iterations=max_it, k1=k1, k2=k2,
                                     random_state=0)
    cluster_object.fit_from_geodataframe(gdf, double_attr_str,
                                         n_regions=n_reg)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #18
0
def test_geodataframe_multi_attr():
    cluster_object = MaxPRegionsExact()
    cluster_object.fit_from_geodataframe(gdf, [attr_str] * 2,
                                         [spatially_extensive_attr_str] * 2,
                                         threshold=double_threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
def test_dict():
    value_dict = dataframe_to_dict(gdf, attr_str)
    cluster_object = AZPReactiveTabu(max_iterations=max_it, k1=k1, k2=k2,
                                     random_state=0)
    cluster_object.fit_from_dict(neighbors_dict, value_dict, n_regions=n_reg)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #20
0
def test_geodataframe_multi_attr():
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_geodataframe(gdf, double_attr_str, n_regions=2)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #21
0
def test_scipy_sparse_matrix_multi_attr():
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_scipy_sparse_matrix(adj, double_attr, n_regions=2)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #22
0
def test_dict_basic():
    cluster_object = MaxPRegionsExact()
    cluster_object.fit_from_dict(neighbors_dict, attr_dict,
                                 spatially_extensive_attr_dict,
                                 threshold=threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #23
0
def test_geodataframe_basic():
    cluster_object = MaxPRegionsExact()
    cluster_object.fit_from_geodataframe(gdf, attr_str,
                                         spatially_extensive_attr_str,
                                         threshold=threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #24
0
def test_dict(method):
    value_dict = dataframe_to_dict(gdf, attr_str)
    cluster_object = PRegionsExact()
    cluster_object.fit_from_dict(neighbors_dict, value_dict, n_regions=2,
                                 method=method)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #25
0
def test_graph_str_basic(method):
    nx.set_node_attributes(graph, attr_str, attr_dict)
    cluster_object = PRegionsExact()
    cluster_object.fit_from_networkx(graph, attr_str, n_regions=2,
                                     method=method)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
def test_scipy_sparse_matrix_multi_attr():
    cluster_object = AZPReactiveTabu(max_iterations=max_it, k1=k1, k2=k2,
                                     random_state=0)
    cluster_object.fit_from_scipy_sparse_matrix(adj, double_attr,
                                                n_regions=n_reg)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #27
0
def test_dict_multi_attr():
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_dict(neighbors_dict, double_attr_dict, n_regions=2)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
def test_graph_str_basic():
    nx.set_node_attributes(graph, attr_str, attr_dict)
    cluster_object = AZPReactiveTabu(max_iterations=max_it, k1=k1, k2=k2,
                                     random_state=0)
    cluster_object.fit_from_networkx(graph, attr_str, n_regions=n_reg)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
def test_dict_multi_attr():
    cluster_object = AZPReactiveTabu(max_iterations=max_it, k1=k1, k2=k2,
                                     random_state=0)
    cluster_object.fit_from_dict(neighbors_dict, double_attr_dict,
                                 n_regions=n_reg)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
def test_w_basic():
    cluster_object = AZPReactiveTabu(max_iterations=max_it,
                                     k1=k1,
                                     k2=k2,
                                     random_state=0)
    cluster_object.fit_from_w(w, attr, n_regions=n_reg)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #31
0
def test_graph_dict_multi_attr():
    cluster_object = MaxPRegionsHeu(random_state=0)
    cluster_object.fit_from_networkx(graph,
                                     double_attr_dict,
                                     double_spatially_extensive_attr_dict,
                                     threshold=double_threshold)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #32
0
def test_dict():
    value_dict = dataframe_to_dict(gdf, attr_str)
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_dict(neighbors_dict, value_dict, n_regions=2)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #33
0
def test_geodataframe(method):
    cluster_object = PRegionsExact()
    cluster_object.fit_from_geodataframe(gdf,
                                         attr_str,
                                         n_regions=2,
                                         method=method)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #34
0
def test_dict_multi_attr(method):
    cluster_object = PRegionsExact()
    cluster_object.fit_from_dict(neighbors_dict,
                                 double_attr_dict,
                                 n_regions=2,
                                 method=method)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #35
0
def test_dict_multi_attr():
    cluster_object = MaxPRegionsExact()
    cluster_object.fit_from_dict(neighbors_dict,
                                 double_attr_dict,
                                 double_spatially_extensive_attr_dict,
                                 threshold=double_threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
def test_dict():
    value_dict = dataframe_to_dict(gdf, attr_str)
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_dict(neighbors_dict, value_dict, n_regions=2)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #37
0
def test_scipy_sparse_matrix_multi_attr(method):
    cluster_object = PRegionsExact()
    cluster_object.fit_from_scipy_sparse_matrix(adj,
                                                double_attr,
                                                n_regions=2,
                                                method=method)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
def test_graph_dict_multi_attr():
    cluster_object = AZPReactiveTabu(max_iterations=max_it,
                                     k1=k1,
                                     k2=k2,
                                     random_state=0)
    cluster_object.fit_from_networkx(graph, double_attr_dict, n_regions=n_reg)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #39
0
def test_w_basic():
    cluster_object = MaxPRegionsHeu(random_state=0)
    cluster_object.fit_from_w(w,
                              attr,
                              spatially_extensive_attr,
                              threshold=threshold)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #40
0
def test_geodataframe_multi_attr(method):
    cluster_object = PRegionsExact()
    cluster_object.fit_from_geodataframe(gdf,
                                         double_attr_str,
                                         n_regions=2,
                                         method=method)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
def test_graph_str_basic():
    nx.set_node_attributes(graph, attr_str, attr_dict)
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_networkx(graph, attr_str, n_regions=2)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #42
0
def test_dict_multi_attr():
    cluster_object = MaxPRegionsHeu(random_state=0)
    cluster_object.fit_from_dict(neighbors_dict,
                                 double_attr_dict,
                                 double_spatially_extensive_attr_dict,
                                 threshold=double_threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #43
0
def test_graph_str_basic():
    nx.set_node_attributes(graph, attr_dict, attr_str)
    cluster_object = AZPSimulatedAnnealing(init_temperature=1,
                                           max_iterations=2,
                                           random_state=0)
    cluster_object.fit_from_networkx(graph, attr_str, n_regions=2)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #44
0
def test_graph_dict_basic(method):
    cluster_object = PRegionsExact()
    cluster_object.fit_from_networkx(graph,
                                     attr_dict,
                                     n_regions=2,
                                     method=method)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #45
0
def test_geodataframe_multi_attr():
    cluster_object = MaxPRegionsExact()
    cluster_object.fit_from_geodataframe(gdf,
                                         [attr_str] * 2,
                                         [spatially_extensive_attr_str] * 2,
                                         threshold=double_threshold)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #46
0
def test_graph_dict_multi_attr():
    cluster_object = MaxPRegionsExact()
    cluster_object.fit_from_networkx(graph,
                                     double_attr_dict,
                                     double_spatially_extensive_attr_dict,
                                     threshold=double_threshold)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #47
0
def test_dict(method):
    value_dict = dataframe_to_dict(gdf, attr_str)
    cluster_object = PRegionsExact()
    cluster_object.fit_from_dict(neighbors_dict,
                                 value_dict,
                                 n_regions=2,
                                 method=method)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #48
0
def test_graph_str_basic():
    nx.set_node_attributes(graph, attr_str, attr_dict)
    nx.set_node_attributes(graph, spatially_extensive_attr_str,
                           spatially_extensive_attr_dict)
    cluster_object = MaxPRegionsHeu(random_state=0)
    cluster_object.fit_from_networkx(graph, attr_str,
                                     spatially_extensive_attr_str,
                                     threshold=threshold)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #49
0
def test_graph_str_multi_attr():
    nx.set_node_attributes(graph, attr_str, attr_dict)
    nx.set_node_attributes(graph, spatially_extensive_attr_str,
                           spatially_extensive_attr_dict)
    cluster_object = MaxPRegionsExact()
    cluster_object.fit_from_networkx(graph,
                                     [attr_str] * 2,
                                     [spatially_extensive_attr_str] * 2,
                                     threshold=double_threshold)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #50
0
def test_w_basic():
    cluster_object = MaxPRegionsExact()
    cluster_object.fit_from_w(w, attr, spatially_extensive_attr,
                              threshold=threshold)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
Exemple #51
0
def test_geodataframe_multi_attr(method):
    cluster_object = PRegionsExact()
    cluster_object.fit_from_geodataframe(gdf, double_attr_str, n_regions=2,
                                         method=method)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
Exemple #52
0
def test_dict_multi_attr(method):
    cluster_object = PRegionsExact()
    cluster_object.fit_from_dict(neighbors_dict, double_attr_dict, n_regions=2,
                                 method=method)
    obtained = region_list_from_array(cluster_object.labels_)
    compare_region_lists(obtained, optimal_clustering)
def test_graph_dict_multi_attr():
    cluster_object = AZPReactiveTabu(max_iterations=max_it, k1=k1, k2=k2,
                                     random_state=0)
    cluster_object.fit_from_networkx(graph, double_attr_dict, n_regions=n_reg)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
def test_w_basic():
    cluster_object = AZPReactiveTabu(max_iterations=max_it, k1=k1, k2=k2,
                                     random_state=0)
    cluster_object.fit_from_w(w, attr, n_regions=n_reg)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)