projectlosangeles commited on
Commit
fa01540
1 Parent(s): e1f3013

Upload 9 files

Browse files
Los_Angeles_MIDI_Dataset_Search_and_Explore.ipynb CHANGED
@@ -1197,7 +1197,11 @@
1197
  "\n",
1198
  " same_pitches = set([T[0] for T in trimmed_p_counts]) & set([m[0] for m in trimmed_pitches_counts])\n",
1199
  " num_same_pitches = len(same_pitches)\n",
1200
- " same_pitches_ratio = (num_same_pitches / len(set([m[0] for m in trimmed_p_counts]+[T[0] for T in trimmed_pitches_counts])))\n",
 
 
 
 
1201
  "\n",
1202
  " if skip_exact_matches:\n",
1203
  " if same_pitches_ratio == 1:\n",
@@ -1390,8 +1394,12 @@
1390
  " trimmed_chords_counts = [y for y in ms_chords_counts if y[1] >= (max_chords_count * chords_counts_cutoff_threshold_ratio)] \n",
1391
  "\n",
1392
  " num_same_chords = len(set([tuple(T[0]) for T in trimmed_c_counts]) & set([tuple(t[0]) for t in trimmed_chords_counts]))\n",
1393
- " same_chords_ratio = (num_same_chords / len(set(tuple(x[0]) for x in [trimmed_c_counts+trimmed_chords_counts][0])))\n",
1394
- "\n",
 
 
 
 
1395
  " if skip_exact_matches:\n",
1396
  " if same_chords_ratio == 1:\n",
1397
  " same_chords_ratio = 0\n",
@@ -1516,7 +1524,12 @@
1516
  " num_same_patches = len(set(p_list) & set(patches_list))\n",
1517
  " \n",
1518
  " if len(set(p_list + patches_list)) > 0:\n",
1519
- " same_patches_ratio = num_same_patches / len(set(p_list + patches_list))\n",
 
 
 
 
 
1520
  " else:\n",
1521
  " same_patches_ratio = 0\n",
1522
  "\n",
 
1197
  "\n",
1198
  " same_pitches = set([T[0] for T in trimmed_p_counts]) & set([m[0] for m in trimmed_pitches_counts])\n",
1199
  " num_same_pitches = len(same_pitches)\n",
1200
+ " \n",
1201
+ " if num_same_pitches == len(trimmed_pitches_counts):\n",
1202
+ " same_pitches_ratio = (num_same_pitches / len(trimmed_p_counts))\n",
1203
+ " else:\n",
1204
+ " same_pitches_ratio = (num_same_pitches / max(len(trimmed_p_counts), len(trimmed_pitches_counts)))\n",
1205
  "\n",
1206
  " if skip_exact_matches:\n",
1207
  " if same_pitches_ratio == 1:\n",
 
1394
  " trimmed_chords_counts = [y for y in ms_chords_counts if y[1] >= (max_chords_count * chords_counts_cutoff_threshold_ratio)] \n",
1395
  "\n",
1396
  " num_same_chords = len(set([tuple(T[0]) for T in trimmed_c_counts]) & set([tuple(t[0]) for t in trimmed_chords_counts]))\n",
1397
+ " \n",
1398
+ " if num_same_chords == len(trimmed_chords_counts):\n",
1399
+ " same_chords_ratio = (num_same_chords / len(trimmed_c_counts))\n",
1400
+ " else:\n",
1401
+ " same_chords_ratio = (num_same_chords / max(len(trimmed_c_counts), len(trimmed_chords_counts)))\n",
1402
+ " \n",
1403
  " if skip_exact_matches:\n",
1404
  " if same_chords_ratio == 1:\n",
1405
  " same_chords_ratio = 0\n",
 
1524
  " num_same_patches = len(set(p_list) & set(patches_list))\n",
1525
  " \n",
1526
  " if len(set(p_list + patches_list)) > 0:\n",
1527
+ " \n",
1528
+ " if num_same_patches == len(patches_list):\n",
1529
+ " same_patches_ratio = num_same_patches / len(p_list)\n",
1530
+ " else:\n",
1531
+ " same_patches_ratio = num_same_patches / max(len(p_list), len(patches_list))\n",
1532
+ " \n",
1533
  " else:\n",
1534
  " same_patches_ratio = 0\n",
1535
  "\n",
Master_MIDI_Dataset_Search_and_Filter.ipynb CHANGED
@@ -254,7 +254,7 @@
254
  "\n",
255
  "pitches_counts_cutoff_threshold_ratio = 0 #@param {type:\"slider\", min:0, max:1, step:0.05}\n",
256
  "search_transposed_pitches = False #@param {type:\"boolean\"}\n",
257
- "skip_exact_matches = True #@param {type:\"boolean\"}\n",
258
  "\n",
259
  "#@markdown Additional search options\n",
260
  "\n",
@@ -579,8 +579,12 @@
579
  "\n",
580
  " same_pitches = set([T[0] for T in trimmed_p_counts]) & set([m[0] for m in trimmed_pitches_counts])\n",
581
  " num_same_pitches = len(same_pitches)\n",
582
- " same_pitches_ratio = (num_same_pitches / len(set([m[0] for m in trimmed_p_counts]+[T[0] for T in trimmed_pitches_counts])))\n",
583
- "\n",
 
 
 
 
584
  " if skip_exact_matches:\n",
585
  " if same_pitches_ratio == 1:\n",
586
  " same_pitches_ratio = 0\n",
@@ -650,7 +654,7 @@
650
  "\n",
651
  " print('-' * 70)\n",
652
  "\n",
653
- " max_ratios = sorted(final_ratios, reverse=True)[:number_of_top_ratios_MIDIs_to_collect]\n",
654
  "\n",
655
  " print('Max match ratio', max_ratios[0])\n",
656
  " print('-' * 70)\n",
 
254
  "\n",
255
  "pitches_counts_cutoff_threshold_ratio = 0 #@param {type:\"slider\", min:0, max:1, step:0.05}\n",
256
  "search_transposed_pitches = False #@param {type:\"boolean\"}\n",
257
+ "skip_exact_matches = False #@param {type:\"boolean\"}\n",
258
  "\n",
259
  "#@markdown Additional search options\n",
260
  "\n",
 
579
  "\n",
580
  " same_pitches = set([T[0] for T in trimmed_p_counts]) & set([m[0] for m in trimmed_pitches_counts])\n",
581
  " num_same_pitches = len(same_pitches)\n",
582
+ " \n",
583
+ " if num_same_pitches == len(trimmed_pitches_counts):\n",
584
+ " same_pitches_ratio = (num_same_pitches / len(trimmed_p_counts))\n",
585
+ " else:\n",
586
+ " same_pitches_ratio = (num_same_pitches / max(len(trimmed_p_counts), len(trimmed_pitches_counts)))\n",
587
+ " \n",
588
  " if skip_exact_matches:\n",
589
  " if same_pitches_ratio == 1:\n",
590
  " same_pitches_ratio = 0\n",
 
654
  "\n",
655
  " print('-' * 70)\n",
656
  "\n",
657
+ " max_ratios = sorted(set(final_ratios), reverse=True)[:number_of_top_ratios_MIDIs_to_collect]\n",
658
  "\n",
659
  " print('Max match ratio', max_ratios[0])\n",
660
  " print('-' * 70)\n",
los_angeles_midi_dataset_search_and_explore.py CHANGED
@@ -1024,7 +1024,11 @@ for d in tqdm(meta_data):
1024
 
1025
  same_pitches = set([T[0] for T in trimmed_p_counts]) & set([m[0] for m in trimmed_pitches_counts])
1026
  num_same_pitches = len(same_pitches)
1027
- same_pitches_ratio = (num_same_pitches / len(set([m[0] for m in trimmed_p_counts]+[T[0] for T in trimmed_pitches_counts])))
 
 
 
 
1028
 
1029
  if skip_exact_matches:
1030
  if same_pitches_ratio == 1:
@@ -1207,8 +1211,12 @@ for d in tqdm(meta_data):
1207
  trimmed_chords_counts = [y for y in ms_chords_counts if y[1] >= (max_chords_count * chords_counts_cutoff_threshold_ratio)]
1208
 
1209
  num_same_chords = len(set([tuple(T[0]) for T in trimmed_c_counts]) & set([tuple(t[0]) for t in trimmed_chords_counts]))
1210
- same_chords_ratio = (num_same_chords / len(set(tuple(x[0]) for x in [trimmed_c_counts+trimmed_chords_counts][0])))
1211
-
 
 
 
 
1212
  if skip_exact_matches:
1213
  if same_chords_ratio == 1:
1214
  same_chords_ratio = 0
@@ -1323,7 +1331,12 @@ for d in tqdm(meta_data):
1323
  num_same_patches = len(set(p_list) & set(patches_list))
1324
 
1325
  if len(set(p_list + patches_list)) > 0:
1326
- same_patches_ratio = num_same_patches / len(set(p_list + patches_list))
 
 
 
 
 
1327
  else:
1328
  same_patches_ratio = 0
1329
 
 
1024
 
1025
  same_pitches = set([T[0] for T in trimmed_p_counts]) & set([m[0] for m in trimmed_pitches_counts])
1026
  num_same_pitches = len(same_pitches)
1027
+
1028
+ if num_same_pitches == len(trimmed_pitches_counts):
1029
+ same_pitches_ratio = (num_same_pitches / len(trimmed_p_counts))
1030
+ else:
1031
+ same_pitches_ratio = (num_same_pitches / max(len(trimmed_p_counts), len(trimmed_pitches_counts)))
1032
 
1033
  if skip_exact_matches:
1034
  if same_pitches_ratio == 1:
 
1211
  trimmed_chords_counts = [y for y in ms_chords_counts if y[1] >= (max_chords_count * chords_counts_cutoff_threshold_ratio)]
1212
 
1213
  num_same_chords = len(set([tuple(T[0]) for T in trimmed_c_counts]) & set([tuple(t[0]) for t in trimmed_chords_counts]))
1214
+
1215
+ if num_same_chords == len(trimmed_chords_counts):
1216
+ same_chords_ratio = (num_same_chords / len(trimmed_c_counts))
1217
+ else:
1218
+ same_chords_ratio = (num_same_chords / max(len(trimmed_c_counts), len(trimmed_chords_counts)))
1219
+
1220
  if skip_exact_matches:
1221
  if same_chords_ratio == 1:
1222
  same_chords_ratio = 0
 
1331
  num_same_patches = len(set(p_list) & set(patches_list))
1332
 
1333
  if len(set(p_list + patches_list)) > 0:
1334
+
1335
+ if num_same_patches == len(patches_list):
1336
+ same_patches_ratio = num_same_patches / len(p_list)
1337
+ else:
1338
+ same_patches_ratio = num_same_patches / max(len(p_list), len(patches_list))
1339
+
1340
  else:
1341
  same_patches_ratio = 0
1342
 
master_midi_dataset_search_and_filter.py CHANGED
@@ -147,7 +147,7 @@ maximum_match_ratio_to_search_for = 1 #@param {type:"slider", min:0, max:1, step
147
 
148
  pitches_counts_cutoff_threshold_ratio = 0 #@param {type:"slider", min:0, max:1, step:0.05}
149
  search_transposed_pitches = False #@param {type:"boolean"}
150
- skip_exact_matches = True #@param {type:"boolean"}
151
 
152
  #@markdown Additional search options
153
 
@@ -472,8 +472,12 @@ for f in filez:
472
 
473
  same_pitches = set([T[0] for T in trimmed_p_counts]) & set([m[0] for m in trimmed_pitches_counts])
474
  num_same_pitches = len(same_pitches)
475
- same_pitches_ratio = (num_same_pitches / len(set([m[0] for m in trimmed_p_counts]+[T[0] for T in trimmed_pitches_counts])))
476
-
 
 
 
 
477
  if skip_exact_matches:
478
  if same_pitches_ratio == 1:
479
  same_pitches_ratio = 0
@@ -543,7 +547,7 @@ for f in filez:
543
 
544
  print('-' * 70)
545
 
546
- max_ratios = sorted(final_ratios, reverse=True)[:number_of_top_ratios_MIDIs_to_collect]
547
 
548
  print('Max match ratio', max_ratios[0])
549
  print('-' * 70)
 
147
 
148
  pitches_counts_cutoff_threshold_ratio = 0 #@param {type:"slider", min:0, max:1, step:0.05}
149
  search_transposed_pitches = False #@param {type:"boolean"}
150
+ skip_exact_matches = False #@param {type:"boolean"}
151
 
152
  #@markdown Additional search options
153
 
 
472
 
473
  same_pitches = set([T[0] for T in trimmed_p_counts]) & set([m[0] for m in trimmed_pitches_counts])
474
  num_same_pitches = len(same_pitches)
475
+
476
+ if num_same_pitches == len(trimmed_pitches_counts):
477
+ same_pitches_ratio = (num_same_pitches / len(trimmed_p_counts))
478
+ else:
479
+ same_pitches_ratio = (num_same_pitches / max(len(trimmed_p_counts), len(trimmed_pitches_counts)))
480
+
481
  if skip_exact_matches:
482
  if same_pitches_ratio == 1:
483
  same_pitches_ratio = 0
 
547
 
548
  print('-' * 70)
549
 
550
+ max_ratios = sorted(set(final_ratios), reverse=True)[:number_of_top_ratios_MIDIs_to_collect]
551
 
552
  print('Max match ratio', max_ratios[0])
553
  print('-' * 70)