Skip to content

DOC coef_ and intercept_ documentation for ComplementNB#17722

Merged
glemaitre merged 3 commits intoscikit-learn:masterfrom
marenwestermann:complement-nb-attributes-doc
Jun 25, 2020
Merged

DOC coef_ and intercept_ documentation for ComplementNB#17722
glemaitre merged 3 commits intoscikit-learn:masterfrom
marenwestermann:complement-nb-attributes-doc

Conversation

@marenwestermann
Copy link
Copy Markdown
Member

Reference Issues/PRs

references #14312

What does this implement/fix? Explain your changes.

Documents the attributes coef_ and intercept_ in class ComplementNB.

Any other comments?

The documentation of the attributes coef_ and intercept_ is almost identical to the documentation of these attributes in MultinomialNB.

ping @adrinjalali

feature_log_prob_ : ndarray of shape (n_classes, n_features)
Empirical weights for class complements.

intercept_ : ndarray of shape (n_classes, )
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
intercept_ : ndarray of shape (n_classes, )
intercept_ : ndarray of shape (n_classes,)

Empirical weights for class complements.

intercept_ : ndarray of shape (n_classes, )
Mirrors ``class_log_prior_`` for interpreting ComplementNB
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Mirrors ``class_log_prior_`` for interpreting ComplementNB
Mirrors ``class_log_prior_`` for interpreting `ComplementNB`

Class labels known to the classifier

coef_ : ndarray of shape (n_classes, n_features)
Mirrors ``feature_log_prob_`` for interpreting ComplementNB
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Mirrors ``feature_log_prob_`` for interpreting ComplementNB
Mirrors ``feature_log_prob_`` for interpreting `ComplementNB`

@glemaitre
Copy link
Copy Markdown
Member

@adrinjalali @agramfort did we deprecate coef_ and intercept_ from the NaiveBayes? Or it was only on class?

@adrinjalali
Copy link
Copy Markdown
Member

They didn't seem to be deprecated here when I checked, are they supposed to be?

@glemaitre
Copy link
Copy Markdown
Member

@adrinjalali I found the PR :)
#17427

@glemaitre
Copy link
Copy Markdown
Member

Anyway it does not change anything since the deprecation did not take place yet. We need first to introduce it in this PR and the other PR will properly deprecate it.

@marenwestermann
Copy link
Copy Markdown
Member Author

I made the suggested changes and applied them to the class MultinomialNB as well because I did a copy-paste from there.

@glemaitre
Copy link
Copy Markdown
Member

Good it makes sense.

Comment on lines +703 to 704
Mirrors ``feature_log_prob_`` for interpreting `MultinomialNB`
as a linear model.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe a bit redundant. What about:

Suggested change
Mirrors ``feature_log_prob_`` for interpreting `MultinomialNB`
as a linear model.
Mirrors ``feature_log_prob_`` for interpreting as a linear model.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that would seem a bit strange of a sentence to me though

Copy link
Copy Markdown
Member

@alfaro96 alfaro96 Jun 25, 2020

Choose a reason for hiding this comment

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

Yep, you are right. Something seems missed in the previous sentence.

Another possibility could be:

Suggested change
Mirrors ``feature_log_prob_`` for interpreting `MultinomialNB`
as a linear model.
Mirrors ``feature_log_prob_`` for interpreting this estimator
as a linear model.

Nevertheless, the original sentence LGTM otherwise.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think it's fine as it is since I did a copy-paste from another class.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Then, LGTM!

@glemaitre glemaitre merged commit db2d905 into scikit-learn:master Jun 25, 2020
@marenwestermann marenwestermann deleted the complement-nb-attributes-doc branch June 26, 2020 12:39
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Jul 17, 2020
jayzed82 pushed a commit to jayzed82/scikit-learn that referenced this pull request Oct 22, 2020
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.

4 participants