def check_and_load(): global theme, path, idx, sng_name, ismini dir_path = create() if not os.path.exists(dir_path + '/settings.toml'): write() theme, path, idx, sng_name, ismini = read()
def restore_settings(): global idx if ismini: path_type = is_dir_file(path) load_songs(path, path_type) try: idx = name_to_idx(sng_name) except: write() return song_list.selection_clear(0, 'end') song_list.selection_set(idx) song_list.activate(idx) song_list.see(idx) play(idx, init_player, True) show_mini() if theme == 'dark': change_theme(init_player, file_menu)
def main_rendu(accuracy_on_train_set=False): ls_kernel = [ kernels.MismatchKernel(12, 2, 4, False), kernels.MismatchKernel(12, 2, 4, True), kernels.MismatchKernel(9, 2, 4, False) ] ls_reg_val = [100 * 0.03162277660168379, .1, 1000 * 0.03162277660168379] ls_methods = [ methods.KernelRidgeRegression(ls_kernel[i], reg_val=ls_reg_val[i]) for i in range(3) ] for i in range(3): print("##################", f"i={i}") # X = read_write.read_X100(f"data/Xtr{i}_mat100.csv") X = read_write.read(f"data/Xtr{i}.csv") # print(X.shape) # X_cat = np.concatenate((X, X), axis=-1) # X_test = read_write.read_X100(f"data/Xte{i}_mat100.csv") X_test = read_write.read(f"data/Xte{i}.csv") # X_test_cat = np.concatenate((X_test, X_test), axis=-1) y = read_write.read_labels(f"data/Ytr{i}.csv") # X_cat = np.concatenate((X, X), axis=-1) # X_test_cat = np.concatenate((X_test, X_test), axis=-1) ls_methods[i].learn(X, y) # FOR ACCURACY ON TRAINING SET if accuracy_on_train_set: y_pred = ls_methods[i].predict(X) print(methods.accuracy(y, y_pred)) y_test = ls_methods[i].predict(X_test) read_write.write(y_test, "predictions/Yte.csv", offset=i * 1000, append=(i != 0))
# get the link in the thumbnail div image_link = a_thumb.find('a') # get the url and the title info image_url = image_link['href'] image_meta = image_link['title'].replace('12 - inch', '12\"').replace( '12\u201d', '12\"').replace('33.3', '33') image_id = image_link['data-image-id'] # write to the sub-dict image['image_url'] = image_url image['image_meta'] = image_meta image['gallery'] = gallery_title image['gallery_url'] = url image['posted_to_tumblr'] = False # write sub-dict to the main dict with id as key # if the image is not already in our dictionary, let's add it if image_id not in images: images[image_id] = image # if the image IS already in our dictionary, but hasn't been posted to social media yet, let's update the info in case something changed if image_id in images and images[image_id]['posted_to_tumblr'] == False: images[image_id] = image print('We now have images from', gallery_title) #write it to json read_write.write('images', images) print('We just dumped', len(images), 'images to images.json')
# get the link in the thumbnail div image_link = a_thumb.find('a') # get the url and the title info image_url = image_link['href'] image_meta = image_link['title'].replace('12 - inch', '12\"').replace('12\u201d', '12\"').replace('33.3', '33') image_id = image_link['data-image-id'] # write to the sub-dict image['image_url'] = image_url image['image_meta'] = image_meta image['gallery'] = gallery_title image['gallery_url'] = url image['posted_to_tumblr'] = False # write sub-dict to the main dict with id as key # if the image is not already in our dictionary, let's add it if image_id not in images: images[image_id] = image # if the image IS already in our dictionary, but hasn't been posted to social media yet, let's update the info in case something changed if image_id in images and images[image_id]['posted_to_tumblr'] == False: images[image_id] = image print('We now have images from', gallery_title) #write it to json read_write.write('images', images) print('We just dumped', len(images), 'images to images.json')