Comments (18)
Hey @geniusjenny
Thanks for the bug report!
Could you please try to run the code from the rake tutorial:
https://import-balance.org/docs/tutorials/quickstart_rake/
And see if you can reproduce the code from it?
What would help me is a fully self-contained reproducible example that I could run in my env to reproduce the error - that would allow me to more easily iterate to get a solution.
Thanks upfront!
from balance.
Thanks for the replies!
For the sample code it runs smoothly with no error.
from balance.
Thanks for checking @geniusjenny
Any way you could play around and try to find a way to reproduce the issue?
I suggest you look at the
sample.df.info()
And look at the data types, and maybe the hint could be there.
Once you could find a way to reproduce the issue, I'd be able to work on it.
WDYT?
from balance.
Hi talgalili, I tried to reproduce the issue but couldn't. I tried using two numerical features ['income', 'happiness'] similar with what I have for my dataset, and the code runs smoothly.
I attached the sample data here for you to reproduce the issue. Sorry that I couldn't be more helpful.
Thank you so much.
sample_test2.csv
target_test2.csv
code:
s2= pd.read_csv('sample_test2.csv',index_col=0)
t2= pd.read_csv('target_test2.csv',index_col=0)
sample = Sample.from_frame(s2)
target = Sample.from_frame(t2)
sample_with_target = sample.set_target(target)
adjusted_ads_weight1 = sample_with_target.adjust(method = "rake")
from balance.
Thanks @geniusjenny
Just to double check, could you please paste the full output of you running the above code?
And please also include the output of:
sample.df.info()
target.df.info()
Thanks!
from balance.
from balance.
from balance.
Hi talgalili,
I just tried binning the numerical variables to categorical variables, but still the code returns the same error. While method='cbps' and method = 'ipw' run smoothly.
Here are the code and df.info:
ERROR:
from balance.
Thanks @geniusjenny
Interesting!
Could you please change the object type of the bucketed variables from 'categorical' to 'object'? And let me know if this resolve the error you get?
from balance.
I also tried that. Still getting the same error.
from balance.
I think I may find the issue.
Some of the bin that appears in the sample has never appeared in the target, causing this error.
Once I add the sample to the target, the bug disappear.
I suggest the code take this edge case in consideration as well!
t2=pd.concat([s2,t2])
t2.reset_index(inplace=True)
t2['id']=t2.index.astype('str')
from balance.
Great catch - thanks a bunch @geniusjenny !
O.k., I'll leave this issue open - and we'll get to add a proper exception in the future.
Thanks again.
from balance.
Thank you!
from balance.
Related Issues (20)
- module 'balance.adjustment' has no attribute 'apply_transformations' HOT 8
- Can't use `method = ipw` in Windows HOT 1
- Can't use `method = "cbps"` (windows, Python 3.10) HOT 8
- When using the RStudio IDE to run Python: Seaborn plots not working HOT 6
- [FEATURE] Migrate from glmnet_python to sklearn HOT 2
- [BUG] libgfortran.so.3: cannot open shared object file when running sample_with_target.adjust(max_de=None) HOT 6
- [BUG] HOT 3
- [BUG] plots in quickstart tutorial are beyond the figure margins
- [BUG] simulation data of target is not the same is sample
- [FEATURE] add kl divergence metrics to covars()
- [FEATURE] Make `balance` API closer to the sklearn syntax
- [FEATURE] Chainging the way Sample take strategy for adjust HOT 1
- [FEATURE] Import the Empirical Calibration package to `adjust`
- [FEATURE] Move from patsy to formulaic
- [FEATURE] Update the printout of an adjusted object to include information about the correction used.
- [FEATURE] Update the printout of adjusted.summary() to include aspects of covars, weights and outcome
- [FEATURE] check (raise warning) if features are provided that lead to all equal weights
- Treatment in balance library for sample and target population HOT 3
- [BUG] rake doesn't support trimming - but also doesn't indicate it to the user HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from balance.