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

Added examples to models in 'mixture' folder #722

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mkalimeri
Copy link
Contributor

Fixes #596 (partially)

Description:
Added examples to models in 'mixture' folder

  • GMMClassifier()
  • BayesianGMMClassifier()
  • GMMOutlierDetector()
  • BayesianGMMOutlierDetector()

Type of change: Bug fix (non-breaking change which fixes an issue)


Before working on a large PR, please check with @FBruzzesi or @koaning to confirm that they agree with the direction of the PR. This discussion should take place in a Github issue before working on the PR, unless it's a minor change like spelling in the docs.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes #(issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the style guidelines (ruff)
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (also to the readme.md)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added tests to check whether the new feature adheres to the sklearn convention
  • New and existing unit tests pass locally with my changes

If you feel your PR is ready for a review, ping @FBruzzesi or @koaning.

Added examples to models in 'mixture' folder

- GMMClassifier()
- BayesianGMMClassifier()
- GMMOutlierDetector()
- BayesianGMMOutlierDetector()
Copy link
Collaborator

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

Hey @mkalimeri , thanks for the PR and for your patience! Work has been a bit hectic recently.

This is very valuable and I would say that it is almost ready - I left comments on bayesian_gmm_classifier.py, but similar feedback is true for all examples:

  • Examples indentation
  • Avoid plotting functionalities in the docstrings
  • Some minor code formatting
  • Print results under each print statement

Comment on lines 26 to 27
Examples
--------
Copy link
Collaborator

Choose a reason for hiding this comment

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

Indentation should be:

Suggested change
Examples
--------
Examples
--------


```python
import numpy as np
import matplotlib.pyplot as plt
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can skip everything involving plotting, it won't be rendered anyway


# Classify a new point into one of two clusters
p = np.array([[1.5, 0.5]])
p_prob= bgmm.predict_proba(p) # predict the probabilities p belongs to each cluster
Copy link
Collaborator

Choose a reason for hiding this comment

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

Tiny format:

Suggested change
p_prob= bgmm.predict_proba(p) # predict the probabilities p belongs to each cluster
p_prob = bgmm.predict_proba(p) # predict the probabilities p belongs to each cluster

sklego/mixture/bayesian_gmm_classifier.py Outdated Show resolved Hide resolved
@mkalimeri
Copy link
Contributor Author

Hello @FBruzzesi, thank you for the feedback! Working on issues is fun, I am happy to pick up more ;-)

I committed the changes requested, but I see the tests are not passing. The errors appear to be related to other files, so I am not sure about how to proceed! Please let me know how things look. Thank you!

@FBruzzesi
Copy link
Collaborator

Hey @mkalimeri thanks for fixing the issues! I will review it soon-ish!

Don't worry about the test suite, we knew that scikit-learn 1.6 release would have broken our tests 🙃 we are working on a fix

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.

[DOCS] Example usage in docstring
2 participants