MCPcopy Create free account
hub / github.com/apple/coremltools / validateKernel

Function validateKernel

mlmodel/src/Validation/SVMValidator.cpp:170–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168 }
169
170 Result validateKernel(const Specification::Kernel& kernel) {
171 switch (kernel.kernel_case()) {
172 case Specification::Kernel::kPolyKernel:
173 if(kernel.polykernel().gamma() < 0)
174 return Result(ResultType::INVALID_MODEL_PARAMETERS, "Gamma must be greater than or equal to zero");
175 if(kernel.polykernel().degree() < 0)
176 return Result(ResultType::INVALID_MODEL_PARAMETERS, "Degree must be greater than or equal to zero");
177 case Specification::Kernel::kRbfKernel:
178 if(kernel.rbfkernel().gamma() < 0)
179 return Result(ResultType::INVALID_MODEL_PARAMETERS, "Gamma must be greater than or equal to zero");
180 break;
181 case Specification::Kernel::kSigmoidKernel:
182 if(kernel.sigmoidkernel().gamma() < 0)
183 return Result(ResultType::INVALID_MODEL_PARAMETERS, "Gamma must be greater than or equal to zero");
184 case Specification::Kernel::kLinearKernel:
185 break;
186 default:
187 return Result(ResultType::INVALID_MODEL_PARAMETERS, "You must specify a supported kernel type");
188 }
189 return Result();
190 }
191}

Calls 1

ResultClass · 0.85

Tested by

no test coverage detected