Skip to content

[MRG+1] Added support for sample_weight in linearSVR, including tests and documentation. Fixes #6862 #6907

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

Merged
merged 22 commits into from
Jun 23, 2016

Conversation

imaculate
Copy link
Contributor

Reference Issue

What does this implement/fix? Explain your changes.

Any other comments?

…umentation

clf.fit(iris.data, iris.target)

prob_predict = clf.predict_proba(iris.data)
assert_array_almost_equal(
np.sum(prob_predict, 1), np.ones(iris.data.shape[0]))
assert_true(np.mean(np.argmax(prob_predict, 1)
== clf.predict(iris.data)) > 0.9)
== clf.predict(iris.data)) > 0.9)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we wouldn't go fixing up cosmetic things when submitting an unrelated PR. It makes the PR somewhat harder to review. But at least this PR is small and focussed

@jnothman
Copy link
Member

Thanks for this. After a skim, it looks good, but I'll give it a closer look when I have time.


assert np.linalg.norm(lsvr.coef_ - lsvr_no_weight.coef_)\
/ np.linalg.norm(lsvr_no_weight.coef_) < .1
assert np.abs(score1 - score2) < 0.1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use assert but assert_less or assert_true

@jnothman
Copy link
Member

Frustratingly, you'll need to rebase on master. Otherwise looks good to me, and you should mention the enhancement in doc/whats_new.rst

@jnothman jnothman changed the title Added support for sample_weight in linearSVR, including tests and documentation. Fixes #6862 [MRG+1] Added support for sample_weight in linearSVR, including tests and documentation. Fixes #6862 Jun 22, 2016
@imaculate
Copy link
Contributor Author

@jnothman I tried to rebase, not sure if I did the right thing.

@jnothman
Copy link
Member

Rebase usually involves something like:

$ git checkout master
$ git pull https://github.com/scikit-learn/scikit-learn/ master
$ git checkout linearsvr_sampleweight
$ git rebase master
# sort out any merge conflicts
$ git push -f https://github.com/imaculate/scikit-learn linearsvr_sampleweight

@jnothman
Copy link
Member

I.e. it is not done correctly here

@imaculate imaculate force-pushed the linearsvr_sampleweight branch from c67fd55 to 65d1d93 Compare June 23, 2016 11:25
@imaculate
Copy link
Contributor Author

Done!

1 similar comment
@imaculate
Copy link
Contributor Author

Done!

@jnothman
Copy link
Member

@agramfort, a quick review?

@agramfort agramfort merged commit 3cc7fea into scikit-learn:master Jun 23, 2016
@agramfort
Copy link
Member

thx @imaculate

@imaculate
Copy link
Contributor Author

Pleasure! Thanks too for the guidance!

olologin pushed a commit to olologin/scikit-learn that referenced this pull request Aug 24, 2016
… and documentation. Fixes scikit-learn#6862 (scikit-learn#6907)

* Make KernelCenterer a _pairwise operation

Replicate solution to scikit-learn@9a52077 except that `_pairwise` should always be `True` for `KernelCenterer` because it's supposed to receive a Gram matrix. This should make `KernelCenterer` usable in `Pipeline`s.

Happy to add tests, just tell me what should be covered.

* Adding test for PR scikit-learn#6900

* Simplifying imports and test

* updating changelog links on homepage (scikit-learn#6901)

* first commit

* changed binary average back to macro

* changed binomialNB to multinomialNB

* emphasis on "higher return values are better..." (scikit-learn#6909)

* fix typo in comment of hierarchical clustering (scikit-learn#6912)

* [MRG] Allows KMeans/MiniBatchKMeans to use float32 internally by using cython fused types (scikit-learn#6846)

* Fix sklearn.base.clone for all scipy.sparse formats (scikit-learn#6910)

* DOC If git is not installed, need to catch OSError

Fixes scikit-learn#6860

* DOC add what's new for clone fix

* fix a typo in ridge.py (scikit-learn#6917)

* pep8

* TST: Speed up: cv=2

This is a smoke test. Hence there is no point having cv=4

* Added support for sample_weight in linearSVR, including tests and documentation

* Changed assert to assert_allclose and assert_almost_equal, reduced the test tolerance

* Fixed pep8 violations and sampleweight format

* rebased with upstream
TomDLT pushed a commit to TomDLT/scikit-learn that referenced this pull request Oct 3, 2016
… and documentation. Fixes scikit-learn#6862 (scikit-learn#6907)

* Make KernelCenterer a _pairwise operation

Replicate solution to scikit-learn@9a52077 except that `_pairwise` should always be `True` for `KernelCenterer` because it's supposed to receive a Gram matrix. This should make `KernelCenterer` usable in `Pipeline`s.

Happy to add tests, just tell me what should be covered.

* Adding test for PR scikit-learn#6900

* Simplifying imports and test

* updating changelog links on homepage (scikit-learn#6901)

* first commit

* changed binary average back to macro

* changed binomialNB to multinomialNB

* emphasis on "higher return values are better..." (scikit-learn#6909)

* fix typo in comment of hierarchical clustering (scikit-learn#6912)

* [MRG] Allows KMeans/MiniBatchKMeans to use float32 internally by using cython fused types (scikit-learn#6846)

* Fix sklearn.base.clone for all scipy.sparse formats (scikit-learn#6910)

* DOC If git is not installed, need to catch OSError

Fixes scikit-learn#6860

* DOC add what's new for clone fix

* fix a typo in ridge.py (scikit-learn#6917)

* pep8

* TST: Speed up: cv=2

This is a smoke test. Hence there is no point having cv=4

* Added support for sample_weight in linearSVR, including tests and documentation

* Changed assert to assert_allclose and assert_almost_equal, reduced the test tolerance

* Fixed pep8 violations and sampleweight format

* rebased with upstream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.