Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (5.3%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: CentroGeo
  • License: apache-2.0
  • Language: Jupyter Notebook
  • Default Branch: master
  • Size: 10.6 MB
Statistics
  • Stars: 0
  • Watchers: 7
  • Forks: 2
  • Open Issues: 1
  • Releases: 0
Created over 4 years ago · Last pushed 11 months ago
Metadata Files
Readme Contributing License Citation

README.md

Hierarchical Geo Clustering

Install

The library uses the cgal library, if the library is use inside a conda enviroment the installation procedure should create the enviroment and install the cgal library using conda install -c conda-forge cgal.

To install the library can be simply:

pip install git+https://github.com/CentroGeo/HierarchicalGeoClustering.git

How to use

Build a TreeCluster

We can build a hierarchical geographical cluster, the TreeCluster class allows to create te structure and then populate it.

python HGC = TreeClusters(3, random_seed= 12)

python HGC.populate_tree(number_per_cluster=100)

python HGC.print_structure()

Root
Root    
 Root_l_0_n_0
    Root_l_0_n_0_l_1_n_0
       Root_l_0_n_0_l_1_n_0_l_2_n_0
       Root_l_0_n_0_l_1_n_0_l_2_n_1
       Root_l_0_n_0_l_1_n_0_l_2_n_2
       Root_l_0_n_0_l_1_n_0_l_2_n_3
       Root_l_0_n_0_l_1_n_0_l_2_n_4
    Root_l_0_n_0_l_1_n_1
        Root_l_0_n_0_l_1_n_1_l_2_n_0
        Root_l_0_n_0_l_1_n_1_l_2_n_1
 Root_l_0_n_1
    Root_l_0_n_1_l_1_n_0
       Root_l_0_n_1_l_1_n_0_l_2_n_0
    Root_l_0_n_1_l_1_n_1
       Root_l_0_n_1_l_1_n_1_l_2_n_0
       Root_l_0_n_1_l_1_n_1_l_2_n_1
       Root_l_0_n_1_l_1_n_1_l_2_n_2
    Root_l_0_n_1_l_1_n_2
    Root_l_0_n_1_l_1_n_3
       Root_l_0_n_1_l_1_n_3_l_2_n_0
       Root_l_0_n_1_l_1_n_3_l_2_n_1
    Root_l_0_n_1_l_1_n_4
        Root_l_0_n_1_l_1_n_4_l_2_n_0
        Root_l_0_n_1_l_1_n_4_l_2_n_1
        Root_l_0_n_1_l_1_n_4_l_2_n_2
 Root_l_0_n_2
     Root_l_0_n_2_l_1_n_0
        Root_l_0_n_2_l_1_n_0_l_2_n_0
        Root_l_0_n_2_l_1_n_0_l_2_n_1
     Root_l_0_n_2_l_1_n_1
        Root_l_0_n_2_l_1_n_1_l_2_n_0
        Root_l_0_n_2_l_1_n_1_l_2_n_1
        Root_l_0_n_2_l_1_n_1_l_2_n_2
        Root_l_0_n_2_l_1_n_1_l_2_n_3
        Root_l_0_n_2_l_1_n_1_l_2_n_4
     Root_l_0_n_2_l_1_n_2
        Root_l_0_n_2_l_1_n_2_l_2_n_0
        Root_l_0_n_2_l_1_n_2_l_2_n_1
        Root_l_0_n_2_l_1_n_2_l_2_n_2
     Root_l_0_n_2_l_1_n_3
         Root_l_0_n_2_l_1_n_3_l_2_n_0
         Root_l_0_n_2_l_1_n_3_l_2_n_1
         Root_l_0_n_2_l_1_n_3_l_2_n_2
         Root_l_0_n_2_l_1_n_3_l_2_n_3
         Root_l_0_n_2_l_1_n_3_l_2_n_4

python fig, axs = plt.subplots( figsize=(8,8)) HGC.visualize(axs, polygon=True)

python HGC.root.polygon_cluster

python HGC.get_deepth()

4

Extract the points and clusterize

To clusterize we extract the points and use the clusterize tool implemented in the Clustering module

python original_points= HGC.get_points_tree() X_2=np.array([[p.x,p.y] for p in original_points]) dic_points={'points':[X_2], 'parent':''}

python HGC_adapta_DBSCAN = recursive_clustering_tree(dic_points, levels_clustering = 3, algorithm = 'adaptative_DBSCAN' )

python fig, axs = plt.subplots( figsize=(8,8)) HGC_adapta_DBSCAN.visualize(axs, polygon=True)

Get the Similarity Shape Measurement

To obtain the SSM the clusters tree has to be used, this due to the use of the geometric shape in the metric. Therefore the polygons of each cluster on each level has to be able to compare.

``` python form_metric=[]

for l in range(0, 4): d = { 'Level': l,
'adaptive DBSCAN':SSM(HGC.levelsnodes[l], HGCadaptaDBSCAN.levelsnodes[l]) } form_metric.append(d) ```

python form_metric

[{'Level': 0, 'adaptive DBSCAN': 0.7963841965263598},
 {'Level': 1, 'adaptive DBSCAN': 0.5072991561547473},
 {'Level': 2, 'adaptive DBSCAN': 0.5257549553632676},
 {'Level': 3, 'adaptive DBSCAN': 0.3398000440017718}]

python df_metric_form = pd.DataFrame(form_metric)

python df_metric_form

| | Level | adaptive DBSCAN | |-----|-------|-----------------| | 0 | 0 | 0.796384 | | 1 | 1 | 0.507299 | | 2 | 2 | 0.525755 | | 3 | 3 | 0.339800 |

A detail documentation is available

Owner

  • Name: CentroGeo
  • Login: CentroGeo
  • Kind: organization
  • Email: pablo.lopez@centrogeo.edu.mx
  • Location: Mexico, DF

Repositorios para los investigadores del CentroGeo

GitHub Events

Total
  • Push event: 8
  • Pull request event: 1
Last Year
  • Push event: 8
  • Pull request event: 1

Issues and Pull Requests

Last synced: over 1 year ago


Dependencies

docker-compose.yml docker
setup.py pypi