Changeset 11633:64a2f4b224ea in orange


Ignore:
Timestamp:
07/16/13 10:54:51 (9 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Fixed 'ScaleLinProjData.create_projection_as_numeric_array' (again).

Two calls to jitter_array with the same seed resulted in jittering
applied only to the y=x direction.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/data/preprocess/scaling.py

    r11632 r11633  
    555555 
    556556 
    557 def jitter_array(array, ratio=0.01, axis=0, rand_seed=0): 
     557def jitter_array(array, ratio=0.01, axis=0, rand_seed=None): 
    558558    """ 
    559559    """ 
     
    858858 
    859859        if jitter_size > 0.0: 
    860             x_positions = jitter_array(x_positions, jitter_size / 100., 
    861                                        rand_seed=self.jitter_seed) 
    862             y_positions = jitter_array(y_positions, jitter_size / 100., 
    863                                        rand_seed=self.jitter_seed) 
     860            positions = numpy.vstack((x_positions, y_positions)) 
     861            positions = jitter_array(positions, jitter_size / 100., axis=1, 
     862                                     rand_seed=self.jitter_seed) 
     863            x_positions, y_positions = numpy.vsplit(positions, 2) 
     864            x_positions = x_positions.ravel() 
     865            y_positions = y_positions.ravel() 
    864866 
    865867        self.last_attr_indices = attr_indices 
Note: See TracChangeset for help on using the changeset viewer.