relf / egobox

Efficient global optimization toolbox in Rust: bayesian optimization, mixture of gaussian processes, sampling methods

Home Page:https://joss.theoj.org/papers/10.21105/joss.04737

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GaussianProcess returning NaN for predict_values and predict_variances

s4ksb opened this issue · comments

commented

Hi there, I am trying to use GaussianProcess with a set of data, which is iteratively updated, meaning that the GP is as well. Occasionally, I find that the returned result from the GaussianProcess is NaN, for both predict_values and predict_variances.

Below is the code that I am currently working with. If you have any suggestions which can avoid getting a result of NaN, that would be great.

Thanks
Karl

let kriging = GaussianProcess::<f32, ConstantMean, SquaredExponentialCorr>::params(
    ConstantMean::default(),
    SquaredExponentialCorr::default(),
)
.fit(&Dataset::new(x_train, y_train))
.expect("Kriging trained");

kriging
    .predict_values(&arr_point)
    .expect("Kriging prediction")
    .get((0, 0))
    .unwrap(),
kriging
    .predict_variances(&arr_point)
    .expect("Kriging prediction")
    .get((0, 0))
    .unwrap(),

Hi. Well, nothing wrong with the code above, the problem arises from the data, it is likely you stumble on an ill-conditionned system.

Such problems may arise for instance if your training data points are too close from each other and/or the point you want to predict is far from your training data (kriging is bad at extrapolation) or if you have too few training points regarding the input dimension.

Unfortunately, the workaround is just to filter out such results. Nevertheless, if you could share a dataset when things go wrong, I could track down what is going on exactly to see whether it is "normal" (maybe I could return an error) or a bug.

Hope you have fixed your problem. Feel free to reopen if needed.