Calculate the expectations without sampling.
427048
def non_sampling_sampler(circuit, meas):
    """"""
    meas = tuple(meas)
    n_qubits = circuit.n_qubits
    return expect(circuit.run(returns="statevector"), meas)
1050734
def predict(self, X):
        
        X_ = self._check_array(X)
        return exp(dot(X_, self._coef))
499694
def _expectation(p, mean, none1, none2, none3, nghp=None):
    
    return mean(p.mu)
609818
def _expectation(p, obj1, feat1, obj2, feat2, nghp=None):
    
    if obj2 is None:
        gaussian = Gaussian(p.mu[:-1], p.cov[0, :-1])
        return expectation(gaussian, (obj1, feat1), nghp=nghp)
    elif obj1 is None:
        gaussian = Gaussian(p.mu[1:], p.cov[0, 1:])
        return expectation(gaussian, (obj2, feat2), nghp=nghp)
    else:
        return expectation(p, (obj1, feat1), (obj2, feat2), nghp=nghp)
851748
def expected_values(early_mean=early_mean,
                    late_mean=late_mean,
                    switchpoint=switchpoint):
    """"""

    # Sample size
    n = len(disasters_array)
    # Expected values
    return concatenate(
        (ones(switchpoint) * early_mean, ones(n - switchpoint) * late_mean))
741087
def generate_expected_value
      if expected_difference.is_a? Range
        (before_value + expected_difference.first)..(before_value + expected_difference.end)
      else
        before_value + expected_difference
      end
    end
951663
def _expectation(p, kern, feat, none1, none2, nghp=None):
    
    with params_as_tensors_for(kern, feat):
        # use only active dimensions
        Z, Xmu = kern._slice(feat.Z, p.mu)

        return tf.matmul(Xmu, Z * kern.variance, transpose_b=True)
1331010
def _expectation(p, constant_mean, none, kern, feat, nghp=None):
    
    with params_as_tensors_for(constant_mean):
        c = constant_mean(p.mu)  # NxQ
        eKxz = expectation(p, (kern, feat), nghp=nghp)  # NxM

        return c[..., None] * eKxz[:, None, :]
297822
def predict_quantiles(self, Xnew=None, quantiles=(2.5, 97.5), balance=None, **kw):
        
        if balance is None:
            p_balance = self.balance
        else:
            p_balance = balance
        
        
        mu, var = self._raw_predict(Xnew, p_balance=p_balance)
        #import pdb; pdb.set_trace()
        return  [stats.norm.ppf(q/100.)*np.sqrt(var + float(self.Gaussian_noise.variance)) + mu for q in quantiles]
413505
public synchronized int getPredictedTotal(T predicted) {
        int total = 0;
        for (T actual : classes) {
            total += getCount(actual, predicted);
        }
        return total;
    }
823376
def predict(self, v=None, X=None):
        """"""
        if X is None:
            X = v
            v = None
        m = self.model(v=v)
        return m.predict(X)
4897
def samples(self):
        """"""
        names = self.series.dimensions
        for n, offset in enumerate(self.series.offsets):
            dt = datetime.timedelta(microseconds=offset * 1000)
            d = {"ts": self.ts + dt}
            for name in names:
                d[name] = getattr(self.series, name)[n]
            yield d
283798
def getExpectedValue(distribution):
  
  k = np.array(distribution.possibleValues)
  return np.sum(k * distribution.pmf(k))
1327802
def compute(self, data, fill_value=None, **kwargs):
        """"""
        del kwargs

        if fill_value is None:
            fill_value = data.attrs.get('_FillValue')
        target_shape = self.target_geo_def.shape

        res = self.resampler.get_sample_from_bil_info(data,
                                                      fill_value=fill_value,
                                                      output_shape=target_shape)

        return res
528261
def get_val(self, x):
        """"""
        interval, mean, std = self.probability_map[x]
        new_val = norm.rvs(mean, std)
        return new_val
656272
def compute(cls, observation, prediction):
        """"""
        assert isinstance(observation, dict)
        try:
            p_value = prediction['mean']  # Use the prediction's mean.
        except (TypeError, KeyError, IndexError):  # If there isn't one...
            try:
                p_value = prediction['value']  # Use the prediction's value.
            except (TypeError, IndexError):  # If there isn't one...
                p_value = prediction  # Use the prediction (assume numeric).
        o_mean = observation['mean']
        o_std = observation['std']
        value = (p_value - o_mean)/o_std
        value = utils.assert_dimensionless(value)
        if np.isnan(value):
            score = InsufficientDataScore('One of the input values was NaN')
        else:
            score = ZScore(value)
        return score
867771
def sample(self, size=None):
        
        self._recompute()
        if size is None:
            n = np.random.randn(len(self._t))
        else:
            n = np.random.randn(len(self._t), size)
        n = self.solver.dot_L(n)
        if size is None:
            return self.mean.get_value(self._t) + n[:, 0]
        return self.mean.get_value(self._t)[None, :] + n.T