Skip to content

Commit

Permalink
Add missing test whether a valid kernel function has been provided.
Browse files Browse the repository at this point in the history
  • Loading branch information
breyerml committed Nov 7, 2023
1 parent db54557 commit f7f56bf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bindings/Python/sklearn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ void parse_provided_params(svc &self, const py::kwargs &args) {
std::stringstream ss{ args["kernel"].cast<std::string>() };
plssvm::kernel_function_type kernel{};
ss >> kernel;
if (ss.fail()) {
throw py::value_error{ fmt::format("'{}' is not in list", args["kernel"].cast<std::string>()) };
}
self.svm_->set_params(plssvm::kernel_type = kernel);
}
if (args.contains("degree")) {
Expand Down

0 comments on commit f7f56bf

Please sign in to comment.