예제 #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
예제 #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
예제 #3
0
 def repeat_transformation(other):
     if len(other) == 0:
         return
     else:
         preprocessing.fix_time_zeros(other)
         other -= means
         other /= stds/std
예제 #4
0
 def repeat_transformation(other):
     if len(other) == 0:
         return
     else:
         preprocessing.fix_time_zeros(other)
         other -= means
         other /= stds / std
예제 #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
예제 #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
예제 #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_
예제 #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_
예제 #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)
예제 #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)
예제 #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
예제 #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
예제 #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
예제 #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