Skip to content

Remove SVM from interfaces #5085

@gf712

Description

@gf712

Currently we expose SVM to interfaces, but this is somewhat redundant as we expose Machine (and SVM is a Machine derived class). This was just a hack to make sure that only SVM types can be passed with put to objects expecting an SVM parameter. But now we can test at runtime if the object being put can be casted to the expected type:

SG_ADD((std::shared_ptr<Machine>*)&estimate, "estimate", "Plugin Estimate.", ParameterProperties::CONSTRAIN,
SG_CONSTRAINT(castable<PluginEstimate>()));

So all Machine which expect an SVM parameter (e.g. MKLClassification) should have this castable check and register the svm parameter as a Machine. This will avoid having to cast machine to svm when passing it to things like MKLClassifcation:

svm = sg.create_machine("MKLClassification", svm=sg.as_svm(libsvm),
interleaved_optimization=False, kernel=kernel)

@karlnapf the only issue will be how does the user have access to compute_svm_primal_objective and compute_svm_dual_objective? Maybe SVM shouldn't be removed from swig, but classes like MKL should register SVM as Machine? That way we avoid having to cast the Machine object when it is just passed as an argument in put?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions