Пример #1
0
func toCParameter(param Parameters) *C.svm_parameter_t {
	cParam := C.parameter_new()

	// SVM type parameters
	cParam.svm_type = param.SVMType.svmType
	cParam.C = param.SVMType.cost
	cParam.nu = param.SVMType.nu
	cParam.p = param.SVMType.epsilon

	// Kernel type parameters
	cParam.kernel_type = param.Kernel.kernelType
	cParam.gamma = param.Kernel.gamma
	cParam.coef0 = param.Kernel.coef0
	cParam.degree = param.Kernel.degree

	cParam.cache_size = C.double(param.CacheSize)
	cParam.eps = C.double(param.Epsilon)

	if param.Shrinking {
		cParam.shrinking = 1
	}

	if param.Probability {
		cParam.probability = 1
	}

	return cParam
}
Пример #2
0
func newParameter() *C.parameter_t {
	param := tryNew(func() unsafe.Pointer {
		return unsafe.Pointer(C.parameter_new())
	})
	return (*C.parameter_t)(param)
}