Log statistics on the variance sum.

@param varstat Statistics log instance
@param varsum Variance sum per cluster
552974
protected void logVarstat(DoubleStatistic varstat, double[] varsum) {
    if(varstat != null) {
      double s = sum(varsum);
      getLogger().statistics(varstat.setDouble(s));
    }
  }
923405
public void updateStats(int fIdx, long count) {
        synchronized (pq) {
            frmtCount[fIdx] += count;
            Stats tmp = new Stats(fIdx, frmtCount[fIdx]);
            // remove the stats object with the same fIdx
            pq.remove(tmp);
            pq.offer(tmp);
        }
        if (LOG.isTraceEnabled()) {
            LOG.trace("update forest " + fIdx);
        }
    }
1275176
public void tryAddLogToBatch(TelemetryData log)
  {
    try
    {
      addLogToBatch(log);
    }
    catch (IOException ex)
    {
      logger.debug("Exception encountered while sending metrics to telemetry endpoint.", ex);
    }
  }
1277836
@Override
   @ManagedOperation(description = "Resets statistics gathered by this component", displayName = "Reset statistics")
   public void resetStatistics() {
      replicationCount.set(0);
      replicationFailures.set(0);
      totalReplicationTime.set(0);
      syncXSiteReplicationTime = new DefaultSimpleStat();
      asyncXSiteCounter.reset();
   }
1271091
private void doLog(long lastRun, long finalMoment)
    {
        double[] percentilenames = m_percentiles;

        //
        //  Do logging, if requested.
        //
        if( m_mode == Mode.LOG_ONLY || m_mode == Mode.ALL )
        {
            if( m_log != null && m_log.isInfoEnabled() )
            {
                StringBuilder percString = new StringBuilder();
                for( int i = 0; i < percentilenames.length; i++ )
                {
                    percString.append( String.format( " %6sth", saneDoubleToString(percentilenames[i]) ) );
                }
                
                printf("Statistics from %tc to %tc", new Date(lastRun), new Date(finalMoment));

                printf("%-"+m_tagWidth+"s %8s %8s %8s %8s%s%8s","Tag","Avg(ms)","Min","Max","Std Dev",percString,"Count");

                for( Map.Entry<String,CollectedStatistics> e : m_stats.entrySet() )
                {
                    CollectedStatistics cs = e.getValue();
                    StringBuilder sb = new StringBuilder();
                    
                    sb.append(String.format("%-"+m_tagWidth+"s %8.2f %8.2f %8.2f %8.2f", e.getKey(),cs.getAverageMS(), cs.getMin(), cs.getMax(), cs.getStdDev()));
                    for( int i = 0; i < percentilenames.length; i++ )
                        sb.append( String.format(" %8.2f", cs.getPercentile( percentilenames[i] )) );
                    
                    sb.append( String.format("%8d", cs.getInvocations()) );
                    m_log.info( sb.toString() );
                    
                    //
                    //  Only collect threshold information when the slow logging
                    //  is on.  Otherwise the array grows without bounds.
                    //
                    if( m_slowLogOn && m_slowLog != null )
                    {
                        long threshold = (long)(cs.getPercentile(m_slowLogPercentile)*1000);
                        m_slowThresholdMicros.put( e.getKey(), threshold );
                    }
                }
                
                m_log.info( "" );
            }
        }

        //
        //  Store these to the JMX attribute list
        //

        if( m_mode == Mode.JMX_ONLY || m_mode == Mode.ALL )
        {
            if( m_jmxAttributes != null )
            {
                m_jmxStatistics = new ConcurrentHashMap<String, PeriodicalLog.JmxStatistics>();

                for( String name : m_jmxAttributes )
                {
                    String n = name.trim();
                    CollectedStatistics cs = m_stats.get(n);

                    if ( cs == null )
                        continue;

                    JmxStatistics js = new JmxStatistics();
                    js.count = cs.getInvocations();
                    js.max = cs.getMax();
                    js.min = cs.getMin();
                    js.mean = cs.getAverageMS();
                    js.percentiles = new double[percentilenames.length];
                    
                    for( int i = 0; i < percentilenames.length; i++ )
                        js.percentiles[i] = cs.getPercentile( percentilenames[i] );
                    
                    js.stddev = cs.getStdDev();
                    m_jmxStatistics.put(n, js);
                }
            }
        }

        resetForNextPeriod();
    }
552852
@Override
    protected void logCumulativeSessionStats(Map<String, RunStats> runstats, RunStats cumulativeTotals) {
        DuplicationRunStats dCumulativeTotals = (DuplicationRunStats) cumulativeTotals;
        log.info("session stats (global cumulative): domains={} dups={}  deletes={}",
                 runstats.keySet().size(), dCumulativeTotals.getDups(), dCumulativeTotals.getDeletes());

    }
15280
function LikelihoodFactor(mean_variable, value_variable, variance) {
      LikelihoodFactor.__super__.constructor.call(this, [mean_variable, value_variable]);
      this.mean = mean_variable;
      this.value = value_variable;
      this.variance = variance;
    }
25822
private static Stats calcStats(List<Double> nums) {
    double sum = 0.0, mean = 0.0, variance = 0.0, stdDev = 0.0;
    for (Double d : nums) {
      sum += d.doubleValue();
    }
    if (nums.size() > 0) {
      mean = sum / nums.size();
    }

    sum = 0.0;
    for (Double d : nums) {
      sum += (d.doubleValue() - mean) * (d.doubleValue() - mean);
    }
    if (nums.size() > 0) {
      variance = sum / nums.size();
    }

    stdDev = Math.sqrt(variance);
    return new Stats(mean, variance, stdDev);
  }
996935
@SuppressWarnings("unchecked")
    public void setVars(final Map<String, ? extends Object> vars) {
        this.vars = (Map<String, Object>)vars;
    }
483392
function onStats( error, stat ) {
		if ( error ) {
			return clbk( error );
		}
		m.mem.memUsed = stat.memory / 1000; // KB
		m.mem.utilization = stat.memory / os.totalmem();
		m.cpu = {
			'utilization': stat.cpu / 100
		};
		clbk( null, m );
	}
408821
@Scheduled(fixedRate = 60000)
  public void logStatistics() {
    // TODO: do we want to log diff with last log instead?
    if (LOG.isDebugEnabled()) {
      LOG.debug("Cache stats:");
      for (Map.Entry<String, LoadingCache<Query<Entity>, List<Object>>> cacheEntry :
          caches.entrySet()) {
        LOG.debug("{}:{}", cacheEntry.getKey(), cacheEntry.getValue().stats());
      }
    }
  }
349002
public static function log(&$context, $vars) {
        if (isset($vars[0][0]) && ($vars[0][0] === 'log')) {
            if (!$context['flags']['nohbh']) {
                if (count($vars) < 2) {
                    $context['error'][] = "No argument after {{log}} !";
                }
                $context['usedFeature']['log']++;
                return true;
            }
        }
    }
419413
@Override
    protected void logIncrementalStatsByAccount(String account, RunStats stats) {
        log.info("Session stats by account (incremental): account={} tasksAdded={}",
                 account, ((BitIntegrityRunStats) stats).getAdded());

    }
1101210
private void addStringStatistics(long valueCount, StringStatistics value)
    {
        requireNonNull(value, "value is null");
        checkArgument(valueCount > 0, "valueCount is 0");
        checkArgument(value.getMin() != null || value.getMax() != null, "min and max cannot both be null");

        if (nonNullValueCount == 0) {
            checkState(minimum == null && maximum == null);
            minimum = value.getMin();
            maximum = value.getMax();
        }
        else {
            if (minimum != null && (value.getMin() == null || minimum.compareTo(value.getMin()) > 0)) {
                minimum = value.getMin();
            }
            if (maximum != null && (value.getMax() == null || maximum.compareTo(value.getMax()) < 0)) {
                maximum = value.getMax();
            }
        }

        nonNullValueCount += valueCount;
        sum = addExact(sum, value.getSum());
    }
1199888
@Override
	public void updateStatistics(Instance inst) {
		// Update the statistics for this node
		// number of instances passing through the node
		nodeStatistics.addToValue(0, 1);
		// sum of y values
		nodeStatistics.addToValue(1, inst.classValue());
		// sum of squared y values
		nodeStatistics.addToValue(2, inst.classValue()*inst.classValue());
				
		this.perceptron.trainOnInstance(inst);
		if (this.predictionFunction != 1) { //Train target mean if prediction function is not Perceptron
			this.targetMean.trainOnInstance(inst);
		}
	}
703964
protected void computeStatistics(T input, int innerWidth, int innerHeight) {
		original.init(blockWidth,blockHeight,thresholdFromLocalBlocks);

		int statPixelStride = stats.getImageType().getNumBands();

		int indexStats = 0;
		for (int y = 0; y < innerHeight; y += blockHeight) {
			for (int x = 0; x < innerWidth; x += blockWidth, indexStats += statPixelStride) {
				original.computeBlockStatistics(x,y,blockWidth,blockHeight,indexStats,input,stats);
			}
			// handle the case where the image's width isn't evenly divisible by the block's width
			if( innerWidth != input.width ) {
				original.computeBlockStatistics(innerWidth,y,input.width-innerWidth,blockHeight,indexStats,input,stats);
				indexStats += statPixelStride;
			}
		}
		// handle the case where the image's height isn't evenly divisible by the block's height
		if( innerHeight != input.height ) {
			int y = innerHeight;
			int blockHeight = input.height-innerHeight;
			for (int x = 0; x < innerWidth; x += blockWidth, indexStats += statPixelStride) {
				original.computeBlockStatistics(x,y,blockWidth,blockHeight,indexStats,input,stats);
			}
			if( innerWidth != input.width ) {
				original.computeBlockStatistics(innerWidth,y,input.width-innerWidth,blockHeight,indexStats,input,stats);
			}
		}
	}
292800
public static double variance(int[] histogram, double mean , int N ) {
		return variance(histogram, mean, count(histogram,N), N);
	}