Skip to content

Limit categories in output multinouli distribution - #487

Merged
qubixes merged 7 commits into
sodascience:developfrom
MSVermet:fix_multinouli_dist_output
Nov 2, 2026
Merged

qubixes merged 7 commits into
sodascience:developfrom
MSVermet:fix_multinouli_dist_output

Conversation

@MSVermet

@MSVermet MSVermet commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #477

Limit the categories in output multinouli distribution to the 10(?) categories with the largest probabilities.

Output would be like this (for this output I temporarily changed the limit to 2):

Column 9: "Embarked"
- Variable Type: categorical
- Data Type: Categorical
- Proportion of Missing Values: 0.0022
- Distribution:
	- Type: core.multinoulli
	- Parameters:
		- labels: ['S', 'C', ...]
		- probs: [0.7244, 0.1890, ...]
		- Showing 2 of 3 categories

Another option would be to change the output to something like this:

- Distribution:
    - Type: core.multinoulli
    - Categories: 25
    - Top 10:
        - 'A': 0,2410
        - 'B': 0,1830
        - 'C': 0,1200
        - 'D': 0,0850
        - 'E': 0,0610
        - 'F': 0,0300
        - 'G': 0,0250
        - 'H': 0,0200
        - 'I': 0,0150
        - 'J': 0,0100
    - ... 15 more categories (0,2100 combined probability)

@MSVermet
MSVermet requested a review from qubixes October 29, 2026 10:05

@qubixes qubixes left a comment

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.

Thanks! It looks much better now. I think your proposal here is better than the alternative you mention. Otherwise it is going to take too much vertical space. Perhaps 10 is a little on the high side even, perhaps 7?

Comment thread metasyn/distribution/categorical.py Resolved
Comment thread metasyn/distribution/categorical.py Resolved
Comment thread metasyn/distribution/categorical.py Resolved
Comment thread metasyn/distribution/categorical.py Resolved
Comment thread metasyn/distribution/categorical.py Resolved
@MSVermet
MSVermet requested a review from qubixes October 29, 2026 12:22

@qubixes qubixes left a comment

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.

I have a few more questions, but otherwise it's good. Feel free to merge after these are addressed.

sorted_indices = np.argsort(-self.probs)
top_indices = sorted_indices[:top_bottom_counts[0]]
bottom_indices = sorted_indices[-top_bottom_counts[1]:]
top_labels = ", ".join(repr(label) for label in self.labels[top_indices].tolist())

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.

Why the repr(label) instead of just label?

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.

I guess because it's a np._str?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

To make sure if label is not a string it can be joined. Not sure if this could ever happen, but just in case.

Comment thread metasyn/distribution/categorical.py Resolved
Comment thread metasyn/distribution/categorical.py Resolved
MSVermet and others added 2 commits November 2, 2026 14:01
Co-authored-by: qubixes <44498096+qubixes@users.noreply.github.com>
Co-authored-by: qubixes <44498096+qubixes@users.noreply.github.com>
@qubixes
qubixes merged commit f73f2d4 into sodascience:develop Nov 2, 2026
13 checks passed
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.

Printing multinoulli distributions can be quite verbose

2 participants