Commit cf7d918d by Jiri Borovec

update

parent 7dc4fed3
......@@ -32,14 +32,14 @@ import dataset_utils as gen_data
import dictionary_learning as dl
import pattern_disctionary as ptn_dict
import pattern_weights as ptn_weigth
import experiment_apd
import experiment_apd as expt_apd
NB_THREADS = experiment_apd.NB_THREADS
SYNTH_PARAMS = experiment_apd.SYNTH_PARAMS
SYNTH_SUB_DATASETS = experiment_apd.SYNTH_SUB_DATASETS
SYNTH_PTN_RANGE = experiment_apd.SYNTH_PTN_RANGE
REAL_PARAMS = experiment_apd.REAL_PARAMS
NB_THREADS = expt_apd.NB_THREADS
SYNTH_PARAMS = expt_apd.SYNTH_PARAMS
SYNTH_SUB_DATASETS = expt_apd.SYNTH_SUB_DATASETS
SYNTH_PTN_RANGE = expt_apd.SYNTH_PTN_RANGE
REAL_PARAMS = expt_apd.REAL_PARAMS
def test_simple_show_case():
......@@ -83,10 +83,10 @@ def experiment_pipeline_alpe_showcase(path_out):
:param path_out: str
:return:
"""
atlas = gen_data.dataset_create_atlas(experiment_apd.SYNTH_PATH_APD)
atlas = gen_data.dataset_create_atlas(expt_apd.SYNTH_PATH_APD)
# plt.imshow(atlas)
path_in = os.path.join(experiment_apd.SYNTH_PATH_APD, gen_data.NAME_DATASET)
path_in = os.path.join(expt_apd.SYNTH_PATH_APD, gen_data.NAME_DATASET)
imgs, _ = gen_data.dataset_load_images(path_in)
# imgs = gen_data.dataset_load_images('datasetBinary_defNoise',
# path_base=SYNTH_PATH_APD)
......@@ -102,7 +102,7 @@ def experiment_pipeline_alpe_showcase(path_out):
return atlas, w_bins
class ExperimentALPE(experiment_apd.ExperimentAPD):
class ExperimentALPE(expt_apd.ExperimentAPD):
"""
the main real experiment or our Atlas Learning Pattern Encoding
"""
......@@ -177,14 +177,14 @@ class ExperimentALPE(experiment_apd.ExperimentAPD):
return stat
class ExperimentALPE_mp(ExperimentALPE, experiment_apd.ExperimentAPD_mp):
class ExperimentALPE_mp(ExperimentALPE, expt_apd.ExperimentAPD_mp):
"""
parallel version of ALPE
"""
pass
def experiments_test(dict_params=experiment_apd.SYNTH_PARAMS):
def experiments_test(dict_params=SYNTH_PARAMS):
""" simple test of the experiments """
logging.basicConfig(level=logging.DEBUG)
# experiment_pipeline_alpe_showcase()
......@@ -210,20 +210,20 @@ def experiments_synthetic(params=SYNTH_PARAMS):
:param ptn_range: [int]
:param ds_version: str, version of dataset
"""
arg_params = experiment_apd.parse_params(params)
arg_params = expt_apd.parse_params(params)
logging.info('PARAMS: \n%s', '\n'.join(['"{}": \n\t {}'.format(k, v)
for k, v in arg_params.iteritems()]))
nb_jobs = arg_params['nb_jobs']
params.update(arg_params)
l_params = [params]
l_params = experiment_apd.extend_list_params(l_params, 'dataset', SYNTH_SUB_DATASETS)
# l_params = experiment_apd.extend_list_params(l_params, 'init_tp', ['msc', 'rnd'])
l_params = experiment_apd.extend_list_params(l_params, 'ptn_split', [True, False])
l_params = experiment_apd.extend_list_params(l_params, 'gc_regul',
l_params = expt_apd.extend_list_params(l_params, 'dataset', SYNTH_SUB_DATASETS)
l_params = expt_apd.extend_list_params(l_params, 'init_tp', ['msc', 'rnd'])
l_params = expt_apd.extend_list_params(l_params, 'ptn_split', [True, False])
l_params = expt_apd.extend_list_params(l_params, 'gc_regul',
[0., 1e-6, 1e-3, 1e-1, 1e0])
ptn_range = SYNTH_PTN_RANGE[os.path.basename(params['path_in'])]
l_params = experiment_apd.extend_list_params(l_params, 'nb_labels', ptn_range)
l_params = expt_apd.extend_list_params(l_params, 'nb_labels', ptn_range)
logging.debug('list params: %i', len(l_params))
......@@ -248,18 +248,18 @@ def experiments_real(params=REAL_PARAMS):
:param nb_jobs: int
:param params: {str: value}
"""
arg_params = experiment_apd.parse_params(params)
arg_params = expt_apd.parse_params(params)
logging.info('PARAMS: \n%s', '\n'.join(['"{}": \n\t {}'.format(k, v)
for k, v in arg_params.iteritems()]))
nb_jobs = arg_params['nb_jobs']
params.update(arg_params)
l_params = [copy.deepcopy(params)]
# l_params = experiment_apd.extend_list_params(l_params, 'init_tp', ['msc', 'rnd'])
# l_params = experiment_apd.extend_list_params(l_params, 'ptn_split', [True, False])
l_params = experiment_apd.extend_list_params(l_params, 'gc_regul',
# l_params = expt_apd.extend_list_params(l_params, 'init_tp', ['msc', 'rnd'])
# l_params = expt_apd.extend_list_params(l_params, 'ptn_split', [True, False])
l_params = expt_apd.extend_list_params(l_params, 'gc_regul',
[0., 1e-9, 1e-6, 1e-3, 1e-2, 1e-1])
# l_params = experiment_apd.extend_list_params(l_params, 'nb_labels',
# l_params = expt_apd.extend_list_params(l_params, 'nb_labels',
# [5, 9, 12, 15, 20, 25, 30, 40])
logging.debug('list params: %i', len(l_params))
......
......@@ -26,17 +26,17 @@ from skimage import segmentation
import tqdm
sys.path.append(os.path.abspath(os.path.join('..','..'))) # Add path to root
import experiment_apd
import experiment_apd as expt_apd
import pattern_disctionary as ptn_dict
import pattern_weights as ptn_weight
SYNTH_PARAMS = experiment_apd.SYNTH_PARAMS
SYNTH_SUB_DATASETS = experiment_apd.SYNTH_SUB_DATASETS
SYNTH_PTN_RANGE = experiment_apd.SYNTH_PTN_RANGE
SYNTH_PARAMS = expt_apd.SYNTH_PARAMS
SYNTH_SUB_DATASETS = expt_apd.SYNTH_SUB_DATASETS
SYNTH_PTN_RANGE = expt_apd.SYNTH_PTN_RANGE
# experiment_apd.ExperimentAPD_mp
class ExperimentLinearCombine(experiment_apd.ExperimentAPD_mp):
# expt_apd.ExperimentAPD_mp
class ExperimentLinearCombine(expt_apd.ExperimentAPD_mp):
"""
State-of-te-Art methods that are based on Linear Combination
"""
......@@ -205,16 +205,15 @@ def experiments_synthetic(params=SYNTH_PARAMS):
:param dataset: str, name of dataset
:param ptn_range: [int]
"""
arg_params = experiment_apd.parse_params(params)
arg_params = expt_apd.parse_params(params)
logging.info('PARAMS: \n%s', '\n'.join(['"{}": \n\t {}'.format(k, v)
for k, v in arg_params.iteritems()]))
params.update(arg_params)
params['max_iter'] = 9999
l_params = [params]
l_params = experiment_apd.extend_list_params(l_params, 'nb_samples',
l_params = expt_apd.extend_list_params(l_params, 'nb_samples',
np.linspace(0.1, 1, 10).tolist())
l_params = experiment_apd.extend_list_params(l_params, 'dataset',
SYNTH_SUB_DATASETS)
l_params = expt_apd.extend_list_params(l_params, 'dataset', SYNTH_SUB_DATASETS)
if not 'methods' in params:
params['methods'] = METHODS.keys()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment