diff --git a/doc/_src_docs/applications/Mixed_Hier_surr.rst b/doc/_src_docs/applications/Mixed_Hier_surr.rst index 058667e1a..09c29327d 100644 --- a/doc/_src_docs/applications/Mixed_Hier_surr.rst +++ b/doc/_src_docs/applications/Mixed_Hier_surr.rst @@ -61,9 +61,9 @@ Example of mixed integer Polynomial (QP) surrogate # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0000544 + Predicting - done. Time (sec): 0.0000598 - Prediction time/pt. (sec) : 0.0000005 + Prediction time/pt. (sec) : 0.0000006 .. figure:: Mixed_Hier_surr_TestMixedInteger_run_mixed_integer_qp_example.png @@ -89,7 +89,10 @@ Example of mixed integer Gower Distance model import matplotlib.pyplot as plt from smt.surrogate_models import KRG, MixIntKernelType - from smt.applications.mixed_integer import MixedIntegerKrigingModel + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) from smt.utils.design_space import ( DesignSpace, CategoricalVariable, @@ -221,9 +224,9 @@ Example of mixed integer Gower Distance model # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0075271 + Predicting - done. Time (sec): 0.0083411 - Prediction time/pt. (sec) : 0.0000753 + Prediction time/pt. (sec) : 0.0000834 ___________________________________________________________________________ @@ -232,9 +235,9 @@ Example of mixed integer Gower Distance model # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0073531 + Predicting - done. Time (sec): 0.0082445 - Prediction time/pt. (sec) : 0.0000735 + Prediction time/pt. (sec) : 0.0000824 ___________________________________________________________________________ @@ -243,15 +246,203 @@ Example of mixed integer Gower Distance model # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0074379 + Predicting - done. Time (sec): 0.0082402 - Prediction time/pt. (sec) : 0.0000744 + Prediction time/pt. (sec) : 0.0000824 .. figure:: Mixed_Hier_surr_TestMixedInteger_run_mixed_gower_example.png :scale: 80 % :align: center +Mixed Integer Kriging with Compound Symmetry (CS) +---------------------------------------------- + +Compound Symmetry is similar to Gower Distance but allow to model negative correlations. Details can be found in [2]_ . + +Example of mixed integer Compound Symmetry model +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + import numpy as np + import matplotlib.pyplot as plt + + from smt.surrogate_models import KRG, MixIntKernelType + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) + from smt.utils.design_space import ( + DesignSpace, + CategoricalVariable, + FloatVariable, + ) + + xt1 = np.array([[0, 0.0], [0, 2.0], [0, 4.0]]) + xt2 = np.array([[1, 0.0], [1, 2.0], [1, 3.0]]) + xt3 = np.array([[2, 1.0], [2, 2.0], [2, 4.0]]) + + xt = np.concatenate((xt1, xt2, xt3), axis=0) + xt[:, 1] = xt[:, 1].astype(np.float64) + yt1 = np.array([0.0, 9.0, 16.0]) + yt2 = np.array([0.0, -4, -13.0]) + yt3 = np.array([-10, 3, 11.0]) + yt = np.concatenate((yt1, yt2, yt3), axis=0) + + design_space = DesignSpace( + [ + CategoricalVariable(["Blue", "Red", "Green"]), + FloatVariable(0, 4), + ] + ) + + # Surrogate + sm = MixedIntegerKrigingModel( + surrogate=KRG( + design_space=design_space, + categorical_kernel=MixIntKernelType.COMPOUND_SYMMETRY, + theta0=[1e-1], + corr="squar_exp", + n_start=20, + ), + ) + sm.set_training_values(xt, yt) + sm.train() + + # DOE for validation + n = 100 + x_cat1 = [] + x_cat2 = [] + x_cat3 = [] + + for i in range(n): + x_cat1.append(0) + x_cat2.append(1) + x_cat3.append(2) + + x_cont = np.linspace(0.0, 4.0, n) + x1 = np.concatenate( + (np.asarray(x_cat1).reshape(-1, 1), x_cont.reshape(-1, 1)), axis=1 + ) + x2 = np.concatenate( + (np.asarray(x_cat2).reshape(-1, 1), x_cont.reshape(-1, 1)), axis=1 + ) + x3 = np.concatenate( + (np.asarray(x_cat3).reshape(-1, 1), x_cont.reshape(-1, 1)), axis=1 + ) + + y1 = sm.predict_values(x1) + y2 = sm.predict_values(x2) + y3 = sm.predict_values(x3) + + # estimated variance + s2_1 = sm.predict_variances(x1) + s2_2 = sm.predict_variances(x2) + s2_3 = sm.predict_variances(x3) + + fig, axs = plt.subplots(3, figsize=(8, 6)) + + axs[0].plot(xt1[:, 1].astype(np.float64), yt1, "o", linestyle="None") + axs[0].plot(x_cont, y1, color="Blue") + axs[0].fill_between( + np.ravel(x_cont), + np.ravel(y1 - 3 * np.sqrt(s2_1)), + np.ravel(y1 + 3 * np.sqrt(s2_1)), + color="lightgrey", + ) + axs[0].set_xlabel("x") + axs[0].set_ylabel("y") + axs[0].legend( + ["Training data", "Prediction", "Confidence Interval 99%"], + loc="upper left", + bbox_to_anchor=[0, 1], + ) + axs[1].plot( + xt2[:, 1].astype(np.float64), yt2, marker="o", color="r", linestyle="None" + ) + axs[1].plot(x_cont, y2, color="Red") + axs[1].fill_between( + np.ravel(x_cont), + np.ravel(y2 - 3 * np.sqrt(s2_2)), + np.ravel(y2 + 3 * np.sqrt(s2_2)), + color="lightgrey", + ) + axs[1].set_xlabel("x") + axs[1].set_ylabel("y") + axs[1].legend( + ["Training data", "Prediction", "Confidence Interval 99%"], + loc="upper left", + bbox_to_anchor=[0, 1], + ) + axs[2].plot( + xt3[:, 1].astype(np.float64), yt3, marker="o", color="r", linestyle="None" + ) + axs[2].plot(x_cont, y3, color="Green") + axs[2].fill_between( + np.ravel(x_cont), + np.ravel(y3 - 3 * np.sqrt(s2_3)), + np.ravel(y3 + 3 * np.sqrt(s2_3)), + color="lightgrey", + ) + axs[2].set_xlabel("x") + axs[2].set_ylabel("y") + axs[2].legend( + ["Training data", "Prediction", "Confidence Interval 99%"], + loc="upper left", + bbox_to_anchor=[0, 1], + ) + plt.tight_layout() + plt.show() + +:: + + exception : 4-th leading minor of the array is not positive definite + [ 3.28121902e+01 -1.19061651e+01 -1.19062304e+01 7.34202209e-04 + -3.09582545e-04 -2.19341599e-04 3.49847536e-09 -1.67389470e-09 + -7.15698325e-10] + exception : 4-th leading minor of the array is not positive definite + [ 9.09297095e+00 -4.69851668e-02 -4.69502417e-02 9.74106925e-04 + -5.62905232e-06 -4.04511718e-06 2.47447275e-08 -1.26347075e-10 + -6.20962697e-11] + ___________________________________________________________________________ + + Evaluation + + # eval points. : 100 + + Predicting ... + Predicting - done. Time (sec): 0.0098972 + + Prediction time/pt. (sec) : 0.0000990 + + ___________________________________________________________________________ + + Evaluation + + # eval points. : 100 + + Predicting ... + Predicting - done. Time (sec): 0.0098805 + + Prediction time/pt. (sec) : 0.0000988 + + ___________________________________________________________________________ + + Evaluation + + # eval points. : 100 + + Predicting ... + Predicting - done. Time (sec): 0.0099378 + + Prediction time/pt. (sec) : 0.0000994 + + +.. figure:: Mixed_Hier_surr_TestMixedInteger_run_mixed_cs_example.png + :scale: 80 % + :align: center + Mixed Integer Kriging with Homoscedastic Hypersphere (HH) --------------------------------------------------------- @@ -267,7 +458,10 @@ Example of mixed integer Homoscedastic Hypersphere model import matplotlib.pyplot as plt from smt.surrogate_models import KRG, MixIntKernelType - from smt.applications.mixed_integer import MixedIntegerKrigingModel + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) from smt.utils.design_space import ( DesignSpace, CategoricalVariable, @@ -399,9 +593,9 @@ Example of mixed integer Homoscedastic Hypersphere model # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0091217 + Predicting - done. Time (sec): 0.0099890 - Prediction time/pt. (sec) : 0.0000912 + Prediction time/pt. (sec) : 0.0000999 ___________________________________________________________________________ @@ -410,9 +604,9 @@ Example of mixed integer Homoscedastic Hypersphere model # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0090504 + Predicting - done. Time (sec): 0.0100174 - Prediction time/pt. (sec) : 0.0000905 + Prediction time/pt. (sec) : 0.0001002 ___________________________________________________________________________ @@ -421,9 +615,9 @@ Example of mixed integer Homoscedastic Hypersphere model # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0090513 + Predicting - done. Time (sec): 0.0100038 - Prediction time/pt. (sec) : 0.0000905 + Prediction time/pt. (sec) : 0.0001000 .. figure:: Mixed_Hier_surr_TestMixedInteger_run_mixed_homo_hyp_example.png @@ -445,7 +639,10 @@ Example of mixed integer Exponential Homoscedastic Hypersphere model import matplotlib.pyplot as plt from smt.surrogate_models import KRG, MixIntKernelType - from smt.applications.mixed_integer import MixedIntegerKrigingModel + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) from smt.utils.design_space import ( DesignSpace, CategoricalVariable, @@ -577,9 +774,9 @@ Example of mixed integer Exponential Homoscedastic Hypersphere model # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0090473 + Predicting - done. Time (sec): 0.0099664 - Prediction time/pt. (sec) : 0.0000905 + Prediction time/pt. (sec) : 0.0000997 ___________________________________________________________________________ @@ -588,9 +785,9 @@ Example of mixed integer Exponential Homoscedastic Hypersphere model # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0090168 + Predicting - done. Time (sec): 0.0101118 - Prediction time/pt. (sec) : 0.0000902 + Prediction time/pt. (sec) : 0.0001011 ___________________________________________________________________________ @@ -599,9 +796,9 @@ Example of mixed integer Exponential Homoscedastic Hypersphere model # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0089972 + Predicting - done. Time (sec): 0.0099428 - Prediction time/pt. (sec) : 0.0000900 + Prediction time/pt. (sec) : 0.0000994 .. figure:: Mixed_Hier_surr_TestMixedInteger_run_mixed_homo_gaussian_example.png @@ -628,8 +825,12 @@ Example of mixed integer Kriging with hierarchical variables IntegerVariable, FloatVariable, ) - from smt.applications.mixed_integer import MixedIntegerKrigingModel + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) from smt.surrogate_models import MixIntKernelType, MixHrcKernelType, KRG + from smt.sampling_methods import LHS def f_hv(X): import numpy as np @@ -764,7 +965,12 @@ Example of mixed integer Kriging with hierarchical variables # Sample from the design spaces, correctly considering hierarchy n_doe = 15 - Xt, Xt_is_acting = design_space.sample_valid_x(n_doe, random_state=42) + design_space.seed = 42 + samp = MixedIntegerSamplingMethod( + LHS, design_space, criterion="ese", random_state=design_space.seed + ) + Xt, Xt_is_acting = samp(n_doe, return_is_acting=True) + Yt = f_hv(Xt) sm = MixedIntegerKrigingModel( @@ -794,9 +1000,9 @@ Example of mixed integer Kriging with hierarchical variables # eval points. : 15 Predicting ... - Predicting - done. Time (sec): 0.0075390 + Predicting - done. Time (sec): 0.0084703 - Prediction time/pt. (sec) : 0.0005026 + Prediction time/pt. (sec) : 0.0005647 @@ -805,3 +1011,5 @@ References ---------- .. [1] Saves, P. and Diouane, Y. and Bartoli, N. and Lefebvre, T. and Morlier, J. (2022). A general square exponential kernel to handle mixed-categorical variables for Gaussian process. AIAA Aviation 2022 Forum. + +.. [2] Pelamatti, J. "Mixed-variable Bayesian optimization: application to aerospace system design", PhD thesis, Université de Lille, Lille, 2020. diff --git a/doc/_src_docs/applications/Mixed_Hier_surr.rstx b/doc/_src_docs/applications/Mixed_Hier_surr.rstx index 259d39321..58f3ad613 100644 --- a/doc/_src_docs/applications/Mixed_Hier_surr.rstx +++ b/doc/_src_docs/applications/Mixed_Hier_surr.rstx @@ -35,6 +35,16 @@ Example of mixed integer Gower Distance model .. embed-test-print-plot :: smt.applications.tests.test_mixed_integer , TestMixedInteger , run_mixed_gower_example, 80 +Mixed Integer Kriging with Compound Symmetry (CS) +---------------------------------------------- + +Compound Symmetry is similar to Gower Distance but allow to model negative correlations. Details can be found in [2]_ . + +Example of mixed integer Compound Symmetry model +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. embed-test-print-plot :: smt.applications.tests.test_mixed_integer , TestMixedInteger , run_mixed_cs_example, 80 + Mixed Integer Kriging with Homoscedastic Hypersphere (HH) --------------------------------------------------------- @@ -75,3 +85,5 @@ References ---------- .. [1] Saves, P. and Diouane, Y. and Bartoli, N. and Lefebvre, T. and Morlier, J. (2022). A general square exponential kernel to handle mixed-categorical variables for Gaussian process. AIAA Aviation 2022 Forum. + +.. [2] Pelamatti, J. "Mixed-variable Bayesian optimization: application to aerospace system design", PhD thesis, Université de Lille, Lille, 2020. diff --git a/doc/_src_docs/applications/Mixed_Hier_surr_TestMixedInteger_run_mixed_cs_example.png b/doc/_src_docs/applications/Mixed_Hier_surr_TestMixedInteger_run_mixed_cs_example.png new file mode 100644 index 000000000..dacc6fcd0 Binary files /dev/null and b/doc/_src_docs/applications/Mixed_Hier_surr_TestMixedInteger_run_mixed_cs_example.png differ diff --git a/doc/_src_docs/applications/Mixed_Hier_usage.rst b/doc/_src_docs/applications/Mixed_Hier_usage.rst index 52f990c4b..027da06b4 100644 --- a/doc/_src_docs/applications/Mixed_Hier_usage.rst +++ b/doc/_src_docs/applications/Mixed_Hier_usage.rst @@ -44,7 +44,8 @@ The design space is then defined from a list of design variables and implements OrdinalVariable, CategoricalVariable, ) - + from smt.sampling_methods import LHS + from smt.applications.mixed_integer import MixedIntegerSamplingMethod ds = DesignSpace( [ CategoricalVariable( @@ -62,7 +63,11 @@ The design space is then defined from a list of design variables and implements # Sample the design space # Note: is_acting_sampled specifies for each design variable whether it is acting or not - x_sampled, is_acting_sampled = ds.sample_valid_x(100, random_state=42) + ds.seed = 42 + samp = MixedIntegerSamplingMethod( + LHS, ds, criterion="ese", random_state=ds.seed + ) + x_sampled, is_acting_sampled = samp(100, return_is_acting=True) # Correct design vectors: round discrete variables, correct hierarchical variables x_corr, is_acting = ds.correct_get_acting( @@ -106,8 +111,9 @@ The hierarchy relationships are specified after instantiating the design space: OrdinalVariable, CategoricalVariable, ) - from smt.applications.mixed_integer import MixedIntegerKrigingModel + from smt.applications.mixed_integer import MixedIntegerKrigingModel, MixedIntegerSamplingMethod from smt.surrogate_models import MixIntKernelType, MixHrcKernelType, KRG + from smt.sampling_methods import LHS ds = DesignSpace( [ @@ -139,7 +145,12 @@ The hierarchy relationships are specified after instantiating the design space: # Sample the design space # Note: is_acting_sampled specifies for each design variable whether it is acting or not - Xt, is_acting_sampled = ds.sample_valid_x(100, random_state=42) + ds.seed = 42 + samp = MixedIntegerSamplingMethod( + LHS, ds, criterion="ese", random_state=ds.seed + ) + Xt, is_acting_sampled = samp(100, return_is_acting=True) + rng = np.random.default_rng(42) Yt = 4 * rng.random(100) - 2 + Xt[:, 0] + Xt[:, 1] - Xt[:, 2] - Xt[:, 3] # Correct design vectors: round discrete variables, correct hierarchical variables @@ -217,9 +228,9 @@ The hierarchy relationships are specified after instantiating the design space: # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.3058572 + Predicting - done. Time (sec): 0.3314385 - Prediction time/pt. (sec) : 0.0030586 + Prediction time/pt. (sec) : 0.0033144 Pred_RMSE 4.092408537263059e-13 @@ -260,7 +271,8 @@ Example of sampling a mixed-discrete design space FloatVariable, CategoricalVariable, ) - + from smt.sampling_methods import LHS + from smt.applications.mixed_integer import MixedIntegerSamplingMethod float_var = FloatVariable(0, 4) cat_var = CategoricalVariable(["blue", "red"]) @@ -272,7 +284,12 @@ Example of sampling a mixed-discrete design space ) num = 40 - x, x_is_acting = design_space.sample_valid_x(num, random_state=42) + design_space.seed = 42 + samp = MixedIntegerSamplingMethod( + LHS, design_space, criterion="ese", random_state=design_space.seed + ) + x, x_is_acting = samp(num, return_is_acting=True) + cmap = colors.ListedColormap(cat_var.values) plt.scatter(x[:, 0], np.zeros(num), c=x[:, 1], cmap=cmap) plt.show() @@ -302,7 +319,7 @@ Example of mixed integer context usage import matplotlib.pyplot as plt from smt.surrogate_models import KRG - from smt.applications.mixed_integer import MixedIntegerContext + from smt.applications.mixed_integer import MixedIntegerContext,MixedIntegerSamplingMethod from smt.utils.design_space import ( DesignSpace, FloatVariable, @@ -359,9 +376,9 @@ Example of mixed integer context usage # eval points. : 50 Predicting ... - Predicting - done. Time (sec): 0.0124640 + Predicting - done. Time (sec): 0.0133548 - Prediction time/pt. (sec) : 0.0002493 + Prediction time/pt. (sec) : 0.0002671 .. figure:: Mixed_Hier_usage_TestMixedInteger_run_mixed_integer_context_example.png diff --git a/doc/_src_docs/applications/Mixed_Hier_usage_TestMixedInteger_run_mixed_integer_context_example.png b/doc/_src_docs/applications/Mixed_Hier_usage_TestMixedInteger_run_mixed_integer_context_example.png index 1b8fbebee..216f3d9f9 100644 Binary files a/doc/_src_docs/applications/Mixed_Hier_usage_TestMixedInteger_run_mixed_integer_context_example.png and b/doc/_src_docs/applications/Mixed_Hier_usage_TestMixedInteger_run_mixed_integer_context_example.png differ diff --git a/doc/_src_docs/applications/ego.rst b/doc/_src_docs/applications/ego.rst index 09d4ba237..8b6e71c0b 100644 --- a/doc/_src_docs/applications/ego.rst +++ b/doc/_src_docs/applications/ego.rst @@ -216,7 +216,7 @@ Usage xlimits = np.array([[0.0, 25.0]]) random_state = 42 # for reproducibility - design_space = DesignSpace(xlimits, seed=random_state) + design_space = DesignSpace(xlimits, random_state=random_state) xdoe = np.atleast_2d([0, 7, 25]).T n_doe = xdoe.size @@ -319,7 +319,7 @@ Usage with parallel options xlimits = np.array([[0.0, 25.0]]) random_state = 42 - design_space = DesignSpace(xlimits, seed=random_state) + design_space = DesignSpace(xlimits, random_state=random_state) xdoe = np.atleast_2d([0, 7, 25]).T n_doe = xdoe.size @@ -450,7 +450,10 @@ Usage with mixed variable import numpy as np from smt.applications import EGO - from smt.applications.mixed_integer import MixedIntegerContext + from smt.applications.mixed_integer import ( + MixedIntegerContext, + MixedIntegerSamplingMethod, + ) from smt.surrogate_models import MixIntKernelType from smt.utils.design_space import ( DesignSpace, @@ -497,7 +500,7 @@ Usage with mixed variable CategoricalVariable(["square", "circle"]), IntegerVariable(0, 2), ], - seed=random_state, + random_state=random_state, ) criterion = "EI" #'EI' or 'SBO' or 'LCB' @@ -546,7 +549,7 @@ Usage with mixed variable :: - Minimum in x=[-4.88885885 2. 0. 0. ] with f(x)=-14.7 + Minimum in x=[-4.88913486 2. 0. 0. ] with f(x)=-14.7 .. figure:: ego_TestEGO_run_ego_mixed_integer_example.png :scale: 80 % @@ -602,7 +605,7 @@ Options - ['str'] - Approximated q-EI maximization strategy * - evaluator - - + - - None - ['Evaluator'] - Object used to run function fun to optimize at x points (nsamples, nxdim) @@ -632,7 +635,7 @@ Options - ['bool'] - Enable the penalization of points that have been already evaluated in EI criterion * - surrogate - - + - - None - ['KRG', 'KPLS', 'KPLSK', 'GEKPLS', 'MGP'] - SMT kriging-based surrogate model used internaly diff --git a/doc/_src_docs/applications/ego_TestEGO_run_ego_example.png b/doc/_src_docs/applications/ego_TestEGO_run_ego_example.png index 8d8dca0e8..9c8edfe00 100644 Binary files a/doc/_src_docs/applications/ego_TestEGO_run_ego_example.png and b/doc/_src_docs/applications/ego_TestEGO_run_ego_example.png differ diff --git a/doc/_src_docs/applications/ego_TestEGO_run_ego_mixed_integer_example.png b/doc/_src_docs/applications/ego_TestEGO_run_ego_mixed_integer_example.png index 3aad4aced..743ac9797 100644 Binary files a/doc/_src_docs/applications/ego_TestEGO_run_ego_mixed_integer_example.png and b/doc/_src_docs/applications/ego_TestEGO_run_ego_mixed_integer_example.png differ diff --git a/doc/_src_docs/applications/ego_TestEGO_run_ego_parallel_example.png b/doc/_src_docs/applications/ego_TestEGO_run_ego_parallel_example.png index 41845b028..4982f6a71 100644 Binary files a/doc/_src_docs/applications/ego_TestEGO_run_ego_parallel_example.png and b/doc/_src_docs/applications/ego_TestEGO_run_ego_parallel_example.png differ diff --git a/doc/_src_docs/applications/mfk.rst b/doc/_src_docs/applications/mfk.rst index a77c82966..c5f1ed673 100644 --- a/doc/_src_docs/applications/mfk.rst +++ b/doc/_src_docs/applications/mfk.rst @@ -103,7 +103,7 @@ Usage Training Training ... - Training - done. Time (sec): 0.1871963 + Training - done. Time (sec): 0.9827604 ___________________________________________________________________________ Evaluation @@ -111,9 +111,9 @@ Usage # eval points. : 101 Predicting ... - Predicting - done. Time (sec): 0.0005431 + Predicting - done. Time (sec): 0.0007160 - Prediction time/pt. (sec) : 0.0000054 + Prediction time/pt. (sec) : 0.0000071 ___________________________________________________________________________ @@ -122,9 +122,9 @@ Usage # eval points. : 101 Predicting ... - Predicting - done. Time (sec): 0.0005081 + Predicting - done. Time (sec): 0.0007083 - Prediction time/pt. (sec) : 0.0000050 + Prediction time/pt. (sec) : 0.0000070 .. figure:: mfk_TestMFK_run_mfk_example.png @@ -186,7 +186,7 @@ Options - Power for the pow_exp kernel function (valid values in (0.0, 2.0]), This option is set automatically when corr option is squar, abs, or matern. * - categorical_kernel - MixIntKernelType.CONT_RELAX - - [, , , ] + - [, , , , ] - None - The kernel to use for categorical inputs. Only for non continuous Kriging * - hierarchical_kernel @@ -210,7 +210,7 @@ Options - ['list', 'ndarray'] - bounds for hyperparameters * - hyper_opt - - Cobyla + - TNC - ['Cobyla', 'TNC'] - ['str'] - Optimiser for hyperparameters optimisation diff --git a/doc/_src_docs/applications/mfk_TestMFK_run_mfk_example.png b/doc/_src_docs/applications/mfk_TestMFK_run_mfk_example.png index 1e8dc531c..b516458b3 100644 Binary files a/doc/_src_docs/applications/mfk_TestMFK_run_mfk_example.png and b/doc/_src_docs/applications/mfk_TestMFK_run_mfk_example.png differ diff --git a/doc/_src_docs/applications/mfkpls.rst b/doc/_src_docs/applications/mfkpls.rst index f54a28543..c188071ba 100644 --- a/doc/_src_docs/applications/mfkpls.rst +++ b/doc/_src_docs/applications/mfkpls.rst @@ -108,7 +108,7 @@ Usage Training Training ... - Training - done. Time (sec): 0.2456450 + Training - done. Time (sec): 0.1955945 ___________________________________________________________________________ Evaluation @@ -116,9 +116,9 @@ Usage # eval points. : 101 Predicting ... - Predicting - done. Time (sec): 0.0005369 + Predicting - done. Time (sec): 0.0007906 - Prediction time/pt. (sec) : 0.0000053 + Prediction time/pt. (sec) : 0.0000078 ___________________________________________________________________________ @@ -127,9 +127,9 @@ Usage # eval points. : 101 Predicting ... - Predicting - done. Time (sec): 0.0005672 + Predicting - done. Time (sec): 0.0007710 - Prediction time/pt. (sec) : 0.0000056 + Prediction time/pt. (sec) : 0.0000076 .. figure:: mfkpls_TestMFKPLS_run_mfkpls_example.png @@ -191,7 +191,7 @@ Options - Power for the pow_exp kernel function (valid values in (0.0, 2.0]), This option is set automatically when corr option is squar, abs, or matern. * - categorical_kernel - MixIntKernelType.CONT_RELAX - - [, , , ] + - [, , , , ] - None - The kernel to use for categorical inputs. Only for non continuous Kriging * - hierarchical_kernel @@ -216,7 +216,7 @@ Options - bounds for hyperparameters * - hyper_opt - Cobyla - - ['Cobyla', 'TNC'] + - ['Cobyla'] - ['str'] - Optimiser for hyperparameters optimisation * - eval_noise diff --git a/doc/_src_docs/applications/mfkplsk.rst b/doc/_src_docs/applications/mfkplsk.rst index baded0c0e..51deaeaae 100644 --- a/doc/_src_docs/applications/mfkplsk.rst +++ b/doc/_src_docs/applications/mfkplsk.rst @@ -108,7 +108,7 @@ Usage Training Training ... - Training - done. Time (sec): 0.2774885 + Training - done. Time (sec): 0.2852046 ___________________________________________________________________________ Evaluation @@ -116,9 +116,9 @@ Usage # eval points. : 101 Predicting ... - Predicting - done. Time (sec): 0.0005379 + Predicting - done. Time (sec): 0.0007157 - Prediction time/pt. (sec) : 0.0000053 + Prediction time/pt. (sec) : 0.0000071 ___________________________________________________________________________ @@ -127,9 +127,9 @@ Usage # eval points. : 101 Predicting ... - Predicting - done. Time (sec): 0.0005195 + Predicting - done. Time (sec): 0.0007243 - Prediction time/pt. (sec) : 0.0000051 + Prediction time/pt. (sec) : 0.0000072 .. figure:: mfkplsk_TestMFKPLSK_run_mfkplsk_example.png @@ -191,7 +191,7 @@ Options - Power for the pow_exp kernel function (valid values in (0.0, 2.0]), This option is set automatically when corr option is squar, abs, or matern. * - categorical_kernel - MixIntKernelType.CONT_RELAX - - [, , , ] + - [, , , , ] - None - The kernel to use for categorical inputs. Only for non continuous Kriging * - hierarchical_kernel @@ -216,7 +216,7 @@ Options - bounds for hyperparameters * - hyper_opt - Cobyla - - ['Cobyla', 'TNC'] + - ['Cobyla'] - ['str'] - Optimiser for hyperparameters optimisation * - eval_noise diff --git a/doc/_src_docs/applications/mgp.rst b/doc/_src_docs/applications/mgp.rst index b52b76189..188851795 100644 --- a/doc/_src_docs/applications/mgp.rst +++ b/doc/_src_docs/applications/mgp.rst @@ -128,7 +128,7 @@ Usage Training Training ... - Training - done. Time (sec): 1.2014399 + Training - done. Time (sec): 0.9149678 .. figure:: mgp_Test_test_mgp.png :scale: 80 % @@ -189,7 +189,7 @@ Options - Power for the pow_exp kernel function (valid values in (0.0, 2.0]), This option is set automatically when corr option is squar, abs, or matern. * - categorical_kernel - MixIntKernelType.CONT_RELAX - - [, , , ] + - [, , , , ] - None - The kernel to use for categorical inputs. Only for non continuous Kriging * - hierarchical_kernel @@ -213,7 +213,7 @@ Options - ['list', 'ndarray'] - bounds for hyperparameters * - hyper_opt - - Cobyla + - TNC - ['Cobyla', 'TNC'] - ['str'] - Optimiser for hyperparameters optimisation diff --git a/doc/_src_docs/applications/mgp_Test_test_mgp.png b/doc/_src_docs/applications/mgp_Test_test_mgp.png index c2cfb42a2..e18ad59ec 100644 Binary files a/doc/_src_docs/applications/mgp_Test_test_mgp.png and b/doc/_src_docs/applications/mgp_Test_test_mgp.png differ diff --git a/doc/_src_docs/applications/moe.rst b/doc/_src_docs/applications/moe.rst index 3419db961..366a187e1 100644 --- a/doc/_src_docs/applications/moe.rst +++ b/doc/_src_docs/applications/moe.rst @@ -114,26 +114,26 @@ Example 1 MOE Experts: ['KRG', 'KPLS', 'KPLSK', 'LS', 'QP', 'RBF', 'IDW', 'RMTB', 'RMTC'] MOE1 enabled experts: ['KRG', 'LS', 'QP', 'KPLS', 'KPLSK', 'RBF', 'RMTC', 'RMTB', 'IDW'] - Kriging 0.9958039509902394 + Kriging 0.9815707262895829 LS 2.0995727775991893 QP 2.310722069846135 - KPLS 0.9958039509902394 - KPLSK 0.9958039509902394 + KPLS 0.9815707262895829 + KPLSK 0.9825363966638618 RBF 0.7122118237076157 RMTC 0.45282839745731696 RMTB 0.3597578645031203 IDW 0.12658286305366004 Best expert = IDW MOE2 enabled experts: ['KRG', 'LS', 'IDW'] - Kriging 6.079121961377609e-08 + Kriging 6.275329367255722e-08 LS 0.0 IDW 0.0018250194376276951 Best expert = LS - Kriging 7.50623277540789e-07 + Kriging 7.49961633494793e-07 LS 0.03086687850659722 IDW 0.00366740075240353 Best expert = Kriging - Kriging 3.883768831314249e-06 + Kriging 3.884201217885241e-06 LS 0.07309199964574886 IDW 0.06980900375922333 Best expert = Kriging @@ -242,46 +242,46 @@ Example 2 MOE Experts: ['KRG', 'KPLS', 'KPLSK', 'LS', 'QP', 'RBF', 'IDW', 'RMTB', 'RMTC'] Enabled Experts: ['KRG', 'LS', 'QP', 'KPLS', 'RBF', 'RMTC', 'IDW'] - Kriging 0.00046387740197980466 - LS 0.07157076020656904 - QP 0.02217838851038167 - KPLS 0.0004223122159721488 - RBF 0.0008988895425178346 - RMTC 0.026248795091541047 - IDW 0.23729513276511724 - Best expert = KPLS - Kriging 0.002210698896907814 - LS 0.04486521104672596 - QP 0.017186868491651075 - KPLS 1.0366187649568073 - RBF 0.0027028250446870456 - RMTC 0.036342925075256924 - IDW 0.25149856997477293 - Best expert = Kriging - Kriging 0.0007785960093832406 + Kriging 0.0007803779033391166 LS 0.1004848526982306 QP 0.032881665708381975 - KPLS 0.0007141734000875625 + KPLS 0.0007142301436532854 RBF 0.0008723421582827863 RMTC 0.026507188424772923 IDW 0.1672279524416464 Best expert = KPLS - Kriging 0.001712965491096218 + Kriging 0.00015896773414401924 + LS 0.10034642438446555 + QP 0.016137577961415787 + KPLS 0.00011789817781383398 + RBF 0.00012095292356293105 + RMTC 0.037435012367327845 + IDW 0.10818152180292166 + Best expert = KPLS + Kriging 0.0027484554804403124 LS 0.20843142513255208 QP 0.04830566919024468 - KPLS 0.0016597617184863516 + KPLS 0.0016596614546306578 RBF 0.0017776814143541382 RMTC 0.02267578790156321 IDW 0.24113676800837835 Best expert = KPLS - Kriging 0.00015929957364973447 - LS 0.10034642438446555 - QP 0.016137577961415787 - KPLS 0.00011799065268499382 - RBF 0.00012095292356293105 - RMTC 0.037435012367327845 - IDW 0.10818152180292166 + Kriging 0.0004650841922269283 + LS 0.07157076020656904 + QP 0.02217838851038167 + KPLS 0.0004223720061388701 + RBF 0.0008988895425178346 + RMTC 0.026248795091541047 + IDW 0.23729513276511724 Best expert = KPLS + Kriging 0.0022109267481927497 + LS 0.04486521104672596 + QP 0.017186868491651075 + KPLS 1.036657965738807 + RBF 0.0027028250446870456 + RMTC 0.036342925075256924 + IDW 0.25149856997477293 + Best expert = Kriging .. figure:: moe_TestMOE_run_moe_example_2d.png :scale: 80 % diff --git a/doc/_src_docs/applications/moe_TestMOE_run_moe_example_1d.png b/doc/_src_docs/applications/moe_TestMOE_run_moe_example_1d.png index aec3d5644..4f9205a00 100644 Binary files a/doc/_src_docs/applications/moe_TestMOE_run_moe_example_1d.png and b/doc/_src_docs/applications/moe_TestMOE_run_moe_example_1d.png differ diff --git a/doc/_src_docs/applications/moe_TestMOE_run_moe_example_2d.png b/doc/_src_docs/applications/moe_TestMOE_run_moe_example_2d.png index 0259d72f3..1bcb6be27 100644 Binary files a/doc/_src_docs/applications/moe_TestMOE_run_moe_example_2d.png and b/doc/_src_docs/applications/moe_TestMOE_run_moe_example_2d.png differ diff --git a/doc/_src_docs/applications/vfm.rst b/doc/_src_docs/applications/vfm.rst index cd8c09c53..8c134b71c 100644 --- a/doc/_src_docs/applications/vfm.rst +++ b/doc/_src_docs/applications/vfm.rst @@ -50,7 +50,12 @@ Usage Bridge_candidate = "KRG" type_bridge = "Multiplicative" optionsLF = {} - optionsB = {"theta0": [1e-2] * ndim, "print_prediction": False, "deriv": False} + optionsB = { + "theta0": [1e-2] * ndim, + "print_prediction": False, + "deriv": False, + "hyper_opt": "Cobyla", + } # Construct low/high fidelity data and validation points sampling = LHS(xlimits=funLF.xlimits, criterion="m") @@ -118,7 +123,7 @@ Usage Training Training ... - Training - done. Time (sec): 0.3434765 + Training - done. Time (sec): 0.3257585 .. figure:: vfm_TestVFM_run_vfm_example.png :scale: 80 % diff --git a/doc/_src_docs/applications/vfm_TestVFM_run_vfm_example.png b/doc/_src_docs/applications/vfm_TestVFM_run_vfm_example.png index 69981a220..5f7984f08 100644 Binary files a/doc/_src_docs/applications/vfm_TestVFM_run_vfm_example.png and b/doc/_src_docs/applications/vfm_TestVFM_run_vfm_example.png differ diff --git a/doc/_src_docs/examples/b777_engine/b777_engine.rst b/doc/_src_docs/examples/b777_engine/b777_engine.rst index 09a240c8d..431fa4be4 100644 --- a/doc/_src_docs/examples/b777_engine/b777_engine.rst +++ b/doc/_src_docs/examples/b777_engine/b777_engine.rst @@ -306,25 +306,25 @@ RMTB Training ... Pre-computing matrices ... Computing dof2coeff ... - Computing dof2coeff - done. Time (sec): 0.0000029 + Computing dof2coeff - done. Time (sec): 0.0000031 Initializing Hessian ... - Initializing Hessian - done. Time (sec): 0.0005333 + Initializing Hessian - done. Time (sec): 0.0005209 Computing energy terms ... - Computing energy terms - done. Time (sec): 0.2833576 + Computing energy terms - done. Time (sec): 0.2799394 Computing approximation terms ... - Computing approximation terms - done. Time (sec): 0.0102527 - Pre-computing matrices - done. Time (sec): 0.2942176 + Computing approximation terms - done. Time (sec): 0.0100091 + Pre-computing matrices - done. Time (sec): 0.2905440 Solving for degrees of freedom ... Solving initial startup problem (n=3375) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 4.857178281e+07 2.642628384e+13 Iteration (num., iy, grad. norm, func.) : 0 0 1.364349733e+05 7.002441710e+09 - Solving for output 0 - done. Time (sec): 0.0885880 + Solving for output 0 - done. Time (sec): 0.0922627 Solving for output 1 ... Iteration (num., iy, grad. norm, func.) : 0 1 3.711896708e-01 7.697335516e-04 Iteration (num., iy, grad. norm, func.) : 0 1 1.384257034e-03 3.512467641e-07 - Solving for output 1 - done. Time (sec): 0.0884008 - Solving initial startup problem (n=3375) - done. Time (sec): 0.1770794 + Solving for output 1 - done. Time (sec): 0.0902426 + Solving initial startup problem (n=3375) - done. Time (sec): 0.1825855 Solving nonlinear problem (n=3375) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 1.364349733e+05 7.002441710e+09 @@ -348,7 +348,7 @@ RMTB Iteration (num., iy, grad. norm, func.) : 17 0 1.583184160e+03 1.493412967e+08 Iteration (num., iy, grad. norm, func.) : 18 0 2.202973513e+03 1.492035778e+08 Iteration (num., iy, grad. norm, func.) : 19 0 1.397841194e+03 1.489828558e+08 - Solving for output 0 - done. Time (sec): 1.7724838 + Solving for output 0 - done. Time (sec): 1.7940125 Solving for output 1 ... Iteration (num., iy, grad. norm, func.) : 0 1 1.384257034e-03 3.512467641e-07 Iteration (num., iy, grad. norm, func.) : 0 1 3.575138262e-04 6.166597300e-08 @@ -371,10 +371,10 @@ RMTB Iteration (num., iy, grad. norm, func.) : 17 1 1.005666171e-05 1.172498758e-09 Iteration (num., iy, grad. norm, func.) : 18 1 4.240888944e-06 1.143928197e-09 Iteration (num., iy, grad. norm, func.) : 19 1 4.653082813e-06 1.142989811e-09 - Solving for output 1 - done. Time (sec): 1.7775493 - Solving nonlinear problem (n=3375) - done. Time (sec): 3.5501003 - Solving for degrees of freedom - done. Time (sec): 3.7272718 - Training - done. Time (sec): 4.0223479 + Solving for output 1 - done. Time (sec): 1.7825229 + Solving nonlinear problem (n=3375) - done. Time (sec): 3.5766032 + Solving for degrees of freedom - done. Time (sec): 3.7592630 + Training - done. Time (sec): 4.0506797 ___________________________________________________________________________ Evaluation @@ -382,9 +382,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012805 + Predicting - done. Time (sec): 0.0013769 - Prediction time/pt. (sec) : 0.0000128 + Prediction time/pt. (sec) : 0.0000138 ___________________________________________________________________________ @@ -393,9 +393,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0011656 + Predicting - done. Time (sec): 0.0012255 - Prediction time/pt. (sec) : 0.0000117 + Prediction time/pt. (sec) : 0.0000123 ___________________________________________________________________________ @@ -404,9 +404,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0011556 + Predicting - done. Time (sec): 0.0012248 - Prediction time/pt. (sec) : 0.0000116 + Prediction time/pt. (sec) : 0.0000122 ___________________________________________________________________________ @@ -415,9 +415,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0011547 + Predicting - done. Time (sec): 0.0011845 - Prediction time/pt. (sec) : 0.0000115 + Prediction time/pt. (sec) : 0.0000118 ___________________________________________________________________________ @@ -426,7 +426,7 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0011721 + Predicting - done. Time (sec): 0.0011716 Prediction time/pt. (sec) : 0.0000117 @@ -437,9 +437,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0011621 + Predicting - done. Time (sec): 0.0011687 - Prediction time/pt. (sec) : 0.0000116 + Prediction time/pt. (sec) : 0.0000117 ___________________________________________________________________________ @@ -448,7 +448,7 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0011656 + Predicting - done. Time (sec): 0.0011730 Prediction time/pt. (sec) : 0.0000117 @@ -459,9 +459,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0011466 + Predicting - done. Time (sec): 0.0011699 - Prediction time/pt. (sec) : 0.0000115 + Prediction time/pt. (sec) : 0.0000117 ___________________________________________________________________________ @@ -470,9 +470,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012228 + Predicting - done. Time (sec): 0.0011830 - Prediction time/pt. (sec) : 0.0000122 + Prediction time/pt. (sec) : 0.0000118 ___________________________________________________________________________ @@ -481,9 +481,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012078 + Predicting - done. Time (sec): 0.0011725 - Prediction time/pt. (sec) : 0.0000121 + Prediction time/pt. (sec) : 0.0000117 ___________________________________________________________________________ @@ -492,9 +492,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012228 + Predicting - done. Time (sec): 0.0011773 - Prediction time/pt. (sec) : 0.0000122 + Prediction time/pt. (sec) : 0.0000118 ___________________________________________________________________________ @@ -503,9 +503,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012078 + Predicting - done. Time (sec): 0.0011685 - Prediction time/pt. (sec) : 0.0000121 + Prediction time/pt. (sec) : 0.0000117 ___________________________________________________________________________ @@ -514,9 +514,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012197 + Predicting - done. Time (sec): 0.0011749 - Prediction time/pt. (sec) : 0.0000122 + Prediction time/pt. (sec) : 0.0000117 ___________________________________________________________________________ @@ -525,9 +525,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012212 + Predicting - done. Time (sec): 0.0011857 - Prediction time/pt. (sec) : 0.0000122 + Prediction time/pt. (sec) : 0.0000119 ___________________________________________________________________________ @@ -536,9 +536,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012045 + Predicting - done. Time (sec): 0.0011725 - Prediction time/pt. (sec) : 0.0000120 + Prediction time/pt. (sec) : 0.0000117 ___________________________________________________________________________ @@ -547,9 +547,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012193 + Predicting - done. Time (sec): 0.0011747 - Prediction time/pt. (sec) : 0.0000122 + Prediction time/pt. (sec) : 0.0000117 ___________________________________________________________________________ @@ -558,9 +558,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012119 + Predicting - done. Time (sec): 0.0011766 - Prediction time/pt. (sec) : 0.0000121 + Prediction time/pt. (sec) : 0.0000118 ___________________________________________________________________________ @@ -569,9 +569,9 @@ RMTB # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0012147 + Predicting - done. Time (sec): 0.0011716 - Prediction time/pt. (sec) : 0.0000121 + Prediction time/pt. (sec) : 0.0000117 .. figure:: b777_engine.png @@ -623,25 +623,25 @@ RMTC Training ... Pre-computing matrices ... Computing dof2coeff ... - Computing dof2coeff - done. Time (sec): 0.0221884 + Computing dof2coeff - done. Time (sec): 0.0208304 Initializing Hessian ... - Initializing Hessian - done. Time (sec): 0.0005217 + Initializing Hessian - done. Time (sec): 0.0005007 Computing energy terms ... - Computing energy terms - done. Time (sec): 0.1968417 + Computing energy terms - done. Time (sec): 0.1770289 Computing approximation terms ... - Computing approximation terms - done. Time (sec): 0.0910423 - Pre-computing matrices - done. Time (sec): 0.3106997 + Computing approximation terms - done. Time (sec): 0.0946603 + Pre-computing matrices - done. Time (sec): 0.2932103 Solving for degrees of freedom ... Solving initial startup problem (n=2744) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 7.864862172e+07 2.642628384e+13 Iteration (num., iy, grad. norm, func.) : 0 0 2.020804204e+05 2.067017787e+09 - Solving for output 0 - done. Time (sec): 0.1912801 + Solving for output 0 - done. Time (sec): 0.1929002 Solving for output 1 ... Iteration (num., iy, grad. norm, func.) : 0 1 8.095040141e-01 7.697335516e-04 Iteration (num., iy, grad. norm, func.) : 0 1 1.242052177e-03 1.322622537e-07 - Solving for output 1 - done. Time (sec): 0.1920962 - Solving initial startup problem (n=2744) - done. Time (sec): 0.3834834 + Solving for output 1 - done. Time (sec): 0.1917922 + Solving initial startup problem (n=2744) - done. Time (sec): 0.3847921 Solving nonlinear problem (n=2744) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 2.020804204e+05 2.067017787e+09 @@ -665,7 +665,7 @@ RMTC Iteration (num., iy, grad. norm, func.) : 17 0 1.028007688e+03 3.298282370e+08 Iteration (num., iy, grad. norm, func.) : 18 0 3.399838938e+02 3.298087400e+08 Iteration (num., iy, grad. norm, func.) : 19 0 2.053750868e+02 3.298071682e+08 - Solving for output 0 - done. Time (sec): 3.7802360 + Solving for output 0 - done. Time (sec): 3.8131907 Solving for output 1 ... Iteration (num., iy, grad. norm, func.) : 0 1 1.242052177e-03 1.322622537e-07 Iteration (num., iy, grad. norm, func.) : 0 1 3.336667748e-04 9.461988364e-09 @@ -688,10 +688,10 @@ RMTC Iteration (num., iy, grad. norm, func.) : 17 1 7.400482695e-06 2.924517350e-09 Iteration (num., iy, grad. norm, func.) : 18 1 6.317494830e-06 2.922681890e-09 Iteration (num., iy, grad. norm, func.) : 19 1 1.047966941e-05 2.918951548e-09 - Solving for output 1 - done. Time (sec): 3.7826016 - Solving nonlinear problem (n=2744) - done. Time (sec): 7.5629272 - Solving for degrees of freedom - done. Time (sec): 7.9465067 - Training - done. Time (sec): 8.2599399 + Solving for output 1 - done. Time (sec): 3.8126450 + Solving nonlinear problem (n=2744) - done. Time (sec): 7.6259100 + Solving for degrees of freedom - done. Time (sec): 8.0107992 + Training - done. Time (sec): 8.3069422 ___________________________________________________________________________ Evaluation @@ -699,9 +699,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0029576 + Predicting - done. Time (sec): 0.0034683 - Prediction time/pt. (sec) : 0.0000296 + Prediction time/pt. (sec) : 0.0000347 ___________________________________________________________________________ @@ -710,9 +710,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0028090 + Predicting - done. Time (sec): 0.0034821 - Prediction time/pt. (sec) : 0.0000281 + Prediction time/pt. (sec) : 0.0000348 ___________________________________________________________________________ @@ -721,9 +721,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0028059 + Predicting - done. Time (sec): 0.0033333 - Prediction time/pt. (sec) : 0.0000281 + Prediction time/pt. (sec) : 0.0000333 ___________________________________________________________________________ @@ -732,9 +732,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0027966 + Predicting - done. Time (sec): 0.0034676 - Prediction time/pt. (sec) : 0.0000280 + Prediction time/pt. (sec) : 0.0000347 ___________________________________________________________________________ @@ -743,9 +743,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0029519 + Predicting - done. Time (sec): 0.0035820 - Prediction time/pt. (sec) : 0.0000295 + Prediction time/pt. (sec) : 0.0000358 ___________________________________________________________________________ @@ -754,9 +754,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0029473 + Predicting - done. Time (sec): 0.0035975 - Prediction time/pt. (sec) : 0.0000295 + Prediction time/pt. (sec) : 0.0000360 ___________________________________________________________________________ @@ -765,9 +765,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0027869 + Predicting - done. Time (sec): 0.0034707 - Prediction time/pt. (sec) : 0.0000279 + Prediction time/pt. (sec) : 0.0000347 ___________________________________________________________________________ @@ -776,9 +776,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0025973 + Predicting - done. Time (sec): 0.0032656 - Prediction time/pt. (sec) : 0.0000260 + Prediction time/pt. (sec) : 0.0000327 ___________________________________________________________________________ @@ -787,9 +787,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0028708 + Predicting - done. Time (sec): 0.0036094 - Prediction time/pt. (sec) : 0.0000287 + Prediction time/pt. (sec) : 0.0000361 ___________________________________________________________________________ @@ -798,9 +798,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0027230 + Predicting - done. Time (sec): 0.0034285 - Prediction time/pt. (sec) : 0.0000272 + Prediction time/pt. (sec) : 0.0000343 ___________________________________________________________________________ @@ -809,9 +809,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0027533 + Predicting - done. Time (sec): 0.0032477 - Prediction time/pt. (sec) : 0.0000275 + Prediction time/pt. (sec) : 0.0000325 ___________________________________________________________________________ @@ -820,9 +820,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0026200 + Predicting - done. Time (sec): 0.0032966 - Prediction time/pt. (sec) : 0.0000262 + Prediction time/pt. (sec) : 0.0000330 ___________________________________________________________________________ @@ -831,9 +831,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0028691 + Predicting - done. Time (sec): 0.0035906 - Prediction time/pt. (sec) : 0.0000287 + Prediction time/pt. (sec) : 0.0000359 ___________________________________________________________________________ @@ -842,9 +842,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0027015 + Predicting - done. Time (sec): 0.0034304 - Prediction time/pt. (sec) : 0.0000270 + Prediction time/pt. (sec) : 0.0000343 ___________________________________________________________________________ @@ -853,9 +853,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0028729 + Predicting - done. Time (sec): 0.0035970 - Prediction time/pt. (sec) : 0.0000287 + Prediction time/pt. (sec) : 0.0000360 ___________________________________________________________________________ @@ -864,9 +864,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0027158 + Predicting - done. Time (sec): 0.0034347 - Prediction time/pt. (sec) : 0.0000272 + Prediction time/pt. (sec) : 0.0000343 ___________________________________________________________________________ @@ -875,9 +875,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0030129 + Predicting - done. Time (sec): 0.0034902 - Prediction time/pt. (sec) : 0.0000301 + Prediction time/pt. (sec) : 0.0000349 ___________________________________________________________________________ @@ -886,9 +886,9 @@ RMTC # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0028460 + Predicting - done. Time (sec): 0.0035002 - Prediction time/pt. (sec) : 0.0000285 + Prediction time/pt. (sec) : 0.0000350 .. figure:: b777_engine.png diff --git a/doc/_src_docs/examples/rans_crm_wing/rans_crm_wing.rst b/doc/_src_docs/examples/rans_crm_wing/rans_crm_wing.rst index 32f264f89..0114f07ee 100644 --- a/doc/_src_docs/examples/rans_crm_wing/rans_crm_wing.rst +++ b/doc/_src_docs/examples/rans_crm_wing/rans_crm_wing.rst @@ -499,25 +499,25 @@ RMTB Training ... Pre-computing matrices ... Computing dof2coeff ... - Computing dof2coeff - done. Time (sec): 0.0000029 + Computing dof2coeff - done. Time (sec): 0.0000026 Initializing Hessian ... - Initializing Hessian - done. Time (sec): 0.0004878 + Initializing Hessian - done. Time (sec): 0.0004532 Computing energy terms ... - Computing energy terms - done. Time (sec): 0.0047712 + Computing energy terms - done. Time (sec): 0.0047638 Computing approximation terms ... - Computing approximation terms - done. Time (sec): 0.0005231 - Pre-computing matrices - done. Time (sec): 0.0058413 + Computing approximation terms - done. Time (sec): 0.0005383 + Pre-computing matrices - done. Time (sec): 0.0058136 Solving for degrees of freedom ... Solving initial startup problem (n=400) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 9.429150220e-02 1.114942861e-02 Iteration (num., iy, grad. norm, func.) : 0 0 1.143986917e-08 1.793039631e-10 - Solving for output 0 - done. Time (sec): 0.0110190 + Solving for output 0 - done. Time (sec): 0.0112951 Solving for output 1 ... Iteration (num., iy, grad. norm, func.) : 0 1 1.955493282e+00 4.799845498e+00 Iteration (num., iy, grad. norm, func.) : 0 1 2.384072909e-06 4.568551517e-08 - Solving for output 1 - done. Time (sec): 0.0110173 - Solving initial startup problem (n=400) - done. Time (sec): 0.0220981 + Solving for output 1 - done. Time (sec): 0.0114489 + Solving initial startup problem (n=400) - done. Time (sec): 0.0228059 Solving nonlinear problem (n=400) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 6.652690767e-09 1.793037175e-10 @@ -534,7 +534,7 @@ RMTB Iteration (num., iy, grad. norm, func.) : 10 0 9.863609127e-12 6.260241753e-12 Iteration (num., iy, grad. norm, func.) : 11 0 4.745498751e-12 6.256621620e-12 Iteration (num., iy, grad. norm, func.) : 12 0 5.194090622e-13 6.255685807e-12 - Solving for output 0 - done. Time (sec): 0.1409807 + Solving for output 0 - done. Time (sec): 0.1453168 Solving for output 1 ... Iteration (num., iy, grad. norm, func.) : 0 1 9.721474920e-08 4.567635024e-08 Iteration (num., iy, grad. norm, func.) : 0 1 9.329075021e-08 4.538184815e-08 @@ -566,10 +566,10 @@ RMTB Iteration (num., iy, grad. norm, func.) : 26 1 1.536813934e-12 2.713450397e-10 Iteration (num., iy, grad. norm, func.) : 27 1 2.749790739e-12 2.713450113e-10 Iteration (num., iy, grad. norm, func.) : 28 1 6.496098764e-13 2.713449801e-10 - Solving for output 1 - done. Time (sec): 0.3234160 - Solving nonlinear problem (n=400) - done. Time (sec): 0.4644523 - Solving for degrees of freedom - done. Time (sec): 0.4866047 - Training - done. Time (sec): 0.4928060 + Solving for output 1 - done. Time (sec): 0.3223901 + Solving nonlinear problem (n=400) - done. Time (sec): 0.4677677 + Solving for degrees of freedom - done. Time (sec): 0.4906218 + Training - done. Time (sec): 0.4967644 ___________________________________________________________________________ Evaluation @@ -577,9 +577,9 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0006843 + Predicting - done. Time (sec): 0.0006168 - Prediction time/pt. (sec) : 0.0000014 + Prediction time/pt. (sec) : 0.0000012 ___________________________________________________________________________ @@ -588,7 +588,7 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0005519 + Predicting - done. Time (sec): 0.0005569 Prediction time/pt. (sec) : 0.0000011 @@ -599,9 +599,9 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0005732 + Predicting - done. Time (sec): 0.0006070 - Prediction time/pt. (sec) : 0.0000011 + Prediction time/pt. (sec) : 0.0000012 ___________________________________________________________________________ @@ -610,7 +610,7 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0005701 + Predicting - done. Time (sec): 0.0005560 Prediction time/pt. (sec) : 0.0000011 @@ -621,7 +621,7 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0005894 + Predicting - done. Time (sec): 0.0006108 Prediction time/pt. (sec) : 0.0000012 @@ -632,7 +632,7 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0005476 + Predicting - done. Time (sec): 0.0005505 Prediction time/pt. (sec) : 0.0000011 @@ -643,7 +643,7 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0006082 + Predicting - done. Time (sec): 0.0005772 Prediction time/pt. (sec) : 0.0000012 @@ -654,7 +654,7 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0005419 + Predicting - done. Time (sec): 0.0005591 Prediction time/pt. (sec) : 0.0000011 @@ -665,9 +665,9 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0006645 + Predicting - done. Time (sec): 0.0006189 - Prediction time/pt. (sec) : 0.0000013 + Prediction time/pt. (sec) : 0.0000012 ___________________________________________________________________________ @@ -676,9 +676,9 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0005865 + Predicting - done. Time (sec): 0.0005662 - Prediction time/pt. (sec) : 0.0000012 + Prediction time/pt. (sec) : 0.0000011 ___________________________________________________________________________ @@ -687,9 +687,9 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0006404 + Predicting - done. Time (sec): 0.0005867 - Prediction time/pt. (sec) : 0.0000013 + Prediction time/pt. (sec) : 0.0000012 ___________________________________________________________________________ @@ -698,9 +698,9 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0006011 + Predicting - done. Time (sec): 0.0005436 - Prediction time/pt. (sec) : 0.0000012 + Prediction time/pt. (sec) : 0.0000011 ___________________________________________________________________________ @@ -709,9 +709,9 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0006433 + Predicting - done. Time (sec): 0.0005887 - Prediction time/pt. (sec) : 0.0000013 + Prediction time/pt. (sec) : 0.0000012 ___________________________________________________________________________ @@ -720,9 +720,9 @@ RMTB # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0005908 + Predicting - done. Time (sec): 0.0005579 - Prediction time/pt. (sec) : 0.0000012 + Prediction time/pt. (sec) : 0.0000011 ___________________________________________________________________________ @@ -731,7 +731,7 @@ RMTB # eval points. : 2500 Predicting ... - Predicting - done. Time (sec): 0.0016086 + Predicting - done. Time (sec): 0.0015001 Prediction time/pt. (sec) : 0.0000006 @@ -742,7 +742,7 @@ RMTB # eval points. : 2500 Predicting ... - Predicting - done. Time (sec): 0.0015078 + Predicting - done. Time (sec): 0.0013916 Prediction time/pt. (sec) : 0.0000006 @@ -790,25 +790,25 @@ RMTC Training ... Pre-computing matrices ... Computing dof2coeff ... - Computing dof2coeff - done. Time (sec): 0.0028155 + Computing dof2coeff - done. Time (sec): 0.0027974 Initializing Hessian ... - Initializing Hessian - done. Time (sec): 0.0004179 + Initializing Hessian - done. Time (sec): 0.0004127 Computing energy terms ... - Computing energy terms - done. Time (sec): 0.0132289 + Computing energy terms - done. Time (sec): 0.0133660 Computing approximation terms ... - Computing approximation terms - done. Time (sec): 0.0009639 - Pre-computing matrices - done. Time (sec): 0.0174913 + Computing approximation terms - done. Time (sec): 0.0009699 + Pre-computing matrices - done. Time (sec): 0.0176098 Solving for degrees of freedom ... Solving initial startup problem (n=1764) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 1.279175539e-01 1.114942861e-02 Iteration (num., iy, grad. norm, func.) : 0 0 1.892260075e-05 2.158606140e-08 - Solving for output 0 - done. Time (sec): 0.0256286 + Solving for output 0 - done. Time (sec): 0.0258362 Solving for output 1 ... Iteration (num., iy, grad. norm, func.) : 0 1 2.653045755e+00 4.799845498e+00 Iteration (num., iy, grad. norm, func.) : 0 1 2.577030681e-04 6.438878057e-06 - Solving for output 1 - done. Time (sec): 0.0254734 - Solving initial startup problem (n=1764) - done. Time (sec): 0.0511737 + Solving for output 1 - done. Time (sec): 0.0259404 + Solving initial startup problem (n=1764) - done. Time (sec): 0.0518465 Solving nonlinear problem (n=1764) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 7.702060163e-07 2.130719039e-08 @@ -880,7 +880,7 @@ RMTC Iteration (num., iy, grad. norm, func.) : 65 0 1.304489358e-12 2.864924159e-10 Iteration (num., iy, grad. norm, func.) : 66 0 1.084620898e-12 2.864924159e-10 Iteration (num., iy, grad. norm, func.) : 67 0 8.307239132e-13 2.864924158e-10 - Solving for output 0 - done. Time (sec): 1.7254970 + Solving for output 0 - done. Time (sec): 1.7402730 Solving for output 1 ... Iteration (num., iy, grad. norm, func.) : 0 1 1.314155074e-05 6.384202420e-06 Iteration (num., iy, grad. norm, func.) : 0 1 1.315928341e-05 6.143977713e-06 @@ -958,10 +958,10 @@ RMTC Iteration (num., iy, grad. norm, func.) : 72 1 2.984397056e-12 1.446355915e-08 Iteration (num., iy, grad. norm, func.) : 73 1 5.117378702e-12 1.446355915e-08 Iteration (num., iy, grad. norm, func.) : 74 1 9.244208624e-13 1.446355915e-08 - Solving for output 1 - done. Time (sec): 1.9191322 - Solving nonlinear problem (n=1764) - done. Time (sec): 3.6446915 - Solving for degrees of freedom - done. Time (sec): 3.6959269 - Training - done. Time (sec): 3.7141054 + Solving for output 1 - done. Time (sec): 1.9195404 + Solving nonlinear problem (n=1764) - done. Time (sec): 3.6598823 + Solving for degrees of freedom - done. Time (sec): 3.7117989 + Training - done. Time (sec): 3.7300661 ___________________________________________________________________________ Evaluation @@ -969,7 +969,7 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0010078 + Predicting - done. Time (sec): 0.0010190 Prediction time/pt. (sec) : 0.0000020 @@ -980,7 +980,7 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0008991 + Predicting - done. Time (sec): 0.0008934 Prediction time/pt. (sec) : 0.0000018 @@ -991,7 +991,7 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0010147 + Predicting - done. Time (sec): 0.0010228 Prediction time/pt. (sec) : 0.0000020 @@ -1002,7 +1002,7 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0009694 + Predicting - done. Time (sec): 0.0009742 Prediction time/pt. (sec) : 0.0000019 @@ -1013,9 +1013,9 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0009682 + Predicting - done. Time (sec): 0.0009773 - Prediction time/pt. (sec) : 0.0000019 + Prediction time/pt. (sec) : 0.0000020 ___________________________________________________________________________ @@ -1024,9 +1024,9 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0009191 + Predicting - done. Time (sec): 0.0009294 - Prediction time/pt. (sec) : 0.0000018 + Prediction time/pt. (sec) : 0.0000019 ___________________________________________________________________________ @@ -1035,7 +1035,7 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0010161 + Predicting - done. Time (sec): 0.0010207 Prediction time/pt. (sec) : 0.0000020 @@ -1046,9 +1046,9 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0009680 + Predicting - done. Time (sec): 0.0009754 - Prediction time/pt. (sec) : 0.0000019 + Prediction time/pt. (sec) : 0.0000020 ___________________________________________________________________________ @@ -1057,7 +1057,7 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0009995 + Predicting - done. Time (sec): 0.0010130 Prediction time/pt. (sec) : 0.0000020 @@ -1068,7 +1068,7 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0009403 + Predicting - done. Time (sec): 0.0009489 Prediction time/pt. (sec) : 0.0000019 @@ -1079,7 +1079,7 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0009837 + Predicting - done. Time (sec): 0.0009880 Prediction time/pt. (sec) : 0.0000020 @@ -1090,7 +1090,7 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0009420 + Predicting - done. Time (sec): 0.0009463 Prediction time/pt. (sec) : 0.0000019 @@ -1101,9 +1101,9 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0010395 + Predicting - done. Time (sec): 0.0009854 - Prediction time/pt. (sec) : 0.0000021 + Prediction time/pt. (sec) : 0.0000020 ___________________________________________________________________________ @@ -1112,7 +1112,7 @@ RMTC # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0009429 + Predicting - done. Time (sec): 0.0009484 Prediction time/pt. (sec) : 0.0000019 @@ -1123,9 +1123,9 @@ RMTC # eval points. : 2500 Predicting ... - Predicting - done. Time (sec): 0.0048163 + Predicting - done. Time (sec): 0.0036263 - Prediction time/pt. (sec) : 0.0000019 + Prediction time/pt. (sec) : 0.0000015 ___________________________________________________________________________ @@ -1134,9 +1134,9 @@ RMTC # eval points. : 2500 Predicting ... - Predicting - done. Time (sec): 0.0047028 + Predicting - done. Time (sec): 0.0035183 - Prediction time/pt. (sec) : 0.0000019 + Prediction time/pt. (sec) : 0.0000014 .. figure:: rans_crm_wing.png diff --git a/doc/_src_docs/problems/mixedcantileverbeam_Test_test_mixed_cantilever_beam.png b/doc/_src_docs/problems/mixedcantileverbeam_Test_test_mixed_cantilever_beam.png index d00eeec96..89ccfba12 100644 Binary files a/doc/_src_docs/problems/mixedcantileverbeam_Test_test_mixed_cantilever_beam.png and b/doc/_src_docs/problems/mixedcantileverbeam_Test_test_mixed_cantilever_beam.png differ diff --git a/doc/_src_docs/problems/neuralnetwork.rst b/doc/_src_docs/problems/neuralnetwork.rst index ab87a887e..7f29b024f 100644 --- a/doc/_src_docs/problems/neuralnetwork.rst +++ b/doc/_src_docs/problems/neuralnetwork.rst @@ -16,14 +16,18 @@ Usage import matplotlib.pyplot as plt from smt.problems import HierarchicalNeuralNetwork + from smt.applications.mixed_integer import MixedIntegerSamplingMethod + from smt.sampling_methods import LHS problem = HierarchicalNeuralNetwork() - + ds = problem.design_space n_doe = 100 - xdoe, x_is_acting = problem.design_space.sample_valid_x( - n_doe - ) # If acting information is needed - # xdoe = problem.sample(n_doe) # Also possible + ds.seed = 42 + samp = MixedIntegerSamplingMethod( + LHS, ds, criterion="ese", random_state=ds.seed + ) + xdoe = samp(n_doe) + y = problem(xdoe) plt.scatter(xdoe[:, 0], y) diff --git a/doc/_src_docs/problems/neuralnetwork_Test_test_hier_neural_network.png b/doc/_src_docs/problems/neuralnetwork_Test_test_hier_neural_network.png index 87f139e6b..f324a7c96 100644 Binary files a/doc/_src_docs/problems/neuralnetwork_Test_test_hier_neural_network.png and b/doc/_src_docs/problems/neuralnetwork_Test_test_hier_neural_network.png differ diff --git a/doc/_src_docs/sampling_methods/lhs_Test_run_lhs.png b/doc/_src_docs/sampling_methods/lhs_Test_run_lhs.png index 965a42c1f..211ffd595 100644 Binary files a/doc/_src_docs/sampling_methods/lhs_Test_run_lhs.png and b/doc/_src_docs/sampling_methods/lhs_Test_run_lhs.png differ diff --git a/doc/_src_docs/sampling_methods_Test_run_random.png b/doc/_src_docs/sampling_methods_Test_run_random.png index 05044e62d..7077357b1 100644 Binary files a/doc/_src_docs/sampling_methods_Test_run_random.png and b/doc/_src_docs/sampling_methods_Test_run_random.png differ diff --git a/doc/_src_docs/surrogate_models.rst b/doc/_src_docs/surrogate_models.rst index c17c8ebad..55738bfba 100644 --- a/doc/_src_docs/surrogate_models.rst +++ b/doc/_src_docs/surrogate_models.rst @@ -67,13 +67,13 @@ Usage Training ... Initializing linear solver ... Performing LU fact. (5 x 5 mtx) ... - Performing LU fact. (5 x 5 mtx) - done. Time (sec): 0.0001109 - Initializing linear solver - done. Time (sec): 0.0001407 + Performing LU fact. (5 x 5 mtx) - done. Time (sec): 0.0001042 + Initializing linear solver - done. Time (sec): 0.0001271 Solving linear system (col. 0) ... Back solving (5 x 5 mtx) ... - Back solving (5 x 5 mtx) - done. Time (sec): 0.0060341 - Solving linear system (col. 0) - done. Time (sec): 0.0060556 - Training - done. Time (sec): 0.0066800 + Back solving (5 x 5 mtx) - done. Time (sec): 0.0000641 + Solving linear system (col. 0) - done. Time (sec): 0.0000830 + Training - done. Time (sec): 0.0005043 ___________________________________________________________________________ Evaluation @@ -81,9 +81,9 @@ Usage # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0000398 + Predicting - done. Time (sec): 0.0000305 - Prediction time/pt. (sec) : 0.0000004 + Prediction time/pt. (sec) : 0.0000003 .. figure:: surrogate_models_Test_test_rbf.png diff --git a/doc/_src_docs/surrogate_models/gekpls.rst b/doc/_src_docs/surrogate_models/gekpls.rst index 5cff262ab..f9657d7fe 100644 --- a/doc/_src_docs/surrogate_models/gekpls.rst +++ b/doc/_src_docs/surrogate_models/gekpls.rst @@ -98,7 +98,7 @@ Usage Training Training ... - Training - done. Time (sec): 0.1576357 + Training - done. Time (sec): 0.1718783 .. figure:: gekpls_Test_test_gekpls.png :scale: 80 % @@ -159,7 +159,7 @@ Options - Power for the pow_exp kernel function (valid values in (0.0, 2.0]), This option is set automatically when corr option is squar, abs, or matern. * - categorical_kernel - MixIntKernelType.CONT_RELAX - - [, , , ] + - [, , , , ] - None - The kernel to use for categorical inputs. Only for non continuous Kriging * - hierarchical_kernel @@ -184,7 +184,7 @@ Options - bounds for hyperparameters * - hyper_opt - Cobyla - - ['Cobyla', 'TNC'] + - ['Cobyla'] - ['str'] - Optimiser for hyperparameters optimisation * - eval_noise diff --git a/doc/_src_docs/surrogate_models/gekpls_Test_test_gekpls.png b/doc/_src_docs/surrogate_models/gekpls_Test_test_gekpls.png index 67c234db1..35ac62a26 100644 Binary files a/doc/_src_docs/surrogate_models/gekpls_Test_test_gekpls.png and b/doc/_src_docs/surrogate_models/gekpls_Test_test_gekpls.png differ diff --git a/doc/_src_docs/surrogate_models/genn.rst b/doc/_src_docs/surrogate_models/genn.rst index 6412b1b86..008ee16fd 100644 --- a/doc/_src_docs/surrogate_models/genn.rst +++ b/doc/_src_docs/surrogate_models/genn.rst @@ -53,21 +53,21 @@ Usage genn.options["alpha"] = 0.1 # learning rate that controls optimizer step size genn.options["beta1"] = 0.9 # tuning parameter to control ADAM optimization genn.options["beta2"] = 0.99 # tuning parameter to control ADAM optimization - genn.options[ - "lambd" - ] = 0.1 # lambd = 0. = no regularization, lambd > 0 = regularization - genn.options[ - "gamma" - ] = 1.0 # gamma = 0. = no grad-enhancement, gamma > 0 = grad-enhancement + genn.options["lambd"] = ( + 0.1 # lambd = 0. = no regularization, lambd > 0 = regularization + ) + genn.options["gamma"] = ( + 1.0 # gamma = 0. = no grad-enhancement, gamma > 0 = grad-enhancement + ) genn.options["deep"] = 2 # number of hidden layers genn.options["wide"] = 6 # number of nodes per hidden layer - genn.options[ - "mini_batch_size" - ] = 64 # used to divide data into training batches (use for large data sets) + genn.options["mini_batch_size"] = ( + 64 # used to divide data into training batches (use for large data sets) + ) genn.options["num_epochs"] = 20 # number of passes through data - genn.options[ - "num_iterations" - ] = 100 # number of optimizer iterations per mini-batch + genn.options["num_iterations"] = ( + 100 # number of optimizer iterations per mini-batch + ) genn.options["is_print"] = True # print output (or not) load_smt_data( genn, xt, yt, dyt_dxt @@ -107,27 +107,27 @@ Usage Training Training ... - epoch = 0, mini-batch = 0, avg cost = 15.902 - epoch = 1, mini-batch = 0, avg cost = 0.821 - epoch = 2, mini-batch = 0, avg cost = 0.677 - epoch = 3, mini-batch = 0, avg cost = 0.645 - epoch = 4, mini-batch = 0, avg cost = 0.627 - epoch = 5, mini-batch = 0, avg cost = 0.620 - epoch = 6, mini-batch = 0, avg cost = 0.614 - epoch = 7, mini-batch = 0, avg cost = 0.609 - epoch = 8, mini-batch = 0, avg cost = 0.604 + epoch = 0, mini-batch = 0, avg cost = 15.913 + epoch = 1, mini-batch = 0, avg cost = 0.776 + epoch = 2, mini-batch = 0, avg cost = 0.664 + epoch = 3, mini-batch = 0, avg cost = 0.646 + epoch = 4, mini-batch = 0, avg cost = 0.632 + epoch = 5, mini-batch = 0, avg cost = 0.623 + epoch = 6, mini-batch = 0, avg cost = 0.617 + epoch = 7, mini-batch = 0, avg cost = 0.610 + epoch = 8, mini-batch = 0, avg cost = 0.605 epoch = 9, mini-batch = 0, avg cost = 0.600 - epoch = 10, mini-batch = 0, avg cost = 0.596 + epoch = 10, mini-batch = 0, avg cost = 0.597 epoch = 11, mini-batch = 0, avg cost = 0.593 - epoch = 12, mini-batch = 0, avg cost = 0.589 - epoch = 13, mini-batch = 0, avg cost = 0.587 - epoch = 14, mini-batch = 0, avg cost = 0.583 + epoch = 12, mini-batch = 0, avg cost = 0.590 + epoch = 13, mini-batch = 0, avg cost = 0.586 + epoch = 14, mini-batch = 0, avg cost = 0.584 epoch = 15, mini-batch = 0, avg cost = 0.581 epoch = 16, mini-batch = 0, avg cost = 0.580 epoch = 17, mini-batch = 0, avg cost = 0.578 epoch = 18, mini-batch = 0, avg cost = 0.576 - epoch = 19, mini-batch = 0, avg cost = 0.573 - Training - done. Time (sec): 5.3290997 + epoch = 19, mini-batch = 0, avg cost = 0.574 + Training - done. Time (sec): 5.6117277 ___________________________________________________________________________ Evaluation @@ -135,9 +135,9 @@ Usage # eval points. : 629 Predicting ... - Predicting - done. Time (sec): 0.0005703 + Predicting - done. Time (sec): 0.0006106 - Prediction time/pt. (sec) : 0.0000009 + Prediction time/pt. (sec) : 0.0000010 .. figure:: genn_Test_test_genn.png diff --git a/doc/_src_docs/surrogate_models/genn_Test_test_genn.png b/doc/_src_docs/surrogate_models/genn_Test_test_genn.png index ab136ae3c..251f6eca3 100644 Binary files a/doc/_src_docs/surrogate_models/genn_Test_test_genn.png and b/doc/_src_docs/surrogate_models/genn_Test_test_genn.png differ diff --git a/doc/_src_docs/surrogate_models/idw.rst b/doc/_src_docs/surrogate_models/idw.rst index 515d7ef24..998cabd39 100644 --- a/doc/_src_docs/surrogate_models/idw.rst +++ b/doc/_src_docs/surrogate_models/idw.rst @@ -79,7 +79,7 @@ Usage Training Training ... - Training - done. Time (sec): 0.0001338 + Training - done. Time (sec): 0.0001416 ___________________________________________________________________________ Evaluation @@ -87,7 +87,7 @@ Usage # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0000291 + Predicting - done. Time (sec): 0.0000296 Prediction time/pt. (sec) : 0.0000003 diff --git a/doc/_src_docs/surrogate_models/kpls.rst b/doc/_src_docs/surrogate_models/kpls.rst index f6483e61b..f4a337ec0 100644 --- a/doc/_src_docs/surrogate_models/kpls.rst +++ b/doc/_src_docs/surrogate_models/kpls.rst @@ -83,7 +83,7 @@ Usage Training Training ... - Training - done. Time (sec): 0.0795786 + Training - done. Time (sec): 0.1402104 ___________________________________________________________________________ Evaluation @@ -91,9 +91,9 @@ Usage # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0025928 + Predicting - done. Time (sec): 0.0025821 - Prediction time/pt. (sec) : 0.0000259 + Prediction time/pt. (sec) : 0.0000258 ___________________________________________________________________________ @@ -102,9 +102,9 @@ Usage # eval points. : 5 Predicting ... - Predicting - done. Time (sec): 0.0003479 + Predicting - done. Time (sec): 0.0004458 - Prediction time/pt. (sec) : 0.0000696 + Prediction time/pt. (sec) : 0.0000892 .. figure:: kpls_Test_test_kpls.png @@ -158,7 +158,7 @@ Usage with an automatic number of components Training Training ... - Training - done. Time (sec): 2.8484025 + Training - done. Time (sec): 14.0136063 The model automatically choose 3 components. ___________________________________________________________________________ @@ -168,12 +168,12 @@ Usage with an automatic number of components # eval points. : 1 Predicting ... - Predicting - done. Time (sec): 0.0009630 + Predicting - done. Time (sec): 0.0011318 - Prediction time/pt. (sec) : 0.0009630 + Prediction time/pt. (sec) : 0.0011318 - [[139.58262186]] - [[212.52053124]] + [[139.34911523]] + [[212.53624102]] Options @@ -231,7 +231,7 @@ Options - Power for the pow_exp kernel function (valid values in (0.0, 2.0]), This option is set automatically when corr option is squar, abs, or matern. * - categorical_kernel - MixIntKernelType.CONT_RELAX - - [, , , ] + - [, , , , ] - None - The kernel to use for categorical inputs. Only for non continuous Kriging * - hierarchical_kernel @@ -255,7 +255,7 @@ Options - ['list', 'ndarray'] - bounds for hyperparameters * - hyper_opt - - Cobyla + - TNC - ['Cobyla', 'TNC'] - ['str'] - Optimiser for hyperparameters optimisation diff --git a/doc/_src_docs/surrogate_models/kpls_Test_test_kpls.png b/doc/_src_docs/surrogate_models/kpls_Test_test_kpls.png index 5dda75092..d5e173276 100644 Binary files a/doc/_src_docs/surrogate_models/kpls_Test_test_kpls.png and b/doc/_src_docs/surrogate_models/kpls_Test_test_kpls.png differ diff --git a/doc/_src_docs/surrogate_models/kplsk.rst b/doc/_src_docs/surrogate_models/kplsk.rst index 528d03d40..91b1bd0d8 100644 --- a/doc/_src_docs/surrogate_models/kplsk.rst +++ b/doc/_src_docs/surrogate_models/kplsk.rst @@ -85,7 +85,7 @@ Usage Training Training ... - Training - done. Time (sec): 0.1207759 + Training - done. Time (sec): 0.2621579 ___________________________________________________________________________ Evaluation @@ -93,9 +93,9 @@ Usage # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0023532 + Predicting - done. Time (sec): 0.0025518 - Prediction time/pt. (sec) : 0.0000235 + Prediction time/pt. (sec) : 0.0000255 ___________________________________________________________________________ @@ -104,9 +104,9 @@ Usage # eval points. : 5 Predicting ... - Predicting - done. Time (sec): 0.0003793 + Predicting - done. Time (sec): 0.0004759 - Prediction time/pt. (sec) : 0.0000759 + Prediction time/pt. (sec) : 0.0000952 .. figure:: kplsk_Test_test_kplsk.png @@ -168,7 +168,7 @@ Options - Power for the pow_exp kernel function (valid values in (0.0, 2.0]), This option is set automatically when corr option is squar, abs, or matern. * - categorical_kernel - MixIntKernelType.CONT_RELAX - - [, , , ] + - [, , , , ] - None - The kernel to use for categorical inputs. Only for non continuous Kriging * - hierarchical_kernel @@ -192,7 +192,7 @@ Options - ['list', 'ndarray'] - bounds for hyperparameters * - hyper_opt - - Cobyla + - TNC - ['Cobyla', 'TNC'] - ['str'] - Optimiser for hyperparameters optimisation diff --git a/doc/_src_docs/surrogate_models/kplsk_Test_test_kplsk.png b/doc/_src_docs/surrogate_models/kplsk_Test_test_kplsk.png index 5dda75092..d5e173276 100644 Binary files a/doc/_src_docs/surrogate_models/kplsk_Test_test_kplsk.png and b/doc/_src_docs/surrogate_models/kplsk_Test_test_kplsk.png differ diff --git a/doc/_src_docs/surrogate_models/krg.rst b/doc/_src_docs/surrogate_models/krg.rst index b8a243e77..d4bfab473 100644 --- a/doc/_src_docs/surrogate_models/krg.rst +++ b/doc/_src_docs/surrogate_models/krg.rst @@ -136,7 +136,7 @@ Example 1 Training Training ... - Training - done. Time (sec): 0.0798278 + Training - done. Time (sec): 0.1418922 ___________________________________________________________________________ Evaluation @@ -144,9 +144,9 @@ Example 1 # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0024059 + Predicting - done. Time (sec): 0.0025797 - Prediction time/pt. (sec) : 0.0000241 + Prediction time/pt. (sec) : 0.0000258 ___________________________________________________________________________ @@ -155,9 +155,9 @@ Example 1 # eval points. : 5 Predicting ... - Predicting - done. Time (sec): 0.0003822 + Predicting - done. Time (sec): 0.0004814 - Prediction time/pt. (sec) : 0.0000764 + Prediction time/pt. (sec) : 0.0000963 .. figure:: krg_Test_test_krg.png @@ -223,9 +223,9 @@ Example 2 with mixed variables # eval points. : 500 Predicting ... - Predicting - done. Time (sec): 0.0089018 + Predicting - done. Time (sec): 0.0096698 - Prediction time/pt. (sec) : 0.0000178 + Prediction time/pt. (sec) : 0.0000193 .. figure:: krg_Test_test_mixed_int_krg.png @@ -287,7 +287,7 @@ Options - Power for the pow_exp kernel function (valid values in (0.0, 2.0]), This option is set automatically when corr option is squar, abs, or matern. * - categorical_kernel - MixIntKernelType.CONT_RELAX - - [, , , ] + - [, , , , ] - None - The kernel to use for categorical inputs. Only for non continuous Kriging * - hierarchical_kernel @@ -311,7 +311,7 @@ Options - ['list', 'ndarray'] - bounds for hyperparameters * - hyper_opt - - Cobyla + - TNC - ['Cobyla', 'TNC'] - ['str'] - Optimiser for hyperparameters optimisation diff --git a/doc/_src_docs/surrogate_models/krg_Test_test_krg.png b/doc/_src_docs/surrogate_models/krg_Test_test_krg.png index b6bcc0646..f08fd0d65 100644 Binary files a/doc/_src_docs/surrogate_models/krg_Test_test_krg.png and b/doc/_src_docs/surrogate_models/krg_Test_test_krg.png differ diff --git a/doc/_src_docs/surrogate_models/ls.rst b/doc/_src_docs/surrogate_models/ls.rst index 49408abf6..282d3ef30 100644 --- a/doc/_src_docs/surrogate_models/ls.rst +++ b/doc/_src_docs/surrogate_models/ls.rst @@ -57,7 +57,7 @@ Usage Training Training ... - Training - done. Time (sec): 0.0005672 + Training - done. Time (sec): 0.0009801 ___________________________________________________________________________ Evaluation @@ -65,9 +65,9 @@ Usage # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0001004 + Predicting - done. Time (sec): 0.0001380 - Prediction time/pt. (sec) : 0.0000010 + Prediction time/pt. (sec) : 0.0000014 .. figure:: ls_Test_test_ls.png diff --git a/doc/_src_docs/surrogate_models/mgp.rst b/doc/_src_docs/surrogate_models/mgp.rst index c980dfe26..6784c28a7 100644 --- a/doc/_src_docs/surrogate_models/mgp.rst +++ b/doc/_src_docs/surrogate_models/mgp.rst @@ -128,7 +128,7 @@ Usage Training Training ... - Training - done. Time (sec): 1.1959300 + Training - done. Time (sec): 0.8920083 .. figure:: mgp_Test_test_mgp.png :scale: 80 % @@ -189,7 +189,7 @@ Options - Power for the pow_exp kernel function (valid values in (0.0, 2.0]), This option is set automatically when corr option is squar, abs, or matern. * - categorical_kernel - MixIntKernelType.CONT_RELAX - - [, , , ] + - [, , , , ] - None - The kernel to use for categorical inputs. Only for non continuous Kriging * - hierarchical_kernel @@ -213,7 +213,7 @@ Options - ['list', 'ndarray'] - bounds for hyperparameters * - hyper_opt - - Cobyla + - TNC - ['Cobyla', 'TNC'] - ['str'] - Optimiser for hyperparameters optimisation diff --git a/doc/_src_docs/surrogate_models/mgp_Test_test_mgp.png b/doc/_src_docs/surrogate_models/mgp_Test_test_mgp.png index c2cfb42a2..e18ad59ec 100644 Binary files a/doc/_src_docs/surrogate_models/mgp_Test_test_mgp.png and b/doc/_src_docs/surrogate_models/mgp_Test_test_mgp.png differ diff --git a/doc/_src_docs/surrogate_models/qp.rst b/doc/_src_docs/surrogate_models/qp.rst index d3cac3408..66fb9c127 100644 --- a/doc/_src_docs/surrogate_models/qp.rst +++ b/doc/_src_docs/surrogate_models/qp.rst @@ -69,7 +69,7 @@ Usage Training Training ... - Training - done. Time (sec): 0.0003550 + Training - done. Time (sec): 0.0004170 ___________________________________________________________________________ Evaluation @@ -77,7 +77,7 @@ Usage # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0000596 + Predicting - done. Time (sec): 0.0000594 Prediction time/pt. (sec) : 0.0000006 diff --git a/doc/_src_docs/surrogate_models/rbf.rst b/doc/_src_docs/surrogate_models/rbf.rst index 02e1569d5..0b7dee8af 100644 --- a/doc/_src_docs/surrogate_models/rbf.rst +++ b/doc/_src_docs/surrogate_models/rbf.rst @@ -100,13 +100,13 @@ Usage Training ... Initializing linear solver ... Performing LU fact. (5 x 5 mtx) ... - Performing LU fact. (5 x 5 mtx) - done. Time (sec): 0.0000365 - Initializing linear solver - done. Time (sec): 0.0000587 + Performing LU fact. (5 x 5 mtx) - done. Time (sec): 0.0000570 + Initializing linear solver - done. Time (sec): 0.0000799 Solving linear system (col. 0) ... Back solving (5 x 5 mtx) ... - Back solving (5 x 5 mtx) - done. Time (sec): 0.0000277 - Solving linear system (col. 0) - done. Time (sec): 0.0000446 - Training - done. Time (sec): 0.0003552 + Back solving (5 x 5 mtx) - done. Time (sec): 0.0000467 + Solving linear system (col. 0) - done. Time (sec): 0.0000653 + Training - done. Time (sec): 0.0004044 ___________________________________________________________________________ Evaluation @@ -114,7 +114,7 @@ Usage # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0000277 + Predicting - done. Time (sec): 0.0000284 Prediction time/pt. (sec) : 0.0000003 diff --git a/doc/_src_docs/surrogate_models/rmts.rst b/doc/_src_docs/surrogate_models/rmts.rst index 7aeb4741c..fe21517d9 100644 --- a/doc/_src_docs/surrogate_models/rmts.rst +++ b/doc/_src_docs/surrogate_models/rmts.rst @@ -145,26 +145,26 @@ Usage (RMTB) Computing dof2coeff ... Computing dof2coeff - done. Time (sec): 0.0000031 Initializing Hessian ... - Initializing Hessian - done. Time (sec): 0.0004747 + Initializing Hessian - done. Time (sec): 0.0005746 Computing energy terms ... - Computing energy terms - done. Time (sec): 0.0013354 + Computing energy terms - done. Time (sec): 0.0014744 Computing approximation terms ... - Computing approximation terms - done. Time (sec): 0.0004859 - Pre-computing matrices - done. Time (sec): 0.0023532 + Computing approximation terms - done. Time (sec): 0.0005143 + Pre-computing matrices - done. Time (sec): 0.0026219 Solving for degrees of freedom ... Solving initial startup problem (n=20) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 1.549745600e+00 2.530000000e+00 Iteration (num., iy, grad. norm, func.) : 0 0 1.339039325e-15 4.464522395e-16 - Solving for output 0 - done. Time (sec): 0.0037177 - Solving initial startup problem (n=20) - done. Time (sec): 0.0037668 + Solving for output 0 - done. Time (sec): 0.0040400 + Solving initial startup problem (n=20) - done. Time (sec): 0.0040886 Solving nonlinear problem (n=20) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 1.533514592e-15 4.464522395e-16 - Solving for output 0 - done. Time (sec): 0.0002389 - Solving nonlinear problem (n=20) - done. Time (sec): 0.0002832 - Solving for degrees of freedom - done. Time (sec): 0.0041001 - Training - done. Time (sec): 0.0068073 + Solving for output 0 - done. Time (sec): 0.0002468 + Solving nonlinear problem (n=20) - done. Time (sec): 0.0002828 + Solving for degrees of freedom - done. Time (sec): 0.0044224 + Training - done. Time (sec): 0.0074224 ___________________________________________________________________________ Evaluation @@ -172,9 +172,9 @@ Usage (RMTB) # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0003538 + Predicting - done. Time (sec): 0.0003743 - Prediction time/pt. (sec) : 0.0000035 + Prediction time/pt. (sec) : 0.0000037 .. figure:: rmts_Test_test_rmtb.png @@ -234,28 +234,28 @@ Usage (RMTC) Training ... Pre-computing matrices ... Computing dof2coeff ... - Computing dof2coeff - done. Time (sec): 0.0008090 + Computing dof2coeff - done. Time (sec): 0.0008018 Initializing Hessian ... - Initializing Hessian - done. Time (sec): 0.0003645 + Initializing Hessian - done. Time (sec): 0.0003910 Computing energy terms ... - Computing energy terms - done. Time (sec): 0.0014215 + Computing energy terms - done. Time (sec): 0.0014522 Computing approximation terms ... - Computing approximation terms - done. Time (sec): 0.0006666 - Pre-computing matrices - done. Time (sec): 0.0033243 + Computing approximation terms - done. Time (sec): 0.0006340 + Pre-computing matrices - done. Time (sec): 0.0033381 Solving for degrees of freedom ... Solving initial startup problem (n=42) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 2.249444376e+00 2.530000000e+00 Iteration (num., iy, grad. norm, func.) : 0 0 2.031017841e-15 4.346868680e-16 - Solving for output 0 - done. Time (sec): 0.0044465 - Solving initial startup problem (n=42) - done. Time (sec): 0.0044966 + Solving for output 0 - done. Time (sec): 0.0047476 + Solving initial startup problem (n=42) - done. Time (sec): 0.0047956 Solving nonlinear problem (n=42) ... Solving for output 0 ... Iteration (num., iy, grad. norm, func.) : 0 0 2.956393318e-15 4.346868680e-16 - Solving for output 0 - done. Time (sec): 0.0002370 - Solving nonlinear problem (n=42) - done. Time (sec): 0.0002759 - Solving for degrees of freedom - done. Time (sec): 0.0048192 - Training - done. Time (sec): 0.0084751 + Solving for output 0 - done. Time (sec): 0.0002475 + Solving nonlinear problem (n=42) - done. Time (sec): 0.0002840 + Solving for degrees of freedom - done. Time (sec): 0.0051248 + Training - done. Time (sec): 0.0088027 ___________________________________________________________________________ Evaluation @@ -263,9 +263,9 @@ Usage (RMTC) # eval points. : 100 Predicting ... - Predicting - done. Time (sec): 0.0003624 + Predicting - done. Time (sec): 0.0003734 - Prediction time/pt. (sec) : 0.0000036 + Prediction time/pt. (sec) : 0.0000037 .. figure:: rmts_Test_test_rmtc.png diff --git a/doc/_src_docs/surrogate_models/sgp.rst b/doc/_src_docs/surrogate_models/sgp.rst index 9b6014dad..30c3cebf6 100644 --- a/doc/_src_docs/surrogate_models/sgp.rst +++ b/doc/_src_docs/surrogate_models/sgp.rst @@ -133,7 +133,7 @@ Using FITC method Training Training ... - Training - done. Time (sec): 0.3038011 + Training - done. Time (sec): 0.3478031 ___________________________________________________________________________ Evaluation @@ -141,9 +141,9 @@ Using FITC method # eval points. : 201 Predicting ... - Predicting - done. Time (sec): 0.0101464 + Predicting - done. Time (sec): 0.0004528 - Prediction time/pt. (sec) : 0.0000505 + Prediction time/pt. (sec) : 0.0000023 .. figure:: sgp_Test_test_sgp_fitc.png @@ -223,7 +223,7 @@ Using VFE method Training Training ... - Training - done. Time (sec): 0.4349508 + Training - done. Time (sec): 0.3391337 ___________________________________________________________________________ Evaluation @@ -231,9 +231,9 @@ Using VFE method # eval points. : 201 Predicting ... - Predicting - done. Time (sec): 0.0020247 + Predicting - done. Time (sec): 0.0004594 - Prediction time/pt. (sec) : 0.0000101 + Prediction time/pt. (sec) : 0.0000023 .. figure:: sgp_Test_test_sgp_vfe.png @@ -295,7 +295,7 @@ Options - Power for the pow_exp kernel function (valid values in (0.0, 2.0]), This option is set automatically when corr option is squar, abs, or matern. * - categorical_kernel - MixIntKernelType.CONT_RELAX - - [, , , ] + - [, , , , ] - None - The kernel to use for categorical inputs. Only for non continuous Kriging * - hierarchical_kernel @@ -320,7 +320,7 @@ Options - bounds for hyperparameters * - hyper_opt - Cobyla - - ['Cobyla', 'TNC'] + - ['Cobyla'] - ['str'] - Optimiser for hyperparameters optimisation * - eval_noise diff --git a/smt/applications/tests/test_ego.py b/smt/applications/tests/test_ego.py index 0b1735104..2926d7962 100644 --- a/smt/applications/tests/test_ego.py +++ b/smt/applications/tests/test_ego.py @@ -1166,7 +1166,10 @@ def function_test_1d(x): def run_ego_mixed_integer_example(): import numpy as np from smt.applications import EGO - from smt.applications.mixed_integer import MixedIntegerContext + from smt.applications.mixed_integer import ( + MixedIntegerContext, + MixedIntegerSamplingMethod, + ) from smt.surrogate_models import MixIntKernelType from smt.utils.design_space import ( DesignSpace, diff --git a/smt/applications/tests/test_mfk_mfkpls_mixed.py b/smt/applications/tests/test_mfk_mfkpls_mixed.py index 13ee0cfe5..fdecb0218 100644 --- a/smt/applications/tests/test_mfk_mfkpls_mixed.py +++ b/smt/applications/tests/test_mfk_mfkpls_mixed.py @@ -327,6 +327,7 @@ def DTLZ5_LF_mixt(self, x): def run_mfk_mixed_example(self): import matplotlib.pyplot as plt + from smt.applications.mixed_integer import MixedIntegerSamplingMethod # KRG_METHODS = ["krg", "kpls", "mfk", "mfkpls"] # KRG_METHODS = ["krg"] @@ -665,6 +666,7 @@ def run_mfk_mixed_example(self): def run_mfkpls_mixed_example(self): import matplotlib.pyplot as plt + from smt.applications.mixed_integer import MixedIntegerSamplingMethod # KRG_METHODS = ["krg", "kpls", "mfk", "mfkpls"] # KRG_METHODS = ["krg"] diff --git a/smt/applications/tests/test_mixed_integer.py b/smt/applications/tests/test_mixed_integer.py index 49f8e00b2..94cdf57d1 100644 --- a/smt/applications/tests/test_mixed_integer.py +++ b/smt/applications/tests/test_mixed_integer.py @@ -323,6 +323,8 @@ def run_mixed_integer_lhs_example(self): FloatVariable, CategoricalVariable, ) + from smt.sampling_methods import LHS + from smt.applications.mixed_integer import MixedIntegerSamplingMethod float_var = FloatVariable(0, 4) cat_var = CategoricalVariable(["blue", "red"]) @@ -381,7 +383,10 @@ def run_mixed_integer_qp_example(self): def run_mixed_integer_context_example(self): import matplotlib.pyplot as plt from smt.surrogate_models import KRG - from smt.applications.mixed_integer import MixedIntegerContext + from smt.applications.mixed_integer import ( + MixedIntegerContext, + MixedIntegerSamplingMethod, + ) from smt.utils.design_space import ( DesignSpace, FloatVariable, @@ -594,6 +599,8 @@ def run_mixed_discrete_design_space_example(self): OrdinalVariable, CategoricalVariable, ) + from smt.sampling_methods import LHS + from smt.applications.mixed_integer import MixedIntegerSamplingMethod ds = DesignSpace( [ @@ -638,8 +645,12 @@ def run_hierarchical_design_space_example(self): OrdinalVariable, CategoricalVariable, ) - from smt.applications.mixed_integer import MixedIntegerKrigingModel + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) from smt.surrogate_models import MixIntKernelType, MixHrcKernelType, KRG + from smt.sampling_methods import LHS ds = DesignSpace( [ @@ -924,8 +935,12 @@ def run_hierarchical_variables_Goldstein(self): IntegerVariable, FloatVariable, ) - from smt.applications.mixed_integer import MixedIntegerKrigingModel + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) from smt.surrogate_models import MixIntKernelType, MixHrcKernelType, KRG + from smt.sampling_methods import LHS def f_hv(X): import numpy as np @@ -1216,6 +1231,48 @@ def test_mixed_gower_2D(self): self.assertEqual(np.shape(y), (105, 1)) + def test_mixed_cs_2D(self): + xt = np.array([[0, 5], [2, -1], [4, 0.5]]) + yt = np.array([[0.0], [1.0], [1.5]]) + design_space = DesignSpace( + [ + CategoricalVariable(["0.0", "1.0", " 2.0", "3.0", "4.0"]), + FloatVariable(-5, 5), + ] + ) + + # Surrogate + sm = MixedIntegerKrigingModel( + surrogate=KRG( + design_space=design_space, + theta0=[1e-2], + corr="abs_exp", + categorical_kernel=MixIntKernelType.COMPOUND_SYMMETRY, + ), + ) + sm.set_training_values(xt, yt) + sm.train() + + # DOE for validation + x = np.linspace(0, 4, 5) + x2 = np.linspace(-5, 5, 21) + x1 = [] + for element in itertools.product(x, x2): + x1.append(np.array(element)) + x_pred = np.array(x1) + + y = sm.predict_values(x_pred) + yvar = sm.predict_variances(x_pred) + + # prediction are correct on known points + self.assertAlmostEqual(y[20, 0], 0) + self.assertAlmostEqual(y[50, 0], 1) + self.assertAlmostEqual(y[95, 0], 1.5) + self.assertTrue(np.abs(np.sum(np.array([y[20], y[50], y[95]]) - yt)) < 1e-6) + self.assertTrue(np.abs(np.sum(np.array([yvar[20], yvar[50], yvar[95]]))) < 1e-6) + + self.assertEqual(np.shape(y), (105, 1)) + def test_mixed_CR_2D(self): xt = np.array([[0, 5], [2, -1], [4, 0.5]]) yt = np.array([[0.0], [1.0], [1.5]]) @@ -1568,7 +1625,10 @@ def run_mixed_gower_example(self): import matplotlib.pyplot as plt from smt.surrogate_models import KRG, MixIntKernelType - from smt.applications.mixed_integer import MixedIntegerKrigingModel + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) from smt.utils.design_space import ( DesignSpace, CategoricalVariable, @@ -1691,12 +1751,146 @@ def run_mixed_gower_example(self): plt.tight_layout() plt.show() + def run_mixed_cs_example(self): + import numpy as np + import matplotlib.pyplot as plt + + from smt.surrogate_models import KRG, MixIntKernelType + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) + from smt.utils.design_space import ( + DesignSpace, + CategoricalVariable, + FloatVariable, + ) + + xt1 = np.array([[0, 0.0], [0, 2.0], [0, 4.0]]) + xt2 = np.array([[1, 0.0], [1, 2.0], [1, 3.0]]) + xt3 = np.array([[2, 1.0], [2, 2.0], [2, 4.0]]) + + xt = np.concatenate((xt1, xt2, xt3), axis=0) + xt[:, 1] = xt[:, 1].astype(np.float64) + yt1 = np.array([0.0, 9.0, 16.0]) + yt2 = np.array([0.0, -4, -13.0]) + yt3 = np.array([-10, 3, 11.0]) + yt = np.concatenate((yt1, yt2, yt3), axis=0) + + design_space = DesignSpace( + [ + CategoricalVariable(["Blue", "Red", "Green"]), + FloatVariable(0, 4), + ] + ) + + # Surrogate + sm = MixedIntegerKrigingModel( + surrogate=KRG( + design_space=design_space, + categorical_kernel=MixIntKernelType.COMPOUND_SYMMETRY, + theta0=[1e-1], + corr="squar_exp", + n_start=20, + ), + ) + sm.set_training_values(xt, yt) + sm.train() + + # DOE for validation + n = 100 + x_cat1 = [] + x_cat2 = [] + x_cat3 = [] + + for i in range(n): + x_cat1.append(0) + x_cat2.append(1) + x_cat3.append(2) + + x_cont = np.linspace(0.0, 4.0, n) + x1 = np.concatenate( + (np.asarray(x_cat1).reshape(-1, 1), x_cont.reshape(-1, 1)), axis=1 + ) + x2 = np.concatenate( + (np.asarray(x_cat2).reshape(-1, 1), x_cont.reshape(-1, 1)), axis=1 + ) + x3 = np.concatenate( + (np.asarray(x_cat3).reshape(-1, 1), x_cont.reshape(-1, 1)), axis=1 + ) + + y1 = sm.predict_values(x1) + y2 = sm.predict_values(x2) + y3 = sm.predict_values(x3) + + # estimated variance + s2_1 = sm.predict_variances(x1) + s2_2 = sm.predict_variances(x2) + s2_3 = sm.predict_variances(x3) + + fig, axs = plt.subplots(3, figsize=(8, 6)) + + axs[0].plot(xt1[:, 1].astype(np.float64), yt1, "o", linestyle="None") + axs[0].plot(x_cont, y1, color="Blue") + axs[0].fill_between( + np.ravel(x_cont), + np.ravel(y1 - 3 * np.sqrt(s2_1)), + np.ravel(y1 + 3 * np.sqrt(s2_1)), + color="lightgrey", + ) + axs[0].set_xlabel("x") + axs[0].set_ylabel("y") + axs[0].legend( + ["Training data", "Prediction", "Confidence Interval 99%"], + loc="upper left", + bbox_to_anchor=[0, 1], + ) + axs[1].plot( + xt2[:, 1].astype(np.float64), yt2, marker="o", color="r", linestyle="None" + ) + axs[1].plot(x_cont, y2, color="Red") + axs[1].fill_between( + np.ravel(x_cont), + np.ravel(y2 - 3 * np.sqrt(s2_2)), + np.ravel(y2 + 3 * np.sqrt(s2_2)), + color="lightgrey", + ) + axs[1].set_xlabel("x") + axs[1].set_ylabel("y") + axs[1].legend( + ["Training data", "Prediction", "Confidence Interval 99%"], + loc="upper left", + bbox_to_anchor=[0, 1], + ) + axs[2].plot( + xt3[:, 1].astype(np.float64), yt3, marker="o", color="r", linestyle="None" + ) + axs[2].plot(x_cont, y3, color="Green") + axs[2].fill_between( + np.ravel(x_cont), + np.ravel(y3 - 3 * np.sqrt(s2_3)), + np.ravel(y3 + 3 * np.sqrt(s2_3)), + color="lightgrey", + ) + axs[2].set_xlabel("x") + axs[2].set_ylabel("y") + axs[2].legend( + ["Training data", "Prediction", "Confidence Interval 99%"], + loc="upper left", + bbox_to_anchor=[0, 1], + ) + plt.tight_layout() + plt.show() + def run_mixed_homo_gaussian_example(self): import numpy as np import matplotlib.pyplot as plt from smt.surrogate_models import KRG, MixIntKernelType - from smt.applications.mixed_integer import MixedIntegerKrigingModel + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) from smt.utils.design_space import ( DesignSpace, CategoricalVariable, @@ -1824,7 +2018,10 @@ def run_mixed_homo_hyp_example(self): import matplotlib.pyplot as plt from smt.surrogate_models import KRG, MixIntKernelType - from smt.applications.mixed_integer import MixedIntegerKrigingModel + from smt.applications.mixed_integer import ( + MixedIntegerKrigingModel, + MixedIntegerSamplingMethod, + ) from smt.utils.design_space import ( DesignSpace, CategoricalVariable, diff --git a/smt/surrogate_models/krg_based.py b/smt/surrogate_models/krg_based.py index e13f14cdd..d3e481986 100644 --- a/smt/surrogate_models/krg_based.py +++ b/smt/surrogate_models/krg_based.py @@ -51,6 +51,7 @@ class MixIntKernelType(Enum): HOMO_HSPHERE = "HOMO_HSPHERE" CONT_RELAX = "CONT_RELAX" GOWER = "GOWER" + COMPOUND_SYMMETRY = "COMPOUND_SYMMETRY" class KrgBased(SurrogateModel): @@ -105,6 +106,7 @@ def _initialize(self): MixIntKernelType.GOWER, MixIntKernelType.EXP_HOMO_HSPHERE, MixIntKernelType.HOMO_HSPHERE, + MixIntKernelType.COMPOUND_SYMMETRY, ], desc="The kernel to use for categorical inputs. Only for non continuous Kriging", ) @@ -527,7 +529,12 @@ def _initialize_theta(self, theta, n_levels, cat_features, cat_kernel): ncomp = 1e5 theta_cont_features = np.zeros((len(theta), 1), dtype=bool) - theta_cat_features = np.zeros((len(theta), len(n_levels)), dtype=bool) + theta_cat_features = np.ones((len(theta), len(n_levels)), dtype=bool) + if cat_kernel in [ + MixIntKernelType.EXP_HOMO_HSPHERE, + MixIntKernelType.HOMO_HSPHERE, + ]: + theta_cat_features = np.zeros((len(theta), len(n_levels)), dtype=bool) i = 0 j = 0 n_theta_cont = 0 @@ -545,6 +552,7 @@ def _initialize_theta(self, theta, n_levels, cat_features, cat_kernel): else: if n_theta_cont < ncomp: theta_cont_features[j] = True + theta_cat_features[j] = False j += 1 n_theta_cont += 1 @@ -706,16 +714,35 @@ def _matrix_data_corr( theta_cat_kernel[theta_cat_features[1]] *= 0.5 * np.pi / theta_bounds[1] elif cat_kernel == MixIntKernelType.HOMO_HSPHERE: theta_cat_kernel[theta_cat_features[1]] *= 2.0 * np.pi / theta_bounds[1] + elif cat_kernel == MixIntKernelType.COMPOUND_SYMMETRY: + theta_cat_kernel[theta_cat_features[1]] *= 2.0 + theta_cat_kernel[theta_cat_features[1]] -= ( + theta_bounds[1] + theta_bounds[0] + ) + theta_cat_kernel[theta_cat_features[1]] *= 1 / ( + 1.000000000001 * theta_bounds[1] + ) for i in range(len(n_levels)): theta_cat = theta_cat_kernel[theta_cat_features[0][i]] - T = matrix_data_corr_levels_cat_matrix( - i, - n_levels, - theta_cat, - theta_bounds, - is_ehh=cat_kernel == MixIntKernelType.EXP_HOMO_HSPHERE, - ) + if cat_kernel == MixIntKernelType.COMPOUND_SYMMETRY: + T = np.zeros((n_levels[i], n_levels[i])) + for tij in range(n_levels[i]): + for tji in range(n_levels[i]): + if tij == tji: + T[tij, tji] = 1 + else: + T[tij, tji] = max( + theta_cat[0], 1e-10 - 1 / (n_levels[i] - 1) + ) + else: + T = matrix_data_corr_levels_cat_matrix( + i, + n_levels, + theta_cat, + theta_bounds, + is_ehh=cat_kernel == MixIntKernelType.EXP_HOMO_HSPHERE, + ) if cat_kernel_comps is not None: # Sampling points X and y @@ -777,6 +804,7 @@ def _matrix_data_corr( in [ MixIntKernelType.EXP_HOMO_HSPHERE, MixIntKernelType.HOMO_HSPHERE, + MixIntKernelType.COMPOUND_SYMMETRY, ], ) @@ -2063,7 +2091,8 @@ def _check_param(self): self.options["theta0"] *= np.ones(n_param) if len(self.options["theta0"]) != d and ( - self.options["categorical_kernel"] == MixIntKernelType.GOWER + self.options["categorical_kernel"] + in [MixIntKernelType.GOWER, MixIntKernelType.COMPOUND_SYMMETRY] or self.is_continuous ): if len(self.options["theta0"]) == 1: @@ -2143,7 +2172,7 @@ def compute_n_param(design_space, cat_kernel, d, n_comp, mat_dim): return n_param if mat_dim is not None: return int(np.sum([l * (l - 1) / 2 for l in mat_dim]) + n_param) - if cat_kernel == MixIntKernelType.GOWER: + if cat_kernel in [MixIntKernelType.GOWER, MixIntKernelType.COMPOUND_SYMMETRY]: return n_param for i, dv in enumerate(design_space.design_variables): if isinstance(dv, CategoricalVariable):