Ignore:
Timestamp:
04/24/12 11:19:31 (2 years ago)
Author:
Miran@…
Branch:
default
Message:

[BUG] Pickling bug, replaced lambda function in evaluation.testing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/evaluation/testing.py

    r10581 r10846  
    8484                                    "actualClass": "actual_class" 
    8585                                    })(TestedExample) 
     86 
     87def mt_vals(vals): 
     88    """ 
     89    Substitution for the unpicklable lambda function for multi-target classifiers. 
     90    """ 
     91    return [int(val) if val.variable.var_type == Orange.feature.Type.Discrete 
     92                                            else float(val) for val in vals] 
    8693 
    8794class ExperimentResults(object): 
     
    181188            elif test_type in (TEST_TYPE_MLC, TEST_TYPE_MULTITARGET): 
    182189                self.labels = [var.name for var in domain.class_vars] 
    183                 self.converter = lambda vals: [int(val) if val.variable.var_type == Orange.feature.Type.Discrete 
    184                                                else float(val) for val in vals] 
     190                self.converter = mt_vals 
     191 
    185192 
    186193        self.__dict__.update(argkw) 
Note: See TracChangeset for help on using the changeset viewer.