Skip to content

Predctions crashes if workflow is open in another language #7015

@janezd

Description

@janezd

What's wrong?

Predictions crashes with

     target = self.class_var.values.index(self.target_class)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: tuple.index(x): x not in tuple

How can we reproduce the problem?

  • Create a workflow that involves predictions. In Show perfomance scores set Target class to "(Average over classes)". Save the workflow.
  • Switch Orange to another language and restart.
  • Load the workflow. Predictions will crash.

The problem is that the "target class" is stored as literal. If Orange is initially in Slovenian, context settings may be as follows:

'values': {
    'show_probability_errors': False,
    'show_reg_errors': 1,
    'shown_probs': 0,
    'target_class': '(Povprečje prek razredov)',
    'score_table': {},
    '__version__': 2},

(Povprečje prek razredov) doesn't exist when Orange is set to English.

Orange workflows should be language independent, hence this setting must be saved as an enum, not a string literal. Settinng migration is feasible assuming that it is done within the same language in which the workflow was created.

Temporary solution

If the user finds himself in this situation, he should switch Show performance scores off and on again. This somehow resolves the state.

What's your environment?

  • Orange 3.38.1
  • macOS Sequoia

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug confirmed by the core teamurgentRequires immediate action

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions