From e154559642becaa1d5f901593842a6d5a2517355 Mon Sep 17 00:00:00 2001 From: shukon Date: Wed, 1 Apr 2020 14:31:32 +0200 Subject: [PATCH 1/2] REMOVE fanova-warning --- README.md | 4 ---- pimp/pimp.py | 16 +--------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/README.md b/README.md index 0f66740..4259105 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,6 @@ To install it simply run ` pip install pyimp ` -If you want to run fANOVA with PyImp you will have to manually install it via -` -pip install git+http://github.com/automl/fanova.git@master -` **PyImp** is an easy to use tool that helps developers to identify the most important parameters of their algorithms. Given the data of a configuration run with [*SMAC3*](https://github.com/automl/SMAC3), PyImp allows one to use *Forward Selection*, *Efficient Ablation* and *Influence Models* to determine which Parameters have the most influence over the algorithms behaviour. diff --git a/pimp/pimp.py b/pimp/pimp.py index 02a7071..ede5bb1 100644 --- a/pimp/pimp.py +++ b/pimp/pimp.py @@ -12,6 +12,7 @@ from typing import Union import numpy as np +import fanova from smac.scenario.scenario import Scenario from smac.runhistory.runhistory import RunHistory, RunKey from smac.tae.execute_ta_run_aclib import StatusType @@ -190,15 +191,6 @@ def cmd_line_call(): logging.basicConfig(level=args.verbose_level) ts = time.time() ts = datetime.datetime.fromtimestamp(ts).strftime('%Y_%m_%d_%H:%M:%S') - fanova_ready = True - - try: - import fanova - except ImportError: - warnings.simplefilter('always', ImportWarning) - warnings.warn('fANOVA is not installed in your environment. To install it please run ' - '"git+http://github.com/automl/fanova.git@master"') - fanova_ready = False if 'influence-model' in args.modus: logging.warning('influence-model not fully supported yet!') @@ -208,17 +200,11 @@ def cmd_line_call(): ' lpi. Use lpi instead.', DeprecationWarning, stacklevel=2) if 'lpi' in args.modus: # LPI will replace incneighbor in the future args.modus[args.modus.index('lpi')] = 'incneighbor' - if 'fanova' in args.modus and not fanova_ready: - raise ImportError('fANOVA is not installed! To install it please run ' - '"git+http://github.com/automl/fanova.git@master"') if 'all' in args.modus: choices = ['ablation', 'forward-selection', 'fanova', 'incneighbor'] - if not fanova_ready: - raise ImportError('fANOVA is not installed! To install it please run ' - '"git+http://github.com/automl/fanova.git@master"') del args.modus[args.modus.index('all')] if len(args.modus) == len(choices): pass From b12b5aa94a8d3505975d2f9ed7d78b1541881d23 Mon Sep 17 00:00:00 2001 From: shukon Date: Wed, 1 Apr 2020 14:33:59 +0200 Subject: [PATCH 2/2] REMOVE legacy script (not needed?) --- examples/branin/example_call.txt | 1 - scripts/evaluate.py | 59 -------------------------------- 2 files changed, 60 deletions(-) delete mode 100644 examples/branin/example_call.txt delete mode 100644 scripts/evaluate.py diff --git a/examples/branin/example_call.txt b/examples/branin/example_call.txt deleted file mode 100644 index f055318..0000000 --- a/examples/branin/example_call.txt +++ /dev/null @@ -1 +0,0 @@ -python ../../scripts/evaluate.py --scenario branin_scenario.txt --verbose_level DEBUG --history smac3-out/runhistory.json --modus forward-selection \ No newline at end of file diff --git a/scripts/evaluate.py b/scripts/evaluate.py deleted file mode 100644 index c986f3f..0000000 --- a/scripts/evaluate.py +++ /dev/null @@ -1,59 +0,0 @@ -import datetime -import inspect -import json -import logging -import os -import sys -import time - -cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0])) -cmd_folder = os.path.realpath(os.path.join(cmd_folder, "..")) -if cmd_folder not in sys.path: - sys.path.insert(0, cmd_folder) - -from pimp.importance.importance import Importance -from pimp.utils.io.cmd_reader import CMDs - -__author__ = "Andre Biedenkapp" -__copyright__ = "Copyright 2016, ML4AAD" -__license__ = "3-clause BSD" -__maintainer__ = "Andre Biedenkapp" -__email__ = "biedenka@cs.uni-freiburg.de" - -if __name__ == '__main__': - """ - Main Parameter importance script. - """ - cmd_reader = CMDs() - args, misc_ = cmd_reader.read_cmd() # read cmd args - logging.basicConfig(level=args.verbose_level) - ts = time.time() - ts = datetime.datetime.fromtimestamp(ts).strftime('%Y_%m_%d_%H:%M:%S') - save_folder = 'PIMP_%s_%s' % (args.modus, ts) - - importance = Importance(scenario_file=args.scenario_file, runhistory_file=args.history, - parameters_to_evaluate=args.num_params, - traj_file=args.trajectory, seed=args.seed, - save_folder=save_folder, - impute_censored=args.impute) # create importance object - save_folder += '_run1' - os.makedirs(save_folder, exist_ok=True) - with open(os.path.join(save_folder, 'pimp_args.json'), 'w') as out_file: - json.dump(args.__dict__, out_file, sort_keys=True, indent=4, separators=(',', ': ')) - result = importance.evaluate_scenario(args.modus, save_folder=save_folder) - - if args.modus == 'all': - with open(os.path.join(save_folder, 'pimp_values_%s.json' % args.modus), 'w') as out_file: - json.dump(result[0], out_file, sort_keys=True, indent=4, separators=(',', ': ')) - importance.plot_results(list(map(lambda x: os.path.join(save_folder, x.name.lower()), result[1])), - result[1], show=False) - if args.table: - importance.table_for_comparison(evaluators=result[1], name=os.path.join( - save_folder, 'pimp_table_%s.tex' % args.modus), style='latex') - else: - importance.table_for_comparison(evaluators=result[1], style='cmd') - else: - with open(os.path.join(save_folder, 'pimp_values_%s.json' % args.modus[0]), 'w') as out_file: - json.dump(result[0], out_file, sort_keys=True, indent=4, separators=(',', ': ')) - - importance.plot_results(name=os.path.join(save_folder, args.modus[0]), show=False)