def run_command(feature_type, missing_data, data_object_base_path_name, base_out_path, input_dims, tone_list, dur_position, num_sampling, d1, d2): deltas = [ [d1, d2] ] output_name_paths = [] for i, d in enumerate(deltas): outp = '{}/input_dims_{}/delta-{}_delta-delta-{}/'.format(base_out_path, input_dims, d[0], d[1]) output_name_paths.append(outp) print 'Missing Data : {}'.format(missing_data) print 'Inducing points : 10 percent' for idx, output_name in enumerate(output_name_paths): delta_bool=deltas[idx][0] delta2_bool=deltas[idx][1] if missing_data: method_name = 'BayesianGPLVMMiniBatch_Missing' else : method_name = 'BGP_LVM' for tone in tone_list: print 'Delta : {}, Delta-Dealta : {}'.format(delta_bool, delta2_bool) data_object_path = '{}{}.pickle'.format(data_object_base_path_name, tone) print 'data path ',data_object_path syllable_management = Utility.load_obj(data_object_path) if len(syllable_management.syllables_list) == 0: print 'No syllable in this object database : {}'.format(tone) print '-----------------------------------------------------------------' continue output_path = '{}/{}_Tone_{}/'.format(output_name, method_name, tone) Utility.make_directory(output_path) print output_path Latent_variable_model_Training.execute_Bayesian_GPLVM_training( syllable_management, feature_type, input_dims, output_path, num_sampling=num_sampling, dur_position=dur_position, delta_bool=delta_bool, delta2_bool=delta2_bool, missing_data=missing_data, num_inducing=int(len(syllable_management.syllables_list)*0.1), max_iters=500) pass
def run_for_voice_data(): dropbox_path = '/home/h1/decha/Dropbox/' output_name,delta_bool,delta2_bool = '02_delta_delta-delta', True, True # output_name,delta_bool,delta2_bool = '03_delta', True, False # output_name,delta_bool,delta2_bool = '04_no_delta', False, False input_dims = 3 for tone in ['0','1','2','3','4', '01234']: # for tone in ['01234']: print 'Running Tone : {}'.format(tone) if tone is '01234': data_object_path = '{}/Inter_speech_2016/Syllable_object/01_manual_labeling_object/syllable_all.pickle'.format(dropbox_path) syllable_management = Utility.load_obj(data_object_path) else : data_object_path = '{}/Inter_speech_2016/Syllable_object/01_manual_labeling_object/syllable_{}.pickle'.format(dropbox_path,tone) syllable_management = Utility.load_obj(data_object_path) print 'Delta : {}, Delta-Dealta : {}'.format(delta_bool, delta2_bool) output_path = '{}/Inter_speech_2016/Syllable_object/{}/BGP_LVM/{}_dimentionality/Tone_{}/'.format(dropbox_path,output_name,input_dims,tone) print output_path Latent_variable_model_Training.execute_Bayesian_GPLVM_training( syllable_management, Syllable.TRAINING_FEATURE_POLYNOMIAL_2_DEGREE_VOICE, input_dims, output_path, delta_bool=delta_bool, delta2_bool=delta2_bool) pass
def run_command(feature_type, missing_data, data_object_base_path_name, base_out_path, input_dims, tone_list, dur_position): deltas = [ [False, False], [True, False], [True, True] ] output_name_paths = [] for i, d in enumerate(deltas): outp = '{}/input_dims_{}/{}_delta-{}_delta-delta-{}/'.format(base_out_path, input_dims, Utility.fill_zero(i+1,2), d[0], d[1]) output_name_paths.append(outp) print 'Missing Data : {}'.format(missing_data) for idx, output_name in enumerate(output_name_paths): delta_bool=deltas[idx][0] delta2_bool=deltas[idx][1] if missing_data: method_name = 'BayesianGPLVMMiniBatch_Missing' else : method_name = 'BGP_LVM' for tone in tone_list: print 'Delta : {}, Delta-Dealta : {}'.format(delta_bool, delta2_bool) data_object_path = '{}{}.pickle'.format(data_object_base_path_name, tone) print 'data path ',data_object_path syllable_management = Utility.load_obj(data_object_path) if len(syllable_management.syllables_list) == 0: print 'No syllable in this object database : {}'.format(tone) print '-----------------------------------------------------------------' continue output_path = '{}/{}_Tone_{}/'.format(output_name, method_name, tone) Utility.make_directory(output_path) print output_path Latent_variable_model_Training.execute_Bayesian_GPLVM_training( syllable_management, feature_type, input_dims, output_path, dur_position=dur_position, subtract_typical_contour=False, exp=False, delta_bool=delta_bool, delta2_bool=delta2_bool, missing_data=missing_data) pass
def run_for_missing_data(): dropbox_path = '/home/h1/decha/Dropbox/' output_name = '05_missing_data_no_delta' delta_bool=False delta2_bool=False input_dims = 3 for tone in ['01234']: print 'Delta : {}, Delta-Dealta : {}'.format(delta_bool, delta2_bool) print 'Missing data' data_object_path = '{}/Inter_speech_2016/Syllable_object/01_manual_labeling_object/syllable_{}.pickle'.format(dropbox_path,tone) if tone is '01234': data_object_path = '{}/Inter_speech_2016/Syllable_object/01_manual_labeling_object/syllable_all.pickle'.format(dropbox_path) syllable_management = Utility.load_obj(data_object_path) output_path = '{}/Inter_speech_2016/Syllable_object/{}/BGP_LVM/Tone_{}/'.format(dropbox_path,output_name,tone) print output_path Latent_variable_model_Training.execute_Bayesian_GPLVM_training( syllable_management, Syllable.MISSING_VALUES, input_dims, output_path, delta_bool=delta_bool, delta2_bool=delta2_bool, missing_data=True) pass pass
def run_command(feature_type, missing_data, data_object_base_path_name, base_out_path, input_dims, tone_list, dur_position, num_sampling, d1, d2): deltas = [[d1, d2]] output_name_paths = [] for i, d in enumerate(deltas): outp = '{}/input_dims_{}/delta-{}_delta-delta-{}/'.format( base_out_path, input_dims, d[0], d[1]) output_name_paths.append(outp) print 'Missing Data : {}'.format(missing_data) print 'Inducing points : 10 percent' for idx, output_name in enumerate(output_name_paths): delta_bool = deltas[idx][0] delta2_bool = deltas[idx][1] if missing_data: method_name = 'BayesianGPLVMMiniBatch_Missing' else: method_name = 'BGP_LVM' for tone in tone_list: print 'Delta : {}, Delta-Dealta : {}'.format( delta_bool, delta2_bool) data_object_path = '{}{}.pickle'.format(data_object_base_path_name, tone) print 'data path ', data_object_path syllable_management = Utility.load_obj(data_object_path) if len(syllable_management.syllables_list) == 0: print 'No syllable in this object database : {}'.format(tone) print '-----------------------------------------------------------------' continue print 'Syllable all : {} Syllables'.format( len(syllable_management.syllables_list)) output_path = '{}/{}_Tone_{}/'.format(output_name, method_name, tone) Utility.make_directory(output_path) print output_path print 'Feature Key : {}'.format(feature_type) Y_full, names, tone, stress, syllable_short_long_type, syllalbe_position, phoneme, syllable_type = syllable_management.get_GP_LVM_training_data( feature_key=feature_type, dur_position=dur_position, delta_bool=delta_bool, delta2_bool=delta2_bool, missing_data=missing_data, num_sampling=num_sampling, ) print 'Y full : {}'.format(np.array(Y_full).shape) Y, names, tone, stress, syllable_short_long_type, syllalbe_position, phoneme, syllable_type = syllable_management.get_GP_LVM_training_data( feature_key=feature_type, dur_position=dur_position, delta_bool=delta_bool, delta2_bool=delta2_bool, missing_data=missing_data, num_sampling=num_sampling, no_short_duration=True, get_only_stress=False, exp=False, subtract_typical_contour=False, non_unlabelled_stress=False, get_only_gpr_data=False) Latent_variable_model_Training.execute_Bayesian_GPLVM_training_with_Y_names( Y, names, input_dims, output_path, missing_data=False, max_iters=500, num_inducing=int(len(Y) * 0.1), BayesianGPLVMMiniBatch=False) pass
def run_for_missing_data_with_delta_and_interpolate(): dropbox_path = '/home/h1/decha/Dropbox/' # 01 output_name_paths = [ # '/work/w13/decha/Inter_speech_2016_workplace/gpr-projection-additional/01_gpr_a-5dims_BayesianGPLVMMiniBatch_data_no_delta/', # '/work/w13/decha/Inter_speech_2016_workplace/gpr-projection-additional/01_gpr_b-5dims_BayesianGPLVMMiniBatch_data_delta/', '/work/w13/decha/Inter_speech_2016_workplace/gpr-projection-additional/01_gpr_c-5dims_BayesianGPLVMMiniBatch_data_delta_deltadelta/' ] missing_data = True subtract_typical_contour = True # 02 # subtract_typical_contour = False # output_name_paths = [ # '/work/w13/decha/Inter_speech_2016_workplace/gpr-projection-additional/02_gpr_a-5dims_BayesianGPLVMMiniBatch_data_no_delta/', # '/work/w13/decha/Inter_speech_2016_workplace/gpr-projection-additional/02_gpr_b-5dims_BayesianGPLVMMiniBatch_data_delta/', # '/work/w13/decha/Inter_speech_2016_workplace/gpr-projection-additional/02_gpr_c-5dims_BayesianGPLVMMiniBatch_data_delta_deltadelta/' # ] print 'Missing Data : {}'.format(missing_data) print 'Subtract_typical_contour : {}'.format(subtract_typical_contour) deltas = [ # [False, False], # [True, False], [True, True] ] # input_dims = 3 input_dims = 5 for idx, output_name in enumerate(output_name_paths): delta_bool = deltas[idx][0] delta2_bool = deltas[idx][1] if missing_data: method_name = 'BayesianGPLVMMiniBatch_Missing' else: method_name = 'BGP_LVM' # for tone in ['0','1','2','3','4','01234']: for tone in ['0', '1', '2', '3', '4']: # for tone in ['01234']: print 'Delta : {}, Delta-Dealta : {}'.format( delta_bool, delta2_bool) print 'Missing data' # data_object_path = '{}/Inter_speech_2016/Syllable_object/01_manual_labeling_object/syllable_{}.pickle'.format(dropbox_path,tone) data_object_path = '/home/h1/decha/Dropbox/Inter_speech_2016/Syllable_object/GPR-data-work-space/gpr_syllable_obj/Syllable_object_a_to_d_tone_{}.pickle'.format( tone) if tone is '01234': # data_object_path = '{}/Inter_speech_2016/Syllable_object/01_manual_labeling_object/syllable_all.pickle'.format(dropbox_path) data_object_path = '/home/h1/decha/Dropbox/Inter_speech_2016/Syllable_object/GPR-data-work-space/gpr_syllable_obj/Syllable_object_a_to_d.pickle' syllable_management = Utility.load_obj(data_object_path) output_path = '{}/{}/Tone_{}/'.format(output_name, method_name, tone) Utility.make_directory(output_path) print output_path Latent_variable_model_Training.execute_Bayesian_GPLVM_training( syllable_management, Syllable.TRAINING_FEATURE_POLYNOMIAL_2_DEGREE_VOICE, input_dims, output_path, subtract_typical_contour=subtract_typical_contour, delta_bool=delta_bool, delta2_bool=delta2_bool, missing_data=missing_data) pass
def run_for_missing_data_with_delta_and_interpolate(max_iters): dropbox_path = '/home/h1/decha/Dropbox/' # output_name = '05_missing_data_no_delta' # output_name_paths = [ # '/work/w13/decha/Inter_speech_2016_workplace/Data/07a_missing_data_no_delta/', # '/work/w13/decha/Inter_speech_2016_workplace/Data/07b_missing_data_delta/', # '/work/w13/decha/Inter_speech_2016_workplace/Data/07c_missing_data_delta_deltadelta/' # ] output_name_paths = [ # '/work/w13/decha/Inter_speech_2016_workplace/Data/07_max_iters_{}/07a-5dims_BayesianGPLVMMiniBatch_data_no_delta/'.format(max_iters) , # '/work/w13/decha/Inter_speech_2016_workplace/Data/07_max_iters_{}/07b-5dims_BayesianGPLVMMiniBatch_data_delta/'.format(max_iters) , '/work/w13/decha/Inter_speech_2016_workplace/Data/07_max_iters_{}/07c-5dims_BayesianGPLVMMiniBatch_data_delta_deltadelta/'.format(max_iters) ] missing_data = True subtract_typical_contour = False print 'Missing Data : {}'.format(missing_data) deltas = [ # [False, False], # [True, False], [True, True] ] # input_dims = 3 input_dims = 5 for idx, output_name in enumerate(output_name_paths): delta_bool=deltas[idx][0] delta2_bool=deltas[idx][1] if missing_data: method_name = 'BayesianGPLVMMiniBatch_Missing' else : method_name = 'BGP_LVM' # for tone in ['0','1','2','3','4','01234']: for tone in ['01234']: print 'Delta : {}, Delta-Dealta : {}'.format(delta_bool, delta2_bool) print 'Missing data' data_object_path = '{}/Inter_speech_2016/Syllable_object/01_manual_labeling_object/syllable_{}.pickle'.format(dropbox_path,tone) if tone is '01234': data_object_path = '{}/Inter_speech_2016/Syllable_object/01_manual_labeling_object/syllable_all.pickle'.format(dropbox_path) syllable_management = Utility.load_obj(data_object_path) output_path = '{}/{}/Tone_{}/'.format(output_name, method_name, tone) Utility.make_directory(output_path) print output_path Latent_variable_model_Training.execute_Bayesian_GPLVM_training( syllable_management, # Syllable.TRAINING_FEATURE_POLYNOMIAL_2_DEGREE, Syllable.TRAINING_FEATURE_POLYNOMIAL_2_DEGREE_VOICE, input_dims, output_path, subtract_typical_contour=subtract_typical_contour, delta_bool=delta_bool, delta2_bool=delta2_bool, missing_data=missing_data, max_iters=max_iters) pass
def run_for_mix(input_dims): dropbox_path = '/home/h1/decha/Dropbox/' missing_data = True subtract_typical_contour = False deltas = [ [False, False], [True, False], [True, True] ] print 'This running aims to show the unlabelled data on the labeled data in distribution.' print 'Do not use subtract contour' data_object = '/home/h1/decha/Dropbox/Inter_speech_2016/Syllable_object/GPR-data-work-space/mix_syllable_obj/mix_syllable_' output_name_paths = [ '/work/w13/decha/Inter_speech_2016_workplace/mix-projection-addtional/02_mix_a-{}dims_data_no_delta_missing_data_No-subtract_typical_contour/'.format(input_dims), '/work/w13/decha/Inter_speech_2016_workplace/mix-projection-addtional/02_mix_b-{}dims_data_delta-{}_delta-delta-{}_missing_data_No-subtract_typical_contour/'.format(input_dims,deltas[1][0],deltas[1][1]), '/work/w13/decha/Inter_speech_2016_workplace/mix-projection-addtional/02_mix_c-{}dims_data_delta-{}_delta-delta-{}_missing_data_No-subtract_typical_contour/'.format(input_dims,deltas[2][0],deltas[2][1]), ] print 'Missing Data : {}'.format(missing_data) print 'Subtract_typical_contour : {}'.format(subtract_typical_contour) for idx, output_name in enumerate(output_name_paths): delta_bool=deltas[idx][0] delta2_bool=deltas[idx][1] if missing_data: method_name = 'BayesianGPLVMMiniBatch_Missing' else : method_name = 'BGP_LVM' for tone in ['0','1','2','3','4','01234']: # for tone in ['01234']: print 'Delta : {}, Delta-Dealta : {}'.format(delta_bool, delta2_bool) print 'Missing data' data_object_path = '{}{}.pickle'.format(data_object, tone) if tone is '01234': data_object_path = '{}all.pickle'.format(data_object) print data_object_path syllable_management = Utility.load_obj(data_object_path) output_path = '{}/{}/Tone_{}/'.format(output_name, method_name, tone) Utility.make_directory(output_path) print output_path Latent_variable_model_Training.execute_Bayesian_GPLVM_training( syllable_management, Syllable.TRAINING_FEATURE_POLYNOMIAL_2_DEGREE_VOICE, input_dims, output_path, subtract_typical_contour=subtract_typical_contour, delta_bool=delta_bool, delta2_bool=delta2_bool, missing_data=missing_data) pass