This file contains 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
edge_dict = {} | |
edge_dict[names[0]] = languages1 | |
edge_dict[names[1]] = languages2 | |
edge_dict[names[2]] = languages2 | |
G=nx.from_dict_of_lists(edge_dict,create_using=nx.MultiDiGraph()) | |
plt.figure(figsize=(12,12)) | |
pos = nx.circular_layout(G) |
This file contains 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
import networkx as nx | |
edge_dict = {} | |
edge_dict['Mathew'] = languages_mathew | |
# create a directed-graph from a dataframe | |
G=nx.from_dict_of_lists(edge_dict,create_using=nx.MultiDiGraph()) | |
plt.figure(figsize=(12,12)) | |
pos = nx.spring_layout(G) | |
nx.draw(G, with_labels=True, node_color='skyblue', edge_cmap=plt.cm.Blues, pos = pos, node_size = 4500) | |
plt.show() |
This file contains 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
import docx2txt | |
def extract_programming_languages(file_name): | |
# read in word file | |
result = docx2txt.process(file_name) | |
programming_languages_pattern = re.search(r'Programming Languages:[A-Za-z,\s0-9]*\.',result) | |
print(programming_languages_pattern) | |
programming_languages_line = programming_languages_pattern.group(0) | |
languages = re.sub("Programming Languages: ","", programming_languages_line) |
This file contains 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
def distance_boxes (boxA, boxB): | |
import math | |
center_boxA = [(boxA[0] + boxA[2])/ 2.0, (boxA[1] + boxA[3])/2.0] | |
center_boxB = [(boxB[0] + boxB[2])/ 2.0, (boxB[1] + boxB[3])/2.0] | |
pixel_distance = math.sqrt( ((center_boxA[0]-center_boxB[0])**2)+((center_boxA[1]-center_boxB[1])**2) ) | |
return pixel_distance |
This file contains 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
class CustomDataset(utils.Dataset): | |
def load_custom(self, dataset_dir, subset): | |
"""Load a subset of the Balloon dataset. | |
dataset_dir: Root directory of the dataset. | |
subset: Subset to load: train or val | |
""" | |
# Add classes. We have only one class to add. | |
self.add_class("damage", 1, "damage") |
NewerOlder