func CovVector(X []*core.RealSample, y *core.RealSample, cov_func CovFunc) *core.Vector { l := int64(len(X)) ret := core.NewVector() for i := int64(0); i < l; i++ { ret.SetValue(i, cov_func(X[i].GetFeatureVector(), y.GetFeatureVector())) } return ret }
func (algo *GaussianProcess) PredictStd(sample *core.RealSample) float64 { k := CovVector(algo.DataSet.Samples, sample, algo.CovarianceFunc) C_inv_k := algo.ApproximateInversion(algo.CovMatrix, k, algo.Params.Theta, algo.TrainingDataCount) std := math.Sqrt(algo.CovarianceFunc(sample.GetFeatureVector(), sample.GetFeatureVector()) - k.Dot(C_inv_k)) return std }