Skip to content

Commit

Permalink
Use yaml SafeLoader since more canonical
Browse files Browse the repository at this point in the history
  • Loading branch information
minimaxir committed Apr 5, 2019
1 parent 82ae6d0 commit 0ea3842
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions automl_gs/utils_automl.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def build_hp_grid(framework, types, num_trials,
"""

with open(hp_path) as f:
hps = yaml.load(f, Loader=yaml.FullLoader)
hps = yaml.safe_load(f)

# Refine hyperparameters by only using ones relevant to
# the data and framework of choice
Expand Down Expand Up @@ -197,7 +197,7 @@ def render_model(params, model_name, framework, env, problem_type,
text_framework = 'tensorflow' if framework == 'tensorflow' else 'sklearn'

with open(metrics_path) as f:
metrics = yaml.load(f, Loader=yaml.FullLoader)[problem_type]
metrics = yaml.safe_load(f)[problem_type]

for file in files:
script = env.get_template('scripts/' + file.replace('.py', '')).render(
Expand Down Expand Up @@ -268,7 +268,7 @@ def get_problem_config(target_data,

# Direction
with open(metrics_path) as f:
metrics = yaml.load(f, Loader=yaml.FullLoader)
metrics = yaml.safe_load(f)

direction = metrics[target_metric]['objective']
direction_text = 'minimizing' if direction == 'min' else 'maximizing'
Expand Down

0 comments on commit 0ea3842

Please sign in to comment.