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
error in method _scores_to_accuracy() of Matcher.py #23
Comments
I found the same problem! I fixed it with |
The solution by @caixiaocherry worked for me, but @xiaolinzhuo 's didn't. |
@caixiaocherry 's solution worked for me. This was with these versions:
@caixiaocherry it may be worth making a PR given multiple people had this issue? |
Actually on additional inspection, this seems similar to |
Hey everyone, I am quite new to python and am having this issue as well. Can anyone tell me how to make the changes that @caixiaocherry suggested? I tried to google it but to no avail. Thanks a lot! |
@diogoalvesderesende , you only need to comment out the following return statement: This shall solve the problem. |
@caixiaocherry 's solution did not for me, it returned error |
U sure u wrote the correct function name? It should be to_numpy not
to_numipy.
On Sat, May 16, 2020 at 3:38 PM w2998 ***@***.***> wrote:
@caixiaocherry <https://github.com/caixiaocherry> 's solution did not for
me, it returned error Fitting Models on Balanced Samples: 1\100Error:
'DataFrame' object has no attribute 'to_numipy' While. @xiaolinzhuo
<https://github.com/xiaolinzhuo> 's solution works, but the average
accuracy seems wrong, it returned value, which was greater than 1. I was
using lending club's data as this article
***@***.***/introducing-the-pymatch-package-6a8c020e2009
.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#23 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIG56LA2LKGIIGY4NXGA6ZDRR4IXLANCNFSM4I45MO3Q>
.
--
Xiao Cai
*Data Science Team | 502.296.7789 (c) | 425.298.6877 (o) | xiao@astrumu.com
<xiao@astrumu.com>*
*AstrumU*
|
Oh, yes. that was a typo. Now, it works, and results make sense. |
I tried both This is the error I'm receiving: Average Accuracy: nan% |
Could you print out y and preds to check the shape? It seems the broadcast failed. |
this worked for me fine, thanks |
@caixiaocherry 's solution works like a charm. Thanks! |
Fixed the error from this issue benmiroglio#23.
I am facing the same issue. Can anyone please explain how to change in the source code? |
@RishabhArora90 , i think this bug had been patched, so you might only need to re install the package? |
Edited based on the issue: benmiroglio#23
Hello, I am currently having this issue although I have added @caixiaocherry solution to the source code:
Am I missing something? Do I need to downgrade Thanks |
I made the recommended change but now I am getting an accuracy of 219400.0%. The error was stated as 'Static column dropped: resultError: Perfect separation detected, results not available. |
It worked for me. I have installed the package today |
I installed pymatch and I also getting this error. I understand that I need to change the pymatch code. I downloaded the package using pip install pymatch. Could someone point me a tutorial to help me change the code and use this function ? Thank you very much |
Go on return (y == preds).sum() * 1.0 / len(y) PS: I think linux are the same .../Python36/Lib/site-packages/pymatch |
I am encountering this error in April 2022, but I can see that @staticmethod
def _scores_to_accuracy(m, X, y):
preds = [[1.0 if i >= .5 else 0.0 for i in m.predict(X)]]
return (y.to_numpy().T == preds).sum() * 1.0 / len(y) Is there another solution to this bug? |
@kelleyjbrady same error here - also in April 2022 🤷🏽♂️ |
@kelleyjbrady and @philffm follow my tutorial above, it will solve your problem I am sure. master/build/lib/pymatch/Matcher.py But when you install it with PIP, then you will get from the build folder. |
Thanks @CarlosDullius I will check it out. I ended up using a propensity matching package that is being presented in July at EMBC 2022, the author has written a blog post on Medium and uploaded to PyPi, but the author (@adriennekline) hasn’t updated the github page yet. I think anyone who has followed this thread all the way down here will be able to figure out how to use the package despite current lack of extensive documentation (the PyPi page has a 'quick start'). It was pretty easy to get it up and running on a simple age+sex match I was working on. @philffm may be interested. |
|
Has anyone updated the code in the package? or has anyone created a clone with corrected code? I am not sure if I am able to correct the code at my end. Because now I am getting the following error 'bool' object has no attribute 'sum' |
Got error when i tried to run the example at:
m.fit_scores(balance=True, nmodels=10)
When the function calls the static method _scores_to_accuracy(), got error of mis matching size.
In this function, y is a DataFrame with shape as (n, 1), while preds is a list. I fixed the code by convert preds to a matrix
The code above works for me.
The text was updated successfully, but these errors were encountered: