Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 17
0
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)
Ejemplo n.º 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)
Ejemplo n.º 19
0
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 26
0
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)
Ejemplo n.º 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)
Ejemplo n.º 28
0
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)
Ejemplo n.º 29
0
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)
Ejemplo n.º 30
0
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 38
0
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 53
0
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)
Ejemplo n.º 54
0
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)