errorCovariance[i, i] = 2.0 + (1.0 + i) * (1.0 + i) for j in range(i): errorCovariance[i, j] = 1.0 / (1.0 + i + j) globalErrorCovariance = ot.CovarianceMatrix(2 * m) for i in range(2 * m): globalErrorCovariance[i, i] = 2.0 + (1.0 + i) * (1.0 + i) for j in range(i): globalErrorCovariance[i, j] = 1.0 / (1.0 + i + j) methods = ["SVD", "QR", "Cholesky"] for method in methods: print("method=", method) # 1. Check with local error covariance print("Local error covariance") algo = ot.GaussianLinearCalibration(modelX, x, y, candidate, priorCovariance, errorCovariance, method) algo.run() calibrationResult = algo.getResult() # Analysis of the results # Maximum A Posteriori estimator thetaMAP = calibrationResult.getParameterMAP() exactTheta = ot.Point([5.69186, 0.0832132, 0.992301]) rtol = 1.e-2 assert_almost_equal(thetaMAP, exactTheta, rtol) # Covariance matrix of theta thetaPosterior = calibrationResult.getParameterPosterior() covarianceThetaStar = matrixToSample(thetaPosterior.getCovariance()) exactCovarianceTheta = ot.Sample(
# %% sigma = ot.CovarianceMatrix(3) sigma[0, 0] = sigmaR**2 sigma[1, 1] = sigmaC**2 sigma[2, 2] = sigmaGamma**2 sigma # %% # Gaussian linear calibration # --------------------------- # %% # The `GaussianLinearCalibration` class performs the gaussian linear calibration by linearizing the model in the neighbourhood of the prior. # %% algo = ot.GaussianLinearCalibration(mycf, observedStrain, observedStress, thetaPrior, sigma, errorCovariance) # %% # The `run` method computes the solution of the problem. # %% algo.run() # %% calibrationResult = algo.getResult() # %% # Analysis of the results # ----------------------- # %%
sigmaKs = 5. sigmaZv = 1. sigmaZm = 1. # %% sigma = ot.CovarianceMatrix(3) sigma[0, 0] = sigmaKs**2 sigma[1, 1] = sigmaZv**2 sigma[2, 2] = sigmaZm**2 print(sigma) # %% # The `GaussianLinearCalibration` class performs Gaussian linear calibration by linearizing the model in the neighbourhood of the prior. # %% algo = ot.GaussianLinearCalibration(mycf, Qobs, Hobs, thetaPrior, sigma, errorCovariance, "SVD") # %% # The `run` method computes the solution of the problem. # %% algo.run() # %% calibrationResult = algo.getResult() # %% # Analysis of the results # ----------------------- # %%
sigmaR = 0.1 * R sigmaC = 0.1 * C sigmaGamma = 0.1 * Gamma priorCovariance = ot.CovarianceMatrix(3) priorCovariance[0, 0] = sigmaR**2 priorCovariance[1, 1] = sigmaC**2 priorCovariance[2, 2] = sigmaGamma**2 methods = ["SVD", "QR", "Cholesky"] for method in methods: print("method=", method) # 1. Local calibration # The `GaussianLinearCalibration` class performs the gaussian linear # calibration by linearizing the model in the neighbourhood of the prior. algo = ot.GaussianLinearCalibration(mycf, observedStrain, observedStress, \ thetaPrior, priorCovariance, localErrorCovariance, method) # The `run` method computes the solution of the problem. algo.run() calibrationResult = algo.getResult() # Analysis of the results # Maximum A Posteriori estimator thetaMAP = calibrationResult.getParameterMAP() exactTheta = ot.Point([762.661, 3056.59, 8.52781]) assert_almost_equal(thetaMAP, exactTheta) # Covariance matrix of theta thetaPosterior = calibrationResult.getParameterPosterior() covarianceThetaStar = matrixToSample(thetaPosterior.getCovariance())
errorCovariance[i, i] = 2.0 + (1.0 + i) * (1.0 + i) for j in range(i): errorCovariance[i, j] = 1.0 / (1.0 + i + j) globalErrorCovariance = ot.CovarianceMatrix(outputDimension * size) for i in range(outputDimension * size): globalErrorCovariance[i, i] = 0.1 * (2.0 + (1.0 + i) * (1.0 + i)) for j in range(i): globalErrorCovariance[i, j] = 0.1 / (1.0 + i + j) methods = ["SVD", "QR", "Cholesky"] for method in methods: print("method=", method) # 1. Check with local error covariance print("Local error covariance") algo = ot.GaussianLinearCalibration( model, inputObservations, outputObservations, candidate, priorCovariance, errorCovariance, method ) algo.run() calibrationResult = algo.getResult() # Analysis of the results # Maximum A Posteriori estimator parameterMAP = calibrationResult.getParameterMAP() print("MAP=", repr(parameterMAP)) rtol = 0.0 atol = 1.0 ott.assert_almost_equal(parameterMAP, trueParameter, rtol, atol) # 2. Check with global error covariance print("Global error covariance") algo = ot.GaussianLinearCalibration(