def test__GmmAnalysis__make_gmm_models(): gmm = GmmAnalysis(configuration=o_config, data=o_data, names=o_config.normalized_error_names, output_path=output_path, max_components=max_components) gmm.make_gmm_models() for k in gmm.models: assert isinstance(gmm.models[k]['obj'], GaussianMixture) assert isinstance(k, int)
def test__GmmAnalysis__do_ic_analysis(): gmm = GmmAnalysis(configuration=o_config, data=o_data, names='all', output_path=output_path, max_components=max_components) gmm.do_ic_analysis() ic_plot_path = os.path.join(output_path, 'ic_plot.png') assert os.path.isfile(ic_plot_path)
def test__GmmAnalysis____init____w_filenames(): gmm = GmmAnalysis(configuration=config_fn, data=data_fn, names=o_config.normalized_error_names, output_path=output_path, max_components=max_components) assert isinstance(gmm.configuration, PyposmatConfigurationFile) assert isinstance(gmm.data, PyposmatDataFile) assert gmm.max_components == max_components assert gmm.aic_criteria is None assert gmm.bic_criteria is None
def test__GmmAnalysis____init____arg_names_string(names): gmm = GmmAnalysis(configuration=o_config, data=o_data, names=names, output_path=output_path, max_components=max_components) assert isinstance(gmm.configuration, PyposmatConfigurationFile) assert isinstance(gmm.data, PyposmatDataFile) assert gmm.max_components == max_components assert gmm.aic_criteria is None assert gmm.bic_criteria is None
def dev__GmmAnalysis__do_aic_analysis(): gmm = GmmAnalysis(configuration=o_config, data=o_data, names=o_config.normalized_error_names, output_path=output_path, max_components=max_components) gmm.make_gmm_models() gmm.do_aic_analysis() for k in gmm.models: print(gmm.models[k])
def test__GmmAnalysis__do_cluster_analysis(): n_components = 10 gmm = GmmAnalysis(configuration=o_config, data=o_data, names=o_config.normalized_error_names, output_path=output_path, max_components=max_components) gmm.make_gmm_models() gmm.do_cluster_analysis(n_components=n_components) for k in gmm.cluster_ids: assert isinstance(k, int)
def test__GmmAnalysis__do_aic_analysis(): gmm = GmmAnalysis(configuration=o_config, data=o_data, names=o_config.normalized_error_names, output_path=output_path, max_components=max_components) gmm.make_gmm_models() gmm.do_aic_analysis() for k in gmm.models: assert isinstance(gmm.models[k]['aic'], float) assert isinstance(gmm.aic_criteria, dict) assert isinstance(gmm.aic_criteria['min_components'], int) assert isinstance(gmm.aic_criteria['min_value'], float)
def test__GmmAnalysis__make_gmm_models(): gmm = GmmAnalysis(configuration=o_config, data=o_data, names=o_config.normalized_error_names, output_path=output_path, max_components=max_components)
def dev__GmmAnalysis(): max_components = 20 n_components = 10 gmm = GmmAnalysis(configuration=o_config, data=o_data, names='all', output_path=output_path, max_components=max_components) print(gmm.names) gmm.make_gmm_models() gmm.do_aic_analysis() gmm.do_bic_analysis() gmm.do_ic_analysis() gmm.do_cluster_analysis(n_components=n_components) # table__cluster_info(gmm) # table__cluster_parameters(gmm) # table__cluster_qois(gmm) plot__cluster_qoi(gmm) gmm.plot_gmm_analysis(n_components=20)
def dev__GmmAnalysis(): max_components = 20 n_components = 10 gmm = GmmAnalysis(configuration=o_config, data=o_data, names='all', output_path=output_path, max_components=max_components) print(gmm.names) gmm.make_gmm_models() gmm.do_aic_analysis() gmm.do_bic_analysis() gmm.do_ic_analysis() gmm.do_cluster_analysis(n_components=n_components) # table__cluster_info(gmm) # table__cluster_parameters(gmm) # table__cluster_qois(gmm) plot__cluster_qoi(gmm) gmm.plot_gmm_analysis(n_components=20) if __name__ == "__main__": n_components = 10 gmm = GmmAnalysis(configuration=o_config, data=o_data, names='all', output_path=output_path, max_components=max_components) gmm.do_cluster_analysis(n_components=n_components)
pypospack_root_dir, 'data','Si__sw__data','reference_potentials', 'pyposmat.kde.1.out') o_config = PyposmatConfigurationFile() o_config.read(filename=config_fn) o_data = PyposmatDataFile() o_data.read(filename=data_fn) o_data.create_normalized_errors( normalize_type='by_qoi_target', qoi_targets=o_config.qoi_targets) max_components = 10 gmm = GmmAnalysis(configuration=o_config, data=o_data, names=o_config.normalized_error_names) gmm.make_gmm_models(max_components=max_components) o_data.df['score'] = o_data.df[o_config.normalized_error_names].abs().sum(axis=1) exit() # do AIC and BIC analysis if True: name_1 = o_config.qoi_names[0] name_2 = o_config.qoi_names[1] data = o_data.df[[name_1,name_2]] max_components = 21 gmm_analysis( config_fn=config_fn, data_fn=data_fn, names=[name_1,name_2],