| 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 | } |
no test coverage detected