raghav-khanna / Facility-Location-India

MIT License
1 stars 0 forks source link

[Vanilla Kmeans] Convert cmlbda output files to the suitable format for shape files #19

Open DarkMenacer opened 10 months ago

DarkMenacer commented 10 months ago

Description

The output files collected at CMLBDA lab are in the format

cluster_centers = 
[
[latitude of center 1, longitude of center 1],
[latitude of center 2, longitude of center 2],
...
]

clusters = 
[
[id's of districts in cluster 1],
[id's of districts in cluster 2],
...
]

To plot these results on a shapefile, It would be better if a dictionary can be created from this format. The desirable format would look something like:

{
[cluster 1 latitude, cluster 1 longitude] : [list of names of districts in cluster 1],
[cluster 2 latitude, cluster 2 longitude] : [list of names of districts in cluster 2],
...
}

To do

A code needs to be written to parse through the output files and convert this data into the desired format.

Examples

cluster_centers = [
[10, 100],
[20, 200]
]

clusters = [
[2, 4],
[1, 3],
]

converted to

{
[10, 100]: [Pune, Lucknow],
[20, 200]: [Jaipur, Bangalore]
}