automatic benchmarkig (finally)

main
Luca Lombardo 3 years ago
parent 15ac496925
commit 6c5b8295ca

@ -1,4 +1,5 @@
#!/usr/bin/env python3
import argparse
import gzip
import requests
import pandas as pd
@ -6,7 +7,11 @@ import numpy as np
import os
import csv
MIN_MOVIES = 70 # Only keep relations for actors that have made more than this many movies
# MIN_MOVIES = 5 # Only keep relations for actors that have made more than this many movies
parser = argparse.ArgumentParser()
parser.add_argument("--min-movies", type=int, required=True)
args = parser.parse_args()
#-----------------DOWNLOAD .GZ FILES FROM IMDB DATABASE-----------------#
def colored(r, g, b, text):
@ -66,7 +71,7 @@ df_relazioni = pd.read_csv(
df_relazioni.query('(category == "actor" or category == "actress") and tconst in @filtered_tconsts', inplace=True)
# Returns an array of unique actor ids (nconsts) and an array of how many times they appear (counts) => the number of movies they appear in
nconsts, counts = np.unique(df_relazioni["nconst"].to_numpy(), return_counts=True)
filtered_nconsts = nconsts[counts>=MIN_MOVIES]
filtered_nconsts = nconsts[counts>=args.min_movies]
df_relazioni.query("nconst in @filtered_nconsts", inplace=True)
# Now select only films and actors that have at lest a relation

@ -0,0 +1,16 @@
#!/bin/bash
cd "$(dirname "$(realpath "$0")")"
for minmovies in 50 60 70
do
echo "##### STARTING FILTERING FOR MIN_MOVIES=$minmovies #####"
cd ../../filters
./actors_graph_filter.py --min-movies $minmovies
echo "##### STARTING TOP-K CLOSENESS COMPUTATION FOR THE ACTORS GRAPH WITH MIN_MOVIES=$minmovies #####"
cd ../scripts/
/usr/bin/time -o actor_bench/time/top_actors_${minmovies}_time.log ./actors_graph actor_bench/top_actors_${minmovies}
cd actor_bench
# echo "##### DONE...\n #####"
done

@ -0,0 +1,100 @@
489 Christopher Lee 0.36884
1725 Omar Sharif 0.366906
626259 Franco Nero 0.364897
323 Michael Caine 0.357953
106387 Rossano Brazzi 0.353559
1884 Max von Sydow 0.351983
1626 Christopher Plummer 0.350356
6573 Philippe Leroy 0.349139
308 Ernest Borgnine 0.348303
1036 Geraldine Chaplin 0.347625
7042 Herbert Lom 0.347275
302 Jacqueline Bisset 0.347166
722636 John Rhys-Davies 0.346818
1012 Claudia Cardinale 0.346405
1424 Udo Kier 0.345885
1016 David Carradine 0.345647
172 Harvey Keitel 0.345453
1868 Michael York 0.345388
53 Robert Mitchum 0.345237
728 Mario Adorf 0.344742
2145 Trevor Howard 0.344699
1934 Kabir Bedi 0.344035
51 James Mason 0.343586
125 Sean Connery 0.343564
312575 Giuliano Gemma 0.343074
1657 Oliver Reed 0.342883
1698 John Savage 0.342628
514059 Virna Lisi 0.341781
442 Rutger Hauer 0.341338
564 Peter O'Toole 0.340036
24 John Gielgud 0.339744
554 Sam Neill 0.339619
1262 Ben Gazzara 0.339327
140649 Mathieu Carrière 0.339202
454 Dennis Hopper 0.338475
367 Gérard Depardieu 0.338041
1768 Rod Steiger 0.337958
63 Anthony Quinn 0.337876
1426 Ben Kingsley 0.337834
1703 Maximilian Schell 0.337814
603402 Jeanne Moreau 0.337814
681566 Michel Piccoli 0.337669
603 Vanessa Redgrave 0.337011
18 Kirk Douglas 0.336847
800 Armand Assante 0.336703
919 Senta Berger 0.336498
616 Eric Roberts 0.336416
908919 Eli Wallach 0.336334
1811 Peter Ustinov 0.336273
627 Greta Scacchi 0.336171
514 Michael Madsen 0.336089
1638 Jürgen Prochnow 0.335987
148041 Adolfo Celi 0.335763
842 Martin Balsam 0.335681
1285 Elliott Gould 0.335457
362735 Robert Hardy 0.335173
59 Laurence Olivier 0.335051
601377 Fabio Testi 0.335051
40545 Féodor Atkine 0.334949
5078 Stacy Keach 0.334888
366 Catherine Deneuve 0.334726
1159 Faye Dunaway 0.334584
1954 Claire Bloom 0.334564
348 Tony Curtis 0.334544
1128 Alain Delon 0.334544
4486 Bruno Ganz 0.334463
432007 Curd Jürgens 0.334402
1417 Brian Keith 0.334281
1673 Jason Robards 0.334241
78 John Wayne 0.334059
457 John Hurt 0.333998
1648 Charlotte Rampling 0.333837
661 Donald Sutherland 0.333535
4051 Brian Cox 0.333535
483 Christopher Lambert 0.333254
670964 Raymond Pellegrin 0.333153
587 Donald Pleasence 0.333093
734 Eddie Albert 0.332893
1428 Klaus Kinski 0.332792
32 Charlton Heston 0.332512
112 Pierce Brosnan 0.332472
47 Sophia Loren 0.332432
1421 George Kennedy 0.332352
948772 Susannah York 0.332352
2094 Vittorio Gassman 0.332253
34 William Holden 0.332113
768334 John Saxon 0.332073
473228 Hardy Krüger 0.331794
6762 Saeed Jaffrey 0.331635
721073 Fernando Rey 0.331575
1229 Glenn Ford 0.331297
148 Harrison Ford 0.331257
1072 Joseph Cotten 0.331218
660327 Irene Papas 0.331178
420 Valeria Golino 0.331079
2072 Mel Ferrer 0.330901
404 Jane Fonda 0.330881
57 David Niven 0.330821
44 Burt Lancaster 0.330821
181305 Valentina Cortese 0.330663

@ -0,0 +1,100 @@
489 Christopher Lee 2207.68
626259 Franco Nero 2190.57
1725 Omar Sharif 2184.83
323 Michael Caine 2140.3
106387 Rossano Brazzi 2121.77
1884 Max von Sydow 2115.4
1626 Christopher Plummer 2114.6
728 Mario Adorf 2097.13
1036 Geraldine Chaplin 2093.43
1012 Claudia Cardinale 2089.2
308 Ernest Borgnine 2088.98
1934 Kabir Bedi 2086.43
7042 Herbert Lom 2081.48
51 James Mason 2080.62
53 Robert Mitchum 2080.42
302 Jacqueline Bisset 2079.78
1424 Udo Kier 2077.98
1868 Michael York 2076.87
2145 Trevor Howard 2071.6
172 Harvey Keitel 2069.92
6573 Philippe Leroy 2062.48
1016 David Carradine 2061.68
367 Gérard Depardieu 2059.72
681566 Michel Piccoli 2055.93
312575 Giuliano Gemma 2055.85
63 Anthony Quinn 2054.7
722636 John Rhys-Davies 2049.67
1703 Maximilian Schell 2049.58
514059 Virna Lisi 2049.12
1698 John Savage 2049.02
1657 Oliver Reed 2046.18
140649 Mathieu Carrière 2046.07
454 Dennis Hopper 2046.05
616 Eric Roberts 2044.83
1768 Rod Steiger 2044.3
919 Senta Berger 2042.07
564 Peter O'Toole 2041.05
125 Sean Connery 2039.8
603402 Jeanne Moreau 2039.27
1262 Ben Gazzara 2039.15
442 Rutger Hauer 2039.02
432007 Curd Jürgens 2035.47
554 Sam Neill 2031.75
24 John Gielgud 2031.38
603 Vanessa Redgrave 2029.38
366 Catherine Deneuve 2027.55
18 Kirk Douglas 2026.52
1638 Jürgen Prochnow 2024.43
1426 Ben Kingsley 2023.53
78 John Wayne 2022.88
908919 Eli Wallach 2022.88
721073 Fernando Rey 2022.72
800 Armand Assante 2021.68
4486 Bruno Ganz 2018.93
601377 Fabio Testi 2016.22
52 Marcello Mastroianni 2014.82
1128 Alain Delon 2014.03
2094 Vittorio Gassman 2013.97
627 Greta Scacchi 2013.8
587 Donald Pleasence 2013.68
1673 Jason Robards 2013.68
1811 Peter Ustinov 2013.18
1159 Faye Dunaway 2012.85
59 Laurence Olivier 2011.62
320760 Annie Girardot 2009.32
661 Donald Sutherland 2008.93
734 Eddie Albert 2008.85
1417 Brian Keith 2008.3
47 Sophia Loren 2007.97
1648 Charlotte Rampling 2007.92
5078 Stacy Keach 2007.62
32 Charlton Heston 2007.45
704719 Francisco Rabal 2007.12
348 Tony Curtis 2006.8
842 Martin Balsam 2006.52
483 Christopher Lambert 2005.17
1229 Glenn Ford 2004.83
670964 Raymond Pellegrin 2004.4
514 Michael Madsen 2004.4
1954 Claire Bloom 2003.9
6762 Saeed Jaffrey 2003.22
1285 Elliott Gould 2001.4
40545 Féodor Atkine 2000.97
44 Burt Lancaster 2000.55
1922 Jean-Pierre Aumont 1999.3
813961 Elke Sommer 1998.88
457 John Hurt 1998.47
1428 Klaus Kinski 1998.25
473228 Hardy Krüger 1998.05
57 David Niven 1997.4
768334 John Saxon 1993.6
660327 Irene Papas 1992.73
181305 Valentina Cortese 1992.27
532 Malcolm McDowell 1991.62
2072 Mel Ferrer 1991.2
164 Anthony Hopkins 1990.75
1588 Jack Palance 1990.27
1421 George Kennedy 1987.92
1682 Mickey Rooney 1987.43
316284 Giancarlo Giannini 1986.93

@ -0,0 +1,100 @@
1725 Omar Sharif 0.368023
489 Christopher Lee 0.364781
626259 Franco Nero 0.360217
106387 Rossano Brazzi 0.352027
1884 Max von Sydow 0.347446
323 Michael Caine 0.347381
7042 Herbert Lom 0.345492
6573 Philippe Leroy 0.344684
1012 Claudia Cardinale 0.343431
308 Ernest Borgnine 0.34308
1868 Michael York 0.342315
1934 Kabir Bedi 0.342219
1626 Christopher Plummer 0.341807
1657 Oliver Reed 0.340354
1424 Udo Kier 0.33979
2145 Trevor Howard 0.339633
302 Jacqueline Bisset 0.338634
722636 John Rhys-Davies 0.338634
1698 John Savage 0.338572
1016 David Carradine 0.338541
1036 Geraldine Chaplin 0.338417
125 Sean Connery 0.338106
53 Robert Mitchum 0.337453
514059 Virna Lisi 0.337332
728 Mario Adorf 0.336439
1262 Ben Gazzara 0.336378
442 Rutger Hauer 0.336347
172 Harvey Keitel 0.33604
312575 Giuliano Gemma 0.335154
51 James Mason 0.334605
554 Sam Neill 0.33409
1426 Ben Kingsley 0.333848
919 Senta Berger 0.333335
24 John Gielgud 0.333094
842 Martin Balsam 0.332883
908919 Eli Wallach 0.332823
1811 Peter Ustinov 0.332733
454 Dennis Hopper 0.332673
514 Michael Madsen 0.332523
601377 Fabio Testi 0.332313
140649 Mathieu Carrière 0.331984
148041 Adolfo Celi 0.331446
800 Armand Assante 0.331386
1285 Elliott Gould 0.331178
6762 Saeed Jaffrey 0.331089
616 Eric Roberts 0.330881
40545 Féodor Atkine 0.330613
564 Peter O'Toole 0.330495
1638 Jürgen Prochnow 0.330228
367 Gérard Depardieu 0.33014
1954 Claire Bloom 0.33008
1703 Maximilian Schell 0.329814
4051 Brian Cox 0.329696
681566 Michel Piccoli 0.329549
348 Tony Curtis 0.329402
1768 Rod Steiger 0.329343
366 Catherine Deneuve 0.329255
603402 Jeanne Moreau 0.328931
78 John Wayne 0.328873
483 Christopher Lambert 0.328843
63 Anthony Quinn 0.328785
670964 Raymond Pellegrin 0.328785
2094 Vittorio Gassman 0.328521
734 Eddie Albert 0.328404
59 Laurence Olivier 0.328228
34 William Holden 0.32814
4486 Bruno Ganz 0.32814
768334 John Saxon 0.32814
1421 George Kennedy 0.328082
18 Kirk Douglas 0.327939
432007 Curd Jürgens 0.327849
47 Sophia Loren 0.32779
457 John Hurt 0.327761
1417 Brian Keith 0.327761
1159 Faye Dunaway 0.327295
32 Charlton Heston 0.32715
1648 Charlotte Rampling 0.326657
1072 Joseph Cotten 0.32657
2011 Lee J. Cobb 0.326397
1428 Klaus Kinski 0.326165
587 Donald Pleasence 0.326137
908914 Dee Wallace 0.326137
44 Burt Lancaster 0.325963
1745 Stellan Skarsgård 0.325906
1673 Jason Robards 0.325848
320760 Annie Girardot 0.325618
721073 Fernando Rey 0.32556
661 Donald Sutherland 0.325417
813961 Elke Sommer 0.325417
704719 Francisco Rabal 0.324671
603 Vanessa Redgrave 0.324614
181305 Valentina Cortese 0.324557
874 Steven Bauer 0.324471
1128 Alain Delon 0.324357
420 Valeria Golino 0.324157
5078 Stacy Keach 0.324043
164 Anthony Hopkins 0.323815
722 Joss Ackland 0.323787
356847 Günther Maria Halmer 0.323361
1229 Glenn Ford 0.322681

@ -0,0 +1,100 @@
1725 Omar Sharif 1469.67
489 Christopher Lee 1464.92
626259 Franco Nero 1447.92
106387 Rossano Brazzi 1411.77
1934 Kabir Bedi 1401.9
1884 Max von Sydow 1400.72
323 Michael Caine 1394.52
1012 Claudia Cardinale 1389.15
7042 Herbert Lom 1386.82
1626 Christopher Plummer 1384.08
308 Ernest Borgnine 1381.25
1868 Michael York 1377.88
728 Mario Adorf 1372.3
1036 Geraldine Chaplin 1367.33
2145 Trevor Howard 1366.02
1424 Udo Kier 1365.53
302 Jacqueline Bisset 1364.65
53 Robert Mitchum 1364.38
6573 Philippe Leroy 1363.08
1657 Oliver Reed 1360.68
51 James Mason 1360.47
919 Senta Berger 1356.15
1016 David Carradine 1355.28
1698 John Savage 1354.75
6762 Saeed Jaffrey 1352.98
514059 Virna Lisi 1352.28
1262 Ben Gazzara 1350.15
616 Eric Roberts 1349.78
172 Harvey Keitel 1349.63
367 Gérard Depardieu 1347.53
454 Dennis Hopper 1346.4
681566 Michel Piccoli 1343.65
442 Rutger Hauer 1343.62
312575 Giuliano Gemma 1342.67
908919 Eli Wallach 1342.17
140649 Mathieu Carrière 1341.77
125 Sean Connery 1341.68
1703 Maximilian Schell 1341.5
24 John Gielgud 1341.02
722636 John Rhys-Davies 1338.68
601377 Fabio Testi 1338.1
432007 Curd Jürgens 1336.45
1811 Peter Ustinov 1336.25
554 Sam Neill 1335.88
2094 Vittorio Gassman 1335.57
603402 Jeanne Moreau 1335.45
78 John Wayne 1335.13
1426 Ben Kingsley 1334.5
366 Catherine Deneuve 1334.47
63 Anthony Quinn 1334.43
1768 Rod Steiger 1334.37
1638 Jürgen Prochnow 1332.28
514 Michael Madsen 1331.73
800 Armand Assante 1330.53
842 Martin Balsam 1330.18
721073 Fernando Rey 1329.52
734 Eddie Albert 1328.18
320760 Annie Girardot 1327.87
564 Peter O'Toole 1327.13
4486 Bruno Ganz 1326.4
756378 Parikshit Sahni 1324.88
18 Kirk Douglas 1324.8
32 Charlton Heston 1324.72
1954 Claire Bloom 1324.1
40545 Féodor Atkine 1324.03
1285 Elliott Gould 1323.13
670964 Raymond Pellegrin 1323.13
483 Christopher Lambert 1322.98
44 Burt Lancaster 1322.72
47 Sophia Loren 1322.57
587 Donald Pleasence 1322.32
1159 Faye Dunaway 1321.95
1421 George Kennedy 1319.9
1417 Brian Keith 1319.28
768334 John Saxon 1318.37
704719 Francisco Rabal 1318.07
348 Tony Curtis 1316.77
813961 Elke Sommer 1316.28
1673 Jason Robards 1315.48
1648 Charlotte Rampling 1315.33
59 Laurence Olivier 1314.58
1128 Alain Delon 1313.47
34 William Holden 1312.67
457 John Hurt 1312.53
1072 Joseph Cotten 1311
2011 Lee J. Cobb 1310.9
148041 Adolfo Celi 1310.9
1229 Glenn Ford 1310.43
4051 Brian Cox 1310.07
181305 Valentina Cortese 1310
661 Donald Sutherland 1307.88
634159 Philippe Noiret 1307.28
603 Vanessa Redgrave 1307.22
52 Marcello Mastroianni 1305.98
1588 Jack Palance 1305.75
770730 Maria Schell 1305.25
1428 Klaus Kinski 1305.25
5078 Stacy Keach 1303.47
57 David Niven 1302.37
356847 Günther Maria Halmer 1301.05

Binary file not shown.

@ -33,6 +33,8 @@ int MAX_ACTOR_ID = -1; // Here DataRead() puts the larges actor_id loaded from A
const int N_THREADS = 12; // Number of threads to use for some functions
string outputFn;
void DataRead()
{
ifstream actors("../data/data_actor_graph/Attori.txt"); // read the file
@ -224,7 +226,7 @@ vector<pair<int, double>> closeness(const size_t k) {
// Waiting for all threads to finish
thread.join();
ofstream output_file("actor_bench/top_actors_c_70.txt");
ofstream output_file(outputFn + "_c.txt");
for (const auto& [actor_id, farness] : top_actors) {
output_file << actor_id << "\t" << A[actor_id].name << "\t" << 1.0/farness << endl;
}
@ -315,7 +317,7 @@ vector<pair<int, double>> harmonic(const size_t k) { //
for (auto& thread : threads)
thread.join();
ofstream output_file("actor_bench/top_actors_h_70.txt");
ofstream output_file(outputFn + "_h.txt");
for (const auto& [actor_id, harmonic] : top_actors) {
output_file << actor_id << "\t" << A[actor_id].name << "\t" << harmonic << endl;
}
@ -325,8 +327,14 @@ vector<pair<int, double>> harmonic(const size_t k) { //
}
int main()
int main(int argc, char* argv[])
{
if (argc != 2) {
cout << "Usage: " << argv[0] << " OUTPUT_FILE_NAME" << endl;
exit(1);
}
outputFn = argv[1];
srand(time(NULL));
DataRead();

Binary file not shown.
Loading…
Cancel
Save