Normalize a plink genotype vector.
762163
def _normalize_missing(g):
        """"""
        g = g.astype(float)
        g[g == -1.0] = np.nan
        return g
362627
def normalize(pw):
    
    pw_lower = pw.lower()
    return ''.join(helper.L33T.get(c, c) for c in pw_lower)
1095459
def _refine_v(seq, species):
        '''
        
        '''
        vgerm = germlines.get_germline(seq['v_gene']['full'], species)
        aln = global_alignment(seq['vdj_nt'], vgerm)
        prepend = ''
        for s, g in zip(aln.aligned_query, aln.aligned_target):
            if s != '-':
                break
            else:
                prepend += g
        seq['vdj_nt'] = prepend + seq['vdj_nt']
926545
def normalize(self, axis):
        """"""
        axis = self.get_axis_number(axis)
        sum_along_axis = np.sum(self.histogram, axis=axis)
        # Don't do anything for subspaces without any entries -- this avoids nans everywhere
        sum_along_axis[sum_along_axis == 0] = 1
        hist = self.histogram / sum_along_axis[self._simsalabim_slice(axis)]
        return Histdd.from_histogram(hist,
                                     bin_edges=self.bin_edges,
                                     axis_names=self.axis_names)
1126
def normalize(self):
        
        self.__v = self.__v - np.amin(self.__v)
        self.__v = self.__v / np.amax(self.__v)
1171181
def _normalize_seqs(s, t):
    """"""
    for ids in s:
        obj = s[ids]
        [obj.norm_freq.update({sample: 1.0 * obj.freq[sample] / (t[sample]+1) * 1000000}) for sample in obj.norm_freq]
        s[ids] = obj
    return s
1334124
def normalised(version):
    """"""
    norm_version = pkg_resources.parse_version(version)
    if not isinstance(norm_version, tuple):
        # Let setuptools (>= 8) do the normalisation
        return str(norm_version)
    else:
        # Homegrown normalisation for older setuptools (< 8)
        public, sep, local = version.lower().partition('+')
        # Remove leading 'v' from public version
        if len(public) >= 2:
            if public[0] == 'v' and public[1] in '0123456789':
                public = public[1:]
        # Turn all chars except alphanumerics into periods in local version
        local = NON_ALPHANUMERIC.sub('.', local)
        return public + sep + local
178538
def normalize(x):
    ''''''
    x = x.astype(float)
    x -= x.mean()
    return x / float(x.std())
149479
def standardize_genes(self, inplace=False):
        """"""
        matrix = self.center_genes(inplace=inplace)
        matrix.X[:,:] = matrix.X / \
            np.tile(np.std(matrix.X, axis=1, ddof=1), (matrix.n, 1)).T
        return matrix
1347053
def normalize_bboxes(bboxes, rows, cols):
    """"""
    return [normalize_bbox(bbox, rows, cols) for bbox in bboxes]
1330985
def _normalize(self, addr):
        """"""
        normalize = None
        if isinstance(addr, Address):
            normalize = addr.addr
            self._is_x10 = addr.is_x10

        elif isinstance(addr, bytearray):
            normalize = binascii.unhexlify(binascii.hexlify(addr).decode())

        elif isinstance(addr, bytes):
            normalize = addr

        elif isinstance(addr, str):
            addr = addr.replace('.', '')
            addr = addr[0:6]
            if addr[0:3].lower() == 'x10':
                x10_addr = Address.x10(addr[3:4], int(addr[4:6]))
                normalize = x10_addr.addr
                self._is_x10 = True
            else:
                normalize = binascii.unhexlify(addr.lower())

        elif addr is None:
            normalize = None

        else:
            _LOGGER.warning('Address class init with unknown type %s: %r',
                            type(addr), addr)
        return normalize
936848
def variation(self,parents):
        """"""
        # downselect to features that are important
        if (self.valid(parents) and
            self.ml_type != 'SVC' and self.ml_type != 'SVR'):
            # this is needed because svm has a bug that throws valueerror on
            # attribute check
            if hasattr(self.pipeline.named_steps['ml'],'coef_'):
                # for l1 regularization, filter individuals with 0 coefficients
                if self.weight_parents:
                    weights = self.pipeline.named_steps['ml'].coef_
                    if len(weights.shape)>1: # handle multi-coefficient models
                        weights = [np.mean(abs(c)) for c in weights.transpose()]
                    # softmax transformation of the weights
                    weights = np.exp(weights)/np.sum(np.exp(weights))
                    offspring = copy.deepcopy(
                        list(self.random_state.choice(self.valid(parents),
                                              self.population_size, p=weights)))
                else:
                    offspring = copy.deepcopy(list(
                        x for i,x in zip(self.pipeline.named_steps['ml'].coef_,
                                         self.valid(parents)) if  (i != 0).any()))
            elif hasattr(self.pipeline.named_steps['ml'],'feature_importances_'):
                # for tree methods, filter our individuals with 0 feature importance
                if self.weight_parents:
                    weights = self.pipeline.named_steps['ml'].feature_importances_
                    # softmax transformation of the weights
                    weights = np.exp(weights)/np.sum(np.exp(weights))
                    offspring = copy.deepcopy(list(
                        self.random_state.choice(self.valid(parents),
                                         self.population_size, p=weights)))
                else:
                    offspring = copy.deepcopy(list(
                        x for i,x in zip(self.pipeline.named_steps['ml'].feature_importances_,
                                         self.valid(parents)) if  i != 0))
            else:
                offspring = copy.deepcopy(self.valid(parents))
        else:
            offspring = copy.deepcopy(self.valid(parents))

        if self.elitism: # keep a copy of the elite individual
            elite_index = np.argmin([x.fitness for x in parents])
            elite = copy.deepcopy(parents[elite_index])

        # Apply crossover and mutation on the offspring
        if self.verbosity > 2: print("variation...")
        for child1, child2 in it.zip_longest(offspring[::2], offspring[1::2],
                                             fillvalue=None):

            if self.random_state.rand() < self.crossover_rate and child2 != None:
            # crossover
                self.cross(child1.stack, child2.stack, self.max_depth)
                # update ids
                child1.parentid = [child1.id,child2.id]
                child1.id = uuid.uuid4()
                child2.parentid = [child1.id,child2.id]
                child2.id = uuid.uuid4()
                # set default fitness
                child1.fitness = -1
                child2.fitness = -1
            elif child2 == None:
            # single mutation
                self.mutate(child1.stack,self.func_set,self.term_set)
                # update ids
                child1.parentid = [child1.id]
                child1.id = uuid.uuid4()
                # set default fitness
                child1.fitness = -1
            else:
            #double mutation
                self.mutate(child1.stack,self.func_set,self.term_set)
                self.mutate(child2.stack,self.func_set,self.term_set)
                # update ids
                child1.parentid = [child1.id]
                child1.id = uuid.uuid4()
                child2.parentid = [child2.id]
                child2.id = uuid.uuid4()
                # set default fitness
                child1.fitness = -1
                child2.fitness = -1

        while len(offspring) < self.population_size:
            #make new offspring to replace the invalid ones
            offspring.append(Ind())
            self.make_program(offspring[-1].stack,self.func_set,self.term_set,
                              self.random_state.randint(self.min_depth,
                                                        self.max_depth+1),
                              self.otype)
            offspring[-1].stack = list(reversed(offspring[-1].stack))
        
        return offspring,elite,elite_index
1090128
def _normalize_bbox(self, bbox, size):
        """"""

        bbox_ratio = float(bbox.width) / float(bbox.height)
        size_ratio = float(size[0]) / float(size[1])

        if round(size_ratio, 4) == round(bbox_ratio, 4):
            return bbox
        else:
            if bbox.height * size_ratio >= bbox.width:
                diff = bbox.height*size_ratio - bbox.width
                return BBox((bbox.xmin - diff/2, bbox.ymin, bbox.xmax + diff/2, bbox.ymax), bbox.projection)
            else:
                diff = abs(bbox.width/size_ratio - bbox.height)
                return BBox((bbox.xmin, bbox.ymin - diff/2, bbox.xmax, bbox.ymax + diff/2), bbox.projection)
437110
def normalize(self):
        """"""
        if self.x1 < self.x0:
            self.x0, self.x1 = self.x1, self.x0
        if self.y1 < self.y0:
            self.y0, self.y1 = self.y1, self.y0
        return self
555757
def _normalize_stack(graphobjs):
    """"""
    for operands, operator in graphobjs:
        operator = str(operator)
        if re.match(r'Q*q+$', operator):  # Zero or more Q, one or more q
            for char in operator:  # Split into individual
                yield ([], char)  # Yield individual
        else:
            yield (operands, operator)
1188331
def _normalize(x, cmin=None, cmax=None, clip=True):
    """"""
    if not isinstance(x, np.ndarray):
        x = np.array(x)
    if cmin is None:
        cmin = x.min()
    if cmax is None:
        cmax = x.max()
    if cmin == cmax:
        return .5 * np.ones(x.shape)
    else:
        cmin, cmax = float(cmin), float(cmax)
        y = (x - cmin) * 1. / (cmax - cmin)
        if clip:
            y = np.clip(y, 0., 1.)
        return y
6093
function normalize(pattern) {
        var type = toString.call(pattern);
        switch (type) {
            case '[object String]':
                return _.glob(pattern);
            case '[object RegExp]':
                return pattern;
            default:
                xgulp.log.error('invalid regexp [%s].', pattern);
        }
    }