Ignore:
Timestamp:
05/04/12 11:48:08 (2 years ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
rebase_source:
2c39db625a4a2644ea33dc1856a1a9008cc1553b
Message:

Handle missing classes in Projector.call, and missing feature values in
_ProjectSingleComponent.call

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/projection/linear.py

    r10803 r10863  
    12641264        self.A = numpy.dot(Xd, U.T) 
    12651265 
    1266         class_, classes = dataset.to_numpy("c")[0], dataset.to_numpy("m")[0] 
     1266        class_, classes = dataset.to_numpy_MA("c")[0], dataset.to_numpy_MA("m")[0] 
    12671267        return data.Table(self.output_domain, numpy.hstack((self.A, class_, classes))) 
    12681268 
     
    12741274 
    12751275    def __call__(self, example, return_what): 
    1276         ex = Orange.data.Table([example]).to_numpy("a")[0] 
     1276        if len(self.projector.projection.T) != len(example.domain.features): 
     1277            ex = Orange.data.Table(self.projector.input_domain, [example]) 
     1278        else: 
     1279            ex = Orange.data.Table([example]) 
     1280        ex = ex.to_numpy_MA("a")[0] 
    12771281        ex -= self.projector.center 
    12781282        if self.projector.standardize: 
Note: See TracChangeset for help on using the changeset viewer.