From 5deffa485ce693e397bd77a90336587c529770ee Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Wed, 2 Oct 2019 02:02:17 +0200 Subject: [PATCH 01/12] added kdd example --- examples/40_paper/2018_kdd_rijn_example.py | 58 ++++++++++++++++++++-- openml/evaluations/functions.py | 13 +++-- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/examples/40_paper/2018_kdd_rijn_example.py b/examples/40_paper/2018_kdd_rijn_example.py index 5e03f09a4f..37fc9688cb 100644 --- a/examples/40_paper/2018_kdd_rijn_example.py +++ b/examples/40_paper/2018_kdd_rijn_example.py @@ -8,9 +8,61 @@ ~~~~~~~~~~~ | Hyperparameter importance across datasets -| Jan van Rijn and Frank Hutter +| Jan N. van Rijn and Frank Hutter | In *Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining*, 2018 | Available at https://dl.acm.org/citation.cfm?id=3220058 - -This is currently a placeholder. """ +import fanova +import json +import logging +import matplotlib.pyplot as plt +import openml +import pandas as pd +import seaborn as sns + +suite_id = 14 +flow_id = 6969 +function = 'predictive_accuracy' +limit_per_task = 200 +n_trees = 16 +root = logging.getLogger() +root.setLevel(logging.INFO) + +suite = openml.study.get_suite(suite_id) + +fanova_results = [] +for idx, task_id in enumerate(suite.tasks): + logging.info('Starting with task %d (%d/%d)' % (task_id, idx+1, len(suite.tasks))) + try: + evals = openml.evaluations.list_evaluations_setups( + function, flow=[flow_id], task=[task_id], size=limit_per_task, output_format='dataframe') + except json.decoder.JSONDecodeError: + continue + # drop non-numeric rows + setups_evals = pd.DataFrame([dict(**setup['parameters'], **{'value': setup['value']}) + for _, setup in evals.iterrows()]).select_dtypes(include=['int64', 'float64']) + # drop rows with unique vals + setups_evals = setups_evals[[c for c in list(setups_evals) if len(setups_evals[c].unique()) > 1 or c == 'value']] + parameter_names = [pname for pname in setups_evals.columns.values if pname != 'value'] + evaluator = fanova.fanova.fANOVA(X=setups_evals[parameter_names].values, + Y=setups_evals['value'].values, + n_trees=n_trees) + for idx, pname in enumerate(parameter_names): + try: + fanova_results.append({ + 'hyperparameter': pname if len(pname) < 35 else '[...] %s' % pname[-30:], + 'fanova': evaluator.quantify_importance([idx])[(idx,)]['individual importance'] + }) + except RuntimeError: + continue + +fanova_results = pd.DataFrame(fanova_results) + + +fig, ax = plt.subplots() +sns.boxplot(x='hyperparameter', y='fanova', data=fanova_results, ax=ax) +ax.set_xticklabels(ax.get_xticklabels(), rotation=45, ha='right') +ax.set_ylabel('Variance Contribution') +ax.set_xlabel(None) +plt.tight_layout() +plt.show() diff --git a/openml/evaluations/functions.py b/openml/evaluations/functions.py index 6e67623fda..e7de9b38d7 100644 --- a/openml/evaluations/functions.py +++ b/openml/evaluations/functions.py @@ -1,4 +1,5 @@ import json +import logging import xmltodict import pandas as pd import numpy as np @@ -315,7 +316,6 @@ def list_evaluations_setups( evals = list_evaluations(function=function, offset=offset, size=size, id=id, task=task, setup=setup, flow=flow, uploader=uploader, tag=tag, per_fold=per_fold, sort_order=sort_order, output_format='dataframe') - # List setups # Split setups in evals into chunks of N setups as list_setups does not support large size df = pd.DataFrame() @@ -331,10 +331,15 @@ def list_evaluations_setups( setups = pd.concat([setups, result], ignore_index=True) parameters = [] # Convert parameters of setup into list of tuples of (hyperparameter, value) - for parameter_dict in setups['parameters']: + for idx, parameter_dict in enumerate(setups['parameters']): if parameter_dict is not None: - parameters.append({param['full_name']: param['value'] - for param in parameter_dict.values()}) + try: + parameters.append({param['full_name']: json.loads(param['value']) + for param in parameter_dict.values()}) + except json.decoder.JSONDecodeError as e: + logging.error('Can not properly parse all parameter values for ' + 'setup %d' % setups.iloc[idx]['setup_id']) + raise e else: parameters.append({}) setups['parameters'] = parameters From d5117170437c1e82c84d730dca0c7eaeeb1d0f9f Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Mon, 7 Oct 2019 23:41:22 +0200 Subject: [PATCH 02/12] finalized example --- examples/40_paper/2018_kdd_rijn_example.py | 97 +++++++++++++++++----- openml/evaluations/functions.py | 2 +- 2 files changed, 77 insertions(+), 22 deletions(-) diff --git a/examples/40_paper/2018_kdd_rijn_example.py b/examples/40_paper/2018_kdd_rijn_example.py index 37fc9688cb..b1c96b7c6b 100644 --- a/examples/40_paper/2018_kdd_rijn_example.py +++ b/examples/40_paper/2018_kdd_rijn_example.py @@ -20,45 +20,100 @@ import pandas as pd import seaborn as sns -suite_id = 14 -flow_id = 6969 -function = 'predictive_accuracy' -limit_per_task = 200 -n_trees = 16 root = logging.getLogger() root.setLevel(logging.INFO) -suite = openml.study.get_suite(suite_id) +############################################################################## +# With the advent of automated machine learning, automated hyperparameter +# optimization methods are by now routinely used in data mining. However, this +# progress is not yet matched by equal progress on automatic analyses that +# yield information beyond performance-optimizing hyperparameter settings. +# In this example, we aim to answer the following two questions: Given an +# algorithm, what are generally its most important hyperparameters? +# +# This work is carried out on the OpenML-100 benchmark suite, which can be +# obtained by `openml.study.get_suite('OpenML100')`. In this example, we +# conduct the experiment on the Support Vector Machine (`flow_id=7707`) +# with specific kernel (we will perform a post-process filter operation for +# this). We should set some other experimental parameters (number of results +# per task, evaluation measure and the number of trees of the internal +# functional Anova) before the fun can begin. +# +# Note that we simplify the example in several ways +# 1) We only consider numerical hyperparameters +# 2) We consider all hyperparameters that are numerical (in reality, some +# hyperparameters might be inactive (e.g., `degree`) or irrelevant (e.g., +# `random_state`) +# 3) We assume all hyperparameters to be on uniform scale +# +# Any difference in conclusion between the actual paper and the presented +# results is most likely due to one of these simplifications. For example, +# # the hyperparameter C looks rather insignificant, whereas it is quite +# important when it is put on a log-scale. All these simplifications can be +# addressed by defining a ConfigSpace. For a more elaborated example that uses +# this, please see: +# https://github.com/janvanrijn/openml-pimp/blob/d0a14f3eb480f2a90008889f00041bdccc7b9265/examples/plot/plot_fanova_aggregates.py # noqa F401 + +suite = openml.study.get_suite('OpenML100') +flow_id = 7707 +parameter_filters = { + 'sklearn.svm.classes.SVC(17)_kernel': 'sigmoid' +} +evaluation_measure = 'predictive_accuracy' +limit_per_task = 500 +n_trees = 16 fanova_results = [] +# we will obtain all results from OpenML per task. Practice has shown that this places the bottleneck on the +# communication with OpenML, and for iterated experimenting it is better to cache the results in a local file. for idx, task_id in enumerate(suite.tasks): logging.info('Starting with task %d (%d/%d)' % (task_id, idx+1, len(suite.tasks))) + evals = openml.evaluations.list_evaluations_setups( + evaluation_measure, flow=[flow_id], task=[task_id], size=limit_per_task, output_format='dataframe') + + performance_column = 'value' + # make a DataFrame consisting of all hyperparameters (which is a dict in setup['parameters']) and the performance + # value (in setup['value']). The following line looks a bit complicated, but combines 2 tasks: a) combine + # hyperparameters and performance data in a single dict, b) cast hyperparameter values to the appropriate format + # Note that try: - evals = openml.evaluations.list_evaluations_setups( - function, flow=[flow_id], task=[task_id], size=limit_per_task, output_format='dataframe') - except json.decoder.JSONDecodeError: + setups_evals = pd.DataFrame([dict(**{name: json.loads(value) for name, value in setup['parameters'].items()}, + **{performance_column: setup[performance_column]}) + for _, setup in evals.iterrows()]) + except json.decoder.JSONDecodeError as e: + logging.warning('Task %d error: %s' % (task_id, e)) continue - # drop non-numeric rows - setups_evals = pd.DataFrame([dict(**setup['parameters'], **{'value': setup['value']}) - for _, setup in evals.iterrows()]).select_dtypes(include=['int64', 'float64']) - # drop rows with unique vals - setups_evals = setups_evals[[c for c in list(setups_evals) if len(setups_evals[c].unique()) > 1 or c == 'value']] - parameter_names = [pname for pname in setups_evals.columns.values if pname != 'value'] - evaluator = fanova.fanova.fANOVA(X=setups_evals[parameter_names].values, - Y=setups_evals['value'].values, - n_trees=n_trees) + # apply our filters, to have only the setups that comply to the hyperparameters we want + for filter_key, filter_value in parameter_filters.items(): + setups_evals = setups_evals[setups_evals[filter_key] == filter_value] + # in this simplified example, we only display numerical and float hyperparameters. For categorical hyperparameters, + # the fanova library needs to be informed by using a configspace object. + setups_evals = setups_evals.select_dtypes(include=['int64', 'float64']) + # drop rows with unique values. These are by definition not an interesting hyperparameter, e.g., `axis`, `verbose` + setups_evals = setups_evals[[c for c in list(setups_evals) + if len(setups_evals[c].unique()) > 1 or c == performance_column]] + # determine x values to pass to fanova library + parameter_names = [pname for pname in setups_evals.columns.values if pname != performance_column] + evaluator = fanova.fanova.fANOVA( + X=setups_evals[parameter_names].values, Y=setups_evals[performance_column].values, n_trees=n_trees) for idx, pname in enumerate(parameter_names): try: fanova_results.append({ 'hyperparameter': pname if len(pname) < 35 else '[...] %s' % pname[-30:], 'fanova': evaluator.quantify_importance([idx])[(idx,)]['individual importance'] }) - except RuntimeError: - continue + except RuntimeError as e: + # functional ANOVA sometimes crashes with a RuntimeError, e.g., on tasks where the performance is constant + # for all configurations (there is no variance) + logging.warning('Task %d error: %s' % (task_id, e)) +# transform fanova_results from a list of dicts into a DataFrame fanova_results = pd.DataFrame(fanova_results) - +############################################################################## +# make the boxplot of the variance contribution. Obviously, we can also use this data to make the Nemenyi plot, but this +# relies on the rather complex `Orange` dependency (`pip install Orange3`). For the complete example, the reader is +# referred to the more elaborate script (referred to earlier) fig, ax = plt.subplots() sns.boxplot(x='hyperparameter', y='fanova', data=fanova_results, ax=ax) ax.set_xticklabels(ax.get_xticklabels(), rotation=45, ha='right') diff --git a/openml/evaluations/functions.py b/openml/evaluations/functions.py index c105c21439..2ce897ca57 100644 --- a/openml/evaluations/functions.py +++ b/openml/evaluations/functions.py @@ -343,7 +343,7 @@ def list_evaluations_setups( for idx, parameter_dict in enumerate(setups['parameters']): if parameter_dict is not None: try: - parameters.append({param['full_name']: json.loads(param['value']) + parameters.append({param['full_name']: param['value'] for param in parameter_dict.values()}) except json.decoder.JSONDecodeError as e: logging.error('Can not properly parse all parameter values for ' From f1f3a84dd316e980c6f539ade4818aac6f9fb239 Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Mon, 7 Oct 2019 23:46:10 +0200 Subject: [PATCH 03/12] undo extension --- openml/evaluations/functions.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/openml/evaluations/functions.py b/openml/evaluations/functions.py index 2ce897ca57..53959e0630 100644 --- a/openml/evaluations/functions.py +++ b/openml/evaluations/functions.py @@ -1,5 +1,4 @@ import json -import logging import xmltodict import pandas as pd import numpy as np @@ -340,15 +339,10 @@ def list_evaluations_setups( setups = pd.concat([setups, result], ignore_index=True) parameters = [] # Convert parameters of setup into list of tuples of (hyperparameter, value) - for idx, parameter_dict in enumerate(setups['parameters']): + for parameter_dict in setups['parameters']: if parameter_dict is not None: - try: - parameters.append({param['full_name']: param['value'] - for param in parameter_dict.values()}) - except json.decoder.JSONDecodeError as e: - logging.error('Can not properly parse all parameter values for ' - 'setup %d' % setups.iloc[idx]['setup_id']) - raise e + parameters.append({param['full_name']: param['value'] + for param in parameter_dict.values()}) else: parameters.append({}) setups['parameters'] = parameters From 65f5a43b416148edc9707175f46c5660678212fd Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Mon, 7 Oct 2019 23:46:41 +0200 Subject: [PATCH 04/12] undo format --- openml/evaluations/functions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openml/evaluations/functions.py b/openml/evaluations/functions.py index 53959e0630..38c31ad12e 100644 --- a/openml/evaluations/functions.py +++ b/openml/evaluations/functions.py @@ -324,6 +324,7 @@ def list_evaluations_setups( evals = list_evaluations(function=function, offset=offset, size=size, id=id, task=task, setup=setup, flow=flow, uploader=uploader, tag=tag, per_fold=per_fold, sort_order=sort_order, output_format='dataframe') + # List setups # Split setups in evals into chunks of N setups as list_setups does not support large size df = pd.DataFrame() From 52550a50d14d06cc621aeaec8d8e67003a32b7ce Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Tue, 8 Oct 2019 14:33:42 +0200 Subject: [PATCH 05/12] incorporated review MF --- ci_scripts/install.sh | 1 + examples/40_paper/2018_kdd_rijn_example.py | 48 ++++++++++++++-------- setup.py | 1 + 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/ci_scripts/install.sh b/ci_scripts/install.sh index ee8ec3b14d..ca0e4f5edd 100644 --- a/ci_scripts/install.sh +++ b/ci_scripts/install.sh @@ -37,6 +37,7 @@ python -c "import numpy; print('numpy %s' % numpy.__version__)" python -c "import scipy; print('scipy %s' % scipy.__version__)" if [[ "$EXAMPLES" == "true" ]]; then + conda install gxx_linux-64 gcc_linux-64 swig pip install -e '.[examples]' fi if [[ "$DOCTEST" == "true" ]]; then diff --git a/examples/40_paper/2018_kdd_rijn_example.py b/examples/40_paper/2018_kdd_rijn_example.py index b1c96b7c6b..6475a25068 100644 --- a/examples/40_paper/2018_kdd_rijn_example.py +++ b/examples/40_paper/2018_kdd_rijn_example.py @@ -12,14 +12,16 @@ | In *Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining*, 2018 | Available at https://dl.acm.org/citation.cfm?id=3220058 """ -import fanova import json import logging + +import fanova import matplotlib.pyplot as plt -import openml import pandas as pd import seaborn as sns +import openml + root = logging.getLogger() root.setLevel(logging.INFO) @@ -32,8 +34,8 @@ # algorithm, what are generally its most important hyperparameters? # # This work is carried out on the OpenML-100 benchmark suite, which can be -# obtained by `openml.study.get_suite('OpenML100')`. In this example, we -# conduct the experiment on the Support Vector Machine (`flow_id=7707`) +# obtained by ``openml.study.get_suite('OpenML100')``. In this example, we +# conduct the experiment on the Support Vector Machine (``flow_id=7707``) # with specific kernel (we will perform a post-process filter operation for # this). We should set some other experimental parameters (number of results # per task, evaluation measure and the number of trees of the internal @@ -42,8 +44,8 @@ # Note that we simplify the example in several ways # 1) We only consider numerical hyperparameters # 2) We consider all hyperparameters that are numerical (in reality, some -# hyperparameters might be inactive (e.g., `degree`) or irrelevant (e.g., -# `random_state`) +# hyperparameters might be inactive (e.g., ``degree``) or irrelevant +# (e.g., ``random_state``) # 3) We assume all hyperparameters to be on uniform scale # # Any difference in conclusion between the actual paper and the presented @@ -61,13 +63,17 @@ } evaluation_measure = 'predictive_accuracy' limit_per_task = 500 +limit_nr_tasks = 15 n_trees = 16 fanova_results = [] # we will obtain all results from OpenML per task. Practice has shown that this places the bottleneck on the # communication with OpenML, and for iterated experimenting it is better to cache the results in a local file. for idx, task_id in enumerate(suite.tasks): - logging.info('Starting with task %d (%d/%d)' % (task_id, idx+1, len(suite.tasks))) + if limit_nr_tasks is not None and idx >= limit_nr_tasks: + continue + logging.info('Starting with task %d (%d/%d)' % (task_id, idx+1, + len(suite.tasks) if limit_nr_tasks is None else limit_nr_tasks)) evals = openml.evaluations.list_evaluations_setups( evaluation_measure, flow=[flow_id], task=[task_id], size=limit_per_task, output_format='dataframe') @@ -75,7 +81,9 @@ # make a DataFrame consisting of all hyperparameters (which is a dict in setup['parameters']) and the performance # value (in setup['value']). The following line looks a bit complicated, but combines 2 tasks: a) combine # hyperparameters and performance data in a single dict, b) cast hyperparameter values to the appropriate format - # Note that + # Note that the ``json.loads(...)`` requires the content to be in JSON format, which is only the case for + # scikit-learn setups (and even there some legacy setups might violate this requirement). It will work for the + # setups that belong to the flows embedded in this example though. try: setups_evals = pd.DataFrame([dict(**{name: json.loads(value) for name, value in setup['parameters'].items()}, **{performance_column: setup[performance_column]}) @@ -89,13 +97,18 @@ # in this simplified example, we only display numerical and float hyperparameters. For categorical hyperparameters, # the fanova library needs to be informed by using a configspace object. setups_evals = setups_evals.select_dtypes(include=['int64', 'float64']) - # drop rows with unique values. These are by definition not an interesting hyperparameter, e.g., `axis`, `verbose` + # drop rows with unique values. These are by definition not an interesting hyperparameter, e.g., ``axis``, + # ``verbose``. setups_evals = setups_evals[[c for c in list(setups_evals) if len(setups_evals[c].unique()) > 1 or c == performance_column]] + # We are done with processing ``setups_evals``. Note that we still might have some irrelevant hyperparameters, e.g., + # ``random_state``. We have dropped some relevant hyperparameters, i.e., several categoricals. Let's check it out: + print(setups_evals.dtypes) + # determine x values to pass to fanova library - parameter_names = [pname for pname in setups_evals.columns.values if pname != performance_column] + parameter_names = [pname for pname in setups_evals.columns.to_numpy() if pname != performance_column] evaluator = fanova.fanova.fANOVA( - X=setups_evals[parameter_names].values, Y=setups_evals[performance_column].values, n_trees=n_trees) + X=setups_evals[parameter_names].to_numpy(), Y=setups_evals[performance_column].to_numpy(), n_trees=n_trees) for idx, pname in enumerate(parameter_names): try: fanova_results.append({ @@ -104,16 +117,19 @@ }) except RuntimeError as e: # functional ANOVA sometimes crashes with a RuntimeError, e.g., on tasks where the performance is constant - # for all configurations (there is no variance) + # for all configurations (there is no variance). We will skip these tasks (like the authors did in the + # paper). logging.warning('Task %d error: %s' % (task_id, e)) + continue -# transform fanova_results from a list of dicts into a DataFrame +# transform ``fanova_results`` from a list of dicts into a DataFrame fanova_results = pd.DataFrame(fanova_results) ############################################################################## -# make the boxplot of the variance contribution. Obviously, we can also use this data to make the Nemenyi plot, but this -# relies on the rather complex `Orange` dependency (`pip install Orange3`). For the complete example, the reader is -# referred to the more elaborate script (referred to earlier) +# make the boxplot of the variance contribution. Obviously, we can also use +# this data to make the Nemenyi plot, but this relies on the rather complex +# ``Orange`` dependency (``pip install Orange3``). For the complete example, +# the reader is referred to the more elaborate script (referred to earlier) fig, ax = plt.subplots() sns.boxplot(x='hyperparameter', y='fanova', data=fanova_results, ax=ax) ax.set_xticklabels(ax.get_xticklabels(), rotation=45, ha='right') diff --git a/setup.py b/setup.py index 52de238aae..cca15fb8a9 100644 --- a/setup.py +++ b/setup.py @@ -52,6 +52,7 @@ 'flaky', ], 'examples': [ + 'fanova', 'matplotlib', 'jupyter', 'notebook', From a26d8e69314ea2ddd6fd57017211e1f94010b47c Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Tue, 8 Oct 2019 19:26:05 +0200 Subject: [PATCH 06/12] incorporated more reviews --- ci_scripts/install.sh | 1 + examples/40_paper/2018_kdd_rijn_example.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ci_scripts/install.sh b/ci_scripts/install.sh index ca0e4f5edd..fcf719c96d 100644 --- a/ci_scripts/install.sh +++ b/ci_scripts/install.sh @@ -41,6 +41,7 @@ if [[ "$EXAMPLES" == "true" ]]; then pip install -e '.[examples]' fi if [[ "$DOCTEST" == "true" ]]; then + conda install gxx_linux-64 gcc_linux-64 swig pip install sphinx_bootstrap_theme fi if [[ "$COVERAGE" == "true" ]]; then diff --git a/examples/40_paper/2018_kdd_rijn_example.py b/examples/40_paper/2018_kdd_rijn_example.py index 6475a25068..016092643a 100644 --- a/examples/40_paper/2018_kdd_rijn_example.py +++ b/examples/40_paper/2018_kdd_rijn_example.py @@ -41,7 +41,8 @@ # per task, evaluation measure and the number of trees of the internal # functional Anova) before the fun can begin. # -# Note that we simplify the example in several ways +# Note that we simplify the example in several ways: +# # 1) We only consider numerical hyperparameters # 2) We consider all hyperparameters that are numerical (in reality, some # hyperparameters might be inactive (e.g., ``degree``) or irrelevant @@ -50,7 +51,7 @@ # # Any difference in conclusion between the actual paper and the presented # results is most likely due to one of these simplifications. For example, -# # the hyperparameter C looks rather insignificant, whereas it is quite +# the hyperparameter C looks rather insignificant, whereas it is quite # important when it is put on a log-scale. All these simplifications can be # addressed by defining a ConfigSpace. For a more elaborated example that uses # this, please see: @@ -74,6 +75,7 @@ continue logging.info('Starting with task %d (%d/%d)' % (task_id, idx+1, len(suite.tasks) if limit_nr_tasks is None else limit_nr_tasks)) + # note that we explicitly only include tasks from the benchmark suite that was specified (as per the for-loop) evals = openml.evaluations.list_evaluations_setups( evaluation_measure, flow=[flow_id], task=[task_id], size=limit_per_task, output_format='dataframe') From 33037c4774265261b3a1a6c1ce454c8455ece450 Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Tue, 8 Oct 2019 21:37:28 +0200 Subject: [PATCH 07/12] changed swig installation --- ci_scripts/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci_scripts/install.sh b/ci_scripts/install.sh index fcf719c96d..01189366c7 100644 --- a/ci_scripts/install.sh +++ b/ci_scripts/install.sh @@ -41,9 +41,11 @@ if [[ "$EXAMPLES" == "true" ]]; then pip install -e '.[examples]' fi if [[ "$DOCTEST" == "true" ]]; then - conda install gxx_linux-64 gcc_linux-64 swig pip install sphinx_bootstrap_theme fi +if [[ "$DOCPUSH" == "true" ]]; then + conda install gxx_linux-64 gcc_linux-64 swig +fi if [[ "$COVERAGE" == "true" ]]; then pip install codecov pytest-cov fi From f1849850d450bd934edd47ab6ea3b2d544d225ee Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Tue, 8 Oct 2019 22:28:05 +0200 Subject: [PATCH 08/12] updated installer --- ci_scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_scripts/install.sh b/ci_scripts/install.sh index 01189366c7..0014393037 100644 --- a/ci_scripts/install.sh +++ b/ci_scripts/install.sh @@ -44,7 +44,7 @@ if [[ "$DOCTEST" == "true" ]]; then pip install sphinx_bootstrap_theme fi if [[ "$DOCPUSH" == "true" ]]; then - conda install gxx_linux-64 gcc_linux-64 swig + conda install --yes gxx_linux-64 gcc_linux-64 swig fi if [[ "$COVERAGE" == "true" ]]; then pip install codecov pytest-cov From e375afd92c85037eab2a0c6d7e50bdec939620b8 Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Tue, 8 Oct 2019 23:08:52 +0200 Subject: [PATCH 09/12] added examples installation --- ci_scripts/install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci_scripts/install.sh b/ci_scripts/install.sh index 0014393037..687dd026b9 100644 --- a/ci_scripts/install.sh +++ b/ci_scripts/install.sh @@ -37,7 +37,7 @@ python -c "import numpy; print('numpy %s' % numpy.__version__)" python -c "import scipy; print('scipy %s' % scipy.__version__)" if [[ "$EXAMPLES" == "true" ]]; then - conda install gxx_linux-64 gcc_linux-64 swig + conda install --yes gxx_linux-64 gcc_linux-64 swig pip install -e '.[examples]' fi if [[ "$DOCTEST" == "true" ]]; then @@ -45,6 +45,7 @@ if [[ "$DOCTEST" == "true" ]]; then fi if [[ "$DOCPUSH" == "true" ]]; then conda install --yes gxx_linux-64 gcc_linux-64 swig + pip install -e '.[examples]' fi if [[ "$COVERAGE" == "true" ]]; then pip install codecov pytest-cov From e86e4a6d61f3c1e11f0a10825f07a36c340f105b Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Thu, 10 Oct 2019 23:24:30 +0200 Subject: [PATCH 10/12] added examples unix --- ci_scripts/install.sh | 2 ++ examples/40_paper/2018_kdd_rijn_example.py | 7 +++++++ setup.py | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ci_scripts/install.sh b/ci_scripts/install.sh index 687dd026b9..eb3def322b 100644 --- a/ci_scripts/install.sh +++ b/ci_scripts/install.sh @@ -39,6 +39,7 @@ python -c "import scipy; print('scipy %s' % scipy.__version__)" if [[ "$EXAMPLES" == "true" ]]; then conda install --yes gxx_linux-64 gcc_linux-64 swig pip install -e '.[examples]' + pip install -e '.[examples_unix]' fi if [[ "$DOCTEST" == "true" ]]; then pip install sphinx_bootstrap_theme @@ -46,6 +47,7 @@ fi if [[ "$DOCPUSH" == "true" ]]; then conda install --yes gxx_linux-64 gcc_linux-64 swig pip install -e '.[examples]' + pip install -e '.[examples_unix]' fi if [[ "$COVERAGE" == "true" ]]; then pip install codecov pytest-cov diff --git a/examples/40_paper/2018_kdd_rijn_example.py b/examples/40_paper/2018_kdd_rijn_example.py index 016092643a..b6327140dd 100644 --- a/examples/40_paper/2018_kdd_rijn_example.py +++ b/examples/40_paper/2018_kdd_rijn_example.py @@ -4,6 +4,9 @@ A tutorial on how to reproduce the paper *Hyperparameter Importance Across Datasets*. +This is a Unix-only tutorial, as the requirements can not be satisfied on a Windows machine (Untested on other +systems). + Publication ~~~~~~~~~~~ @@ -14,7 +17,11 @@ """ import json import logging +import sys +if sys.platform == 'win32': # noqa + logging.warning('The pyrfr library (requirement of fanova) can currently not be installed on Windows systems') + exit() import fanova import matplotlib.pyplot as plt import pandas as pd diff --git a/setup.py b/setup.py index cca15fb8a9..ecc76536d0 100644 --- a/setup.py +++ b/setup.py @@ -52,7 +52,6 @@ 'flaky', ], 'examples': [ - 'fanova', 'matplotlib', 'jupyter', 'notebook', @@ -62,6 +61,9 @@ 'ipython', 'ipykernel', 'seaborn' + ], + 'examples_unix': [ + 'fanova', ] }, test_suite="pytest", From feb57c271be467c1374eedbaef1e9a0bcb29844a Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Thu, 10 Oct 2019 23:39:12 +0200 Subject: [PATCH 11/12] fixed indentation --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index ecc76536d0..c968f4e269 100644 --- a/setup.py +++ b/setup.py @@ -63,7 +63,7 @@ 'seaborn' ], 'examples_unix': [ - 'fanova', + 'fanova', ] }, test_suite="pytest", From 807d33c1dc1cf04c5bbab042079a842565e8016f Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Fri, 11 Oct 2019 15:09:22 +0200 Subject: [PATCH 12/12] fixes ci script --- ci_scripts/install.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ci_scripts/install.sh b/ci_scripts/install.sh index eb3def322b..a2fd9bfb0e 100644 --- a/ci_scripts/install.sh +++ b/ci_scripts/install.sh @@ -36,18 +36,12 @@ pip install -e '.[test]' python -c "import numpy; print('numpy %s' % numpy.__version__)" python -c "import scipy; print('scipy %s' % scipy.__version__)" -if [[ "$EXAMPLES" == "true" ]]; then - conda install --yes gxx_linux-64 gcc_linux-64 swig - pip install -e '.[examples]' - pip install -e '.[examples_unix]' -fi if [[ "$DOCTEST" == "true" ]]; then pip install sphinx_bootstrap_theme fi if [[ "$DOCPUSH" == "true" ]]; then conda install --yes gxx_linux-64 gcc_linux-64 swig - pip install -e '.[examples]' - pip install -e '.[examples_unix]' + pip install -e '.[examples,examples_unix]' fi if [[ "$COVERAGE" == "true" ]]; then pip install codecov pytest-cov