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] Preprocess: pickle when saving #2289

Closed
wants to merge 1 commit into from
Closed

[FIX] Preprocess: pickle when saving #2289

wants to merge 1 commit into from

Conversation

jerneju
Copy link
Contributor

@jerneju jerneju commented May 5, 2017

Issue

Preprocess widget is unable to save Randomize, Normalize Features, and Continuize Discrete Variables due to some pickle error.

Steps to reproduce the behavior

Add Randomize or Normalize Features or Continuize Discrete Variables. Change some parameters. Save the workflow and close the application Orange. Then run the app and open the workflow.

Description of changes
Includes
  • Code changes
  • Tests
  • Documentation

@codecov-io
Copy link

codecov-io commented May 5, 2017

Codecov Report

Merging #2289 into master will decrease coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2289      +/-   ##
==========================================
- Coverage   73.29%   73.29%   -0.01%     
==========================================
  Files         317      317              
  Lines       55512    55532      +20     
==========================================
+ Hits        40687    40701      +14     
- Misses      14825    14831       +6

@kernc
Copy link
Contributor

kernc commented May 5, 2017

How can this issue be reproduced?

@jerneju
Copy link
Contributor Author

jerneju commented May 8, 2017

@kernc : Added the steps above.

"Indicators, FirstAsBase, FrequentAsBase,"
"Remove, RemoveMultinomial, ReportError, AsOrdinal,"
"AsNormalizedOrdinal, Leave")
class ContinuizeDV(Enum):
Copy link
Contributor

@kernc kernc May 12, 2017

Choose a reason for hiding this comment

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

Before, you'd get:

>>> from Orange.preprocess import Continuize
>>> preproc = Continuize(multinomial_treatment=Continuize.FrequentAsBase)
>>> preproc
Continuize(multinomial_treatment=Continuize.FrequentAsBase)

With this change, it's:

>>> preproc = Continuize(multinomial_treatment=Continuize.FrequentAsBase)
>>> preproc
Continuize(multinomial_treatment=2)

Is there some way to keep the customized Enum and still pickle numbers?

Or, as an alternative, sklearn uses expressive strings. I wouldn't mind that also.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kernc: I did some changes.

@jerneju jerneju changed the title [WIP][FIX] Preprocess: pickle when saving [FIX] Preprocess: pickle when saving Jun 7, 2017
ReportError = "ReportError"
AsOrdinal = "AsOrdinal"
AsNormalizedOrdinal = "AsNormalizedOrdinal"
Leave = "Leave"
Copy link
Contributor

@kernc kernc Jun 12, 2017

Choose a reason for hiding this comment

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

I don't oppose strings at all. They are simple and robust. Sklearn is all strings in params, and nobody is complaining. But sklearn checks their user input for invalid values. Could we check the passed argument is valid? E.g.:

assert multinomial_treatment in self._MultinomialTreatment

"Indicators, FirstAsBase, FrequentAsBase,"
"Remove, RemoveMultinomial, ReportError, AsOrdinal,"
"AsNormalizedOrdinal, Leave")
class ContinuizeDV(Enum):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can name this MultinomialTreatment is it's an enumeration of such methods?

@lanzagar lanzagar added this to the 3.4.4 milestone Jun 16, 2017
@janezd
Copy link
Contributor

janezd commented Jun 16, 2017

Solved in #2409.

@janezd janezd closed this Jun 16, 2017
@jerneju jerneju deleted the pickle-preprocess branch June 21, 2017 07:20
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.

None yet

5 participants