// PredictEx predicts using the Gaussian process regression model, returning Ymean and std or cov
PredictEx predicts using the Gaussian process regression model, returning Ymean and std or cov
// PredictEx predicts using the Gaussian process regression model returning Ymean and std or cov
func (m *Regressor) PredictEx(X mat.Matrix, Y mat.Mutable, returnStd, returnCov bool) (*mat.Dense, *mat.DiagDense, *mat.Dense) {
	NSamples, _ := X.Dims()
	var Ymean, Ycov *mat.Dense
	var Ystd *mat.DiagDense
	if _, ok := Y.(*mat.Dense); ok {
		Ymean = Y.(*mat.Dense)
	} else {
		Ymean = mat.NewDense(NSamples, m.GetNOutputs(), nil)
	}
	if m.Xtrain == nil {
		if returnCov {
			Ycov, _ = m.Kernel.Eval(X, nil, false)
		} else if returnStd {
			Ystd = m.Kernel.Diag(X)
			for i := 0; i < NSamples; i++ {
				Ystd.SetDiag(i, math.Sqrt(Ystd.At(i, i)))
			}
		}
	} else {
		Ktrans, _ := m.Kernel.Eval(X, m.Xtrain, false)
		Ymean.Mul(Ktrans, mat.NewDense(NSamples, 1, m.Alpha))
		Ymean.Add(Ymean, m.YtrainMean)
		if returnStd {
		} else if returnCov {
		}
	}
	return base.FromDense(Y, Ymean), Ystd, Ycov
}
func ( m * Regressor ) PredictEx ( X mat . Matrix , Y mat . Mutable , returnStd , returnCov bool ) ( * mat . Dense , * mat . DiagDense , * mat . Dense ) { NSamples , _ := X . Dims ( ) var Ymean , Ycov * mat . Dense var Ystd * mat . DiagDense if _ , ok := Y . ( * mat . Dense ) ; ok { Ymean = Y . ( * mat . Dense ) } else { Ymean = mat . NewDense ( NSamples , m . GetNOutputs ( ) , nil ) } if m . Xtrain == nil { if returnCov { Ycov , _ = m . Kernel . Eval ( X , nil , false ) } else if returnStd { Ystd = m . Kernel . Diag ( X ) for i := 0 ; i < NSamples ; i ++ { Ystd . SetDiag ( i , math . Sqrt ( Ystd . At ( i , i ) ) ) } } } else { Ktrans , _ := m . Kernel . Eval ( X , m . Xtrain , false ) Ymean . Mul ( Ktrans , mat . NewDense ( NSamples , 1 , m . Alpha ) ) Ymean . Add ( Ymean , m . YtrainMean ) if returnStd { } else if returnCov { } } return base . FromDense ( Y , Ymean ) , Ystd , Ycov }
PredictEx predicts using the Gaussian process regression model, returning Ymean and std or cov
PredictEx predicts using the Gaussian process regression model returning Ymean and std or cov
// # Unfitted;predict based on GP prior // y_mean = np.zeros(X.shape[0]) // # Predict based on GP posterior //K_trans = self.kernel_(X, self.X_train_) //y_mean = K_trans.dot(self.alpha_)  # Line 4 (y_mean = f_star) //y_mean = self._y_train_mean + y_mean  # undo normal. // TODO // TODO