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

Fix boolean slot featurization #6601

Merged
merged 16 commits into from
Sep 14, 2020
Merged

Fix boolean slot featurization #6601

merged 16 commits into from
Sep 14, 2020

Conversation

JEM-Mosig
Copy link

@JEM-Mosig JEM-Mosig commented Sep 8, 2020

Proposed changes:

  • Fixes boolean featurization bug, as reported here

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@JEM-Mosig JEM-Mosig requested a review from tmbo September 8, 2020 10:21
Copy link
Member

@tmbo tmbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch! let's add some tests to prevent this in the future

("9", [1, 1]),
(12, [1, 1]),
("9", [1, 0]),
(12, [1, 0]),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmbo I don't know why this was supposed to be 1.

@JEM-Mosig JEM-Mosig requested a review from tmbo September 9, 2020 09:49
@JEM-Mosig JEM-Mosig self-assigned this Sep 9, 2020
Copy link
Member

@tmbo tmbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good 👍 can you please add tests for the two exceptions?

@JEM-Mosig JEM-Mosig marked this pull request as ready for review September 11, 2020 09:12
@JEM-Mosig
Copy link
Author

Ups... I clicked on "ready to review" and assumed that would tag @tmbo , but it added half a dozen people! Sorry 😬

Copy link
Contributor

@wochinge wochinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is fine for rasa.shared (it still needs a proper review)

Comment on lines 1 to 2
Fixed a bug in the featurization of the boolean slot type. Previously, to set a slot value to "true",
you had to set it to "1", which is in conflict with the documentation.
Copy link
Contributor

@erohmensing erohmensing Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You didn't have to set it to "1", just to true (no quotes)

- slot{"my_bool_slot": true}

Copy link
Author

@JEM-Mosig JEM-Mosig Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but that's still confusing users. I'll change the doc string.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I make this an improvement then, instead of a bug fix? Also, I am not sure about the float(x) == 1.0. Perhaps it'd be better to have float(x) != 0.0 as before, though that's a bit odd I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I totally agree that this is a good improvement! (or bugfix if you expected "true" to work). Just wanted to point out that saying you had to set it to 1 would probably confuse a lot of people whose bots were working as expected before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erohmensing just FYI that while just true might work for training time, I think there might be an issue with the JSON validation schema since I got this error message when changing stories to use just true.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this error.

@@ -36,7 +36,7 @@ mapping:
- type: "map"
mapping:
regex;(.*):
type: "text"
type: "any"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erohmensing This fixes the yaml problem and true without quotes works again. But I have no idea if this is the proper way of doing this.

@JEM-Mosig JEM-Mosig merged commit d978bc1 into master Sep 14, 2020
@JEM-Mosig JEM-Mosig deleted the fix-boolean-slots branch September 14, 2020 16:25
@degiz
Copy link
Contributor

degiz commented Sep 16, 2020

@JEM-Mosig
I've noticed this change. Is there a reason for the type to be that generic? If there's a problem parsing boolean, then we can use the bool type instead, otherwise the schema validation is not that effective :(

@JEM-Mosig
Copy link
Author

JEM-Mosig commented Sep 18, 2020

@JEM-Mosig
I've noticed this change. Is there a reason for the type to be that generic? If there's a problem parsing boolean, then we can use the bool type instead, otherwise the schema validation is not that effective :(

@degiz I wasn't sure about this change. Strings and booleans should definitely be allowed. Also lists, since we have a list-type slot. And since you can define your own slot type, really anything should be allowed I guess...

@degiz
Copy link
Contributor

degiz commented Sep 22, 2020

I'd rather allow bool, text, and list separately, and extend it on-the-go, as required. I have some high hopes that the detailed schema will help first adapters of 2.0 find error faster 😬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants