diff --git a/.spyderproject b/.spyderproject deleted file mode 100644 index 1606cc8..0000000 Binary files a/.spyderproject and /dev/null differ diff --git a/.travis.yml b/.travis.yml index df6606f..02bfa62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,19 +7,20 @@ python: - '3.5' - '3.6' - '3.7-dev' -matrix: - include: - - os: osx - language: generic +#matrix: +# include: +# - os: osx +# language: generic cache: pip sudo: required -#matrix: -# allow_failures: -# - python: '2.7' -# - python: '3.5' -# - python: '3.6' +matrix: + allow_failures: + - python: '2.7' + - python: '3.5' + - python: '3.6' + - python: '3.7-dev' addons: @@ -58,8 +59,6 @@ before_install: - export PATH="$HOME/anaconda/bin:$PATH" - hash -r - conda config --set always_yes yes --set changeps1 no -#- conda update conda -y -#- conda update anaconda -y - conda info -a - conda config --add channels https://conda.anaconda.org/nlesc/label/dev @@ -73,21 +72,20 @@ before_install: - conda install -y coverage > tmp.txt && echo "alive" - conda install -y future > tmp.txt && echo "alive" - pip install coveralls > tmp.txt && echo "alive" -#- pip install future install: -- pip install xgboost > tmp.txt && echo "alive" -- pip uninstall pandas -y || echo pandas not installed -- conda install pandas -y +- if [[ "MAYOU_PYTHON_VERSION" == 2.7 ]] ; then + conda install pandas py-xgboost -y; + else + pip install xgboost > tmp.txt && echo "alive"; + fi +#- pip uninstall pandas -y || echo pandas not installed +#- pip install xgboost > tmp.txt && echo "alive" #- pip install -U -r requirements.txt -#- pip install -U rootpy root_numpy -# - pip install .[root] --no-dependencies -- pip install git+https://github.com/REPlegacy/rep -- ls -- pwd -- pip install .[all] +- pip install git+https://github.com/REPlegacy/rep -U +- pip install .[all] --process-dependency-links script: #- python -m unittest discover diff --git a/README.md b/README.md deleted file mode 100644 index b64e3c0..0000000 --- a/README.md +++ /dev/null @@ -1,96 +0,0 @@ -[![Code Health](https://landscape.io/github/mayou36/raredecay/master/landscape.svg?style=flat)](https://landscape.io/github/mayou36/raredecay/master) -[![Build Status](https://travis-ci.org/mayou36/raredecay.svg?branch=master)](https://travis-ci.org/mayou36/raredecay) -[![PyPI version](https://badge.fury.io/py/raredecay.svg)](https://badge.fury.io/py/raredecay) -[![Dependency Status](https://www.versioneye.com/user/projects/58273f1df09d22004f5914f9/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/58273f1df09d22004f5914f9) - - - - -# raredecay # - -This package consists of several tools for the event selection of particle decays, mostly built on machine learning techniques. -It contains: - -- a **data-container** holding data, weights, labels and more and implemented root-to-python data conversion as well as plots and KFold-data splitting -- **reweighting** tools from the hep_ml-repository wrapped in a KFolding structure and with metrics to evaluate the reweighting quality -- **classifier optimization** tools for hyper-parameters as well as feature selection involving a backward-elimination -- an **output handler** which makes it easy to add text as well as figures into your code and automatically save them to a file -- ... and more - -## HowTo examples ## - -To get an idea of the package, have a look at the howto notebooks: -[HTML version](https://mayou36.bitbucket.io/raredecay/howto/) or the -[IPython Notebooks](https://github.com/mayou36/raredecay/tree/master/howto) - -## Minimal example ## -Want to test whether your reweighting did overfit? Use train_similar: - -```python -import raredecay as rd - -mc_data = rd.data.HEPDataStorage(df, weights=*pd.Series weights*, target=0) -real_data = rd.data.HEPDataStorage(df, weights=*pd.Series weights*, target=1) - -score = rd.score.train_similar(mc_data, real_data, old_mc_weights=1 *or whatever weights the mc had before*) -``` - - -## Getting started right now ## - -If you want it the easy, fast way, have a look at the -[Ready-to-use scripts](https://github.com/mayou36/raredecay/tree/master/scripts_readyToUse). -All you need to do is to have a look at every "TODO" task and probably change them. Then you can run the script without the need of coding at all. - -## Documentation and API ## - -The API as well as the documentation: -[Documentation](https://mayou36.github.io/raredecay/) - -## Setup and installation ## - - -### Anaconda ### -Easiest way: use conda to install everything (except of the rep, which has to be upgraded with pip for some functionalities) - -``` -conda install raredecay -c mayou36 -``` - -### PyPI ### - -The package with all extras requires root_numpy as well as rootpy (and therefore a ROOT installation with python-bindings) to be installed on your system. If that is not the case, some functions won't work. - -If you want to install all the extra, first install the very newest version of REP (may also needed with conda install) -(the -U can be omitted, but is recommended to have the newest dependencies): -``` -pip install -U https://github.com/yandex/rep/archive/stratifiedkfold.zip -``` - - -Then, install the raredecay package (without ROOT-support) via - -``` -pip install raredecay -``` - -To make sure you can convert ROOT-NTuples, use - -``` -pip install raredecay[root] # *use raredecay\[root\] in a zsh-console* -``` - -or, instead of root/additionally (comma separated) `reweight` or `reweight` for the specific functionalities. - -In order to have all functionalities, use - -``` -pip install raredecay[all] -``` -As it is a young package still under developement, it may receive regular updates and improvements and it is probably a good idea to regularly download the newest package. - - -[pandas.DataFrame]: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html -[LabeledDataStorage]: http://yandex.github.io/rep/data.html#module-rep.data.storage -[numpy.array]: http://docs.scipy.org/doc/numpy-1.10.1/user/basics.rec.html -[rootTree]: https://root.cern.ch/doc/v606/classTTree.html diff --git a/README.rst b/README.rst index 9086641..ff8706b 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -|Code Health| |Build Status| |PyPI version| |Dependency Status| +|Code Health| |Build Status| |PyPI version| raredecay ========= @@ -34,10 +34,10 @@ Want to test whether your reweighting did overfit? Use train\_similar: .. code:: python - import raredecay as rd + import raredecay as rd - mc_data = rd.data.HEPDataStorage(df, weights=*pd.Series weights*, target=0) - real_data = rd.data.HEPDataStorage(df, weights=*pd.Series weights*, target=1) + mc_data = rd.data.HEPDataStorage(df, weights=*pd.Series weights*, target=0) + real_data = rd.data.HEPDataStorage(df, weights=*pd.Series weights*, target=1) score = rd.score.train_similar(mc_data, real_data, old_mc_weights=1 *or whatever weights the mc had before*) @@ -59,16 +59,6 @@ The API as well as the documentation: Setup and installation ---------------------- -Anaconda -~~~~~~~~ - -Easiest way: use conda to install everything (except of the rep, which -has to be upgraded with pip for some functionalities) - -:: - - conda install raredecay -c mayou36 - PyPI ~~~~ @@ -76,19 +66,24 @@ The package with all extras requires root\_numpy as well as rootpy (and therefore a ROOT installation with python-bindings) to be installed on your system. If that is not the case, some functions won't work. -If you want to install all the extra, first install the very newest -version of REP (may also needed with conda install) (the -U can be -omitted, but is recommended to have the newest dependencies): +Recommended installation (requires ROOT): + :: - pip install -U https://github.com/yandex/rep/archive/stratifiedkfold.zip + pip install raredecay[all] --process-dependency-links -Then, install the raredecay package (without ROOT-support) via +Anaconda +~~~~~~~~ + +Easiest way: use conda to install everything (except of the rep, which +has to be upgraded with pip for some functionalities) :: - pip install raredecay + conda install raredecay -c mayou36 + + To make sure you can convert ROOT-NTuples, use @@ -99,15 +94,6 @@ To make sure you can convert ROOT-NTuples, use or, instead of root/additionally (comma separated) ``reweight`` or ``reweight`` for the specific functionalities. -In order to have all functionalities, use - -:: - - pip install raredecay[all] - -As it is a young package still under developement, it may receive -regular updates and improvements and it is probably a good idea to -regularly download the newest package. .. |Code Health| image:: https://landscape.io/github/mayou36/raredecay/master/landscape.svg?style=flat :target: https://landscape.io/github/mayou36/raredecay/master diff --git a/raredecay/__init__.py b/raredecay/__init__.py index 9e5e9db..a9b456b 100644 --- a/raredecay/__init__.py +++ b/raredecay/__init__.py @@ -36,10 +36,10 @@ # Python 2 backwards compatibility overhead END -import raredecay.reweight, raredecay.config, raredecay.data, raredecay.ml, raredecay.score +from . import reweight, config, data, ml, score import raredecay.settings, raredecay.stat -__all__ = ["reweight", "config", "data", "ml", "score", "settings", "stat"] +__all__ = ["reweight", "config", "data", "ml", "score", "settings", "stat", "meta_config", "globals_"] __author__ = "Jonas Eschle 'Mayou36'" -__version__ = '2.0.2' +__version__ = '2.1.0' diff --git a/raredecay/analysis/physical_analysis.py b/raredecay/analysis/physical_analysis.py index 0cc25aa..6f1c319 100644 --- a/raredecay/analysis/physical_analysis.py +++ b/raredecay/analysis/physical_analysis.py @@ -68,98 +68,98 @@ def _cut(data): return data_tools.apply_cuts(*data) -def preselection_cut(signal_data, bkg_data, percent_sig_to_keep=100): - """Cut the bkg while maintaining a certain percent of the signal. WIP.""" - - # import raredecay.meta_config as meta_cfg - from raredecay.tools import data_tools - from raredecay.globals_ import out - # from raredecay.tools.data_storage import HEPDataStorage - - columns = signal_data.columns - signal_data.plot(figure="Before cut", title="Data comparison before cut") - signal_data.plot(figure="Signal comparison", title="Data comparison before cut vs after") - bkg_data.plot(figure="Background comparison", title="Data comparison before cut vs after") - bkg_data.plot(figure="Before cut") - bkg_length = len(bkg_data) - signal_length = len(signal_data) - signal_cp = signal_data.copy_storage() - bkg_cp = bkg_data.copy_storage() - signal_data = signal_data.pandasDF() - bkg_data = bkg_data.pandasDF() - - applied_cuts = {} - - percent_end = percent_sig_to_keep - percent_sig_to_keep = 100 - stepsize = 0.1 - keep = {} - - while True: - - # pool = multiprocessing.Pool(meta_cfg.n_cpu_max) - sig = np.array([signal_data.as_matrix()[:, i] for i, _t in enumerate(columns)]) - sig = copy.deepcopy(sig) - bkg = np.array([bkg_data.as_matrix()[:, i] for i, _t in enumerate(columns)]) - bkg = copy.deepcopy(bkg) - data = list(zip(sig, bkg, [percent_sig_to_keep] * len(columns))) - limits, rejection = [], [] - for sig, bkg, per in data: - temp = data_tools.apply_cuts(sig, bkg, per, bkg_length=bkg_length) - limits.append(temp[0]) - rejection.append(temp[1]) - # limits, rejection = pool.map(_cut, data) - i_max_rej = np.argmax(rejection) - max_rejection = np.max(rejection) - column, limits = columns[i_max_rej], limits[i_max_rej] - print(percent_sig_to_keep, percent_end) - if max_rejection < 0.001 and percent_sig_to_keep == 100: - if percent_end < 100: - percent_sig_to_keep -= stepsize - else: - break - elif percent_end <= percent_sig_to_keep < 100: - percent_end += stepsize - stepsize *= (100 - stepsize) / 100 - elif percent_sig_to_keep < percent_end: - break - - if column in applied_cuts: - max_rejection += applied_cuts[column]['reduction'] - applied_cuts[column] = {"limits": limits, "reduction": max_rejection} - - cuts = np.logical_and(signal_data[column] > limits[0], signal_data[column] < limits[1]) - signal_data = signal_data[cuts] - - cuts = np.logical_and(bkg_data[column] > limits[0], bkg_data[column] < limits[1]) - bkg_data = bkg_data[cuts] - print("We used " + column) - - # signal_data.hist(bins=30) - # bkg_data.hist(bins=30) - - signal_len_cut = len(np.array(signal_data.as_matrix()[:, 0])) - bkg_len_cut = len(np.array(bkg_data.as_matrix()[:, 0])) - signal_cp.set_data(signal_data) - signal_cp.plot(figure="Signal comparison") - signal_cp.plot(figure="Data cut plt", title="Data with cuts applied", log_y_axes=True) - - bkg_cp.set_data(bkg_data) - bkg_cp.plot(figure="Background comparison") - bkg_cp.plot(figure="Data cut plt", log_y_axes=True) - - out.add_output(applied_cuts, section="Preselection cuts report") - out.add_output(keep, section="All limits") - bkg_rejection = sum([i['reduction'] for i in list(applied_cuts.values())]) - out.add_output(["summed up Bkg rejection: ", bkg_rejection, "True rejection: ", - 100.0 - (bkg_len_cut / bkg_length), " True remaining signal: ", - signal_len_cut / signal_length], section="Total bkg rejection") - print(signal_len_cut) - print(signal_length) - print(bkg_len_cut) - print(bkg_length) - - return applied_cuts +# def preselection_cut(signal_data, bkg_data, percent_sig_to_keep=100): +# """Cut the bkg while maintaining a certain percent of the signal. WIP.""" +# +# # import raredecay.meta_config as meta_cfg +# from raredecay.tools import data_tools +# from raredecay.globals_ import out +# # from raredecay.tools.data_storage import HEPDataStorage +# +# columns = signal_data.columns +# signal_data.plot(figure="Before cut", title="Data comparison before cut") +# signal_data.plot(figure="Signal comparison", title="Data comparison before cut vs after") +# bkg_data.plot(figure="Background comparison", title="Data comparison before cut vs after") +# bkg_data.plot(figure="Before cut") +# bkg_length = len(bkg_data) +# signal_length = len(signal_data) +# signal_cp = signal_data.copy_storage() +# bkg_cp = bkg_data.copy_storage() +# signal_data = signal_data.pandasDF() +# bkg_data = bkg_data.pandasDF() +# +# applied_cuts = {} +# +# percent_end = percent_sig_to_keep +# percent_sig_to_keep = 100 +# stepsize = 0.1 +# keep = {} +# +# while True: +# +# # pool = multiprocessing.Pool(meta_cfg.n_cpu_max) +# sig = np.array([signal_data.as_matrix()[:, i] for i, _t in enumerate(columns)]) +# sig = copy.deepcopy(sig) +# bkg = np.array([bkg_data.as_matrix()[:, i] for i, _t in enumerate(columns)]) +# bkg = copy.deepcopy(bkg) +# data = list(zip(sig, bkg, [percent_sig_to_keep] * len(columns))) +# limits, rejection = [], [] +# for sig, bkg, per in data: +# temp = data_tools.apply_cuts(sig, bkg, per, bkg_length=bkg_length) +# limits.append(temp[0]) +# rejection.append(temp[1]) +# # limits, rejection = pool.map(_cut, data) +# i_max_rej = np.argmax(rejection) +# max_rejection = np.max(rejection) +# column, limits = columns[i_max_rej], limits[i_max_rej] +# print(percent_sig_to_keep, percent_end) +# if max_rejection < 0.001 and percent_sig_to_keep == 100: +# if percent_end < 100: +# percent_sig_to_keep -= stepsize +# else: +# break +# elif percent_end <= percent_sig_to_keep < 100: +# percent_end += stepsize +# stepsize *= (100 - stepsize) / 100 +# elif percent_sig_to_keep < percent_end: +# break +# +# if column in applied_cuts: +# max_rejection += applied_cuts[column]['reduction'] +# applied_cuts[column] = {"limits": limits, "reduction": max_rejection} +# +# cuts = np.logical_and(signal_data[column] > limits[0], signal_data[column] < limits[1]) +# signal_data = signal_data[cuts] +# +# cuts = np.logical_and(bkg_data[column] > limits[0], bkg_data[column] < limits[1]) +# bkg_data = bkg_data[cuts] +# print("We used " + column) +# +# # signal_data.hist(bins=30) +# # bkg_data.hist(bins=30) +# +# signal_len_cut = len(np.array(signal_data.as_matrix()[:, 0])) +# bkg_len_cut = len(np.array(bkg_data.as_matrix()[:, 0])) +# signal_cp.set_data(signal_data) +# signal_cp.plot(figure="Signal comparison") +# signal_cp.plot(figure="Data cut plt", title="Data with cuts applied", log_y_axes=True) +# +# bkg_cp.set_data(bkg_data) +# bkg_cp.plot(figure="Background comparison") +# bkg_cp.plot(figure="Data cut plt", log_y_axes=True) +# +# out.add_output(applied_cuts, section="Preselection cuts report") +# out.add_output(keep, section="All limits") +# bkg_rejection = sum([i['reduction'] for i in list(applied_cuts.values())]) +# out.add_output(["summed up Bkg rejection: ", bkg_rejection, "True rejection: ", +# 100.0 - (bkg_len_cut / bkg_length), " True remaining signal: ", +# signal_len_cut / signal_length], section="Total bkg rejection") +# print(signal_len_cut) +# print(signal_length) +# print(bkg_len_cut) +# print(bkg_length) +# +# return applied_cuts def feature_exploration(original_data, target_data, features=None, n_folds=10, diff --git a/raredecay/config.py b/raredecay/config.py index 9d8e894..e382146 100644 --- a/raredecay/config.py +++ b/raredecay/config.py @@ -36,6 +36,8 @@ # Python 2 backwards compatibility overhead END +__all__ = ['RUN_NAME', 'run_message', 'OUTPUT_CFG', 'save_fig_cfg', 'logger_cfg'] + RUN_NAME = 'Default run name' run_message = str("Default run message") diff --git a/raredecay/globals_.py b/raredecay/globals_.py index 096e2c4..ef9996d 100644 --- a/raredecay/globals_.py +++ b/raredecay/globals_.py @@ -82,6 +82,8 @@ import raredecay.meta_config as meta_cfg import raredecay.config as cfg +__all__ = ['out', 'logger_cfg', 'n_cpu_used', 'free_cpus'] + # ============================================================================== # Output handler. Contains methods "initialize" and "finalize" # ============================================================================== @@ -110,7 +112,3 @@ def free_cpus(): n_out = max([meta_cfg.n_cpu_max - n_cpu_used, 1]) return n_out - -if __name__ == '__main__': - print("Selftest start") - print("Selftest completed") diff --git a/raredecay/meta_config.py b/raredecay/meta_config.py index 47b4d2a..735f07e 100644 --- a/raredecay/meta_config.py +++ b/raredecay/meta_config.py @@ -40,8 +40,8 @@ try: # noqa from future.builtins.disabled import (apply, cmp, coerce, execfile, file, long, raw_input, # noqa - reduce, reload, unicode, xrange, StandardError, - ) # noqa + reduce, reload, unicode, xrange, StandardError, + ) # noqa from future.standard_library import install_aliases # noqa install_aliases() # noqa @@ -63,6 +63,17 @@ # endings are changed. # ============================================================================== +__all__ = ['PROMPT_FOR_COMMENT', 'MULTITHREAD', 'MULTIPROCESSING', 'n_cpu_max', 'use_gpu', 'use_stratified_folding', + 'get_n_cpu', 'set_parallel_profile', 'PICKLE_DATATYPE', 'ROOT_DATATYPE', + 'PICKLE_PATH', 'GIT_DIR_PATH', 'PICKLE_PROTOCOL', 'SUPPRESS_WRONG_SKLEARN_VERSION', + 'SUPPRESS_FUTURE_IMPORT_ERROR', 'MAX_AUTO_FOLDERS', 'NO_PROMPT_ASSUME_YES', + 'MAX_ERROR_COUNT', 'MAX_FIGURES', 'DEFAULT_OUTPUT_FOLDERS', 'DEFAULT_HIST_SETTINGS', + 'DEFAULT_SAVE_FIG', 'DEFAULT_EXT_SAVE_FIG', 'DEFAULT_LOGGER_CFG', 'DEFAULT_CLF_XGB', 'DEFAULT_CLF_TMVA', + 'DEFAULT_CLF_RDF', 'DEFAULT_CLF_GB', 'DEFAULT_CLF_ADA', 'DEFAULT_CLF_NN', 'DEFAULT_CLF_CONFIG', + 'DEFAULT_CLF_NAME', 'max_difference_feature_selection', 'DEFAULT_HYPER_GENERATOR', 'loggers', 'verbosity', + 'plot_verbosity', 'set_verbosity', 'set_plot_verbosity', 'rand_seed', 'randint', + 'randfloat', 'set_seed', 'error_occured', 'warning_occured'] + # ------------------------------------------------------------------------------ # General run parameters # ------------------------------------------------------------------------------ @@ -287,9 +298,6 @@ def set_parallel_profile(n_cpu=-1, gpu_in_use=False, stratified_kfolding=True): }], ) -DEFAULT_CLF_KNN = dict( - n_neigh=5 - ) # default clf config collection DEFAULT_CLF_CONFIG = dict( @@ -298,7 +306,6 @@ def set_parallel_profile(n_cpu=-1, gpu_in_use=False, stratified_kfolding=True): gb=DEFAULT_CLF_GB, ada=DEFAULT_CLF_ADA, nn=DEFAULT_CLF_NN, - knn=DEFAULT_CLF_KNN, rdf=DEFAULT_CLF_RDF ) diff --git a/raredecay/settings.py b/raredecay/settings.py index bded56d..2815874 100644 --- a/raredecay/settings.py +++ b/raredecay/settings.py @@ -34,6 +34,9 @@ basestring = str # noqa # Python 2 backwards compatibility overhead END +__all__ = ['initialize', 'finalize', 'set_verbosity', 'get_output_handler', 'parallel_profile', + 'figure_save_config', 'set_random_seed'] + import copy import raredecay.meta_config as meta_cfg diff --git a/requirements.txt b/requirements.txt index c2ecc27..c9486e4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,6 @@ pandas numpy matplotlib future +xgboost +rep>0.7.0 hep_ml>=0.5.0 diff --git a/setup.py b/setup.py index 50c6090..4422b74 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ here = os.path.abspath(os.path.dirname(__file__)) with io.open(os.path.join(here, 'requirements.txt')) as f: - requirements = f.read().split('\n') + requirements = f.read().splitlines() def readme(): @@ -24,7 +24,7 @@ def readme(): return f.read() -git_version = '2.0.2' +git_version = '2.1.0' extras_require = {'all': []} extras_require_tmp = { @@ -67,7 +67,7 @@ def readme(): author='Jonas Eschle', author_email='mayou36@jonas.eschle.com', license='Apache-2.0 License', - # dependency_links=['https://github.com/yandex/rep/archive/stratifiedkfold.zip'], + dependency_links=['https://github.com/REPlegacy/rep/tarball/master#egg=rep-0.7.3'], install_requires=requirements, extras_require=extras_require, packages=['raredecay', diff --git a/tests/raredecay_test/tools_test/data_storage_test/test_HEPDataStorage.py b/tests/raredecay_test/tools_test/data_storage_test/test_HEPDataStorage.py index b27c07e..13e3990 100644 --- a/tests/raredecay_test/tools_test/data_storage_test/test_HEPDataStorage.py +++ b/tests/raredecay_test/tools_test/data_storage_test/test_HEPDataStorage.py @@ -132,26 +132,21 @@ def test_initialization(self): nptest.assert_almost_equal(self.truth_weights_normalized2, self.ds2.get_weights()) - def test_get_name(self): - pass - - def test_name(self): - pass + # def test_get_name(self): + # pass + # + # def test_name(self): + # pass - def test__get_name(self): - pass - - def test__set_name(self): - pass def test_data_name(self): self.assertEqual(self.truth_name, self.ds.data_name) - def test_data_name_addition(self): - pass - - def test_fold_name(self): - pass + # def test_data_name_addition(self): + # pass + # + # def test_fold_name(self): + # pass def test_data_type(self): self.assertEqual(self.truth_data_type, self.ds.data_type, ) @@ -163,11 +158,6 @@ def test_get_index(self): def test_index(self): nptest.assert_almost_equal(self.truth_index, self.ds.index) - def test__make_index(self): - pass - - def test__set_index(self): - pass def test_columns(self): self.assertListEqual(self.truth_columns, self.ds.columns) @@ -178,14 +168,7 @@ def test_columns(self): self.ds.columns = copy.deepcopy(self.truth_columns) self.assertListEqual(self.truth_columns, self.ds.columns) - def test__set_columns(self): - pass - def test__set_length(self): - pass - - def test__get_data_type(self): - pass def test_data(self): pass @@ -197,14 +180,11 @@ def test_set_data(self): self._test_ds() self.ds = ds_original - def test__set_data(self): - pass def test_get_weights(self): nptest.assert_almost_equal(self.truth_weights, self.ds.get_weights(normalize=False)) - def test__get_weights(self): - pass + def test_set_weights(self): weights_original = self.ds.get_weights(normalize=False) @@ -220,8 +200,6 @@ def test_set_weights(self): self.ds.set_weights(weights_original) self.truth_weights = weights_truth_original - def test__set_weights(self): - pass def test_set_root_selection(self): pass @@ -237,8 +215,7 @@ def test_pandasDF(self): 'd': [32, 31, 35]}, index=index) pdtest.assert_frame_equal(indexed_df, self.ds.pandasDF(index=index)) - def test__make_df(self): - pass + def test_get_targets(self): indices = [1, 2, 5] @@ -247,8 +224,7 @@ def test_get_targets(self): nptest.assert_almost_equal(self.truth_targets, self.ds.get_targets()) nptest.assert_almost_equal(self.truth_targets, self.ds.targets) - def test__get_targets(self): - pass + def test_set_targets(self): targets_original = self.ds.get_targets() @@ -264,8 +240,6 @@ def test_set_targets(self): self.ds.set_targets(targets_original) self.truth_targets = targets_truth_original - def test__set_target(self): - pass def test_make_dataset(self): data, targets, weights = self.ds.make_dataset(second_storage=self.ds2, weights_ratio=0)