Skip to content

Default value for solving an SVM in primal and dual should be determined automatically #24651

@ChidiRnweke

Description

@ChidiRnweke

Describe the workflow you want to enable

Currently the default value for LinearSVC and LinearSVR with regards to solving the problem in dual is True. This means that for users that are unfamiliar with support-vector machines and do not know the importance of this parameter they could be using te framework inefficiently.

I would propose for the default value to be None and a simple check to occur. If n_samples > n_features it's set to dual and otherwise it is set to primal.

Describe your proposed solution

This is a quick and easy fix and would only require a few lines of code in the fit method:

        if self.dual != None:
            pass
        else:
            if X.shape[0] < X.shape[1]:
                self.dual = True
            else:
                self.dual = False

Describe alternatives you've considered, if relevant

No response

Additional context

No response

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