This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # calculates the transfers, 2 rounds | |
| # using weights from R | |
| import json | |
| import csv | |
| # read into data | |
| i = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # | |
| # | |
| import pickle | |
| import csv | |
| import json | |
| with open("responsesw", 'rb') as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //join election results with list of all stations and output lat,lng,results into json | |
| // we want to get such structure (similar): | |
| // {"name": "\u00dast\u00ed nad Labem-0", "winner": "Zeman", "coordinates": ["14.036975", "50.660316"], "id": "554804-0", "population": {"p9": "16025", "p6": "21011", etc. }, "party" : {"p1": "Úsvit", etc. }, "names": ["p1": "Talaš ..", etc.}}, | |
| $handle_results = fopen('zlin_stations.csv','r'); | |
| $handle_geo = fopen('okrsky_geo_adj.csv','r'); | |
| $handle_out = fopen('zlin.json','w'); | |
| // read results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //join election results with list of all stations and output lat,lng,results into json | |
| // we want to get such structure (similar): | |
| // {"name": "\u00dast\u00ed nad Labem-0", "winner": "Zeman", "coordinates": ["14.036975", "50.660316"], "id": "554804-0", "population": {"p9": "16025", "p6": "21011", etc. }, "party" : {"p1": "Úsvit", etc. }, "names": ["p1": "Talaš ..", etc.}}, | |
| $handle_results = fopen('zlin_stations.csv','r'); | |
| $handle_geo = fopen('okrsky_geo_adj.csv','r'); | |
| $handle_out = fopen('zlin.json','w'); | |
| // read results |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| # creates json for sankey from matrix row->column | |
| # 10 -> 3 | |
| import json | |
| import csv | |
| # read into data | |
| out = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import json | |
| import csv | |
| import string | |
| data = [] | |
| i = 0 | |
| with open("geocoded_adj.csv","r") as fin: | |
| finreader = csv.reader(fin,delimiter="\t") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name | S | A | D | F | group | white | |
|---|---|---|---|---|---|---|---|
| Person-1 | 5 | 15 | 50 | 95 | 3 | 0 | |
| Person-2 | 5 | 30 | 80 | 98 | 3 | 0 | |
| Person-3 | 2 | 20 | 50 | 90 | 3 | 0 | |
| Person-4 | 1 | 10 | 50 | 98 | 3 | 0 | |
| Person-5 | 12 | 24 | 78 | 95 | 3 | 0 | |
| Person-6 | 5 | 10 | 65 | 98 | 3 | 0 | |
| Person-7 | 1 | 12 | 65 | 97 | 3 | 0 | |
| Person-8 | 5 | 20 | 68.5 | 94 | 3 | 0 | |
| Person-9 | 10 | 20 | 50 | 90 | 3 | 0 |
Based on answers from http://VolebnaKalkulacka.sk
Values between 0 and 100.
Based on answers from http://VolebnaKalkulacka.sk using Weighted PCA method as described here: https://gist.github.com/michalskop/8514867
Cutting lines with loss function 0 (no errors, perfect cut) are shown.