Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Fixed n_support_ attr for OneClassSVM and SVR #15099

Merged
merged 9 commits into from Oct 2, 2019

Conversation

@NicolasHug
Copy link
Contributor

NicolasHug commented Sep 26, 2019

Closes #14799
Closes #15034

Fixes #14774

@amueller I think this is enough?

(That doesn't fix the nonsense that the attribute has size 2 (i.e. 2 classes) for OneClass and SVR but that's a different issue) It does now

NicolasHug added 3 commits Sep 26, 2019
@amueller

This comment has been minimized.

Copy link
Member

amueller commented Sep 26, 2019

I mean it's better but ideally we'd fix that nonsense as well, right?

@NicolasHug

This comment has been minimized.

Copy link
Contributor Author

NicolasHug commented Sep 26, 2019

that means we need a deprecation then. On master n_support_ is [0, 0].

@amueller

This comment has been minimized.

Copy link
Member

amueller commented Sep 26, 2019

I would argue it's a bugfix. On master it's uninitialized memory values afaik.

Copy link
Member

adrinjalali left a comment

Otherwise LGTM :)

@@ -484,6 +484,17 @@ def coef_(self):
def _get_coef(self):
return safe_sparse_dot(self._dual_coef_, self.support_vectors_)

@property
def n_support_(self):
check_is_fitted(self)

This comment has been minimized.

Copy link
@adrinjalali

adrinjalali Sep 30, 2019

Member

I think a @property raising a NotFittedError is kinda odd. Rather have an AttributeError here.

NicolasHug added 2 commits Oct 1, 2019
Copy link
Member

adrinjalali left a comment

Thanks @NicolasHug

Copy link
Member

jnothman left a comment

Otherwise lgtm

cdef np.ndarray[np.int32_t, ndim=1, mode='c'] n_class_SV
n_class_SV = np.empty(n_class, dtype=np.int32)
copy_nSV(n_class_SV.data, model)
if (svm_type == 0 or svm_type == 1):

This comment has been minimized.

Copy link
@jnothman

jnothman Oct 2, 2019

Member

Rm parentheses

@NicolasHug NicolasHug merged commit af82929 into scikit-learn:master Oct 2, 2019
19 checks passed
19 checks passed
LGTM analysis: C/C++ No code changes detected
Details
LGTM analysis: JavaScript No code changes detected
Details
LGTM analysis: Python No new or fixed alerts
Details
ci/circleci: deploy Your tests passed on CircleCI!
Details
ci/circleci: doc Your tests passed on CircleCI!
Details
ci/circleci: doc artifact Link to 0/doc/_changed.html
Details
ci/circleci: doc-min-dependencies Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
codecov/patch 95.83% of diff hit (within 1% threshold of 96.75%)
Details
codecov/project 96.73% (-0.02%) compared to c4f372c
Details
scikit-learn.scikit-learn Build #20191002.28 succeeded
Details
scikit-learn.scikit-learn (Linux py35_conda_openblas) Linux py35_conda_openblas succeeded
Details
scikit-learn.scikit-learn (Linux py35_ubuntu_atlas) Linux py35_ubuntu_atlas succeeded
Details
scikit-learn.scikit-learn (Linux pylatest_conda_mkl) Linux pylatest_conda_mkl succeeded
Details
scikit-learn.scikit-learn (Linux pylatest_pip_openblas_pandas) Linux pylatest_pip_openblas_pandas succeeded
Details
scikit-learn.scikit-learn (Linux32 py35_ubuntu_atlas_32bit) Linux32 py35_ubuntu_atlas_32bit succeeded
Details
scikit-learn.scikit-learn (Windows py35_pip_openblas_32bit) Windows py35_pip_openblas_32bit succeeded
Details
scikit-learn.scikit-learn (Windows py37_conda_mkl) Windows py37_conda_mkl succeeded
Details
scikit-learn.scikit-learn (macOS pylatest_conda_mkl) macOS pylatest_conda_mkl succeeded
Details
@NicolasHug

This comment has been minimized.

Copy link
Contributor Author

NicolasHug commented Oct 2, 2019

Comments were addressed, mergning. Thanks for the reviews!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.