func NewSVC() *SVC {
	m := &SVC{
		BaseLibSVM: BaseLibSVM{C: 1., Epsilon: 0.1, Kernel: "rbf", Degree: 3., Gamma: 0., Coef0: 0., Shrinking: true, Tol: 1e-3, CacheSize: 200},
	}
	return m
}
NewSVC ...
Kernel: "linear","poly","rbf","sigmoid" default is "rbf"
if Gamma<=0 il will be changed to 1/NFeatures
Cachesize is in MB. defaults to 200
package svm
import (
	"fmt"
	"math"
	"golang.org/x/exp/rand"
	"github.com/pa-m/sklearn/base"
	"github.com/pa-m/sklearn/metrics"
	"gonum.org/v1/gonum/mat"
)
type Model struct {
	X              *mat.Dense
	Y              []float64
	KernelFunction func(X1, X2 []float64) float64
	B       float64
	Alphas  []float64
	Support []int
}
func svmTrain(X *mat.Dense, Y []float64, C, Epsilon float64, KernelFunction func(X1, X2 []float64) float64, Tol float64, MaxPasses int, CacheSize uint, RandomState base.RandomState) *Model {
	m, n := X.Dims()
	alphas := make([]float64, m)
	b := 0.
	E := make([]float64, m)
	eta := 0.
	passes := 0
	L, H := 0., 0.
	K := cachedKernel(X, CacheSize, KernelFunction)
	f := func(i int) float64 {
		y := b
		for i1 := 0; i1 < m; i1++ {
			y += alphas[i1] * Y[i1] * K(i1, i)
		}
		return y
	}
	randIntn := rand.Intn
	if RandomState != nil {
		type Intner interface{ Intn(int) int }
		if intner, ok := RandomState.(Intner); ok {
			randIntn = intner.Intn
		} else {
			randIntn = rand.New(RandomState).Intn
		}
	}
	for passes < MaxPasses {
		numChangedAlphas := 0
		var KKTviolated bool
		for i := 0; i < m; i++ {
			Kii := K(i, i)
			E[i] = f(i) - Y[i]
			if (Y[i]*E[i] < -Epsilon && alphas[i] < C) || (Y[i]*E[i] > Epsilon && alphas[i] > 0) {
				KKTviolated = true
				j := randIntn(m - 1)
				if j >= i {
					j++
				}
				E[j] = f(j) - Y[j]
				alphaiold, alphajold := alphas[i], alphas[j]
				if Y[i] == Y[j] {
					L, H = math.Max(0, alphas[j]+alphas[i]-C), math.Min(C, alphas[j]+alphas[i])
				} else {
					L, H = math.Max(0, alphas[j]-alphas[i]), math.Min(C, C+alphas[j]-alphas[i])
				}
				if L == H {
					continue
				}
				Kij := K(i, j)
				Kjj := K(j, j)
				eta = 2*Kij - Kii - Kjj
				if eta >= 0 {
					continue
				}
				alphas[j] = alphas[j] - (Y[j]*(E[i]-E[j]))/eta
				alphas[j] = math.Max(L, math.Min(H, alphas[j]))
				if alphas[j]-alphajold < Tol {
					alphas[j] = alphajold
					continue
				}
				alphas[i] += Y[i] * Y[j] * (alphajold - alphas[j])
				b1 := b - E[i] - Y[i]*(alphas[i]-alphaiold)*Kii - Y[j]*(alphas[j]-alphajold)*Kij
				b2 := b - E[j] - Y[i]*(alphas[i]-alphaiold)*Kij - Y[j]*(alphas[j]-alphajold)*Kjj
				if 0 < alphas[i] && alphas[i] < C {
					b = b1
				} else if 0 < alphas[j] && alphas[j] < C {
					b = b2
				} else {
					b = (b1 + b2) / 2
				}
				numChangedAlphas++
			}
		}
		if !KKTviolated {
			break
		}
		if numChangedAlphas == 0 {
			passes++
		} else {
			passes = 0
		}
	}
	idx := make([]int, 0)
	for i := 0; i < m; i++ {
		if alphas[i] > Tol {
			idx = append(idx, i)
		}
	}
	model := &Model{
		X:              mat.NewDense(len(idx), n, nil),
		Y:              make([]float64, len(idx)),
		KernelFunction: KernelFunction,
		B:              b,
		Alphas:         make([]float64, len(idx)),
		Support:        idx,
	}
	for ii, i := range idx {
		model.X.SetRow(ii, X.RawRowView(i))
		model.Y[ii] = Y[i]
		model.Alphas[ii] = alphas[i]
	}
	return model
}
func svmPredict(model *Model, X, Y *mat.Dense, output int, binary bool) {
	NSamples, _ := X.Dims()
	Ymat := Y.RawMatrix()
	for i, yoff := 0, output; i < NSamples; i, yoff = i+1, yoff+Ymat.Stride {
		prediction := 0.
		for j := range model.Alphas {
			prediction += model.Alphas[j] * model.Y[j] * model.KernelFunction(X.RawRowView(i), model.X.RawRowView(j))
		}
		prediction += model.B
		if binary {
			var predi float64
			if prediction >= 0 {
				predi = 1.
			}
			Ymat.Data[yoff] = predi
		} else {
			Ymat.Data[yoff] = prediction
		}
	}
}
type BaseLibSVM struct {
	C, Epsilon  float64
	Kernel      interface{}  
	Degree      float64
	Gamma       float64
	Coef0       float64
	Tol         float64
	Shrinking   bool
	CacheSize   uint
	RandomState base.Source
	MaxIter        int
	Model          []*Model
	Support        [][]int
	SupportVectors [][][]float64
}
type SVC struct {
	BaseLibSVM
	Probability bool
	ClassWeight []float64
	nOutputs    int
}