Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move advanced design space handling in separate smt-design-space-ext module #651

Merged
merged 87 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
420b4ed
add notebook
Paul-Saves Jul 17, 2024
ff17d9d
update design space utils
Paul-Saves Jul 18, 2024
d9ce638
update test
Paul-Saves Jul 18, 2024
7b966dd
update notebook
Paul-Saves Jul 22, 2024
7a7202e
update notebook
Paul-Saves Jul 22, 2024
f1159d8
improve conversion with meta and decreed relationship
Paul-Saves Jul 23, 2024
6ee874e
ruff'
Paul-Saves Jul 23, 2024
ebb218d
finish implementation, need test, need to update the colab but we're …
Paul-Saves Jul 24, 2024
c855457
add test
Paul-Saves Jul 26, 2024
7b85385
update tuto
Paul-Saves Aug 6, 2024
c99b47d
add ArchDesignSpace
Paul-Saves Aug 6, 2024
ed1050b
update class
Paul-Saves Aug 6, 2024
223d742
update notebook
Paul-Saves Aug 6, 2024
311dc3f
Merge branch 'master' into master-3
Paul-Saves Aug 19, 2024
e4fd6a6
test
Paul-Saves Aug 19, 2024
d6efc16
ruff'
Paul-Saves Aug 19, 2024
aab216c
assert
Paul-Saves Aug 19, 2024
c648049
assert
Paul-Saves Aug 19, 2024
a55fac4
Merge branch 'master' into master-3
Paul-Saves Aug 21, 2024
b2e98be
Merge branch 'master' into master-3
Paul-Saves Aug 23, 2024
ac7996f
Merge branch 'master' into master-3
Paul-Saves Aug 23, 2024
7012809
ruff 0.6.2
Paul-Saves Aug 23, 2024
0451c2b
remove ds
Paul-Saves Sep 17, 2024
2e0cb92
remove notebook ds
Paul-Saves Sep 17, 2024
6ea35b5
add import
Paul-Saves Sep 17, 2024
f0ef7b8
remove debrecated package utils
Paul-Saves Sep 17, 2024
8683a99
add requirements
Paul-Saves Sep 17, 2024
fe346f0
remove test
Paul-Saves Sep 17, 2024
c3c4b17
fix tests imports
Paul-Saves Sep 17, 2024
68f3eaa
Merge branch 'master' into smt-connexion-with-designspace
Paul-Saves Sep 17, 2024
41f80a1
fix setup?
Paul-Saves Sep 17, 2024
f6bbaba
restore basedesignspace
Paul-Saves Sep 17, 2024
726b860
restore ds
Paul-Saves Sep 17, 2024
97b7378
add base design space
Paul-Saves Sep 17, 2024
cad8d89
fix adsg import
Paul-Saves Sep 17, 2024
27e06ea
update design_space
Paul-Saves Sep 17, 2024
46ff9bc
update setup
Paul-Saves Sep 17, 2024
ef48563
restore lhs
Paul-Saves Sep 17, 2024
bf52800
restore ego'
Paul-Saves Sep 17, 2024
50108e7
update tests
Paul-Saves Sep 17, 2024
bf0ddf4
ruff
Paul-Saves Sep 17, 2024
37790f1
ruff
Paul-Saves Sep 17, 2024
e353487
restore tests
Paul-Saves Sep 17, 2024
3e15411
ruff'
Paul-Saves Sep 17, 2024
3b11c09
add adsg 1.1.1
Paul-Saves Sep 18, 2024
93c4078
Merge branch 'master' into smt-connexion-with-designspace
Paul-Saves Sep 18, 2024
9a1a894
Merge branch 'master' into smt-connexion-with-designspace
Paul-Saves Sep 19, 2024
14f6a65
ruff
Paul-Saves Sep 19, 2024
d9f8188
fix
Paul-Saves Sep 19, 2024
c949d55
fix
Paul-Saves Sep 19, 2024
6c621e8
add test
Paul-Saves Sep 19, 2024
a63cdfd
Merge branch 'master' into smt-connexion-with-designspace
Paul-Saves Sep 20, 2024
4b386ca
move ds
Paul-Saves Sep 21, 2024
ede2089
change imports
Paul-Saves Sep 21, 2024
f3cfda8
change imports
Paul-Saves Sep 21, 2024
8242415
add import
Paul-Saves Sep 21, 2024
d58050d
fix mi test
Paul-Saves Sep 21, 2024
5ec3737
ruff
Paul-Saves Sep 21, 2024
bb1a99e
ruff
Paul-Saves Sep 21, 2024
5a4f45b
add tests
Paul-Saves Sep 21, 2024
d8d0e6e
try to fix
Paul-Saves Sep 21, 2024
db03654
try to fix
Paul-Saves Sep 21, 2024
096e276
try to fix
Paul-Saves Sep 21, 2024
3c61802
fix import
Paul-Saves Sep 21, 2024
5d1cb5b
update test
Paul-Saves Sep 21, 2024
5b0b5be
update test
Paul-Saves Sep 21, 2024
aadb829
fix files
Paul-Saves Sep 21, 2024
686d134
test to tests
Paul-Saves Sep 21, 2024
5914e50
restore tests
Paul-Saves Sep 21, 2024
ee024ab
Merge branch 'master' into smt-connexion-with-designspace
Paul-Saves Sep 23, 2024
12ca00b
Merge branch 'master' into smt-connexion-with-designspace
Paul-Saves Sep 23, 2024
6ebeb3f
remove notebook
Paul-Saves Sep 26, 2024
5e471fc
rename adsg to dsg
Paul-Saves Sep 26, 2024
75d797b
update init
Paul-Saves Sep 26, 2024
70ed02f
improve the code
Paul-Saves Sep 30, 2024
2743c06
Merge branch 'master' into smt-connexion-with-designspace
Paul-Saves Sep 30, 2024
96c15b5
remove old smtdesignspace
Paul-Saves Sep 30, 2024
5c02088
fix srtup
Paul-Saves Oct 1, 2024
aff6f19
try for better init
Paul-Saves Oct 1, 2024
206f8fe
try for better init
Paul-Saves Oct 1, 2024
86ed356
try for better init
Paul-Saves Oct 1, 2024
44ae42f
try for better init
Paul-Saves Oct 1, 2024
fd2483d
try for better init
Paul-Saves Oct 1, 2024
0b93b83
try for better init
Paul-Saves Oct 1, 2024
6eb4b0f
rename repo
Paul-Saves Oct 1, 2024
ae1d794
change boolean name
Paul-Saves Oct 1, 2024
69037ae
update name of bool
Paul-Saves Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ omit =
*/tests/*
*/examples/*
*/__init__.py
*/setup.py
*/setup.py
2 changes: 1 addition & 1 deletion .github/workflows/tests_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt numpy==1.26.4 ConfigSpace==0.6.1
pip install -r requirements.txt numpy==1.26.4 ConfigSpace==0.6.1 adsg-core==1.1.1 git+https://github.com/SMTorg/smt-design-space-ext
pip list
pip install -e .

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ pytest-xdist # allows running parallel testing with pytest -n <num_workers>
pytest-cov # allows to get coverage report
ruff # format and lint code
jenn >= 1.0.2, <2.0
egobox ~= 0.20.0
egobox ~= 0.20.0
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
"smt.sampling_methods",
"smt.utils",
"smt.applications",
"smt.design_space",
"smt.kernels",
],
install_requires=[
"scikit-learn",
Expand All @@ -118,9 +120,6 @@
"numba": [ # pip install smt[numba]
"numba~=0.56.4",
],
"cs": [ # pip install smt[cs]
"ConfigSpace~=0.6.1",
],
"gpx": ["egobox~=0.22"], # pip install smt[gpx]
},
python_requires=">=3.9",
Expand Down
13 changes: 13 additions & 0 deletions smt/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
__version__ = "2.7.0"

__all__ = [
"surrogate_models",
"kernels",
"design_space",
"applications",
"examples",
"sampling_methods",
"utils",
"tests",
"src",
"problems",
]
5 changes: 1 addition & 4 deletions smt/applications/ego.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
)
from smt.sampling_methods import LHS
from smt.surrogate_models import GEKPLS, GPX, KPLS, KPLSK, KRG, MGP
from smt.utils.design_space import (
BaseDesignSpace,
DesignSpace,
)
from smt.design_space import BaseDesignSpace, DesignSpace


class Evaluator(object):
Expand Down
2 changes: 1 addition & 1 deletion smt/applications/mfk.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
MixIntKernelType,
compute_n_param,
)
from smt.utils.design_space import ensure_design_space
from smt.design_space import ensure_design_space
from smt.utils.kriging import (
componentwise_distance,
compute_X_cont,
Expand Down
3 changes: 2 additions & 1 deletion smt/applications/mixed_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
from smt.surrogate_models.krg_based import KrgBased, MixIntKernelType
from smt.surrogate_models.surrogate_model import SurrogateModel
from smt.utils.checks import ensure_2d_array
from smt.utils.design_space import (

from smt.design_space import (
BaseDesignSpace,
CategoricalVariable,
ensure_design_space,
Expand Down
2 changes: 1 addition & 1 deletion smt/applications/tests/test_ego.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import numpy as np

import smt.utils.design_space as ds
import smt.design_space as ds
from smt.applications import EGO
from smt.applications.ego import Evaluator
from smt.applications.mixed_integer import (
Expand Down
4 changes: 2 additions & 2 deletions smt/applications/tests/test_mfk_mfkpls_mixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
KRG,
MixIntKernelType,
)
from smt.utils.design_space import (
CategoricalVariable,
from smt.design_space import (
DesignSpace,
CategoricalVariable,
FloatVariable,
IntegerVariable,
)
Expand Down
43 changes: 22 additions & 21 deletions smt/applications/tests/test_mixed_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
except ImportError:
NO_MATPLOTLIB = True

import smt.utils.design_space as ds
import smt.design_space as ds
from smt.design_space import (
HAS_CONFIG_SPACE,
DesignSpace,
CategoricalVariable,
FloatVariable,
IntegerVariable,
OrdinalVariable,
)

from smt.applications.mixed_integer import (
MixedIntegerContext,
MixedIntegerKrigingModel,
Expand All @@ -33,14 +42,6 @@
MixHrcKernelType,
MixIntKernelType,
)
from smt.utils.design_space import (
HAS_CONFIG_SPACE,
CategoricalVariable,
DesignSpace,
FloatVariable,
IntegerVariable,
OrdinalVariable,
)


class TestMixedInteger(unittest.TestCase):
Expand Down Expand Up @@ -474,10 +475,10 @@ def run_mixed_integer_lhs_example(self):

from smt.applications.mixed_integer import MixedIntegerSamplingMethod
from smt.sampling_methods import LHS
from smt.utils.design_space import (
CategoricalVariable,
DesignSpace,
from smt.design_space import (
FloatVariable,
DesignSpace,
CategoricalVariable,
)

float_var = FloatVariable(0, 4)
Expand Down Expand Up @@ -507,7 +508,7 @@ def run_mixed_integer_qp_example(self):

from smt.applications.mixed_integer import MixedIntegerSurrogateModel
from smt.surrogate_models import QP
from smt.utils.design_space import DesignSpace, IntegerVariable
from smt.design_space import DesignSpace, IntegerVariable

xt = np.array([0.0, 1.0, 2.0, 3.0, 4.0])
yt = np.array([0.0, 1.0, 1.5, 0.5, 1.0])
Expand Down Expand Up @@ -539,7 +540,7 @@ def run_mixed_integer_context_example(self):

from smt.applications.mixed_integer import MixedIntegerContext
from smt.surrogate_models import KRG
from smt.utils.design_space import (
from smt.design_space import (
CategoricalVariable,
DesignSpace,
FloatVariable,
Expand Down Expand Up @@ -747,7 +748,7 @@ def run_mixed_discrete_design_space_example(self):

from smt.applications.mixed_integer import MixedIntegerSamplingMethod
from smt.sampling_methods import LHS
from smt.utils.design_space import (
from smt.design_space import (
CategoricalVariable,
DesignSpace,
FloatVariable,
Expand Down Expand Up @@ -798,7 +799,7 @@ def run_hierarchical_design_space_example(self):
)
from smt.sampling_methods import LHS
from smt.surrogate_models import KRG, MixHrcKernelType, MixIntKernelType
from smt.utils.design_space import (
from smt.design_space import (
CategoricalVariable,
DesignSpace,
FloatVariable,
Expand Down Expand Up @@ -1099,7 +1100,7 @@ def run_hierarchical_variables_Goldstein(self):
)
from smt.sampling_methods import LHS
from smt.surrogate_models import KRG, MixHrcKernelType, MixIntKernelType
from smt.utils.design_space import (
from smt.design_space import (
CategoricalVariable,
DesignSpace,
FloatVariable,
Expand Down Expand Up @@ -2005,7 +2006,7 @@ def run_mixed_gower_example(self):
MixedIntegerKrigingModel,
)
from smt.surrogate_models import KRG, MixIntKernelType
from smt.utils.design_space import (
from smt.design_space import (
CategoricalVariable,
DesignSpace,
FloatVariable,
Expand Down Expand Up @@ -2136,7 +2137,7 @@ def run_mixed_cs_example(self):
MixedIntegerKrigingModel,
)
from smt.surrogate_models import KRG, MixIntKernelType
from smt.utils.design_space import (
from smt.design_space import (
CategoricalVariable,
DesignSpace,
FloatVariable,
Expand Down Expand Up @@ -2265,7 +2266,7 @@ def run_mixed_homo_gaussian_example(self):

from smt.applications.mixed_integer import MixedIntegerKrigingModel
from smt.surrogate_models import KRG, MixIntKernelType
from smt.utils.design_space import (
from smt.design_space import (
CategoricalVariable,
DesignSpace,
FloatVariable,
Expand Down Expand Up @@ -2394,7 +2395,7 @@ def run_mixed_homo_hyp_example(self):

from smt.applications.mixed_integer import MixedIntegerKrigingModel
from smt.surrogate_models import KRG, MixIntKernelType
from smt.utils.design_space import (
from smt.design_space import (
CategoricalVariable,
DesignSpace,
FloatVariable,
Expand Down
55 changes: 55 additions & 0 deletions smt/design_space/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import importlib

spec = importlib.util.find_spec("smt_design_space")
if spec:
HAS_DESIGN_SPACE_EXT = True
HAS_CONFIG_SPACE = True
HAS_ADSG = True
else:
HAS_DESIGN_SPACE_EXT = False
HAS_CONFIG_SPACE = False
HAS_ADSG = False


if HAS_DESIGN_SPACE_EXT:
from smt_design_space.design_space import (
CategoricalVariable,
DesignSpace,
BaseDesignSpace,
FloatVariable,
IntegerVariable,
OrdinalVariable,
ensure_design_space,
)

else:
from smt.design_space.design_space import (
CategoricalVariable,
DesignSpace,
FloatVariable,
IntegerVariable,
OrdinalVariable,
ensure_design_space,
BaseDesignSpace,
)

if HAS_DESIGN_SPACE_EXT:
from smt_design_space.design_space import DesignSpaceGraph
else:

class DesignSpaceGraph:
pass


__all__ = [
"HAS_DESIGN_SPACE_EXT",
"HAS_CONFIG_SPACE",
"HAS_ADSG",
"BaseDesignSpace",
"DesignSpace",
"FloatVariable",
"IntegerVariable",
"OrdinalVariable",
"CategoricalVariable",
"ensure_design_space",
]
Loading