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

Wrong values of % target #116

Closed
sebastien-foulle opened this issue Apr 22, 2022 · 4 comments
Closed

Wrong values of % target #116

sebastien-foulle opened this issue Apr 22, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@sebastien-foulle
Copy link

Hello,

the html report produced by the following script shows that if bill_length_mm <= 35 then % target < 90%,
and if 35 <= bill_length_mm <= 37.5 then % target > 105% (!).

image

import pandas as pd
from palmerpenguins import load_penguins
import sweetviz as sv
penguins = load_penguins()
penguins["target"] = penguins.species == 'Adelie'
penguins = penguins[["species", "bill_length_mm", "target"]]
penguins.head()

my_report = sv.analyze(penguins, target_feat = "target")
my_report.show_html()

But in fact if bill_length_mm <= 40, % target should always be 100% : there are only Adelie penguins in this case.

# Adelie    100
penguins.query('bill_length_mm <= 40').species.value_counts()

Maybe it's a rounding problem.

@fbdesignpro
Copy link
Owner

@sebastien-foulle thank you for reporting this, I will take a look!

@makotu1208
Copy link

I am experiencing a same event.
How is the progress of the investigation and fix here?

@cwzkevin
Copy link

cwzkevin commented Dec 8, 2022

I have a similar issue! Attached is the example_data.pkl file, example_data.pkl.zip

The code to reproduce the result:

feature_config = sv.FeatureConfig(force_cat=['numerical_var'])
correct_report = sv.analyze([example_data, 'Train'],
                             target_feat='outcome', 
                             feat_cfg=feature_config,
                             pairwise_analysis='off')
correct_report.show_html('correct_report.html')

feature_config = sv.FeatureConfig(force_num=['numerical_var'])
wrong_report = sv.analyze([example_data, 'Train'],
                           target_feat='outcome', 
                           feat_cfg=feature_config,
                           pairwise_analysis='off')
wrong_report.show_html('wrong_report.html')

When we force_cat the numerical_var, we can get the correct distribution of the outcome:

correct_need_to_force_cat

If we force_num the numerical_var, the outcome distribution is completely off:

wrong_as_numerical

@fbdesignpro fbdesignpro self-assigned this Aug 22, 2023
@fbdesignpro fbdesignpro added bug Something isn't working working on it A fix/update for this should be coming soon! labels Oct 4, 2023
@fbdesignpro fbdesignpro removed the working on it A fix/update for this should be coming soon! label Nov 14, 2023
@fbdesignpro
Copy link
Owner

Fixed by 2ec0848!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants