Smooth out fluctuations in the estimate for this node compared to
        previous runs. Returns an integer.
197986
def smoothEstimate(self, nodeShape, estimatedNodeCount):
        
        weightedEstimate = (1 - self.betaInertia) * estimatedNodeCount + \
                           self.betaInertia * self.previousWeightedEstimate[nodeShape]
        self.previousWeightedEstimate[nodeShape] = weightedEstimate
        return self._round(weightedEstimate)
1349549
def smoothness(self):
        
        energies = self.energies
        try:
            sp = self.spline()
        except:
            print("Energy spline failed.")
            return None
        spline_energies = sp(range(len(energies)))
        diff = spline_energies - energies
        rms = np.sqrt(np.sum(np.square(diff)) / len(energies))
        return rms
541898
def CredibleInterval(self, percentage=90):
        
        prob = (1 - percentage / 100.0) / 2
        interval = self.Value(prob), self.Value(1 - prob)
        return interval
299407
def estimate(self):
        
        E = self.alpha * float(self.m ** 2) / np.power(2.0, - self.M).sum()
        if E <= 2.5 * self.m:             # Small range correction
            V = self.m - np.count_nonzero(self.M)
            return int(self.m * np.log(self.m / float(V))) if V > 0 else int(E)
        # intermidiate range correction -> No correction
        elif E <= float(long(1) << self.precision) / 30.0:
            return int(E)
        else:
            return int(-(long(1) << self.precision) *
                       np.log(1.0 - E / (long(1) << self.precision)))
510421
def smooth(x, y, degree=3):
    """"""

    if degree == 1:
        return x, y
    elif not isodd(degree):
        raise ValueError("Degree must be an odd number")
    else:
        window_width = int(degree / 2)
        data_size = len(y) - degree + 1

        smoothed_y = np.zeros(data_size)
        for idx in range(degree):
            smoothed_y += y[idx:idx + data_size]
        smoothed_y /= degree

        smoothed_x = x[window_width:-window_width]

        return smoothed_x, smoothed_y
392711
def C00_(self):
        
        self._check_estimated()
        return self._rc.cov_XX(bessel=self.bessel)
1190850
def estimate_tau_int(chains, **kwargs):
    
    return autocorr.integrated_time(np.mean(chains, axis=0), **kwargs)
1091932
def _estimate(self, buffer):
        
        m = self._bucket_number
        raw_e = self._alpha * pow(m, 2) / sum([pow(2, -x) for x in buffer])
        if raw_e <= 5 / 2.0 * m:
            v = buffer.count(0)
            if v != 0:
                return m * log(m / float(v), 2)
            else:
                return raw_e
        elif raw_e <= 1 / 30.0 * 2 ** 160:
            return raw_e
        else:
            return -2 ** 160 * log(1 - raw_e / 2.0 ** 160, 2)
173008
def generation_fluctuating(self):
        
        try:
            return self._generation_fluctuating.loc[[self.timeindex], :]
        except:
            return self._generation_fluctuating.loc[self.timeindex, :]
1187787
def _prep_smooth(t, y, dy, span, t_out, span_out, period):
    """"""

    # If period is provided, sort by phases. Otherwise sort by t
    if period:
        t = t % period
        if t_out is not None:
            t_out = t_out % period

    t, y, dy = validate_inputs(t, y, dy, sort_by=t)

    if span_out is not None:
        if t_out is None:
            raise ValueError("Must specify t_out when span_out is given")
        if span is not None:
            raise ValueError("Must specify only one of span, span_out")
        span, t_out = np.broadcast_arrays(span_out, t_out)
        indices = np.searchsorted(t, t_out)
    elif span is None:
        raise ValueError("Must specify either span_out or span")
    else:
        indices = None

    return t, y, dy, span, t_out, span_out, indices
645123
def smooth(data, fw):
    """"""
    if fw == 0:
        fdata = data
    else:
        fdata = lfilter(np.ones(fw)/fw, 1, data)
    return fdata
1194682
def getThroughput(self, instId: int) -> float:
        
        # We are using the instanceStarted time in the denominator instead of
        # a time interval. This is alright for now as all the instances on a
        # node are started at almost the same time.
        if instId not in self.instances.ids:
            return None
        perf_time = time.perf_counter()
        throughput = self.throughputs[instId].get_throughput(perf_time)
        return throughput
1164689
def _smooth_best_span_estimates(self):
        """"""
        self._smoothed_best_spans = smoother.perform_smooth(self.x,
                                                            self._best_span_at_each_point,
                                                            MID_SPAN)
99859
private void smoothData() {
        final int SIZE = DATA_LIST.size();
        double y;

        switch (smoothFunction) {
            case CONTINUOUS_AVERAGE:
                // Add first point
                pointList.add(new Point2D.Double(0, ((DATA_LIST.getFirst().getValue() - lo) * (1 / scaleY) + offset)));

                // Add the averaged points
                for (int i = 1; i < SIZE - 1; i++) {
                    //System.out.println((a * dataList.get(i - 1) + b * dataList.get(i) + c * (dataList.get( i + 1))) / (a + b + c));
                    y = continuousAverage(DATA_LIST.get(i - 1).getValue(), DATA_LIST.get(i).getValue(), DATA_LIST.get(i + 1).getValue());
                    pointList.add(new Point2D.Double((DATA_LIST.get(i).getTimeStamp() - DATA_LIST.getFirst().getTimeStamp()) * pixelResolution, ((y - lo) * (1 / scaleY) + offset)));
                }

                // Add last point
                pointList.add(new Point2D.Double((DATA_LIST.getLast().getTimeStamp() - DATA_LIST.getFirst().getTimeStamp()) * pixelResolution, ((DATA_LIST.getLast().getValue() - lo) * (1 / scaleY) + offset)));
                break;

            case CUBIC_SPLINE:
                for (int i = 2; i < SIZE - 1; i++) {
                    y = cubicInterpolate(DATA_LIST.get(i - 2).getValue(), DATA_LIST.get(i - 1).getValue(), DATA_LIST.get(i).getValue(), DATA_LIST.get(i + 1).getValue(), 0.5);
                    pointList.add(new Point2D.Double((DATA_LIST.get(i).getTimeStamp() - DATA_LIST.getFirst().getTimeStamp()) * pixelResolution, ((y - lo) * (1 / scaleY) + offset)));
                }
                break;

            case HERMITE:
                for (int i = 2; i < SIZE - 1; i++) {
                    y = hermiteInterpolate(DATA_LIST.get(i - 2).getValue(), DATA_LIST.get(i - 1).getValue(), DATA_LIST.get(i - 0).getValue(), DATA_LIST.get(i + 1).getValue(), 0.5, 0, 0);
                    pointList.add(new Point2D.Double((DATA_LIST.get(i).getTimeStamp() - DATA_LIST.getFirst().getTimeStamp()) * pixelResolution, ((y - lo) * (1 / scaleY) + offset)));
                }
                break;

            case COSINUS:

            default:
                for (int i = 0; i < SIZE - 1; i++) {
                    y = cosInterpolate(DATA_LIST.get(i).getValue(), DATA_LIST.get(i + 1).getValue(), 0.5);
                    pointList.add(new Point2D.Double((DATA_LIST.get(i).getTimeStamp() - DATA_LIST.getFirst().getTimeStamp()) * pixelResolution, ((y - lo) * (1 / scaleY) + offset)));
                }
                break;
        }
    }
1065820
def _perturbation(self):
        
        if self.P>1:
            scales = []
            for term_i in range(self.n_randEffs):
                _scales = sp.randn(self.diag[term_i].shape[0])
                if self.jitter[term_i]>0:
                    _scales  = sp.concatenate((_scales,sp.zeros(1)))
                scales.append(_scales)
            scales = sp.concatenate(scales)
        else:
            scales = sp.randn(self.vd.getNumberScales())
        return scales
575390
private RandomVariable getShortRate(int timeIndex) throws CalculationException {
		double time = getProcess().getTime(timeIndex);
		double timePrev = timeIndex > 0 ? getProcess().getTime(timeIndex-1) : time;
		double timeNext = getProcess().getTime(timeIndex+1);

		RandomVariable zeroRate = getZeroRateFromForwardCurve(time); //getDiscountFactorFromForwardCurve(time).div(getDiscountFactorFromForwardCurve(timeNext)).log().div(timeNext-time);

		RandomVariable alpha = getDV(0, time);

		RandomVariable value = getProcess().getProcessValue(timeIndex, 0);
		value = value.add(alpha);
		//		value = value.sub(Math.log(value.exp().getAverage()));

		value = value.add(zeroRate);

		return value;
	}
307513
def compute(self):
        """"""
        self._compute_window_size()
        smooth = []
        residual = []

        x, y = self.x, self.y

        # step through x and y data with a window window_size wide.
        self._update_values_in_window()
        self._update_mean_in_window()
        self._update_variance_in_window()
        for i, (xi, yi) in enumerate(zip(x, y)):
            if ((i - self._neighbors_on_each_side) > 0.0 and
                    (i + self._neighbors_on_each_side) < len(x)):
                self._advance_window()
            smooth_here = self._compute_smooth_during_construction(xi)
            residual_here = self._compute_cross_validated_residual_here(xi, yi, smooth_here)
            smooth.append(smooth_here)
            residual.append(residual_here)

        self._store_unsorted_results(smooth, residual)