Skip to content
Snippets Groups Projects
Commit 74b2cd8e authored by Werner Alfons Hilda Van Geit's avatar Werner Alfons Hilda Van Geit
Browse files

Add repaired morph dir to config file

parent 6e478495
No related branches found
No related tags found
No related merge requests found
...@@ -187,6 +187,7 @@ def create_mm_sqlite( ...@@ -187,6 +187,7 @@ def create_mm_sqlite(
output_filename, output_filename,
recipe_filename, recipe_filename,
morph_dir, morph_dir,
rep_morph_dir,
original_emodel_etype_map, original_emodel_etype_map,
final_dict, final_dict,
emodel_dirs, emodel_dirs,
...@@ -270,7 +271,7 @@ def create_mm_sqlite( ...@@ -270,7 +271,7 @@ def create_mm_sqlite(
fullmtype_morph_map, fullmtype_morph_map,
original_emodel_etype_map, original_emodel_etype_map,
emodel_dirs, emodel_dirs,
morph_dir, rep_morph_dir,
skip_repaired_exemplar=skip_repaired_exemplar) skip_repaired_exemplar=skip_repaired_exemplar)
# Prepend exemplar rows to full_map # Prepend exemplar rows to full_map
......
...@@ -59,12 +59,15 @@ def prepare_emodels(conf_dict, continu, scores_db_path): ...@@ -59,12 +59,15 @@ def prepare_emodels(conf_dict, continu, scores_db_path):
skip_repaired_exemplar = conf_dict.get('skip_repaired_exemplar', False) skip_repaired_exemplar = conf_dict.get('skip_repaired_exemplar', False)
recipe_filename = conf_dict['recipe_path'] recipe_filename = conf_dict['recipe_path']
morph_dir = conf_dict['morph_path'] morph_dir = conf_dict['morph_path']
rep_morph_dir = conf_dict['rep_morph_path']
print('Using repaired exemplar morph path: %s' % rep_morph_dir)
# Create a sqlite3 db with all the combos # Create a sqlite3 db with all the combos
create_mm_sqlite.create_mm_sqlite( create_mm_sqlite.create_mm_sqlite(
scores_db_path, scores_db_path,
recipe_filename, recipe_filename,
morph_dir, morph_dir,
rep_morph_dir,
emodel_etype_map, emodel_etype_map,
final_dict, final_dict,
emodel_dirs, emodel_dirs,
......
...@@ -34,16 +34,19 @@ def _row_transform(row, exemplar_row, to_skip_patterns, ...@@ -34,16 +34,19 @@ def _row_transform(row, exemplar_row, to_skip_patterns,
feature did not exceed the corresponding feature threshold, or can be feature did not exceed the corresponding feature threshold, or can be
ignored. ignored.
""" """
for column in row.index[1:]: for column in row.index[1:]:
# set all values that can be ignored to True # set all values that can be ignored to True
for pattern in to_skip_patterns: for pattern in to_skip_patterns:
if pattern.match(column): if pattern.match(column):
row[column] = True row[column] = True
continue
# find the appropriate threshold # find the appropriate threshold
for megate_feature_threshold in row['megate_feature_threshold']: for megate_feature_threshold in row['megate_feature_threshold']:
if megate_feature_threshold['features'].match(column): if megate_feature_threshold['features'].match(column):
megate_threshold = megate_feature_threshold['megate_threshold'] megate_threshold = megate_feature_threshold[
'megate_threshold']
# transform score # transform score
if skip_repaired_exemplar: if skip_repaired_exemplar:
...@@ -149,14 +152,13 @@ def check_opt_scores(emodel, scores): ...@@ -149,14 +152,13 @@ def check_opt_scores(emodel, scores):
def _apply_megating(emodel_mtype_etype_thresholds, emodel_score_values, def _apply_megating(emodel_mtype_etype_thresholds, emodel_score_values,
exemplar_row, to_skip_patterns, skip_repaired_exemplar): exemplar_row, to_skip_patterns, skip_repaired_exemplar):
"""Compare score values to applicable feature thresholds.""" """Compare score values to applicable feature thresholds."""
megate_scores = pandas.concat( megate_scores = pandas.concat(
[emodel_mtype_etype_thresholds['megate_feature_threshold'], [emodel_mtype_etype_thresholds['megate_feature_threshold'],
emodel_score_values], emodel_score_values], axis=1).apply(
axis=1).apply(lambda row: _row_transform(row, lambda row:
exemplar_row, _row_transform(row, exemplar_row, to_skip_patterns,
to_skip_patterns, skip_repaired_exemplar), axis=1)
skip_repaired_exemplar),
axis=1)
del megate_scores['megate_feature_threshold'] del megate_scores['megate_feature_threshold']
megate_scores['Passed all'] = megate_scores.all(axis=1) megate_scores['Passed all'] = megate_scores.all(axis=1)
return megate_scores return megate_scores
...@@ -251,7 +253,7 @@ def process_emodel(emodel, ...@@ -251,7 +253,7 @@ def process_emodel(emodel,
print('Skipping e-model %s: no repaired exemplars' % emodel) print('Skipping e-model %s: no repaired exemplars' % emodel)
return return
exemplar_row = exemplar_score_values.iloc[0] exemplar_row = exemplar_score_values.iloc[0].to_dict()
# identify relevant me-gate feature thresholds for each row # identify relevant me-gate feature thresholds for each row
emodel_mtype_etypes = scores[(scores.emodel == emodel) & emodel_mtype_etypes = scores[(scores.emodel == emodel) &
...@@ -264,6 +266,7 @@ def process_emodel(emodel, ...@@ -264,6 +266,7 @@ def process_emodel(emodel,
emodel_mtype_etype_thresholds = emodel_mtype_etypes.loc[ emodel_mtype_etype_thresholds = emodel_mtype_etypes.loc[
:, ['emodel', 'fullmtype', 'etype']] :, ['emodel', 'fullmtype', 'etype']]
emodel_mtype_etype_thresholds['megate_feature_threshold'] = None emodel_mtype_etype_thresholds['megate_feature_threshold'] = None
emodel_mtype_etype_thresholds.apply( emodel_mtype_etype_thresholds.apply(
lambda row: row_threshold_transform(row, megate_patterns), lambda row: row_threshold_transform(row, megate_patterns),
axis=1) axis=1)
...@@ -281,6 +284,7 @@ def process_emodel(emodel, ...@@ -281,6 +284,7 @@ def process_emodel(emodel,
# identify combinations that passed the me-gating step # identify combinations that passed the me-gating step
emodel_scores = scores[(scores.emodel == emodel) & emodel_scores = scores[(scores.emodel == emodel) &
(scores.is_exemplar == 0)].copy() (scores.is_exemplar == 0)].copy()
passed_combos = emodel_scores[megate_scores['Passed all']] passed_combos = emodel_scores[megate_scores['Passed all']]
if len(passed_combos[passed_combos['emodel'] != emodel]) > 0: if len(passed_combos[passed_combos['emodel'] != emodel]) > 0:
raise Exception('Something went wrong during row indexing in megating') raise Exception('Something went wrong during row indexing in megating')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment