The function value and the gradient vector value provided by the ImpurityConcentrationDataSource.run methods seem to be inconsistent. A brute-force check of the finite-difference gradient versus the provided (analytical) gradients, as in:
is failing. For instance, the tested function value of the DataSource at test_basic_evaluation is 0.372027129767. The gradient corresponding to the first input parameter (by default set to 0.5) equals approximately 0.01596.
If we perturb the value of the first parameter by 1.e-4, the function value now is 0.37201671105224304, which is equivalent to the gradient of -0.1041871.
I suggest implementing an automated gradient testing in future.
Update
The problem is apparently not in the gradient calculations, but in the discrepancy between the input parameters and the output gradients: the gradient vector is not (directly) related to the parameters vector.
The function value and the gradient vector value provided by the
ImpurityConcentrationDataSource.run
methods seem to be inconsistent. A brute-force check of the finite-difference gradient versus the provided (analytical) gradients, as in:is failing. For instance, the tested function value of the DataSource at
test_basic_evaluation
is0.372027129767
. The gradient corresponding to the first input parameter (by default set to0.5
) equals approximately0.01596
.If we perturb the value of the first parameter by
1.e-4
, the function value now is0.37201671105224304
, which is equivalent to the gradient of-0.1041871
.I suggest implementing an automated gradient testing in future.
Update
The problem is apparently not in the gradient calculations, but in the discrepancy between the input parameters and the output gradients: the gradient vector is not (directly) related to the parameters vector.