コード例 #1
0
    public Tuple1<Double> map(DenseVector v) throws Exception {
      double mu[] = {1, 2};
      double cov[][] = {{1.9837212, 0.8039848}, {0.8039848, 0.6288061}};

      MultivariateNormalDistribution mnd = new MultivariateNormalDistribution(mu, cov);

      Double value = 0.0;
      value = mnd.density(v.data());
      System.out.println("VAL: " + value);
      return new Tuple1<Double>(value);
    }
コード例 #2
0
 private void CalculateLogLikelihood() {
   sum_log_likelihood_ = 0;
   for (int ii = 0; ii < number_of_observations_; ii++) {
     if (observations_ref_[ii] == null) {
       continue;
     }
     // System.out.println(ii);
     // System.out.println(predicted_observation_covariances_[ii]);
     MultivariateNormalDistribution dist =
         new MultivariateNormalDistribution(
             predicted_observation_means_[ii].getColumn(0).toArray(),
             predicted_observation_covariances_[ii].toArray2());
     sum_log_likelihood_ += Math.log(dist.density(observations_ref_[ii].getColumn(0).toArray()));
   }
 }