コード例 #1
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #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)
コード例 #3
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)
コード例 #4
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)
コード例 #5
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)
コード例 #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)
コード例 #7
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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #12
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #13
0
ファイル: test_heu.py プロジェクト: sm1992/region
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)
コード例 #14
0
ファイル: test_heu.py プロジェクト: knaaptime/region
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)
コード例 #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)
コード例 #16
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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #22
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #23
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #24
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #25
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #31
0
ファイル: test_heu.py プロジェクト: knaaptime/region
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)
コード例 #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)
コード例 #33
0
ファイル: test_exact.py プロジェクト: ljwolf/region
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)
コード例 #34
0
ファイル: test_exact.py プロジェクト: ljwolf/region
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)
コード例 #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)
コード例 #36
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)
コード例 #37
0
ファイル: test_exact.py プロジェクト: ljwolf/region
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)
コード例 #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)
コード例 #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)
コード例 #40
0
ファイル: test_exact.py プロジェクト: ljwolf/region
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)
コード例 #41
0
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)
コード例 #42
0
ファイル: test_heu.py プロジェクト: knaaptime/region
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)
コード例 #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)
コード例 #44
0
ファイル: test_exact.py プロジェクト: ljwolf/region
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)
コード例 #45
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #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)
コード例 #47
0
ファイル: test_exact.py プロジェクト: ljwolf/region
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)
コード例 #48
0
ファイル: test_heu.py プロジェクト: knaaptime/region
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)
コード例 #49
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #50
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #51
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #52
0
ファイル: test_exact.py プロジェクト: knaaptime/region
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)
コード例 #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)
コード例 #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)