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

sweetviz shows wrong target rate for numerical variable #127

Closed
shreeprasadbhat opened this issue Dec 8, 2022 · 1 comment
Closed

sweetviz shows wrong target rate for numerical variable #127

shreeprasadbhat opened this issue Dec 8, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@shreeprasadbhat
Copy link

shreeprasadbhat commented Dec 8, 2022

I am trying to plot the distribution of a variable and target rate in each of its value, sweetviz shows wrong target rate. Below is the reproducible code.

import pandas as pd
import sweetviz as sv

var1 = [0.]*10 + [1.]*10 + [2]*10 + [3]*10
target = [0]*2 + [1]*8 + [0]*4 +[1]*6 + [0]*8 + [1]*2 + [0]*10
df = pd.DataFrame({'var1':var1, 'target':target})

fc = sv.FeatureConfig(force_num=['var1'])
report = sv.analyze([df, 'Train'], target_feat='target', feat_cfg=fc, pairwise_analysis='off')
report.show_html('report.html')
report.show_notebook('report.html')

image

I know that, if var1 is forcefully set to categorical, it shows the correct output. But it is not useful for me, since categorical variables sweetviz charts are not sorted based axis labels, but on the size of category.

image

How to make this work, by keep the variable numerical itself?

@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
Copy link
Owner

Fixed by 2ec0848!

@fbdesignpro fbdesignpro removed the working on it A fix/update for this should be coming soon! label Nov 15, 2023
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

2 participants