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
| while True: | |
| current_page +=1 | |
| #print("Retrieving urls...") | |
| #connect to the url and read all the infor | |
| res = session.get(url,verify=True) #get the url of the user | |
| data = get_shared_data(res) | |
| try: | |
| media = data['entry_data'][page_name][0][section_name]['media'] | |
| media_info = data['entry_data'][page_name][0][section_name]['media']["nodes"] | |
| count_photos = 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
| https://gist.github.com/Steboss/34d109ba95b63062e69bdab58ad806cf |
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
| https://github.com/Steboss/lovInstagram/blob/master/politics_rev1.1/berlusconi/test/basic_dict/classifier.py#L22:L26 |
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
| positive_feature = [ (format_sentence(pos_term),"pos") for pos_term in pos] | |
| negative_feature = [ (format_sentence(neg_term),"neg") for neg_term in neg] | |
| train_test = positive_feature + negative_feature | |
| classifier = NaiveBayesClassifier.train(train_test) |
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
| #Training part | |
| training = pos[:int((.5)*len(pos))] + neg[:int((.5)*len(neg))] | |
| #this cryptic way to write it's just to select the last half part of the | |
| #data set (above) | |
| #and the first half dataset (below) | |
| test = pos[int((.5)*len(pos)):] + neg[int((.5)*len(neg)):] | |
| counter = 0 | |
| test_dataset = [] | |
| with open("basic_positive.csv","r") as reader: |
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
| , Silvio Berlusconi, Matteo Salvini, Matteo Renzi, Luigi Di Maio | |
| Precision, 0.96, 0.88, 0.95, 0.86 | |
| Recall, 0.85, 0.83, 0.86, 0.91 | |
| F1 score,0.90, 0.86, 0.90, 0.88 |
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
| Silvio Berlusconi | Matteo Salvini | Matteo Renzi | Luigi Di Maio | ||
|---|---|---|---|---|---|
| Precision | 0.96 | 0.88 | 0.95 | 0.86 | |
| Recall | 0.85 | 0.83 | 0.86 | 0.91 | |
| F1 score | 0.90 | 0.86 | 0.90 | 0.88 |
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
| Candidate | Total Number of Comments | Total Number of Likes | |
|---|---|---|---|
| Silvio Berlusconi | 4324 | 359'279 | |
| Matteo Salvini | 5397 | 995'240 | |
| Matteo Renzi | 1794 | 264'722 | |
| Luigi Di Maio | 7303 | 820'654 |
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
| def in_boxes(boxes, points): | |
| # (N, 4, 2) = boxes.shape | |
| # (M, 2) = points.shape | |
| w = np.zeros(points.shape[0]) | |
| start = time.time() | |
| for (i, point) in enumerate(points): | |
| in_box = False | |
| for box in boxes: | |
| (A, B, C, D) = box | |
| AP = (point - A) |
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
| int in_rect(double *boxes, int n_boxes,int n_boxes_coords, double *points, int n_points) | |
| { | |
| int counter = 0 ; | |
| int i,j,k; | |
| /* | |
| Here we could cycle through the first box, retrieve the coords of Axy,B,C,D | |
| into arrays or one array? | |
| then cycle through th epoints and compute Ax - pointX, Ay - pointY | |
| */ |
OlderNewer