sergioburdisso / pyss3

A Python package implementing a new interpretable machine learning model for text classification (with visualization tools for Explainable AI :octocat:)
https://pyss3.readthedocs.io
MIT License
336 stars 44 forks source link

Initialization of sanction function #11

Closed angrymeir closed 4 years ago

angrymeir commented 4 years ago

Hey @sergioburdisso,

as far as I understand the SS3 framework, there is an inconsistency between the initialization of SS3 and its documentation. The initialization describes the parameter _snm as method used to compute the sanction (sn) function [...]

However in the actual initialization the only function that changes based on the _snm parameter is the significance function (see here).

I would be great if you could have a look at it and tell me whether I'm wrong? 😄

Best, Florian

sergioburdisso commented 4 years ago

This gif perfectly describes how I feel right now:

I don't know what I was thinking when I wrote that part of the code, maybe I was hungry and was thinking about eating some pizza (?) :facepalm: lol.

Anyway, thanks for reporting this, I should update the documentation and replace "sanction" with "significance", and "sn_m" with "sg_m" (Note: if you have already done it yourself, do not hesitate to create a new Pull Request, it will be appreciated and received with love :heart: :octocat:).

angrymeir commented 4 years ago

Ah nice 😄 I implemented the changes, however the tests for the latest commit fail for me at Job 1.2 and Job 1.4.

Are you sure this test is implemented correctly? To me it seems odd, that there is no path given... Could you please help me to understand the problem here?

Btw: Is there a reason that only Job 1.2 and Job 1.4 perform server testing?

sergioburdisso commented 4 years ago

That is really really super duper weird 😮, why failing with Python 3.5 and 3.7, and not 3.6? that is super weird 🤔.

Are you sure this test is implemented correctly? To me it seems odd, that there is no path given...

The path should be given by the mockers argument: https://github.com/sergioburdisso/pyss3/blob/bc8ec0a46168a5a329969db1ca1e6d89734e2efd/tests/test_server.py#L215 Which is defined here: https://github.com/sergioburdisso/pyss3/blob/bc8ec0a46168a5a329969db1ca1e6d89734e2efd/tests/test_server.py#L57-L65 The last two lines above (line 64 and 65) return a mocked version of the "parse_args" which is defined here: https://github.com/sergioburdisso/pyss3/blob/bc8ec0a46168a5a329969db1ca1e6d89734e2efd/tests/test_server.py#L46-L54 There, in line 51, the path is being set (path = dataset_path). That's the way the path should be given, which explains why it worked for all the other jobs... but why not for those Job 1.2 and Job 1.4? mmm... what I can tell by the error log, somehow the path is (or has become) None there, would it be caused by the previous "ValueError: the default category must be 'most-probable', 'unknown', or a category name (current value is 'xxxxx')" error? I don't know, in which case I would try removing or commenting out this line: https://github.com/sergioburdisso/pyss3/blob/bc8ec0a46168a5a329969db1ca1e6d89734e2efd/tests/test_server.py#L155

But, as I said, it is weird, the server test is not "straightforward" because it has to use threads to run the server multiple times with different arguments sending (handcrafted) HTTP requests from the main test thread to those "server threads", could it be something related to the overlapping of those asynchronous tests, somehow? Anyhow, feel free to perform the Pull Request, we will merge it and then try to locally replicate the error to trace back where this error is originating. Don't worry, before releasing a new version with these patches, we will fix these test errors, what do you think?

angrymeir commented 4 years ago

Ah okay now I understand where it gets its arguments from.

I just ran the tests on a plain 18.04 Ubuntu VM and all of them passed... However ValueError: the default category must be 'most-probable', 'unknown', or a category name (current value is 'xxxxx'). still occurs - guess this doesn't have an impact on our failing tests. Maybe it's due to the fact, that the Buildagents still use Ubuntu 16.04?

Then lets do the merge and figure out the problem after that :)

sergioburdisso commented 4 years ago

Perfect! Thanks for your contribution!!!

I've merged the changes and updated the Contributions section to add "code" to your contribution types :+1:. Now I'll try to locally replicate the error before releasing the new version containing your patch. :crossed_fingers: :crossed_fingers: :crossed_fingers:

(I've just sent you an invitation to be added as a contributor, so you can get direct access to this repository from now on :sunglasses: )

angrymeir commented 4 years ago

Nice! \o/ Let me know if you find anything - I'll also have a look into it again later 🔍