예제 #1
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)
예제 #2
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)
예제 #3
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)
예제 #4
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)
예제 #5
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)
예제 #6
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)
예제 #7
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)
예제 #8
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)
예제 #9
0
파일: test_exact.py 프로젝트: ljwolf/region
def test_graph_str_multi_attr(method):
    nx.set_node_attributes(graph, attr_str, attr_dict)
    cluster_object = PRegionsExact()
    cluster_object.fit_from_networkx(graph,
                                     double_attr_str,
                                     n_regions=2,
                                     method=method)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
예제 #10
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)
예제 #11
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)
예제 #12
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)
예제 #13
0
def test_w_basic(method):
    cluster_object = PRegionsExact()
    cluster_object.fit_from_w(w, attr, n_regions=2, method=method)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
예제 #14
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)
예제 #15
0
def test_graph_dict_multi_attr(method):
    cluster_object = PRegionsExact()
    cluster_object.fit_from_networkx(graph, double_attr_dict, n_regions=2,
                                     method=method)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)
예제 #16
0
파일: test_exact.py 프로젝트: ljwolf/region
def test_w_basic(method):
    cluster_object = PRegionsExact()
    cluster_object.fit_from_w(w, attr, n_regions=2, method=method)
    result = region_list_from_array(cluster_object.labels_)
    compare_region_lists(result, optimal_clustering)