获取对应的weight的列表，从小到大的排序结果
964393
public synchronized List<Long> weights() {
        return Lists.transform(buckets, new Function<WeightBucket<T>, Long>() {

            public Long apply(WeightBucket<T> input) {
                return input.getWeight();
            }
        });
    }
62506
public int getWeight() {
        ProviderStatus status = getStatus();
        if (status == ProviderStatus.WARMING_UP) {
            try {
                // 还处于预热时间中
                Integer warmUpWeight = (Integer) getDynamicAttr(ProviderInfoAttrs.ATTR_WARMUP_WEIGHT);
                if (warmUpWeight != null) {
                    return warmUpWeight;
                }
            } catch (Exception e) {
                return weight;
            }
        }
        return weight;
    }
589336
private int getWeight(Object value) {
    if (value == null) {
      return 0;
    }
    if (value.getClass().isArray()) {
      Class cc = value.getClass().getComponentType();
      if (cc.isPrimitive()) {
        if (cc.equals(int.class)) {
          return ((int[]) value).length * 4;
        } else if (cc.equals(long.class)) {
          return ((long[]) value).length * 8;
        } else if (cc.equals(double.class)) {
          return ((double[]) value).length * 8;
        } else if (cc.equals(float.class)) {
          return ((float[]) value).length * 4;
        } else if (cc.equals(boolean.class)) {
          return ((boolean[]) value).length * 1;
        } else if (cc.equals(byte.class)) {
          return ((byte[]) value).length * 1;
        } else if (cc.equals(short.class)) {
          return ((short[]) value).length * 2;
        } else if (cc.equals(char.class)) {
          return ((char[]) value).length * 2;
        }
      } else if (cc.equals(String.class)) {
        String[] v = (String[]) value;
        int res = 0;
        for (int i = 0; i < v.length; i++) {
          res += v[i].length() * 2 + 40;
        }
        return res;
      } else if (cc.equals(int[].class)) {
        int[][] v = (int[][]) value;
        int res = 0;
        for (int i = 0; i < v.length; i++) {
          res += v[i].length * 4;
        }
        return res;
      } else if (cc.equals(long[].class)) {
        long[][] v = (long[][]) value;
        int res = 0;
        for (int i = 0; i < v.length; i++) {
          res += v[i].length * 8;
        }
        return res;
      } else {
        Object[] v = (Object[]) value;
        int res = 0;
        for (int i = 0; i < v.length; i++) {
          res += getWeight(v[i]);
        }
        return res;
      }
    } else if (value instanceof String) {
      return ((String) value).length() * 2 + 40;
    } else {
      Serializer serializer = configuration.getSerializer(value.getClass());
      if (serializer != null) {
        return serializer.getWeight(value);
      }
    }
    return 16;
  }
1034986
def weight_to_comm(self, v, comm):
    
    return _c_louvain._MutableVertexPartition_weight_to_comm(self._partition, v, comm)
1167267
public static double calculateWeight(Vertex from, Vertex to)
    {
        int frequency = from.getAttribute().totalFrequency;
        if (frequency == 0)
        {
            frequency = 1;  // 防止发生除零错误
        }
//        int nTwoWordsFreq = BiGramDictionary.getBiFrequency(from.word, to.word);
        int nTwoWordsFreq = CoreBiGramTableDictionary.getBiFrequency(from.wordID, to.wordID);
        double value = -Math.log(dSmoothingPara * frequency / (MAX_FREQUENCY) + (1 - dSmoothingPara) * ((1 - dTemp) * nTwoWordsFreq / frequency + dTemp));
        if (value < 0.0)
        {
            value = -value;
        }
//        logger.info(String.format("%5s frequency:%6d, %s nTwoWordsFreq:%3d, weight:%.2f", from.word, frequency, from.word + "@" + to.word, nTwoWordsFreq, value));
        return value;
    }
1212995
@Override
  public double getWeight(double distance, double max, double stddev) {
    if(stddev <= 0) {
      return 1;
    }
    return NormalDistribution.erfc(MathUtil.SQRTHALF * distance / stddev);
  }
731304
private float weight(int c1, int c2) {
		float w;
		float pc1 = wordProb.get(c1);
		float pc2 = wordProb.get(c2);
		if (c1==c2) {
			float pcc = getProb(c1,c1);
			w =  clacW(pcc,pc1,pc2);
		} else {
			float pcc1 = getProb(c1, c2);			
			float p1= clacW(pcc1,pc1,pc2);			

			float pcc2 = getProb(c2, c1);			
			float p2 = clacW(pcc2,pc2,pc1);			
			w =  p1 + p2;
		}
		setweight(c1, c2, w);
		return w;
	}
910678
public function getMeanWeight(): float
    {
        $meanWeight = 0;

        /** @var PackedBox $box */
        foreach ($this->list as $box) {
            $meanWeight += $box->getWeight();
        }

        return $meanWeight / count($this->list);
    }
1260598
private void adjustWeights() {
        for (int l = 1; l < net.length; l++) {
            for (int i = 0; i < net[l].units; i++) {
                for (int j = 0; j <= net[l - 1].units; j++) {
                    double out = net[l - 1].output[j];
                    double err = net[l].error[i];
                    double delta = (1 - alpha) * eta * err * out + alpha * net[l].delta[i][j];
                    net[l].delta[i][j] = delta;
                    net[l].weight[i][j] += delta;
                    if (lambda != 0.0 && j < net[l-1].units) {
                        net[l].weight[i][j] *= (1.0 - eta * lambda);
                    }
                }
            }
        }
    }
775655
function getUnitsPerEm(xMin, xMax, yMin, yMax) {
            var seed = Math.ceil(Math.min(yMax - yMin, xMax - xMin));

            if (!seed) {
                return 1024;
            }

            if (seed <= 128) {
                return seed;
            }

            // 获取合适的unitsPerEm
            var unitsPerEm = 128;
            while (unitsPerEm < 16384) {

                if (seed <= 1.2 * unitsPerEm) {
                    return unitsPerEm;
                }

                unitsPerEm = unitsPerEm << 1;
            }

            return 1024;
        }
152848
def weighted(weights, sample_size, with_replacement=False):
        
        assert sample_size <= len(weights), "The sample size must be smaller \
than or equal to the number of weights it's taken from."

        # Convert weights to floats
        weights = [float(w) for w in weights]
        weight_indexes = list(range(0, len(weights)))

        samples = []
        while len(samples) < sample_size:
            # Choice a weight
            sample = OneOf.weighted(weights)

            # Add the choosen weight to our samples
            samples.append(weight_indexes[sample])

            if not with_replacement:
                # Remove the weight from the list of weights we can select from
                del weights[sample]
                del weight_indexes[sample]

        return samples
541443
@Override
    public double getMean() {
        if (values.length == 0) {
            return 0;
        }

        double sum = 0;
        for (int i = 0; i < values.length; i++) {
            sum += values[i] * normWeights[i];
        }
        return sum;
    }
722333
def compute_weight(self, r, ytr=None, mask=None):
        
        ytr = self._ytr if ytr is None else ytr
        mask = self._mask if mask is None else mask
        return compute_weight(r, ytr, mask)
235041
def weight(w, sparsity):
  """"""
  w_shape = common_layers.shape_list(w)
  k = int(np.prod(w_shape[:-1]))
  count = tf.to_int32(k * sparsity)
  mask = common_layers.weight_targeting(w, count)
  return (1 - mask) * w
1063456
def get_line_weight(value)   # :nodoc:
    value = value.downcase if value.respond_to?(:to_str)
    default = 0

    weights = {
      1          => -1,
      2          => 0,
      3          => 1,
      4          => 2,
      'hairline' => -1,
      'narrow'   => 0,
      'medium'   => 1,
      'wide'     => 2,
    }

    if weights.has_key?(value)
      weights[value]
    else
      default
    end
  end
751549
public static void scale(double[][] x, double lo, double hi) {
        int n = x.length;
        int p = x[0].length;

        double[] min = colMin(x);
        double[] max = colMax(x);

        for (int j = 0; j < p; j++) {
            double scale = max[j] - min[j];
            if (!Math.isZero(scale)) {
                for (int i = 0; i < n; i++) {
                    x[i][j] = (x[i][j] - min[j]) / scale;
                }
            } else {
                for (int i = 0; i < n; i++) {
                    x[i][j] = 0.5;
                }
            }
        }
    }
944524
public void scaleWeights(double scale) {
    for (int i = 0; i < weights.length; i++) {
      for (int j = 0; j < weights[i].length; j++) {
        weights[i][j] *= scale;
      }
    }
  }