test_class.declarator: log = LoggerFactory.getLogger(MixtureTest.class)
test_class.modifier: private static final
test_class.original_string: private static final Logger log = LoggerFactory.getLogger(MixtureTest.class);
test_class.type: Logger
test_class.var_name: log
test_class.file: contrib/src/test/java/macrobase/analysis/stats/distribution/MixtureTest.java
test_class.identifier: MixtureTest
test_case.body: @Test
      public void nonZeroScoreTest() {
          List<MultivariateDistribution> listDist = new ArrayList<>(3);
          double[] weights = {2. / 7, 3. / 7, 2. / 7};
          double[][] distData = {
                  {1.5, 2}, {0.5, 0.4, 0.4, 0.5}, {2000},
                  {2, 0}, {0.3, 0, 0, 0.6}, {3000},
                  {4.5, 1}, {0.9, 0.2, 0.2, 0.3}, {2000}};
          for (int i = 0; i < distData.length; i += 3) {
              RealVector mean = new ArrayRealVector(distData[i + 0]);
              double[][] covArray = new double[2][2];
              covArray[0] = Arrays.copyOfRange(distData[i + 1], 0, 2);
              covArray[1] = Arrays.copyOfRange(distData[i + 1], 2, 4);
              RealMatrix cov = new BlockRealMatrix(covArray);
              listDist.add(new MultivariateNormal(mean, cov));
          }
  
          Mixture mixture = new Mixture(listDist, weights);
  
          assertEquals(0.155359, mixture.density(new ArrayRealVector(distData[0])), 1e-6);
          assertEquals(0.162771, mixture.density(new ArrayRealVector(distData[3])), 1e-6);
          assertEquals(0.094819, mixture.density(new ArrayRealVector(distData[6])), 1e-6);
      }
test_case.class_method_signature: MixtureTest.nonZeroScoreTest()
test_case.full_signature: @Test public void nonZeroScoreTest()
test_case.identifier: nonZeroScoreTest
test_case.invocations: copyOfRange copyOfRange add assertEquals density assertEquals density assertEquals density
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void nonZeroScoreTest()
focal_class.declarator: log = LoggerFactory.getLogger(Mixture.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(Mixture.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: components
focal_class.modifier: private
focal_class.original_string: private List<MultivariateDistribution> components;
focal_class.type: List<MultivariateDistribution>
focal_class.var_name: components
focal_class.declarator: weights
focal_class.modifier: private
focal_class.original_string: private double[] weights;
focal_class.type: double[]
focal_class.var_name: weights
focal_class.file: contrib/src/main/java/macrobase/analysis/stats/distribution/Mixture.java
focal_class.identifier: Mixture
focal_class.interfaces: implements MultivariateDistribution
focal_class.class_method_signature: Mixture.Mixture(List<MultivariateDistribution> components, double[] weights)
focal_class.full_signature: public  Mixture(List<MultivariateDistribution> components, double[] weights)
focal_class.identifier: Mixture
focal_class.modifiers: public
focal_class.parameters: (List<MultivariateDistribution> components, double[] weights)
focal_class.signature:  Mixture(List<MultivariateDistribution> components, double[] weights)
focal_class.class_method_signature: Mixture.density(RealVector vector)
focal_class.full_signature: @Override public double density(RealVector vector)
focal_class.identifier: density
focal_class.modifiers: @Override public
focal_class.parameters: (RealVector vector)
focal_class.return: double
focal_class.signature: double density(RealVector vector)
focal_method.body: @Override
      public double density(RealVector vector) {
          double d = 0;
          for (int i=0; i< components.size(); i++) {
              d += components.get(i).density(vector) * weights[i];
          }
          return d;
      }
focal_method.class_method_signature: Mixture.density(RealVector vector)
focal_method.full_signature: @Override public double density(RealVector vector)
focal_method.identifier: density
focal_method.invocations: size density get
focal_method.modifiers: @Override public
focal_method.parameters: (RealVector vector)
focal_method.return: double
focal_method.signature: double density(RealVector vector)