Note
Click here to download the full example code
Use of Radial Basis Function¶
from smt.sampling_methods import LHS
from smt.problems import Sphere
from smt.surrogate_models import RBF
import numpy as np
import otsmt
import openturns as ot
Definition of Initial data
Training of smt model for Radial Basis Function
sm_rbf = RBF()
sm_rbf.set_training_values(xt, yt[:,0])
sm_rbf.train()
Out:
___________________________________________________________________________
RBF
___________________________________________________________________________
Problem size
# training points. : 40
___________________________________________________________________________
Training
Training ...
Initializing linear solver ...
Performing LU fact. (40 x 40 mtx) ...
Performing LU fact. (40 x 40 mtx) - done. Time (sec): 0.0001147
Initializing linear solver - done. Time (sec): 0.0001836
Solving linear system (col. 0) ...
Back solving (40 x 40 mtx) ...
Back solving (40 x 40 mtx) - done. Time (sec): 0.0000541
Solving linear system (col. 0) - done. Time (sec): 0.0001123
Training - done. Time (sec): 0.0006683
Creation of OpenTurns PythonFunction for prediction
otrbf = otsmt.smt2ot(sm_rbf)
otrbfprediction = otrbf.getPredictionFunction()
print('Predicted values by RBF:',otrbfprediction(xv))
Out:
___________________________________________________________________________
Evaluation
# eval points. : 2
Predicting ...
Predicting - done. Time (sec): 0.0000222
Prediction time/pt. (sec) : 0.0000111
Predicted values by RBF: [ y0 ]
0 : [ 0.00737942 ]
1 : [ 0.022817 ]
Total running time of the script: ( 0 minutes 0.004 seconds)