repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
smt | smt-master/smt/examples/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/examples/b777_engine/run_b777_engine_rmtc.py | from smt.surrogate_models import RMTC
from smt.examples.b777_engine.b777_engine import get_b777_engine, plot_b777_engine
xt, yt, dyt_dxt, xlimits = get_b777_engine()
interp = RMTC(
num_elements=6,
xlimits=xlimits,
nonlinear_maxiter=20,
approx_order=2,
energy_weight=0.0,
regularization_weight=0... | 612 | 26.863636 | 82 | py |
smt | smt-master/smt/examples/b777_engine/run_b777_engine_rmtb.py | from smt.surrogate_models import RMTB
from smt.examples.b777_engine.b777_engine import get_b777_engine, plot_b777_engine
xt, yt, dyt_dxt, xlimits = get_b777_engine()
interp = RMTB(
num_ctrl_pts=15,
xlimits=xlimits,
nonlinear_maxiter=20,
approx_order=2,
energy_weight=0e-14,
regularization_weigh... | 617 | 27.090909 | 82 | py |
smt | smt-master/smt/examples/b777_engine/b777_engine.py | import numpy as np
import os
def get_b777_engine():
this_dir = os.path.split(__file__)[0]
nt = 12 * 11 * 8
xt = np.loadtxt(os.path.join(this_dir, "b777_engine_inputs.dat")).reshape((nt, 3))
yt = np.loadtxt(os.path.join(this_dir, "b777_engine_outputs.dat")).reshape((nt, 2))
dyt_dxt = np.loadtxt(os... | 8,217 | 30.976654 | 88 | py |
smt | smt-master/smt/examples/b777_engine/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/examples/b777_engine/tests/test_b777_engine.py | import unittest
import matplotlib
matplotlib.use("Agg")
try:
from smt.surrogate_models import RMTB, RMTC
compiled_available = True
except:
compiled_available = False
class Test(unittest.TestCase):
@unittest.skipIf(not compiled_available, "C compilation failed")
def test_rmtb(self):
fro... | 653 | 20.8 | 68 | py |
smt | smt-master/smt/examples/b777_engine/tests/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/examples/multi_modal/run_genn_demo.py | """
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Description: This program uses the two dimensional Rastrigin function to demonstrate GENN,
which is an egg-crate-looking function that can be challenging to fit because
of its multi-modality.
Author: Steven H. B... | 8,592 | 27.453642 | 118 | py |
smt | smt-master/smt/examples/multi_modal/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/examples/one_D_step/run_one_D_step_rmtb.py | from smt.surrogate_models import RMTB
from smt.examples.one_D_step.one_D_step import get_one_d_step, plot_one_d_step
xt, yt, xlimits = get_one_d_step()
interp = RMTB(
num_ctrl_pts=100,
xlimits=xlimits,
nonlinear_maxiter=20,
solver_tolerance=1e-16,
energy_weight=1e-14,
regularization_weight=0.0... | 416 | 22.166667 | 78 | py |
smt | smt-master/smt/examples/one_D_step/run_one_D_step_rmtc.py | from smt.surrogate_models import RMTC
from smt.examples.one_D_step.one_D_step import get_one_d_step, plot_one_d_step
xt, yt, xlimits = get_one_d_step()
interp = RMTC(
num_elements=40,
xlimits=xlimits,
nonlinear_maxiter=20,
solver_tolerance=1e-16,
energy_weight=1e-14,
regularization_weight=0.0,... | 415 | 22.111111 | 78 | py |
smt | smt-master/smt/examples/one_D_step/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/examples/one_D_step/one_D_step.py | import numpy as np
def get_one_d_step():
xt = np.array(
[
0.0000,
0.4000,
0.6000,
0.7000,
0.7500,
0.7750,
0.8000,
0.8500,
0.8750,
0.9000,
0.9250,
0.9500,
... | 1,518 | 17.301205 | 44 | py |
smt | smt-master/smt/examples/one_D_step/tests/test_one_D_step.py | import unittest
import matplotlib
matplotlib.use("Agg")
try:
from smt.surrogate_models import RMTB, RMTC
compiled_available = True
except:
compiled_available = False
class Test(unittest.TestCase):
@unittest.skipIf(not compiled_available, "C compilation failed")
def test_rmtb(self):
fro... | 532 | 22.173913 | 68 | py |
smt | smt-master/smt/examples/one_D_step/tests/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/examples/rans_crm_wing/run_rans_crm_wing_rmtb.py | from smt.surrogate_models import RMTB
from smt.examples.rans_crm_wing.rans_crm_wing import (
get_rans_crm_wing,
plot_rans_crm_wing,
)
xt, yt, xlimits = get_rans_crm_wing()
interp = RMTB(
num_ctrl_pts=20, xlimits=xlimits, nonlinear_maxiter=100, energy_weight=1e-12
)
interp.set_training_values(xt, yt)
inter... | 375 | 22.5 | 80 | py |
smt | smt-master/smt/examples/rans_crm_wing/run_rans_crm_wing_rmtc.py | from smt.surrogate_models import RMTC
from smt.examples.rans_crm_wing.rans_crm_wing import (
get_rans_crm_wing,
plot_rans_crm_wing,
)
xt, yt, xlimits = get_rans_crm_wing()
interp = RMTC(
num_elements=20, xlimits=xlimits, nonlinear_maxiter=100, energy_weight=1e-10
)
interp.set_training_values(xt, yt)
inter... | 375 | 22.5 | 80 | py |
smt | smt-master/smt/examples/rans_crm_wing/rans_crm_wing.py | import numpy as np
raw = np.array(
[
[
2.000000000000000000e00,
4.500000000000000111e-01,
1.536799999999999972e-02,
3.674239999999999728e-01,
5.592279999999999474e-01,
-1.258039999999999992e-01,
-1.248699999999999984e-02,
... | 13,903 | 29.491228 | 83 | py |
smt | smt-master/smt/examples/rans_crm_wing/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/examples/rans_crm_wing/tests/test_rans_crm_wing.py | import unittest
import matplotlib
matplotlib.use("Agg")
try:
from smt.surrogate_models import RMTB, RMTC
compiled_available = True
except:
compiled_available = False
class Test(unittest.TestCase):
@unittest.skipIf(not compiled_available, "C compilation failed")
def test_rmtb(self):
fro... | 661 | 21.066667 | 69 | py |
smt | smt-master/smt/examples/rans_crm_wing/tests/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/examples/airfoil_parameters/learning_airfoil_parameters.py | import os
import numpy as np
import csv
WORKDIR = os.path.dirname(os.path.abspath(__file__))
def load_NACA4412_modeshapes():
return np.loadtxt(open(os.path.join(WORKDIR, "modes_NACA4412_ct.txt")))
def load_cd_training_data():
with open(os.path.join(WORKDIR, "cd_x_y.csv")) as file:
reader = csv.read... | 1,709 | 28.482759 | 77 | py |
smt | smt-master/smt/examples/airfoil_parameters/run_genn.py | """
Predicting Airfoil Aerodynamics through data by Raul Carreira Rufato and Prof. Joseph Morlier
"""
import os
import numpy as np
import csv
from smt.examples.airfoil_parameters.learning_airfoil_parameters import (
load_cd_training_data,
load_NACA4412_modeshapes,
plot_predictions,
)
from sklearn.model_se... | 2,752 | 33.848101 | 98 | py |
smt | smt-master/smt/sampling_methods/lhs.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
LHS sampling; uses the pyDOE2 package.
"""
from pyDOE2 import lhs
from scipy.spatial.distance import pdist, cdist
import numpy as np
from smt.sampling_methods.sampling_method import ScaledSamplingMethod
class LHS(S... | 13,432 | 30.385514 | 115 | py |
smt | smt-master/smt/sampling_methods/sampling_method.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Base class for sampling algorithms.
"""
from abc import ABCMeta, abstractmethod
import numpy as np
from smt.utils.options_dictionary import OptionsDictionary
class SamplingMethod(metaclass=ABCMeta):
def __init_... | 4,516 | 27.23125 | 97 | py |
smt | smt-master/smt/sampling_methods/full_factorial.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Full-factorial sampling.
"""
import numpy as np
from smt.sampling_methods.sampling_method import ScaledSamplingMethod
class FullFactorial(ScaledSamplingMethod):
def _initialize(self, **kwargs):
self.opt... | 1,948 | 27.246377 | 109 | py |
smt | smt-master/smt/sampling_methods/random.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Random sampling.
"""
import numpy as np
from smt.sampling_methods.sampling_method import ScaledSamplingMethod
class Random(ScaledSamplingMethod):
def _compute(self, nt):
"""
Implemented by sampl... | 797 | 23.181818 | 91 | py |
smt | smt-master/smt/sampling_methods/__init__.py | from .random import Random
from .lhs import LHS
from .full_factorial import FullFactorial
| 90 | 21.75 | 41 | py |
smt | smt-master/smt/sampling_methods/tests/test_fullfactorial.py | import unittest
import numpy as np
from smt.sampling_methods import FullFactorial
class Test(unittest.TestCase):
def test_ff_weights(self):
xlimits = np.array([[0.0, 1.0], [0.0, 1.0]])
sampling = FullFactorial(xlimits=xlimits, weights=[0.25, 0.75])
num = 10
x = sampling(num)
... | 640 | 23.653846 | 71 | py |
smt | smt-master/smt/sampling_methods/tests/test_sampling_method_examples.py | import unittest
import matplotlib
matplotlib.use("Agg")
class Test(unittest.TestCase):
def test_random(self):
import numpy as np
import matplotlib.pyplot as plt
from smt.sampling_methods import Random
xlimits = np.array([[0.0, 4.0], [0.0, 3.0]])
sampling = Random(xlimit... | 1,403 | 19.347826 | 54 | py |
smt | smt-master/smt/sampling_methods/tests/test_lhs.py | import os
import unittest
import numpy as np
from smt.sampling_methods import LHS
class Test(unittest.TestCase):
def test_lhs_ese(self):
xlimits = np.array([[0.0, 4.0], [0.0, 3.0]])
sampling = LHS(xlimits=xlimits, criterion="ese")
num = 50
x = sampling(num)
self.assertEqu... | 2,541 | 30 | 88 | py |
smt | smt-master/smt/sampling_methods/tests/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/tests/test_training_derivs.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import unittest
import inspect
from collections import OrderedDict
from smt.problems import Sphere, TensorProduct
from smt.sampling_methods import LHS, FullFactorial
from smt.utils.design_spac... | 5,812 | 27.777228 | 88 | py |
smt | smt-master/smt/tests/test_extrap.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import unittest
import inspect
from collections import OrderedDict
from smt.problems import Sphere, TensorProduct
from smt.sampling_methods import LHS
from smt.utils.design_space import Design... | 3,271 | 27.955752 | 88 | py |
smt | smt-master/smt/tests/test_problems.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import unittest
from smt.problems import (
CantileverBeam,
Sphere,
ReducedProblem,
RobotArm,
Rosenbrock,
Branin,
LpNorm,
)
from smt.problems import (
TensorProdu... | 5,656 | 29.912568 | 87 | py |
smt | smt-master/smt/tests/test_array_outputs.py | import numpy as np
import unittest
from smt.utils.sm_test_case import SMTestCase
from smt.utils.silence import Silence
from smt.surrogate_models import QP, KRG
from smt.examples.rans_crm_wing.rans_crm_wing import (
get_rans_crm_wing,
plot_rans_crm_wing,
)
def setup_sm(sm_name, settings={}):
xt, yt, xlimi... | 2,051 | 28.73913 | 88 | py |
smt | smt-master/smt/tests/test_high_dim.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import os
import numpy as np
import unittest
import inspect
from collections import OrderedDict
from smt.problems import Sphere, TensorProduct
from smt.sampling_methods import LHS
from smt.utils.sm_test_case im... | 5,712 | 25.327189 | 88 | py |
smt | smt-master/smt/tests/test_kpls_auto.py | """
Author: Paul Saves
This package is distributed under New BSD license.
"""
import numpy as np
import unittest
import inspect
from collections import OrderedDict
from smt.problems import Sphere, TensorProduct, Rosenbrock, Branin
from smt.sampling_methods import LHS
from smt.utils.sm_test_case import SMTestCase
... | 3,287 | 24.292308 | 88 | py |
smt | smt-master/smt/tests/test_low_dim.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import unittest
import inspect
from collections import OrderedDict
from smt.problems import Sphere, TensorProduct
from smt.sampling_methods import LHS
from smt.utils.design_space import Design... | 5,047 | 26.434783 | 88 | py |
smt | smt-master/smt/tests/test_output_derivs.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import unittest
import inspect
from collections import OrderedDict
from smt.utils.design_space import DesignSpace
from smt.problems import Sphere
from smt.sampling_methods import FullFactorial... | 3,409 | 25.850394 | 88 | py |
smt | smt-master/smt/tests/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/tests/test_all.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
Dr. Mohamed A. Bouhlel <mbouhlel@umich>
This package is distributed under New BSD license.
"""
import os
import numpy as np
import unittest
import inspect
from collections import OrderedDict
from smt.problems import TensorProduct
from smt.sampling_methods im... | 10,473 | 27.461957 | 88 | py |
smt | smt-master/smt/tests/test_derivs.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import unittest
import inspect
from collections import OrderedDict
from smt.problems import Sphere
from smt.sampling_methods import LHS
from smt.utils.sm_test_case import SMTestCase
from smt.... | 3,494 | 24.698529 | 88 | py |
smt | smt-master/smt/problems/problem.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Base class for benchmarking/test problems.
"""
from typing import Optional
import numpy as np
from smt.utils.options_dictionary import OptionsDictionary
from smt.utils.checks import ensure_2d_array
from smt.utils.des... | 4,616 | 32.215827 | 114 | py |
smt | smt-master/smt/problems/water_flow.py | """
Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>
Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Water flow problem from:
Liu, H., Xu, S., & Wang, X. Sampling strategies and metamodeling techniques for engineering design: comparison and application. I... | 3,066 | 32.336957 | 258 | py |
smt | smt-master/smt/problems/wing_weight.py | """
Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>
Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Aircraft wing weight problem from:
Liu, H., Xu, S., & Wang, X. Sampling strategies and metamodeling techniques for engineering design: comparison and appl... | 3,273 | 31.74 | 258 | py |
smt | smt-master/smt/problems/tensor_product.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Tensor-product of cos, exp, or tanh.
"""
import numpy as np
from smt.problems.problem import Problem
class TensorProduct(Problem):
def _initialize(self):
self.options.declare("name", "TP", types=str)
... | 2,044 | 30.461538 | 79 | py |
smt | smt-master/smt/problems/ndim_rosenbrock.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
N-dimensional Rosenbrock problem.
"""
import numpy as np
from smt.utils.options_dictionary import OptionsDictionary
from smt.problems.problem import Problem
from smt.problems.reduced_problem import ReducedProblem
fro... | 932 | 28.15625 | 66 | py |
smt | smt-master/smt/problems/rosenbrock.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Multi-dimensional Rosenbrock function.
"""
import numpy as np
from smt.problems.problem import Problem
class Rosenbrock(Problem):
def _initialize(self):
self.options.declare("name", "Rosenbrock", types=... | 1,415 | 25.716981 | 85 | py |
smt | smt-master/smt/problems/hierarchical_goldstein.py | """
Author: P.Saves and J.H. Bussemaker
This package is distributed under New BSD license.
Cantilever beam problem from:
P. Saves, Y. Diouane, N. Bartoli, T. Lefebvre, and J. Morlier. A mixed-categorical correlation kernel for gaussian process, 2022
"""
import numpy as np
from smt.problems.problem import Problem
from... | 5,183 | 33.105263 | 128 | py |
smt | smt-master/smt/problems/robot_arm.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Robot arm problem from:
Liu, H., Xu, S., & Wang, X. Sampling strategies and metamodeling techniques for engineering design: comparison and application. In ASME Turbo Expo 2016: Turbomachinery Technical Conference and ... | 3,018 | 35.373494 | 258 | py |
smt | smt-master/smt/problems/neural_network.py | """
Author: P.Saves
This package is distributed under New BSD license.
Multi-Layer Perceptron problem from:
C. Audet, E. Hall e-Hannan, and S. Le Digabel. A general mathematical framework for constrained mixed-variable blackbox optimization problems with meta and categorical variables. Operations Research Forum,499
4... | 3,178 | 31.111111 | 208 | py |
smt | smt-master/smt/problems/branin.py | """
Author: Remi Lafage <remi.lafage@onera.fr>
This package is distributed under New BSD license.
Branin function.
"""
import numpy as np
from smt.problems.problem import Problem
class Branin(Problem):
def _initialize(self):
self.options.declare("ndim", 2, values=[2], types=int)
self.options.de... | 1,679 | 27 | 77 | py |
smt | smt-master/smt/problems/mixed_cantilever_beam.py | """
Author: P.Saves
This package is distributed under New BSD license.
Cantilever beam problem from:
P. Saves, Y. Diouane, N. Bartoli, T. Lefebvre, and J. Morlier. A mixed-categorical correlation kernel for gaussian process, 2022
"""
import numpy as np
from smt.problems.problem import Problem
from smt.utils.design_s... | 1,822 | 25.42029 | 128 | py |
smt | smt-master/smt/problems/reduced_problem.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Reduced problem class - selects a subset of input variables.
"""
import numpy as np
from smt.utils.options_dictionary import OptionsDictionary
from smt.problems.problem import Problem
class ReducedProblem(Problem):... | 2,647 | 31.292683 | 91 | py |
smt | smt-master/smt/problems/water_flow_lfidelity.py | """
Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>
Dr. John T. Hwang <hwangjt@umich.edu>
Water flow problem from:
Xiong, S., Qian, P. Z., & Wu, C. J. (2013). Sequential design and analysis of high-accuracy and low-accuracy computer codes. Technometrics, 55(1), 37-46.
"""
import numpy as np
from... | 2,718 | 29.897727 | 153 | py |
smt | smt-master/smt/problems/torsion_vibration.py | """
Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>
Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Torsion vibration problem from:
Liu, H., Xu, S., & Wang, X. Sampling strategies and metamodeling techniques for engineering design: comparison and applica... | 4,554 | 29.366667 | 266 | py |
smt | smt-master/smt/problems/__init__.py | from .branin import Branin
from .cantilever_beam import CantileverBeam
from .sphere import Sphere
from .reduced_problem import ReducedProblem
from .robot_arm import RobotArm
from .rosenbrock import Rosenbrock
from .tensor_product import TensorProduct
from .torsion_vibration import TorsionVibration
from .water_flow impo... | 840 | 39.047619 | 57 | py |
smt | smt-master/smt/problems/cantilever_beam.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Cantilever beam problem from:
Liu, H., Xu, S., & Wang, X. Sampling strategies and metamodeling techniques for engineering design: comparison and application. In ASME Turbo Expo 2016: Turbomachinery Technical Conferenc... | 4,082 | 33.601695 | 258 | py |
smt | smt-master/smt/problems/sphere.py | """
Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>
Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Sphere function.
"""
import numpy as np
from smt.problems.problem import Problem
class Sphere(Problem):
def _initialize(self):
self.options... | 1,101 | 22.956522 | 77 | py |
smt | smt-master/smt/problems/welded_beam.py | """
Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>
Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Welded beam problem from:
Liu, H., Xu, S., & Wang, X. Sampling strategies and metamodeling techniques for engineering design: comparison and application. I... | 2,951 | 33.325581 | 258 | py |
smt | smt-master/smt/problems/lp_norm.py | """
Author: Remi Lafage <remi.lafage@onera.fr>
This package is distributed under New BSD license.
Norm function.
"""
import numpy as np
from smt.problems.problem import Problem
class LpNorm(Problem):
def _initialize(self, ndim=1):
self.options.declare("order", default=2, types=int)
self.options... | 1,308 | 24.666667 | 86 | py |
smt | smt-master/smt/problems/ndim_step_function.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
N-dimensional step function problem.
"""
import numpy as np
from smt.utils.options_dictionary import OptionsDictionary
from smt.problems.problem import Problem
from smt.problems.tensor_product import TensorProduct
... | 853 | 28.448276 | 73 | py |
smt | smt-master/smt/problems/ndim_cantilever_beam.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
N-dimensional cantilever beam problem.
"""
import numpy as np
from smt.utils.options_dictionary import OptionsDictionary
from smt.problems.problem import Problem
from smt.problems.reduced_problem import ReducedProble... | 961 | 29.0625 | 73 | py |
smt | smt-master/smt/problems/ndim_robot_arm.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
N-dimensional robot arm problem.
"""
import numpy as np
from smt.utils.options_dictionary import OptionsDictionary
from smt.problems.problem import Problem
from smt.problems.reduced_problem import ReducedProblem
from... | 937 | 28.3125 | 79 | py |
smt | smt-master/smt/problems/tests/__init__.py | 0 | 0 | 0 | py | |
smt | smt-master/smt/problems/tests/test_problem_examples.py | import unittest
import matplotlib
import matplotlib.pyplot
matplotlib.use("Agg")
matplotlib.pyplot.switch_backend("Agg")
class Test(unittest.TestCase):
def test_cantilever_beam(self):
import numpy as np
import matplotlib.pyplot as plt
from smt.problems import CantileverBeam
ndi... | 8,254 | 22.653295 | 75 | py |
smt | smt-master/smt/utils/sm_test_case.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import unittest
class SMTestCase(unittest.TestCase):
def assert_error(self, computed, desired, atol=1e-15, rtol=1e-15):
"""
Check relative error of a scalar or arra... | 1,370 | 30.159091 | 87 | py |
smt | smt-master/smt/utils/silence.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import os
import sys
class Silence(object):
def __enter__(self):
sys.stdout = open(os.devnull, "w")
def __exit__(self, *args):
sys.stdout.close()
sys.stdout = sys.__stdou... | 3,955 | 28.744361 | 80 | py |
smt | smt-master/smt/utils/checks.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
def ensure_2d_array(array, name):
if not isinstance(array, np.ndarray):
raise ValueError("{} must be a NumPy array".format(name))
array = np.atleast_2d(array.T).T
... | 914 | 24.416667 | 84 | py |
smt | smt-master/smt/utils/printer.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import time
import contextlib
class Printer(object):
"""
Tool for formatting printing and measuring wall times.
Attributes
----------
active : bool
If False, the printer is in a stat... | 3,477 | 25.348485 | 92 | py |
smt | smt-master/smt/utils/misc.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import sys
import numpy as np
from bisect import bisect_left
def standardization(X, y):
"""
We substract the mean from each variable. Then, we divide the values of each
variable by its standard devia... | 3,620 | 26.641221 | 88 | py |
smt | smt-master/smt/utils/linear_solvers.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import scipy.sparse.linalg
import scipy.linalg
import contextlib
from smt.utils.options_dictionary import OptionsDictionary
VALID_SOLVERS = (
"krylov-dense",
"dense-lu",
"d... | 17,450 | 31.497207 | 87 | py |
smt | smt-master/smt/utils/line_search.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import scipy.sparse
VALID_LINE_SEARCHES = ("backtracking", "bracketed", "quadratic", "cubic", "null")
def get_line_search_class(line_search):
if line_search == "backtracking":
... | 7,762 | 28.743295 | 87 | py |
smt | smt-master/smt/utils/kriging.py | """
Author: Dr. Mohamed A. Bouhlel <mbouhlel@umich.edu>
This package is distributed under New BSD license.
"""
import warnings
import numpy as np
from enum import Enum
from copy import deepcopy
import os
from sklearn.cross_decomposition import PLSRegression as pls
from pyDOE2 import bbdesign
from sklearn.metrics.pair... | 48,566 | 30.578023 | 108 | py |
smt | smt-master/smt/utils/options_dictionary.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
class OptionsDictionary(object):
"""
Generalization of the dictionary that allows for declaring keys.
Attributes
----------
_dict : dict
Dictionary of option values keyed by o... | 4,481 | 28.88 | 91 | py |
smt | smt-master/smt/utils/__init__.py | from .misc import compute_rms_error
| 36 | 17.5 | 35 | py |
smt | smt-master/smt/utils/krg_sampling.py | """
Authors : Morgane Menz / Alexandre Thouvenot
Some parts are copied from KrgBased SMT class
"""
import numpy as np
from smt.utils.kriging import differences
from scipy import linalg
def covariance_matrix(krg, X, conditioned=True):
"""
This function computes the covariance matrix (with conditioned kernel o... | 12,780 | 31.113065 | 107 | py |
smt | smt-master/smt/utils/caching.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
try:
import cPickle as pickle
except:
import pickle
import hashlib
import contextlib
@contextlib.contextmanager
def cached_operation(inputs_dict, data_dir, desc=""):
"""
Context manager f... | 1,784 | 21.3125 | 81 | py |
smt | smt-master/smt/utils/design_space.py | """
Author: Jasper Bussemaker <jasper.bussemaker@dlr.de>
This package is distributed under New BSD license.
"""
import numpy as np
from typing import List, Union, Tuple, Sequence, Optional
from smt.sampling_methods import LHS
def ensure_design_space(xt=None, xlimits=None, design_space=None) -> "BaseDesignSpace":
... | 28,950 | 35.786531 | 124 | py |
smt | smt-master/smt/utils/test/test_design_space.py | """
Author: Jasper Bussemaker <jasper.bussemaker@dlr.de>
"""
import unittest
import itertools
import numpy as np
from smt.sampling_methods import LHS
from smt.utils.design_space import (
FloatVariable,
IntegerVariable,
OrdinalVariable,
CategoricalVariable,
BaseDesignSpace,
DesignSpace,
)
class... | 13,086 | 33.898667 | 88 | py |
smt | smt-master/smt/utils/test/test_misc_utils.py | """
Author: P. Saves
This package is distributed under New BSD license.
"""
from smt.utils import misc
import unittest
import numpy as np
class TestMisc(unittest.TestCase):
def test_standardization(self):
X = np.array([[0], [1], [2]])
y = np.array([[1], [3], [5]])
X2, y2, X_offset, y_mean... | 852 | 26.516129 | 72 | py |
smt | smt-master/smt/utils/test/test_kriging_sampling_utils.py | """
Author: Paul Saves
"""
import unittest
import numpy as np
from smt.surrogate_models import KRG
from smt.utils.krg_sampling import (
covariance_matrix,
sample_trajectory,
gauss_legendre_grid,
rectangular_grid,
simpson_grid,
eig_grid,
sample_eigen,
)
class Test(unittest.TestCase):
d... | 3,996 | 29.052632 | 88 | py |
smt | smt-master/smt/utils/neural_net/activation.py | """
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Author: Steven H. Berguin <steven.berguin@gtri.gatech.edu>
This package is distributed under New BSD license.
"""
import numpy as np
class Activation(object):
def __init__(self, **kwargs):
for name, value in kwargs.items()... | 2,424 | 22.095238 | 76 | py |
smt | smt-master/smt/utils/neural_net/loss.py | """
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Author: Steven H. Berguin <steven.berguin@gtri.gatech.edu>
This package is distributed under New BSD license.
"""
import numpy as np
tensor = np.ndarray
EPS = np.finfo(float).eps # small number to avoid division by zero
def compute... | 3,498 | 31.700935 | 116 | py |
smt | smt-master/smt/utils/neural_net/model.py | """
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Author: Steven H. Berguin <steven.berguin@gtri.gatech.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import matplotlib.gridspec as gridspec
from smt.utils.neural_net.data import random_mini_batches
from s... | 21,367 | 34.495017 | 120 | py |
smt | smt-master/smt/utils/neural_net/data.py | """
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Author: Steven H. Berguin <steven.berguin@gtri.gatech.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import os
import math
def load_csv(file=None, inputs=None, outputs=None, partials=None):
"""
... | 9,754 | 37.557312 | 116 | py |
smt | smt-master/smt/utils/neural_net/bwd_prop.py | """
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Author: Steven H. Berguin <steven.berguin@gtri.gatech.edu>
This package is distributed under New BSD license.
"""
import numpy as np
EPS = np.finfo(float).eps # small number to avoid division by zero
def initialize_back_prop(AL, Y, ... | 11,439 | 49.396476 | 128 | py |
smt | smt-master/smt/utils/neural_net/metrics.py | """
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Author: Steven H. Berguin <steven.berguin@gtri.gatech.edu>
This package is distributed under New BSD license.
"""
import numpy as np
def rsquare(Y_pred, Y_true):
"""
Compute R-square for a single response.
NOTE: If you ha... | 1,049 | 31.8125 | 119 | py |
smt | smt-master/smt/utils/neural_net/__init__.py | from smt.utils.neural_net import activation
from smt.utils.neural_net import bwd_prop
from smt.utils.neural_net import fwd_prop
from smt.utils.neural_net import loss
from smt.utils.neural_net import model
from smt.utils.neural_net import optimizer
from smt.utils.neural_net import data
| 286 | 34.875 | 43 | py |
smt | smt-master/smt/utils/neural_net/fwd_prop.py | """
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Author: Steven H. Berguin <steven.berguin@gtri.gatech.edu>
This package is distributed under New BSD license.
"""
import numpy as np
def linear_activation_forward(A_prev, W, b, activation):
"""
Implement forward propagation fo... | 9,532 | 45.960591 | 120 | py |
smt | smt-master/smt/utils/neural_net/optimizer.py | """
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Author: Steven H. Berguin <steven.berguin@gtri.gatech.edu>
This package is distributed under New BSD license.
"""
import numpy as np
EPS = np.finfo(float).eps # small number to avoid division by zero
# ------------------------------... | 12,861 | 32.407792 | 120 | py |
smt | smt-master/smt/surrogate_models/rmtc.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import scipy.sparse
from numbers import Integral
from smt.utils.linear_solvers import get_solver
from smt.utils.line_search import get_line_search_class
from smt.surrogate_models.rmts import RMT... | 5,612 | 36.42 | 88 | py |
smt | smt-master/smt/surrogate_models/rmts.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
import scipy.sparse
from numbers import Integral
from smt.utils.linear_solvers import get_solver, LinearSolver, VALID_SOLVERS
from smt.utils.line_search import get_line_search_class, LineSearch,... | 20,336 | 34.003442 | 98 | py |
smt | smt-master/smt/surrogate_models/gekpls.py | """
Author: Dr. Mohamed A. Bouhlel <mbouhlel@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
from smt.surrogate_models import KPLS
from smt.utils.kriging import ge_compute_pls
class GEKPLS(KPLS):
name = "GEKPLS"
def _initialize(self):
super(GEKPLS, self)._initia... | 1,924 | 30.048387 | 83 | py |
smt | smt-master/smt/surrogate_models/idw.py | """
Author: Dr. Mohamed A. Bouhlel <mbouhlel@umich.edu>
Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
from scipy.sparse import csc_matrix
from smt.surrogate_models.surrogate_model import SurrogateModel
from smt.utils.caching import cached_operat... | 3,670 | 25.992647 | 98 | py |
smt | smt-master/smt/surrogate_models/rbf.py | """
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
"""
import numpy as np
from scipy.sparse import csc_matrix
from smt.surrogate_models.surrogate_model import SurrogateModel
from smt.utils.linear_solvers import get_solver
from smt.utils.caching import cached_operation... | 6,314 | 28.101382 | 98 | py |
smt | smt-master/smt/surrogate_models/mgp.py | """
Author: Remy Priem (remy.priem@onera.fr)
This package is distributed under New BSD license.
"""
from __future__ import division
import numpy as np
from scipy import linalg
from smt.utils.kriging import differences, componentwise_distance
from smt.surrogate_models.krg_based import KrgBased
from smt.utils.checks i... | 17,186 | 31.367232 | 95 | py |
smt | smt-master/smt/surrogate_models/ls.py | """
Author: Dr. Mohamed Amine Bouhlel <mbouhlel@umich.edu>
Dr. Nathalie.bartoli <nathalie@onera.fr>
This package is distributed under New BSD license.
TO DO:
- define outputs['sol'] = self.sol
"""
import numpy as np
from sklearn import linear_model
from smt.surrogate_models.surrogate_model import Surrog... | 2,682 | 25.303922 | 98 | py |
smt | smt-master/smt/surrogate_models/genn.py | """
G R A D I E N T - E N H A N C E D N E U R A L N E T W O R K S (G E N N)
Author: Steven H. Berguin <steven.berguin@gtri.gatech.edu>
This package is distributed under New BSD license.
"""
from smt.surrogate_models.surrogate_model import SurrogateModel
from smt.utils.neural_net.model import Model
import numpy... | 10,170 | 30.489164 | 120 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.