func (m *BaseNB) PredictProbas(Xmatrix mat.Matrix, Ymutable mat.Mutable) *mat.Dense {
	X, Y := base.ToDense(Xmatrix), base.ToDense(Ymutable)
	if Y.IsEmpty() {
		fanOut := len(m.Classes)
		Y = mat.NewDense(X.RawMatrix().Rows, fanOut, nil)
	}
	m.PredictLogProbas(X, Y)
	Y.Apply(func(_, _ int, v float64) float64 { return math.Exp(v) }, Y)
	return base.FromDense(Ymutable, Y)
}
PredictProbas return log-probability estimates.
package naivebayes
import (
	"fmt"
	"github.com/pa-m/sklearn/base"
	"github.com/pa-m/sklearn/metrics"
	"gonum.org/v1/gonum/floats"
	"gonum.org/v1/gonum/mat"
	"math"
	"runtime"
	"sort"
)
var _ base.Fiter = &GaussianNB{}
var _ base.Predicter = &GaussianNB{}
type BaseNB struct {
	nOutputs           int
	jointLogLikelihood func(jll, xrow []float64)
	Classes            []float64
}
func (m *BaseNB) GetNOutputs() int {
	return m.nOutputs
}
func (m *BaseNB) Predict(X mat.Matrix, Y mat.Mutable) *mat.Dense {
	Ypred := base.ToDense(Y)
	if Y == mat.Mutable(nil) {
		NSamples, _ := X.Dims()
		Ypred = mat.NewDense(NSamples, m.GetNOutputs(), nil)
	}
	NSamples, NFeatures := X.Dims()
	row := make([]float64, NFeatures)
	jll := make([]float64, len(m.Classes))
	for i := 0; i < NSamples; i++ {
		mat.Row(row, i, X)
		m.jointLogLikelihood(jll, row)
		index := floats.MaxIdx(jll)
		Ypred.Set(i, 0, m.Classes[index])
	}
	return base.FromDense(Y, Ypred)
}
func (m *BaseNB) PredictLogProbas(Xmatrix mat.Matrix, Ymutable mat.Mutable) *mat.Dense {
	X, Y := base.ToDense(Xmatrix), base.ToDense(Ymutable)
	Xraw := X.RawMatrix()
	if Y.IsEmpty() {
		fanOut := len(m.Classes)
		Y = mat.NewDense(Xraw.Rows, fanOut, nil)
	}
	base.Parallelize(runtime.GOMAXPROCS(0), Xraw.Rows, func(th, start, end int) {
		for i := start; i < end; i++ {
			jll := Y.RawRowView(i)
			m.jointLogLikelihood(jll, Xraw.Data[i*Xraw.Stride:i*Xraw.Stride+Xraw.Cols])
			logProbX := floats.LogSumExp(jll)
			floats.AddConst(-logProbX, jll)
		}
	})
	return base.FromDense(Ymutable, Y)
}