Ejemplo n.º 1
0
    def preprocess_data(self, x, y=None, **kwargs):
        '''Prepare the data for the neural network.

            - Remove 0's from the time channels
            - Center the data on 0
            - Scale it to have lie on the interval [-1, 1]'''
        preprocessing.fix_time_zeros(x)
        means = preprocessing.center(x)
        min_, max_, = -1, 1
        mins, maxes = preprocessing.scale_min_max(x, min_, max_)
        if 'channel' in kwargs:
            channel = kwargs['channel']
        else:
            channel = None
        preprocessing.standardize_cylinder_rotation(x, channel)
        def repeat_transformation(other):
            if len(other) == 0:
                return
            else:
                preprocessing.fix_time_zeros(other)
                other -= means
                other -= mins
                other /= maxes - mins
                other *= max_ - min_
                other += min_
                preprocessing.standardize_cylinder_rotation(other, channel)
        return repeat_transformation
Ejemplo n.º 2
0
    def preprocess_data(self, x, y=None, **kwargs):
        '''Prepare the data for the neural network.

            - Remove 0's from the time channels
            - Center the data on 0
            - Scale it to have lie on the interval [-1, 1]'''
        preprocessing.fix_time_zeros(x)
        means = preprocessing.center(x)
        min_, max_, = -1, 1
        mins, maxes = preprocessing.scale_min_max(x, min_, max_)
        if 'channel' in kwargs:
            channel = kwargs['channel']
        else:
            channel = None
        preprocessing.standardize_cylinder_rotation(x, channel)

        def repeat_transformation(other):
            if len(other) == 0:
                return
            else:
                preprocessing.fix_time_zeros(other)
                other -= means
                other -= mins
                other /= maxes - mins
                other *= max_ - min_
                other += min_
                preprocessing.standardize_cylinder_rotation(other, channel)

        return repeat_transformation
Ejemplo n.º 3
0
 def repeat_transformation(other):
     if len(other) == 0:
         return
     else:
         preprocessing.fix_time_zeros(other)
         other -= means
         other /= stds/std
Ejemplo n.º 4
0
 def repeat_transformation(other):
     if len(other) == 0:
         return
     else:
         preprocessing.fix_time_zeros(other)
         other -= means
         other /= stds / std
Ejemplo n.º 5
0
 def repeat_transformation(other):
     if len(other) == 0:
         return
     else:
         if not getattr(self, 'only_charge', False):
             preprocessing.fix_time_zeros(other)
         other -= means
         other /= stds / std
Ejemplo n.º 6
0
 def repeat_transformation(other):
     if len(other) == 0:
         return
     else:
         if not getattr(self, 'only_charge', False):
             preprocessing.fix_time_zeros(other)
         other -= means
         other /= stds/std
Ejemplo n.º 7
0
 def repeat_transformation(other):
     if len(other) == 0:
         return
     else:
         preprocessing.fix_time_zeros(other)
         other -= means
         other -= mins
         other /= maxes - mins
         other *= max_ - min_
         other += min_
Ejemplo n.º 8
0
 def repeat_transformation(other):
     if len(other) == 0:
         return
     else:
         preprocessing.fix_time_zeros(other)
         other -= means
         other -= mins
         other /= maxes - mins
         other *= max_ - min_
         other += min_
Ejemplo n.º 9
0
 def repeat_transformation(other):
     if len(other) == 0:
         return
     else:
         preprocessing.fix_time_zeros(other)
         other -= means
         other -= mins
         other /= maxes - mins
         other *= max_ - min_
         other += min_
         preprocessing.standardize_cylinder_rotation(other, channel)
Ejemplo n.º 10
0
 def repeat_transformation(other):
     if len(other) == 0:
         return
     else:
         preprocessing.fix_time_zeros(other)
         other -= means
         other -= mins
         other /= maxes - mins
         other *= max_ - min_
         other += min_
         preprocessing.standardize_cylinder_rotation(other, channel)
Ejemplo n.º 11
0
    def preprocess_data(self, x, y=None):
        '''Prepare the data for the neural network.

            - Remove 0's from the time channels
            - Center the data on 0
            - Scale it to have a standard deviation of 1'''
        std = 1
        preprocessing.fix_time_zeros(x)
        means = preprocessing.center(x)
        stds = preprocessing.scale(x, std, mode='standardize')
        def repeat_transformation(other):
            if len(other) == 0:
                return
            else:
                preprocessing.fix_time_zeros(other)
                other -= means
                other /= stds/std
        return repeat_transformation
Ejemplo n.º 12
0
    def preprocess_data(self, x, y=None):
        '''Prepare the data for the neural network.

            - Remove 0's from the time channels
            - Center the data on 0
            - Scale it to have a standard deviation of 1'''
        std = 1
        preprocessing.fix_time_zeros(x)
        means = preprocessing.center(x)
        stds = preprocessing.scale(x, std, mode='standardize')

        def repeat_transformation(other):
            if len(other) == 0:
                return
            else:
                preprocessing.fix_time_zeros(other)
                other -= means
                other /= stds / std

        return repeat_transformation
Ejemplo n.º 13
0
    def preprocess_data(self, x, y=None):
        '''Prepare the data for the neural network.

            - Remove 0's from the time channels
            - Center the data on 0
            - Scale it to have lie on the interval [-1, 1]'''
        preprocessing.fix_time_zeros(x)
        means = preprocessing.center(x)
        min_, max_, = -1, 1
        mins, maxes = preprocessing.scale_min_max(x, min_, max_)
        def repeat_transformation(other):
            if len(other) == 0:
                return
            else:
                preprocessing.fix_time_zeros(other)
                other -= means
                other -= mins
                other /= maxes - mins
                other *= max_ - min_
                other += min_
        return repeat_transformation
Ejemplo n.º 14
0
    def preprocess_data(self, x, y=None):
        '''Prepare the data for the neural network.

            - Remove 0's from the time channels
            - Center the data on 0
            - Scale it to have lie on the interval [-1, 1]'''
        preprocessing.fix_time_zeros(x)
        means = preprocessing.center(x)
        min_, max_, = -1, 1
        mins, maxes = preprocessing.scale_min_max(x, min_, max_)

        def repeat_transformation(other):
            if len(other) == 0:
                return
            else:
                preprocessing.fix_time_zeros(other)
                other -= means
                other -= mins
                other /= maxes - mins
                other *= max_ - min_
                other += min_

        return repeat_transformation