repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
spegg
spegg-master/tests/googletest/googlemock/scripts/generator/cpp/gmock_class_test.py
#!/usr/bin/env python # # Copyright 2009 Neal Norwitz All Rights Reserved. # Portions Copyright 2009 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
11,356
24.293987
78
py
spegg
spegg-master/tests/googletest/googlemock/scripts/generator/cpp/utils.py
#!/usr/bin/env python # # Copyright 2007 Neal Norwitz # Portions Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
1,153
26.47619
74
py
spegg
spegg-master/tests/googletest/googlemock/scripts/generator/cpp/__init__.py
0
0
0
py
spegg
spegg-master/tests/googletest/googlemock/scripts/generator/cpp/ast.py
#!/usr/bin/env python # # Copyright 2007 Neal Norwitz # Portions Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
62,773
35.201845
82
py
spegg
spegg-master/tests/googletest/googlemock/scripts/generator/cpp/tokenize.py
#!/usr/bin/env python # # Copyright 2007 Neal Norwitz # Portions Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
9,752
32.864583
79
py
deephyper
deephyper-master/setup.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Note: To use the 'upload' functionality of this file, you must: # $ pip install twine import os import platform import sys from shutil import rmtree from setuptools import Command, setup # path of the directory where this file is located here = os.path.abspath(os.pa...
5,761
25.552995
93
py
deephyper
deephyper-master/examples/plot_from_serial_to_parallel_hyperparameter_search.py
# -*- coding: utf-8 -*- """ From Serial to Parallel Evaluations =================================== **Author(s)**: Romain Egele. This example demonstrates the advantages of parallel evaluations over serial evaluations. We start by defining an artificial black-box ``run``-function by using the Ackley function: .. ima...
3,321
39.512195
590
py
deephyper
deephyper-master/examples/plot_transfer_learning_for_hps.py
# -*- coding: utf-8 -*- """ Transfer Learning for Hyperparameter Search =========================================== **Author(s)**: Romain Egele. In this example we present how to apply transfer-learning for hyperparameter search. Let's assume you have a bunch of similar tasks for example the search of neural networks...
3,293
36.431818
1,014
py
deephyper
deephyper-master/examples/black_box_util.py
"""Set of Black-Box functions useful to build examples. """ import time import numpy as np from deephyper.evaluator import profile def ackley(x, a=20, b=0.2, c=2 * np.pi): d = len(x) s1 = np.sum(x**2) s2 = np.sum(np.cos(c * x)) term1 = -a * np.exp(-b * np.sqrt(s1 / d)) term2 = -np.exp(s2 / d) ...
820
26.366667
68
py
deephyper
deephyper-master/examples/plot_notify_failures_hyperparameter_search.py
# -*- coding: utf-8 -*- """ Notify Failures in Hyperparameter optimization ============================================== **Author(s)**: Romain Egele. This example demonstrates how to handle failure of objectives in hyperparameter search. In many cases such as software auto-tuning (where we minimize the run-time of ...
3,235
42.146667
760
py
deephyper
deephyper-master/examples/plot_profile_worker_utilization.py
# -*- coding: utf-8 -*- """ Profile the Worker Utilization ============================== **Author(s)**: Romain Egele. This example demonstrates the advantages of parallel evaluations over serial evaluations. We start by defining an artificial black-box ``run``-function by using the Ackley function: .. image:: https...
3,542
31.805556
657
py
deephyper
deephyper-master/tests/conftest.py
import pytest # -- Control skipping of tests according to command line option def pytest_addoption(parser): parser.addoption( "--run", default="fast,hps", help="Select tests to run.", ) def pytest_collection_modifyitems(config, items): selected_marks = set(config.getoption("--ru...
1,138
28.973684
83
py
deephyper
deephyper-master/tests/test_quickstart.py
import pytest def run(job): # The suggested parameters are accessible in job.parameters (dict) x = job.parameters["x"] b = job.parameters["b"] if job.parameters["function"] == "linear": y = x + b elif job.parameters["function"] == "cubic": y = x**3 + b # Maximization! ret...
1,432
25.537037
88
py
deephyper
deephyper-master/tests/deephyper/skopt/test_space.py
import pytest import numbers import numpy as np import os import yaml from tempfile import NamedTemporaryFile from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal from numpy.testing import assert_equal from numpy.testing import assert_raises_regex from deephyper.skopt impor...
27,583
31.186698
88
py
deephyper
deephyper-master/tests/deephyper/skopt/test_optimizer.py
import numpy as np import pytest from sklearn.multioutput import MultiOutputRegressor from numpy.testing import assert_array_equal from numpy.testing import assert_equal from numpy.testing import assert_raises from deephyper.skopt import gp_minimize from deephyper.skopt import forest_minimize from deephyper.skopt.ben...
14,307
28.501031
87
py
deephyper
deephyper-master/tests/deephyper/skopt/test_gp_opt.py
import numpy as np from numpy.testing import assert_array_equal import pytest from deephyper.skopt import gp_minimize from deephyper.skopt.benchmarks import bench1 from deephyper.skopt.benchmarks import bench2 from deephyper.skopt.benchmarks import bench3 from deephyper.skopt.benchmarks import bench4 from deephyper.sk...
5,703
26.291866
87
py
deephyper
deephyper-master/tests/deephyper/skopt/test_gpr.py
import pytest import numpy as np from deephyper.skopt.learning import GaussianProcessRegressor @pytest.mark.hps def test_gpr_uses_noise(): """Test that gpr is using WhiteKernel""" X = np.random.normal(size=[100, 2]) Y = np.random.normal(size=[100]) g_gaussian = GaussianProcessRegressor(noise="gauss...
431
23
61
py
deephyper
deephyper-master/tests/deephyper/skopt/test_common.py
from functools import partial from itertools import product import numpy as np from scipy.optimize import OptimizeResult import pytest from numpy.testing import assert_almost_equal from numpy.testing import assert_array_less from numpy.testing import assert_array_equal from numpy.testing import assert_array_almost_e...
15,995
30.612648
88
py
deephyper
deephyper-master/tests/deephyper/skopt/test_parallel_cl.py
"""This script contains set of functions that test parallel optimization with skopt, where constant liar parallelization strategy is used. """ from numpy.testing import assert_equal from numpy.testing import assert_raises from deephyper.skopt.space import Real from deephyper.skopt import Optimizer from deephyper.sko...
5,448
31.825301
79
py
deephyper
deephyper-master/tests/deephyper/skopt/test_deprecation.py
from functools import partial from itertools import product import pytest from deephyper.skopt import gp_minimize from deephyper.skopt import forest_minimize from deephyper.skopt import gbrt_minimize from deephyper.skopt import Optimizer from deephyper.skopt.learning import ExtraTreesRegressor # dummy_minimize does...
896
28.9
81
py
deephyper
deephyper-master/tests/deephyper/skopt/test_plots.py
"""Scikit-optimize plotting tests.""" import numpy as np import pytest from sklearn.datasets import load_breast_cancer from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import cross_val_score from numpy.testing import assert_array_almost_equal from deephyper.skopt.space import Integer, Catego...
6,050
31.88587
88
py
deephyper
deephyper-master/tests/deephyper/skopt/test_benchmarks.py
import numpy as np import pytest from numpy.testing import assert_array_almost_equal from numpy.testing import assert_almost_equal from deephyper.skopt.benchmarks import branin from deephyper.skopt.benchmarks import hart6 @pytest.mark.hps def test_branin(): xstars = np.asarray([(-np.pi, 12.275), (+np.pi, 2.275)...
700
25.961538
78
py
deephyper
deephyper-master/tests/deephyper/skopt/test_sampler.py
import pytest import numbers import numpy as np import os import yaml from tempfile import NamedTemporaryFile from numpy.testing import assert_array_almost_equal from numpy.testing import assert_almost_equal from numpy.testing import assert_array_equal from numpy.testing import assert_equal from numpy.testing import a...
10,894
25.444175
83
py
deephyper
deephyper-master/tests/deephyper/skopt/test_dummy_opt.py
import pytest from deephyper.skopt import dummy_minimize from deephyper.skopt.benchmarks import bench1 from deephyper.skopt.benchmarks import bench2 from deephyper.skopt.benchmarks import bench3 def check_minimize(func, y_opt, dimensions, margin, n_calls): r = dummy_minimize(func, dimensions, n_calls=n_calls, ran...
812
28.035714
73
py
deephyper
deephyper-master/tests/deephyper/skopt/test_forest_opt.py
from functools import partial from sklearn.tree import DecisionTreeClassifier import pytest from deephyper.skopt import gbrt_minimize from deephyper.skopt import forest_minimize from deephyper.skopt.benchmarks import bench1 from deephyper.skopt.benchmarks import bench2 from deephyper.skopt.benchmarks import bench3 fro...
2,602
29.267442
87
py
deephyper
deephyper-master/tests/deephyper/skopt/test_transformers.py
import pytest import numbers import numpy as np from numpy.testing import assert_raises from numpy.testing import assert_array_equal from numpy.testing import assert_equal from numpy.testing import assert_raises_regex from deephyper.skopt.space import LogN, Normalize from deephyper.skopt.space.transformers import Strin...
4,002
32.082645
84
py
deephyper
deephyper-master/tests/deephyper/skopt/test_acquisition.py
import numpy as np import pytest from scipy import optimize from sklearn.multioutput import MultiOutputRegressor from numpy.testing import assert_array_almost_equal from numpy.testing import assert_array_equal from numpy.testing import assert_raises from deephyper.skopt.acquisition import _gaussian_acquisition from ...
5,933
32.150838
80
py
deephyper
deephyper-master/tests/deephyper/skopt/test_callbacks.py
import pytest import numpy as np import os from collections import namedtuple from deephyper.skopt import dummy_minimize from deephyper.skopt import gp_minimize from deephyper.skopt.benchmarks import bench1 from deephyper.skopt.benchmarks import bench3 from deephyper.skopt.callbacks import TimerCallback from deephype...
3,800
29.902439
85
py
deephyper
deephyper-master/tests/deephyper/skopt/test_searchcv.py
"""Test scikit-optimize based implementation of hyperparameter search with interface similar to those of GridSearchCV """ import pytest from sklearn.datasets import load_iris, make_classification from sklearn.model_selection import train_test_split from sklearn.pipeline import Pipeline from sklearn.svm import SVC, Li...
13,971
28.352941
87
py
deephyper
deephyper-master/tests/deephyper/skopt/test_utils.py
import pytest import tempfile from numpy.testing import assert_array_equal from numpy.testing import assert_equal from numpy.testing import assert_raises import numpy as np from deephyper.skopt import gp_minimize, forest_minimize from deephyper.skopt import load from deephyper.skopt import dump from deephyper.skopt i...
9,985
30.304075
83
py
deephyper
deephyper-master/tests/deephyper/evaluator/test_evaluator.py
import unittest from collections import Counter import pandas as pd import pytest def run(job, y=0): return job["x"] + y def run_many_results(job, y=0): return {"objective": job["x"], "metadata": {"y": y}} class TestEvaluator(unittest.TestCase): @pytest.mark.fast @pytest.mark.hps def test_imp...
9,383
28.142857
133
py
deephyper
deephyper-master/tests/deephyper/evaluator/test_distributed_evaluator.py
""" mpirun -np 2 python test_distributed_evaluator.py """ import os import sys import time PYTHON = sys.executable SCRIPT = os.path.abspath(__file__) import pytest import deephyper.test def run(config): r = config["r"] if r == 1: time.sleep(2) print(f"r={r}") return config["r"] def _test_...
1,630
24.092308
83
py
deephyper
deephyper-master/tests/deephyper/evaluator/test_mpi_comm_evaluator.py
import os import sys import time import pytest PYTHON = sys.executable SCRIPT = os.path.abspath(__file__) import deephyper.test from deephyper.evaluator import Evaluator def run(config): job_id = config["job_id"] print(f"job {job_id}...") if job_id > 3: time.sleep(2) print(f"job {job_id} do...
1,299
22.214286
71
py
deephyper
deephyper-master/tests/deephyper/evaluator/test_decorator.py
import unittest import pytest from deephyper.evaluator import profile @profile def run_profile(config): return config["x"] @pytest.mark.fast @pytest.mark.hps class TestDecorator(unittest.TestCase): def test_profile(self): output = run_profile({"x": 0}) assert "timestamp_end" in output["me...
424
18.318182
54
py
deephyper
deephyper-master/tests/deephyper/evaluator/test_queued_evaluator.py
import pytest import unittest def run(config, dequed=None): return config["x"] + dequed[0] class TestQueuedEvaluator(unittest.TestCase): @pytest.mark.fast @pytest.mark.hps def test_queued_serial_evaluator(self): from deephyper.evaluator import SerialEvaluator, queued QueuedSerialEva...
2,317
26.270588
66
py
deephyper
deephyper-master/tests/deephyper/evaluator/storage/test_memory_storage.py
import unittest import pytest from deephyper.evaluator import Evaluator, RunningJob from deephyper.evaluator.storage import MemoryStorage def run_0(job: RunningJob) -> dict: return { "objective": job.parameters["x"], "metadata": {"storage_id": id(job.storage)}, } @pytest.mark.fast @pytest.m...
3,427
32.281553
71
py
deephyper
deephyper-master/tests/deephyper/evaluator/storage/test_redis_storage.py
import unittest import pytest from deephyper.evaluator import Evaluator, RunningJob def run_0(job: RunningJob) -> dict: if not (job.storage.connected): job.storage.connect() job.storage.store_job_metadata(job.id, "foo", 0) return { "objective": job.parameters["x"], "metadata": {"s...
3,926
32.853448
75
py
deephyper
deephyper-master/tests/deephyper/stopper/test__median_stopper.py
import pytest import numpy as np from deephyper.evaluator import RunningJob from deephyper.problem import HpProblem from deephyper.search.hps import CBO from deephyper.stopper import MedianStopper def run(job: RunningJob) -> dict: assert isinstance(job.stopper, MedianStopper) max_budget = 50 objective...
1,491
22.3125
75
py
deephyper
deephyper-master/tests/deephyper/stopper/test__sha_stopper.py
import unittest import pytest import numpy as np from deephyper.evaluator import RunningJob from deephyper.problem import HpProblem from deephyper.search.hps import CBO from deephyper.stopper import SuccessiveHalvingStopper def run(job: RunningJob) -> dict: assert isinstance(job.stopper, SuccessiveHalvingStopp...
1,502
22.857143
75
py
deephyper
deephyper-master/tests/deephyper/stopper/test__idle_stopper.py
import pytest import numpy as np from deephyper.evaluator import RunningJob from deephyper.problem import HpProblem from deephyper.search.hps import CBO from deephyper.stopper import IdleStopper def run(job: RunningJob) -> dict: assert isinstance(job.stopper, IdleStopper) max_budget = 50 objective_i =...
1,390
21.435484
75
py
deephyper
deephyper-master/tests/deephyper/nas/test_node.py
import unittest import pytest @pytest.mark.fast @pytest.mark.nas class NodeTest(unittest.TestCase): def test_mirror_node(self): import tensorflow as tf from deephyper.nas.node import MirrorNode, VariableNode from deephyper.nas.operation import operation Dense = operation(tf.keras...
1,118
21.836735
63
py
deephyper
deephyper-master/tests/deephyper/nas/test_dense_skipco_factory.py
import pytest @pytest.mark.fast @pytest.mark.nas def test_search_space(): from deephyper.nas.spacelib.tabular import DenseSkipCoSpace space = DenseSkipCoSpace(input_shape=(10,), output_shape=(1,)).build() model = space.sample()
243
21.181818
74
py
deephyper
deephyper-master/tests/deephyper/nas/test_one_layer_factory.py
import pytest @pytest.mark.fast @pytest.mark.nas def test_search_space(): from deephyper.nas.spacelib.tabular import OneLayerSpace space = OneLayerSpace(input_shape=(10,), output_shape=(1,)).build() model = space.sample()
237
20.636364
71
py
deephyper
deephyper-master/tests/deephyper/nas/test_new_api.py
import pytest @pytest.mark.fast @pytest.mark.nas def test_basic_space(verbose=0): import tensorflow as tf from deephyper.nas import KSearchSpace from deephyper.nas.node import VariableNode, ConstantNode from deephyper.nas.operation import operation, Identity Dense = operation(tf.keras.layers.Den...
1,177
24.608696
88
py
deephyper
deephyper-master/tests/deephyper/nas/test_trainer_keras_regressor.py
import unittest import pytest @pytest.mark.slow @pytest.mark.nas class TrainerKerasRegressorTest(unittest.TestCase): def test_trainer_regressor_train_valid_with_one_input(self): import sys from random import random import deephyper.core.utils import numpy as np from deeph...
4,879
33.125874
85
py
deephyper
deephyper-master/tests/deephyper/nas/test_keras_search_space.py
import unittest import pytest @pytest.mark.nas class TestKSearchSpace(unittest.TestCase): def test_create(self): import tensorflow as tf from deephyper.nas import KSearchSpace from deephyper.nas.node import VariableNode from deephyper.nas.operation import operation Dense ...
2,481
28.2
66
py
deephyper
deephyper-master/tests/deephyper/nas/run/test_single_loss.py
import pytest import numpy as np def load_data(dim=10): """ Generate data for linear function -sum(x_i). Return: Tuple of Numpy arrays: ``(train_X, train_y), (valid_X, valid_y)``. """ rs = np.random.RandomState(42) size = 100000 prop = 0.80 a, b = 0, 100 d = b - a x = ...
1,507
23.721311
74
py
deephyper
deephyper-master/tests/deephyper/nas/run/test_multi_loss.py
import pytest import numpy as np def load_data(dim=100): """ Generate data for linear function -sum(x_i). Return: Tuple of Numpy arrays: ``(train_X, train_y), (valid_X, valid_y)``. """ rs = np.random.RandomState(42) size = 100000 prop = 0.80 a, b = 0, 100 d = b - a x =...
1,794
27.046875
76
py
deephyper
deephyper-master/tests/deephyper/nas/run/test_single_loss_multi_var.py
import pytest import numpy as np def load_data(dim=10): """ Generate data for linear function -sum(x_i). Return: Tuple of Numpy arrays: ``(train_X, train_y), (valid_X, valid_y)``. """ rs = np.random.RandomState(42) size = 100000 prop = 0.80 a, b = 0, 100 d = b - a x =...
1,540
23.854839
74
py
deephyper
deephyper-master/tests/deephyper/problem/test_problem.py
import unittest import pytest @pytest.mark.hps class HpProblemTest(unittest.TestCase): def test_add_good_dim(self): import ConfigSpace as cs import ConfigSpace.hyperparameters as csh from deephyper.problem import HpProblem pb = HpProblem() p0 = pb.add_hyperparameter((-10...
4,405
30.248227
84
py
deephyper
deephyper-master/tests/deephyper/keras/layers/padding_test.py
import pytest @pytest.mark.fast @pytest.mark.nas def test_padding_layer(): import tensorflow as tf import numpy as np from deephyper.keras.layers import Padding model = tf.keras.Sequential() model.add(Padding([[1, 1]])) data = np.random.random((3, 1)) shape_data = np.shape(data) asse...
450
20.47619
46
py
deephyper
deephyper-master/tests/deephyper/search/hps/test_dbo_max_evals.py
import os import sys import pytest PYTHON = sys.executable SCRIPT = os.path.abspath(__file__) import deephyper.test def _test_dbo_max_evals(tmp_path): import time import numpy as np from deephyper.problem import HpProblem from deephyper.search.hps import MPIDistributedBO d = 10 domain = (-...
1,760
23.458333
78
py
deephyper
deephyper-master/tests/deephyper/search/hps/test__cbo_mpi.py
import os import sys import pytest PYTHON = sys.executable SCRIPT = os.path.abspath(__file__) import deephyper.test def _test_mpi_timeout(tmp_path): """Test if the timeout condition is working properly when the run-function runs indefinitely.""" import time from deephyper.problem import HpProblem fr...
1,516
25.614035
100
py
deephyper
deephyper-master/tests/deephyper/search/hps/test_parallel_cbo_manual.py
import os import shutil import sys import pytest PYTHON = sys.executable SCRIPT = os.path.abspath(__file__) import deephyper.test def _test_parallel_cbo_manual(): from mpi4py import MPI comm = MPI.COMM_WORLD rank = comm.Get_rank() from deephyper.problem import HpProblem def run(job): ...
1,971
22.2
78
py
deephyper
deephyper-master/tests/deephyper/search/hps/test_dbo_timeout.py
import os import shutil import sys import pytest PYTHON = sys.executable SCRIPT = os.path.abspath(__file__) import deephyper.test def _test_dbo_timeout(): import time import numpy as np from deephyper.problem import HpProblem from deephyper.search.hps import MPIDistributedBO d = 10 domain ...
1,836
22.551282
70
py
deephyper
deephyper-master/tests/deephyper/search/hps/test__cbo.py
import pytest @pytest.mark.hps def test_cbo_random_seed(tmp_path): import numpy as np from deephyper.evaluator import Evaluator from deephyper.problem import HpProblem from deephyper.search.hps import CBO problem = HpProblem() problem.add_hyperparameter((0.0, 10.0), "x") def run(config):...
8,589
23.403409
83
py
deephyper
deephyper-master/tests/deephyper/search/nas/test_random_mpicomm.py
import os import sys import time import pytest PYTHON = sys.executable SCRIPT = os.path.abspath(__file__) import deephyper.test def _test_random_search_mpicomm(): """Example to execute: mpirun -np 4 python test_random_mpicomm.py """ from deephyper.evaluator import Evaluator from deephyper.nas...
1,206
21.773585
75
py
deephyper
deephyper-master/tests/deephyper/search/nas/test_agebo.py
import unittest import pytest @pytest.mark.slow @pytest.mark.nas class AgEBOTest(unittest.TestCase): def test_agebo_without_hp(self): from deephyper.test.nas import linearReg from deephyper.evaluator import Evaluator from deephyper.nas.run import run_debug_arch from deephyper.sear...
1,697
29.321429
84
py
deephyper
deephyper-master/tests/deephyper/search/nas/test_random.py
import unittest import pytest @pytest.mark.slow @pytest.mark.nas class RandomTest(unittest.TestCase): def test_random_search(self): import numpy as np from deephyper.evaluator import Evaluator from deephyper.nas.run import run_debug_arch from deephyper.search.nas import Random ...
1,847
30.322034
85
py
deephyper
deephyper-master/tests/deephyper/search/nas/test_regevomixed.py
import unittest import pytest @pytest.mark.slow @pytest.mark.nas class RegevoMixedTest(unittest.TestCase): def test_regovomixed_without_hp(self): import numpy as np from deephyper.test.nas import linearReg from deephyper.evaluator import Evaluator from deephyper.nas.run import run...
2,048
29.132353
84
py
deephyper
deephyper-master/tests/deephyper/search/nas/test_nas.py
import pytest import unittest @pytest.mark.slow @pytest.mark.nas class TestNeuralArchitectureSearchAlgorithms(unittest.TestCase): def evaluate_search(self, search_cls, problem): from deephyper.evaluator import Evaluator from deephyper.nas.run import run_debug_arch # Test "max_evals" stopp...
2,944
36.278481
82
py
deephyper
deephyper-master/tests/deephyper/search/nas/test_ambsmixed.py
import unittest import pytest @pytest.mark.slow @pytest.mark.nas class AgEBOTest(unittest.TestCase): def test_ambsmixed_without_hp(self): import numpy as np from deephyper.test.nas import linearReg from deephyper.evaluator import Evaluator from deephyper.nas.run import run_debug_a...
1,803
29.066667
84
py
deephyper
deephyper-master/tests/deephyper/search/nas/test_regevo.py
import unittest import pytest @pytest.mark.slow @pytest.mark.nas class RegevoTest(unittest.TestCase): def test_regovo_with_hp(self): from deephyper.test.nas import linearRegHybrid from deephyper.evaluator import Evaluator from deephyper.nas.run import run_debug_arch from deephyper...
1,545
30.55102
84
py
deephyper
deephyper-master/docs/conf.py
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
8,809
27.79085
107
py
deephyper
deephyper-master/docs/examples/plot_from_serial_to_parallel_hyperparameter_search.py
# -*- coding: utf-8 -*- """ From Serial to Parallel Evaluations =================================== **Author(s)**: Romain Egele. This example demonstrates the advantages of parallel evaluations over serial evaluations. We start by defining an artificial black-box ``run``-function by using the Ackley function: .. ima...
3,321
39.512195
590
py
deephyper
deephyper-master/docs/examples/plot_transfer_learning_for_hps.py
# -*- coding: utf-8 -*- """ Transfer Learning for Hyperparameter Search =========================================== **Author(s)**: Romain Egele. In this example we present how to apply transfer-learning for hyperparameter search. Let's assume you have a bunch of similar tasks for example the search of neural networks...
3,293
36.431818
1,014
py
deephyper
deephyper-master/docs/examples/plot_notify_failures_hyperparameter_search.py
# -*- coding: utf-8 -*- """ Notify Failures in Hyperparameter optimization ============================================== **Author(s)**: Romain Egele. This example demonstrates how to handle failure of objectives in hyperparameter search. In many cases such as software auto-tuning (where we minimize the run-time of ...
3,235
42.146667
760
py
deephyper
deephyper-master/docs/examples/plot_profile_worker_utilization.py
# -*- coding: utf-8 -*- """ Profile the Worker Utilization ============================== **Author(s)**: Romain Egele. This example demonstrates the advantages of parallel evaluations over serial evaluations. We start by defining an artificial black-box ``run``-function by using the Ackley function: .. image:: https...
3,542
31.805556
657
py
deephyper
deephyper-master/deephyper/__version__.py
VERSION = (0, 5, 0) __version__ = ".".join(map(str, VERSION)) # alpha/beta/rc tags __version_suffix__ = ""
109
14.714286
41
py
deephyper
deephyper-master/deephyper/__init__.py
""" DeepHyper is a distributed machine learning (`AutoML <https://en.wikipedia.org/wiki/Automated_machine_learning>`_) package for automating the development of deep neural networks for scientific applications. It can run on a single laptop as well as on 1,000 of nodes. It comprises different tools such as: * Optimiz...
1,721
49.647059
266
py
deephyper
deephyper-master/deephyper/core/parser.py
import argparse import inspect from inspect import signature def add_arguments_from_signature(parser, obj, prefix="", exclude=[]): """Add arguments to parser base on obj default keyword parameters. :meta private: Args: parser (ArgumentParser)): the argument parser to which we want to add argumen...
1,822
28.885246
99
py
deephyper
deephyper-master/deephyper/core/__init__.py
0
0
0
py
deephyper
deephyper-master/deephyper/core/cli/_new_problem.py
""" Create a DeepHyper Problem -------------------------- Command line to create a new problem sub-package in a DeepHyper projet package. It can be used with: .. code-block:: console $ deephyper new-problem hps problem_name """ import glob import os import pathlib from jinja2 import Template def add_subparse...
2,325
27.024096
89
py
deephyper
deephyper-master/deephyper/core/cli/_start_project.py
""" Start a DeepHyper Project ------------------------- Command line to create a new DeepHyper project package. The package is automatically installed to the current virtual Python environment. It can be used with: .. code-block:: console $ deephyper start-project project_name """ import os import pathlib impor...
1,811
29.2
155
py
deephyper
deephyper-master/deephyper/core/cli/_hps.py
""" Hyperparameter Search --------------------- Command line to execute hyperparameter search. .. code-block:: bash $ deephyper hps ambs --help usage: deephyper hps ambs [-h] --problem PROBLEM --evaluator EVALUATOR [--random-state RANDOM_STATE] [--log-dir LOG_DIR] [--verbose VERBOSE] [--surrogate-model SURR...
6,917
34.659794
203
py
deephyper
deephyper-master/deephyper/core/cli/_nodelist.py
import sys import socket def _theta_nodelist(node_str): # string like: 1001-1005,1030,1034-1200 node_ids = [] ranges = node_str.split(",") lo = None hi = None for node_range in ranges: lo, *hi = node_range.split("-") lo = int(lo) if hi: hi = int(hi[0]) ...
938
22.475
66
py
deephyper
deephyper-master/deephyper/core/cli/__init__.py
# for the documentation from . import _cli, _hps, _nas, _new_problem, _start_project commands = [_cli, _hps, _nas, _new_problem, _start_project] __doc__ = "" for c in commands: __doc__ += c.__doc__
205
19.6
60
py
deephyper
deephyper-master/deephyper/core/cli/_nas.py
""" Neural Architecture Search -------------------------- Command line to execute neural architecture search or joint hyperparameter and neural architecture search. .. code-block:: bash $ deephyper nas regevo --help usage: deephyper nas regevo [-h] --problem PROBLEM --evaluator EVALUATOR [--random-state RAN...
6,849
34.677083
210
py
deephyper
deephyper-master/deephyper/core/cli/_cli.py
"""DeepHyper command line interface. It can be used in the shell with: .. code-block:: console $ deephyper --help usage: deephyper [-h] {hps,nas,new-problem,ray-cluster,ray-submit,start-project} ... DeepHyper command line. positional arguments: {hps,nas,new-problem,ray-cluster,ray-submit,start...
1,600
23.257576
122
py
deephyper
deephyper-master/deephyper/core/cli/_cobalt_nodelist.py
import os # Adapted from 'get_job_nodelist()' found in the following project: # https://github.com/argonne-lcf/balsam/blob/main/balsam/platform/compute_node/alcf_thetaknl_node.py def nodelist(): """Get all compute nodes allocated in the current job context. :meta private: """ node_str = os.environ["...
796
23.90625
100
py
deephyper
deephyper-master/deephyper/core/analytics/_topk.py
""" Top-K Configuration ------------------- A command line to extract the top-k best configuration from a DeepHyper execution. It can be used with: .. code-block:: console $ deephyper-analytics --help usage: deephyper-analytics topk [-h] [-k K] [-o OUTPUT] path positional arguments: path ...
4,269
27.278146
104
py
deephyper
deephyper-master/deephyper/core/analytics/_dashboard.py
""" Dashboard --------- A tool to open an interactive dashboard in the browser to help analyse DeepHyper results. It can be used such as: .. code-block:: console $ deephyper-analytics dashboard --database db.json Then an interactive dashboard will appear in your browser. """ import os import subprocess HERE = ...
1,222
22.075472
89
py
deephyper
deephyper-master/deephyper/core/analytics/_analytics.py
"""Analytics command line interface for DeepHyper. It can be used with: .. code-block:: console $ deephyper-analytics --help Command line to analysis the outputs produced by DeepHyper. positional arguments: {dashboard,notebook,quickplot,topk} Kind of analytics. d...
1,364
22.947368
81
py
deephyper
deephyper-master/deephyper/core/analytics/__init__.py
# for the documentation from . import _topk, _quick_plot, _dashboard from ._db_manager import DBManager, Query commands = [_topk, _quick_plot, _dashboard] __all__ = ["DBManager", "Query"] __doc__ = "Provides command lines tools to visualize results from DeepHyper.\n\n" for c in commands: __doc__ += c.__doc__
317
25.5
81
py
deephyper
deephyper-master/deephyper/core/analytics/_db_manager.py
""" Database --------- A tool to interact with a database of Deephyper results. To view the database run: .. code-block:: console $ deephyper-analytics database --view '' --database db.json To add an entry to the database run: .. code-block:: console $ deephyper-analytics database --add $log_dir --databas...
9,098
30.814685
306
py
deephyper
deephyper-master/deephyper/core/analytics/_quick_plot.py
""" Quick Plot ---------- A tool to have quick and simple visualization from your data. It can be use such as: .. code-block:: console $ deephyper-analytics quickplot nas_big_data/combo/exp_sc21/combo_1gpu_8_age/infos/results.csv $ deephyper-analytics quickplot save/history/*.json --xy time val_r2 $ dee...
5,701
22.561983
118
py
deephyper
deephyper-master/deephyper/core/analytics/dashboard/_pyplot.py
import json from datetime import datetime import matplotlib import matplotlib.pyplot as plt import streamlit as st from deephyper.core.exceptions import DeephyperRuntimeError width = 8 height = width / 1.618 fontsize = 18 matplotlib.rcParams.update( { "font.size": fontsize, "figure.figsize": (widt...
3,507
19.045714
84
py
deephyper
deephyper-master/deephyper/core/analytics/dashboard/_views.py
import abc import os import sys import altair as alt import pandas as pd import streamlit as st from deephyper.core.analytics import DBManager from st_aggrid import AgGrid, GridOptionsBuilder, ColumnsAutoSizeMode class View(abc.ABC): @abc.abstractmethod def show(self): ... class Dashboard(View): ...
20,546
31.927885
131
py
deephyper
deephyper-master/deephyper/core/analytics/dashboard/__init__.py
0
0
0
py
deephyper
deephyper-master/deephyper/core/exceptions/loading.py
"""Exceptions related with imports of modules/attributes/scripts. """ from deephyper.core.exceptions import DeephyperError class GenericLoaderError(DeephyperError): """Raised when the generic_loader function is failing.""" def __init__(self, target, attr, error_source, custom_msg=""): self.target = t...
655
28.818182
82
py
deephyper
deephyper-master/deephyper/core/exceptions/problem.py
"""Exceptions related with problem definition. """ from deephyper.core.exceptions import DeephyperError class SpaceDimNameOfWrongType(DeephyperError): """Raised when a dimension name of the space is not a string.""" def __init__(self, value): self.value = value def __str__(self): return...
2,811
28.291667
107
py
deephyper
deephyper-master/deephyper/core/exceptions/__init__.py
"""Deephyper exceptions """ # ! Root exceptions class DeephyperError(Exception): """Root deephyper exception.""" class DeephyperRuntimeError(RuntimeError): """Raised when an error is detected in deephyper and that doesn’t fall in any of the other categories. The associated value is a string indicating what...
770
23.870968
180
py
deephyper
deephyper-master/deephyper/core/exceptions/nas/space.py
from deephyper.core.exceptions.nas import NASError class WrongSequenceToSetOperations(NASError): """Raised when a sequence of actions is not of the same lenght as the number of variable nodes of the search_space.""" def __init__(self, sequence_given, sequence_valid): self.sequence_given = sequence_gi...
1,838
30.706897
169
py
deephyper
deephyper-master/deephyper/core/exceptions/nas/__init__.py
"""Neural architecture search exceptions. """ from deephyper.core.exceptions import DeephyperError class NASError(DeephyperError): """Root neural architecture search exception."""
187
19.888889
52
py
deephyper
deephyper-master/deephyper/core/utils/_timeout.py
import multiprocessing import multiprocessing.pool from deephyper.core.exceptions import SearchTerminationError def terminate_on_timeout(timeout, func, *args, **kwargs): """High order function to wrap the call of a function in a thread to monitor its execution time.""" pool = multiprocessing.pool.ThreadPoo...
608
29.45
103
py
deephyper
deephyper-master/deephyper/core/utils/_import.py
import importlib def load_attr(str_full_module): """Loadd attribute from module. Args: str_full_module (str): string of the form ``{module_name}.{attr}``. Returns: Any: the attribute. """ if type(str_full_module) == str: split_full = str_full_module.split(".") str...
525
24.047619
75
py
deephyper
deephyper-master/deephyper/core/utils/_files.py
import pathlib def ensure_dh_folder_exists(): """Creates a ``".deephyper"`` directory in the user home directory.""" home = pathlib.Path.home() deephyper_dir = home.joinpath(".deephyper") deephyper_dir.mkdir(parents=False, exist_ok=True) return deephyper_dir.as_posix()
292
28.3
74
py
deephyper
deephyper-master/deephyper/core/utils/__init__.py
from ._import import load_attr __all__ = ["load_attr"]
56
13.25
30
py
deephyper
deephyper-master/deephyper/core/utils/_introspection.py
import inspect import json def _get_init_param_names(cls): """Get parameter names for the estimator""" # fetch the constructor init = cls.__init__ if init is object.__init__: # No explicit constructor to introspect return [] # introspect the constructor arguments to find the model...
2,257
28.324675
82
py
deephyper
deephyper-master/deephyper/skopt/callbacks.py
"""Monitor and influence the optimization procedure via callbacks. Callbacks are callables which are invoked after each iteration of the optimizer and are passed the results "so far". Callbacks can monitor progress, or stop the optimization early by returning `True`. """ try: from collections.abc import Callable ...
9,497
27.183976
87
py