-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[ENH] Feature Constructor: Evaluate categorical variables to strings #5637
[ENH] Feature Constructor: Evaluate categorical variables to strings #5637
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5637 +/- ##
==========================================
+ Coverage 86.07% 86.11% +0.03%
==========================================
Files 315 315
Lines 66048 66074 +26
==========================================
+ Hits 56854 56901 +47
+ Misses 9194 9173 -21 |
b301dff
to
39dad0f
Compare
39dad0f
to
839e8bb
Compare
@lanzagar, I think you'll like this (if it works :). An "Upgrade Expression" button now removes |
@@ -330,6 +339,111 @@ def data(self, index, role=Qt.DisplayRole): | |||
return super().data(index, role) | |||
|
|||
|
|||
def freevars(exp, env): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function has been moved above the class definition: it is called from migrate_context
, which is called from meta class, which is sets up the class. Function below the class definition are not yet defined at that moment.
a1e5733
to
7aa7570
Compare
if mo.group(3) == ".value": # uses string; remove `.value` | ||
return "".join(mo.group(1, 2, 4)) | ||
# Uses ints: get them by indexing | ||
return "{" + mo.group(1) + \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "{" + mo.group(1) + \ | |
return mo.group(1) + "{" + \ |
7aa7570
to
1f399a7
Compare
Issue
Fixes #5510. That is, not the original issue but @markotoplak's comment that Feature Constructor should be modified to be more user-friendly.
Description of changes
Values of categorical features are now evaluated to strings, not indices.
Indices were not very useful, also because they referred to indices in a list whose order was not necessarily fixed, therefore this was unstable and dangerous. For this reason -- and because this behaviour wasn't documented anyway (see https://orangedatamining.com/widget-catalog/data/featureconstructor/) -- the only effort towards backward compatibility in this PR is to remove
.value
from expressions. Plus, the change is noted in the tooltip and documentation.Includes