Standardize the variables within a range [-1.0 and 1.0]

        This replaces the local copies of this data. When it's time to
        scale back, use destandardize from the datasource for that.
172571
def standardize(self):
        


        nonmissing = numpy.invert(self.missing)
        nmcount = numpy.sum(nonmissing)

        self.covariates = []
        self.phenotypes = []

        for idx in range(0, self.covar_count):
            x = self.datasource.covariate_data[idx]
            nonmissing = x != PhenoCovar.missing_encoding
            mx = numpy.mean(x[nonmissing])
            sx = numpy.std(x[nonmissing])
            self.covariates.append((x-mx)/sx)

        for idx in range(0, self.pheno_count):
            y = self.datasource.phenotype_data[idx]
            nonmissing = y != PhenoCovar.missing_encoding
            my = numpy.mean(y[nonmissing])
            sy = numpy.std(y[nonmissing])
            self.phenotypes.append((y-my)/sy)
990198
def normalize(self):
        
        if self.should_collapse(): return self.collapse()
        elif self.number_of_values == 1: return list(self._si_set)[0]
        else:
            for si in self._si_set:
                self._update_bits(si)
            return self
402561
def delete_local_variable(self, onnx_name):
        '''
        
        '''
        if onnx_name not in self.onnx_variable_names or onnx_name not in self.variables:
            raise RuntimeError('The variable to be removed not found')
        self.onnx_variable_names.discard(onnx_name)
        raw_name = self.variables[onnx_name].raw_name
        self.variable_name_mapping[raw_name].remove(onnx_name)
        del self.variables[onnx_name]
1156507
def scale(input_value, input_min, input_max, out_min, out_max):
    
    # Figure out how 'wide' each range is
    input_span = input_max - input_min
    output_span = out_max - out_min
    # Convert the left range into a 0-1 range (float)
    valuescaled = float(input_value - input_min) / float(input_span)
    # Convert the 0-1 range into a value in the right range.
    return out_min + (valuescaled * output_span)
43660
public static void normalize(double[] a) {
    double total = sum(a);
    if (total == 0.0 || Double.isNaN(total)) {
      throw new RuntimeException("Can't normalize an array with sum 0.0 or NaN: " + Arrays.toString(a));
    }
    multiplyInPlace(a, 1.0/total); // divide each value by total
  }
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
20645
def handle_zeros_in_scale(scale, copy=True):
    ''' '''

    # if we are fitting on 1D arrays, scale might be a scalar
    if np.isscalar(scale):
        if scale == .0:
            scale = 1.
        return scale
    elif isinstance(scale, np.ndarray):
        if copy:
            # New array to avoid side-effects
            scale = scale.copy()
        scale[scale == 0.0] = 1.0
    return scale
955597
public void normalize() {
		if (llx > urx) {
			float a = llx;
			llx = urx;
			urx = a;
		}
		if (lly > ury) {
			float a = lly;
			lly = ury;
			ury = a;
		}
	}
220423
def _normalize_info(dev):
    '''
    
    '''
    for sect, val in dev.items():
        if len(val) == 1:
            dev[sect] = val[0]

    return dev
623939
public void normalize() {
        for (T key : keySet()) {
            setCount(key, getCount(key) / totalCount.get());
        }

        rebuildTotals();
    }
846434
function StandardScalerTransforms(vector = [], nan_value = -1, return_nan=false) {
  const average = avg(vector);
  const standard_dev = sd(vector);
  const maximum = max(vector);
  const minimum = min(vector);
  const scale = (z) => {
    const scaledValue = (z - average) / standard_dev;
    if (isNaN(scaledValue) && return_nan) return scaledValue;
    else if (isNaN(scaledValue) && return_nan === false) return (isNaN(standard_dev)) ? z : standard_dev;
    else return scaledValue;
  }; // equivalent to MinMaxScaler(z)
  const descale = (scaledZ) => {
    const descaledValue = (scaledZ * standard_dev) + average;
    if (isNaN(descaledValue) && return_nan) return descaledValue;
    else if (isNaN(descaledValue) && return_nan === false) return (isNaN(standard_dev)) ? scaledZ : standard_dev;
    else return descaledValue;
  };
  const values = vector.map(scale)
    .map(val => {
      if (isNaN(val)) return nan_value;
      else return val;
    });
  return {
    components: {
      average,
      standard_dev,
      maximum,
      minimum,
    },
    scale,
    descale,
    values,
  };
}
316427
function normaliseScale(s) {
  if (s>1) throw('s must be <1');
  s = 0 | (1/s);
  var l = log2(s);
  var mask = 1 << l;
  var accuracy = 4;
  while(accuracy && l) { l--; mask |= 1<<l; accuracy--; }
  return 1 / ( s & mask );
}
197081
def scale(val, src, dst):
    
    if val < src[0]:
        return dst[0]
    if val > src[1]:
        return dst[1]

    return ((val - src[0]) / (src[1] - src[0])) * (dst[1] - dst[0]) + dst[0]
744025
def postpro_standardize(data, report=None):
    
    if not report:
        report = {}
    # First make dim 1 = time.
    data = np.transpose(data, [2, 0, 1])
    standardized_data = (data - data.mean(axis=0)) / data.std(axis=0)
    standardized_data = np.transpose(standardized_data, [1, 2, 0])
    report['standardize'] = {}
    report['standardize']['performed'] = 'yes'
    report['standardize']['method'] = 'Z-score'
    # The above makes self connections to nan, set to 1.
    data = set_diagonal(data, 1)
    return standardized_data, report
410631
def _rescale(ar):
    """"""
    max = np.nanmax(ar)
    min = np.nanmin(ar)
    midpoint = (max + min) / 2.0
    return 2.0 * (ar - midpoint) / (max - min)
1121791
def standardize_cell_val v
      v = ((float = Float(v)) && (float % 1.0 == 0) ? float.to_i : float) rescue v
      v = v.force_encoding("UTF-8") if v.is_a?(String)
      v
    end
138937
def normalize(v):
    ''''''
    if 0 == np.linalg.norm(v):
        return v
    return v / np.linalg.norm(v)