Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jmetzen
Copy link
Member

@jmetzen jmetzen commented Mar 5, 2015

This PR adds support for sample weights to GaussianNB.

@jmetzen jmetzen mentioned this pull request Mar 5, 2015
5 tasks
Copy link
Member

Choose a reason for hiding this comment

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

I think I'd prefer a test where you explicitly construct a dataset with duplicate points, so that not all sample weights are the same.

Copy link
Member

Choose a reason for hiding this comment

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

+1

besides looks clean

Copy link
Member Author

Choose a reason for hiding this comment

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

I've extended the test by comparing a dataset with duplicate entries to a dataset without duplicates but correspondingly increased sample weight

@jmetzen jmetzen changed the title [WIP] Sample-weight support for GaussianNB [MRG] Sample-weight support for GaussianNB Mar 6, 2015
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be " None for uniform weights"? Not sure what the docstring usually says ^^

Copy link
Member Author

Choose a reason for hiding this comment

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

This is copy-paste from BaseDiscreteNB to keep docstrings consistent in the module

Copy link
Member

Choose a reason for hiding this comment

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

(n_samples,)

@jmetzen
Copy link
Member Author

jmetzen commented Mar 7, 2015

I've refactored _update_mean_variance() to reduce repetitions and added comments

@amueller amueller changed the title [MRG] Sample-weight support for GaussianNB [MRG + 1] Sample-weight support for GaussianNB Mar 9, 2015
@amueller
Copy link
Member

amueller commented Mar 9, 2015

Great, thanks :) LGTM

Copy link
Member

Choose a reason for hiding this comment

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

shape (n_samples,)

with comma. It's a tuple with 1 element

@agramfort
Copy link
Member

besides +1 for merge

thx @jmetzen !

Jan Hendrik Metzen added 2 commits March 9, 2015 16:37
FIX Converting sample_weight.sum() to float

REFACTOR Reorganizing and commenting _update_mean_variance() in GaussianNB
TST Test GaussianNB sample-weight by somparing with duplicate entries
@jmetzen
Copy link
Member Author

jmetzen commented Mar 9, 2015

Docstring inconsistencies have been addressed

@amueller
Copy link
Member

amueller commented Mar 9, 2015

Is the backticks commit from this PR? Otherwise could you rebase on master?

@amueller amueller changed the title [MRG + 1] Sample-weight support for GaussianNB [MRG + 2] Sample-weight support for GaussianNB Mar 9, 2015
@amueller
Copy link
Member

amueller commented Mar 9, 2015

Also, please add an entry to whatsnew under a new 0.17 heading.

@amueller
Copy link
Member

amueller commented Mar 9, 2015

added to whatsnew and pushed.

@amueller amueller closed this Mar 9, 2015
@jmetzen
Copy link
Member Author

jmetzen commented Mar 9, 2015

Thanks for merging! I was too slow ;-)

@amueller
Copy link
Member

amueller commented Mar 9, 2015

Or I was too fast ;) Thanks for the contribution!

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

Successfully merging this pull request may close these issues.

4 participants