Rescales factors across modes so that all norms match.
17701
def rebalance(self):
        

        # Compute norms along columns for each factor matrix
        norms = [sci.linalg.norm(f, axis=0) for f in self.factors]

        # Multiply norms across all modes
        lam = sci.multiply.reduce(norms) ** (1/self.ndim)

        # Update factors
        self.factors = [f * (lam / fn) for f, fn in zip(self.factors, norms)]
        return self
771415
def normalize(self, mag=1.):
        

        def f(dataset, s, null, mag):
            dataset[s] -= null
            dataset[s] /= mag

        if self.signed:
            mag = self.mag() / mag
        else:
            mag = self.max() / mag
        self.chunkwise(f, null=self.null, mag=mag)
        self._null = 0
1305577
def standardize(self):
        

        if self.preprocessed_data.empty:
            data = self.original_data
        else:
            data = self.preprocessed_data
        
        scaler = preprocessing.StandardScaler()
        data = pd.DataFrame(scaler.fit_transform(data), columns=data.columns, index=data.index)
        self.preprocessed_data = data
1345080
def _scale(self, factor):
        
        factor = factor[0]
        for k, v in self.items():
            v *= factor
            self[k] = v
427828
def re_normalize_flux(self, kwargs_ps, norm_factor):
        
        for i, model in enumerate(self.point_source_type_list):
            if model == 'UNLENSED':
                kwargs_ps[i]['point_amp'] *= norm_factor
            elif model in ['LENSED_POSITION', 'SOURCE_POSITION']:
                if self._fixed_magnification_list[i] is True:
                    kwargs_ps[i]['source_amp'] *= norm_factor
                else:
                    kwargs_ps[i]['point_amp'] *= norm_factor
        return kwargs_ps
1008582
void normalizeY(double yMax, int normMax) {
		exploded.forEach(y -> {
			int norm = (int) Math.round((y / yMax) * normMax);
			normalized.add(norm);
		});
	}
850490
def Scale(self, factor):
        
        new = self.Copy()
        new.xs = [x * factor for x in self.xs]
        return new
1069159
def standardize(self):
        
        self.covariates = self.datasource.covariate_data
        self.phenotypes = self.datasource.phenotype_data
80567
def normalize_pts(pts, ymax, scaler=2):
    
    return [(x * scaler, ymax - (y * scaler)) for x, y in pts]
812207
def matches_factor_conditions(s, env):
    """""""
    env_labels = set(env.name.split('-'))
    labels = set(bash_expand(s))
    return bool(labels & env_labels)
1153559
def standardize(score):
    """"""
    score = asarray_ndim(score, 1)
    return (score - np.nanmean(score)) / np.nanstd(score)
773349
def factor_coeff(cls, ops, kwargs):
    """"""
    coeffs, nops = zip(*map(_coeff_term, ops))
    coeff = 1
    for c in coeffs:
        coeff *= c
    if coeff == 1:
        return nops, coeffs
    else:
        return coeff * cls.create(*nops, **kwargs)
321938
def scale_to_vol(self, vol):
        """"""

        f = np.exp((np.log(vol) - np.log(self.vol)) / self.n)  # linear factor
        self.expand *= f
        self.cov *= f**2
        self.am *= f**-2
        self.axlens *= f
        self.axes *= f
        self.vol = vol
690649
def scale(p, factor, o=(0, 0)):
    
    v = vector(o, p)
    sv = v[0] * factor, v[1] * factor
    return translate(sv, o)
999762
def rescale_by(self, scale_x, scale_y, detail):
        
        self.rescale_by_factors((scale_x, scale_y), detail)
254907
def _scaled_bqm(bqm, scalar, bias_range, quadratic_range,
                ignored_variables, ignored_interactions,
                ignore_offset):
    """"""

    bqm_copy = bqm.copy()
    if scalar is None:
        scalar = _calc_norm_coeff(bqm_copy.linear, bqm_copy.quadratic,
                                  bias_range, quadratic_range,
                                  ignored_variables, ignored_interactions)

    bqm_copy.scale(scalar, ignored_variables=ignored_variables,
                   ignored_interactions=ignored_interactions,
                   ignore_offset=ignore_offset)
    bqm_copy.info.update({'scalar': scalar})
    return bqm_copy
1285508
def _rescale(self, points):
        """"""
        return [(
            x, self._scale_diff + (y - self._scale_min_2nd) * self._scale
            if y is not None else None
        ) for x, y in points]