Skip to content

Instantly share code, notes, and snippets.

View jinglescode's full-sized avatar
🎯
stay focus

Hong Jing (Jingles) jinglescode

🎯
stay focus
View GitHub Profile
places = []
with open(kml_filename, "r") as file:
content = file.readlines()
content = "".join(content)
bs_content = BeautifulSoup(content, "xml")
placemarks = bs_content.findAll('Placemark')
for placemark in placemarks:
@jinglescode
jinglescode / article-plan-your-perfect-holiday.ipynb
Created March 6, 2020 13:44
Article-Plan your perfect holiday.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
starting_point = 2 #@param {type:"integer"}
cur_index = starting_point
seq = [cur_index]
while len(seq) < len(list(df_distance_matrix.keys())):
nearest_clusters = list(df_distance_matrix[cur_index].sort_values().index)
for cluster_id in nearest_clusters:
if cluster_id != cur_index and cluster_id not in seq:
seq.append(cluster_id)
cur_index = cluster_id
from scipy.spatial.distance import cdist
distance_matrix = cdist(
mean_lat_long_by_group.values,
mean_lat_long_by_group.values
)
df_distance_matrix = pd.DataFrame(distance_matrix)
df_distance_matrix
Name Latitude Longitude Cluster Day
Athens International Airport 37.9356467 23.9484156 2 1
Acropolis of Athens 37.9715323 23.7257492 2 1
Pl. Agias Irinis 2 37.977418 23.7280221 2 1
Diporto - Secret underground restaurant 37.9806622 23.7257688 2 1
Temple of Zeus 37.9692838 23.7331012 2 1
Plaka 37.9725529 23.7303363999999 2 1
Temple of Olympian Zeus 37.9693 23.7331 2 1
Lake Vouliagmeni 37.8078002 23.7855018 2 1
0 1 2 3 4 5 6 7 8 9 10 11
0 0.000000 11.987656 9.896897 11.599586 10.742770 0.386050 12.197858 11.100726 0.249281 12.021981 12.517198 11.246962
1 11.987656 0.000000 2.276986 1.396634 2.084259 11.607277 1.117249 1.660945 11.797155 1.488543 1.208088 1.837654
2 9.896897 2.276986 0.000000 2.706433 2.515520 9.523493 2.987206 2.456373 9.720741 3.096684 3.240456 2.751974
3 11.599586 1.396634 2.706433 0.000000 0.935321 11.214140 0.658161 0.507003 11.391950 0.439252 0.966409 0.500744
4 10.742770 2.084259 2.515520 0.935321 0.000000 10.356811 1.593083 0.454365 10.530636 1.306551 1.900750 0.504926
5 0.386050 11.607277 9.523493 11.214140 10.356811 0.000000 11.813022 10.715118 0.211347 11.636331 12.132428 10.861026
6 12.197858 1.117249 2.987206 0.658161 1.593083 11.813022 0.000000 1.155043 11.993443 0.439558 0.320395 1.143226
7 11.100726 1.660945 2.456373 0.507003 0.454365 10.715118 1.155043 0.000000 10.892023 0.921615 1.469345 0.297166
Cluster Latitude Longitude
0 40.846395 14.281423
1 36.411881 25.418702
2 37.958535 23.747617
3 35.359073 24.500997
4 35.449291 23.570038
5 40.645347 14.610990
6 35.325403 25.158296
7 35.517232 24.019294
Name Latitude Longitude
Athens International Airport 37.9356467 23.9484156
Ancient Agora of Athens 37.9746507 23.7219716
Tzistarakis Mosque 37.9759204 23
Roman Forum 37.9743749 23.7255435
Theatre of Dionysus 37.9703658 23.7278553
Parthenon 37.9715285 23.7267166
Acropolis Museum 37.9684499 23.7285227
Temple of Olympian Zeus 37.9693 23
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import torch
import torch.nn as nn
class conv_block(nn.Module):
def __init__(self, in_ch, out_ch):
super(conv_block, self).__init__()
self.conv = nn.Sequential(
nn.Conv2d(in_ch, out_ch, kernel_size=3, stride=1, padding=1, bias=True),
nn.BatchNorm2d(out_ch),