test_class.declarator: data = new HashMap<>()
test_class.modifier: private static final
test_class.original_string: private static final Map<Integer, double[]> data = new HashMap<>();
test_class.type: Map<Integer, double[]>
test_class.var_name: data
test_class.file: modules/ml/src/test/java/org/apache/ignite/ml/clustering/gmm/GmmTrainerTest.java
test_class.identifier: GmmTrainerTest
test_class.superclass: extends TrainerTest
test_case.body: @Test
      public void testFit() {
          GmmTrainer trainer = new GmmTrainer(2, 1)
              .withInitialMeans(Arrays.asList(
                  VectorUtils.of(1.0, 2.0),
                  VectorUtils.of(-1.0, -2.0)));
          GmmModel model = trainer.fit(
              new LocalDatasetBuilder<>(data, parts),
              new DoubleArrayVectorizer<Integer>().labeled(Vectorizer.LabelCoordinate.LAST)
          );
  
          Assert.assertEquals(2, model.countOfComponents());
          Assert.assertEquals(2, model.dimension());
          Assert.assertArrayEquals(new double[] {1.33, 1.33}, model.distributions().get(0).mean().asArray(), 1e-2);
          Assert.assertArrayEquals(new double[] {-1.33, -1.33}, model.distributions().get(1).mean().asArray(), 1e-2);
      }
test_case.class_method_signature: GmmTrainerTest.testFit()
test_case.full_signature: @Test public void testFit()
test_case.identifier: testFit
test_case.invocations: withInitialMeans asList of of fit labeled assertEquals countOfComponents assertEquals dimension assertArrayEquals asArray mean get distributions assertArrayEquals asArray mean get distributions
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testFit()
focal_class.declarator: eps = 1e-3
focal_class.modifier: private
focal_class.original_string: private double eps = 1e-3;
focal_class.type: double
focal_class.var_name: eps
focal_class.declarator: countOfComponents = 2
focal_class.modifier: private
focal_class.original_string: private int countOfComponents = 2;
focal_class.type: int
focal_class.var_name: countOfComponents
focal_class.declarator: maxCountOfIterations = 10
focal_class.modifier: private
focal_class.original_string: private int maxCountOfIterations = 10;
focal_class.type: int
focal_class.var_name: maxCountOfIterations
focal_class.declarator: initialMeans
focal_class.modifier: private
focal_class.original_string: private Vector[] initialMeans;
focal_class.type: Vector[]
focal_class.var_name: initialMeans
focal_class.declarator: maxCountOfInitTries = 3
focal_class.modifier: private
focal_class.original_string: private int maxCountOfInitTries = 3;
focal_class.type: int
focal_class.var_name: maxCountOfInitTries
focal_class.declarator: maxCountOfClusters = 2
focal_class.modifier: private
focal_class.original_string: private int maxCountOfClusters = 2;
focal_class.type: int
focal_class.var_name: maxCountOfClusters
focal_class.declarator: maxLikelihoodDivergence = 5
focal_class.modifier: private
focal_class.original_string: private double maxLikelihoodDivergence = 5;
focal_class.type: double
focal_class.var_name: maxLikelihoodDivergence
focal_class.declarator: minElementsForNewCluster = 300
focal_class.modifier: private
focal_class.original_string: private double minElementsForNewCluster = 300;
focal_class.type: double
focal_class.var_name: minElementsForNewCluster
focal_class.declarator: minClusterProbability = 0.05
focal_class.modifier: private
focal_class.original_string: private double minClusterProbability = 0.05;
focal_class.type: double
focal_class.var_name: minClusterProbability
focal_class.file: modules/ml/src/main/java/org/apache/ignite/ml/clustering/gmm/GmmTrainer.java
focal_class.identifier: GmmTrainer
focal_class.class_method_signature: GmmTrainer.GmmTrainer()
focal_class.full_signature: public  GmmTrainer()
focal_class.identifier: GmmTrainer
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  GmmTrainer()
focal_class.class_method_signature: GmmTrainer.GmmTrainer(int countOfComponents, int maxCountOfIterations)
focal_class.full_signature: public  GmmTrainer(int countOfComponents, int maxCountOfIterations)
focal_class.identifier: GmmTrainer
focal_class.modifiers: public
focal_class.parameters: (int countOfComponents, int maxCountOfIterations)
focal_class.signature:  GmmTrainer(int countOfComponents, int maxCountOfIterations)
focal_class.class_method_signature: GmmTrainer.GmmTrainer(int countOfComponents)
focal_class.full_signature: public  GmmTrainer(int countOfComponents)
focal_class.identifier: GmmTrainer
focal_class.modifiers: public
focal_class.parameters: (int countOfComponents)
focal_class.signature:  GmmTrainer(int countOfComponents)
focal_class.class_method_signature: GmmTrainer.fitWithInitializedDeployingContext(DatasetBuilder<K, V> datasetBuilder,
          Preprocessor<K, V> extractor)
focal_class.full_signature: @Override public GmmModel fitWithInitializedDeployingContext(DatasetBuilder<K, V> datasetBuilder,
          Preprocessor<K, V> extractor)
focal_class.identifier: fitWithInitializedDeployingContext
focal_class.modifiers: @Override public
focal_class.parameters: (DatasetBuilder<K, V> datasetBuilder,
          Preprocessor<K, V> extractor)
focal_class.return: GmmModel
focal_class.signature: GmmModel fitWithInitializedDeployingContext(DatasetBuilder<K, V> datasetBuilder,
          Preprocessor<K, V> extractor)
focal_class.class_method_signature: GmmTrainer.selectNRandomXsMapper(int n)
focal_class.full_signature: private static IgniteBiFunction<GmmPartitionData, LearningEnvironment, Vector[][]> selectNRandomXsMapper(int n)
focal_class.identifier: selectNRandomXsMapper
focal_class.modifiers: private static
focal_class.parameters: (int n)
focal_class.return: IgniteBiFunction<GmmPartitionData, LearningEnvironment, Vector[][]>
focal_class.signature: IgniteBiFunction<GmmPartitionData, LearningEnvironment, Vector[][]> selectNRandomXsMapper(int n)
focal_class.class_method_signature: GmmTrainer.selectNRandomXsReducer(Vector[][] l, Vector[][] r)
focal_class.full_signature: private static Vector[][] selectNRandomXsReducer(Vector[][] l, Vector[][] r)
focal_class.identifier: selectNRandomXsReducer
focal_class.modifiers: private static
focal_class.parameters: (Vector[][] l, Vector[][] r)
focal_class.return: Vector[][]
focal_class.signature: Vector[][] selectNRandomXsReducer(Vector[][] l, Vector[][] r)
focal_class.class_method_signature: GmmTrainer.withInitialCountOfComponents(int numberOfComponents)
focal_class.full_signature: public GmmTrainer withInitialCountOfComponents(int numberOfComponents)
focal_class.identifier: withInitialCountOfComponents
focal_class.modifiers: public
focal_class.parameters: (int numberOfComponents)
focal_class.return: GmmTrainer
focal_class.signature: GmmTrainer withInitialCountOfComponents(int numberOfComponents)
focal_class.class_method_signature: GmmTrainer.withInitialMeans(List<Vector> means)
focal_class.full_signature: public GmmTrainer withInitialMeans(List<Vector> means)
focal_class.identifier: withInitialMeans
focal_class.modifiers: public
focal_class.parameters: (List<Vector> means)
focal_class.return: GmmTrainer
focal_class.signature: GmmTrainer withInitialMeans(List<Vector> means)
focal_class.class_method_signature: GmmTrainer.withMaxCountIterations(int maxCountOfIterations)
focal_class.full_signature: public GmmTrainer withMaxCountIterations(int maxCountOfIterations)
focal_class.identifier: withMaxCountIterations
focal_class.modifiers: public
focal_class.parameters: (int maxCountOfIterations)
focal_class.return: GmmTrainer
focal_class.signature: GmmTrainer withMaxCountIterations(int maxCountOfIterations)
focal_class.class_method_signature: GmmTrainer.withEps(double eps)
focal_class.full_signature: public GmmTrainer withEps(double eps)
focal_class.identifier: withEps
focal_class.modifiers: public
focal_class.parameters: (double eps)
focal_class.return: GmmTrainer
focal_class.signature: GmmTrainer withEps(double eps)
focal_class.class_method_signature: GmmTrainer.withMaxCountOfInitTries(int maxCountOfInitTries)
focal_class.full_signature: public GmmTrainer withMaxCountOfInitTries(int maxCountOfInitTries)
focal_class.identifier: withMaxCountOfInitTries
focal_class.modifiers: public
focal_class.parameters: (int maxCountOfInitTries)
focal_class.return: GmmTrainer
focal_class.signature: GmmTrainer withMaxCountOfInitTries(int maxCountOfInitTries)
focal_class.class_method_signature: GmmTrainer.withMaxCountOfClusters(int maxCountOfClusters)
focal_class.full_signature: public GmmTrainer withMaxCountOfClusters(int maxCountOfClusters)
focal_class.identifier: withMaxCountOfClusters
focal_class.modifiers: public
focal_class.parameters: (int maxCountOfClusters)
focal_class.return: GmmTrainer
focal_class.signature: GmmTrainer withMaxCountOfClusters(int maxCountOfClusters)
focal_class.class_method_signature: GmmTrainer.withMaxLikelihoodDivergence(double maxLikelihoodDivergence)
focal_class.full_signature: public GmmTrainer withMaxLikelihoodDivergence(double maxLikelihoodDivergence)
focal_class.identifier: withMaxLikelihoodDivergence
focal_class.modifiers: public
focal_class.parameters: (double maxLikelihoodDivergence)
focal_class.return: GmmTrainer
focal_class.signature: GmmTrainer withMaxLikelihoodDivergence(double maxLikelihoodDivergence)
focal_class.class_method_signature: GmmTrainer.fit(Dataset<EmptyContext, GmmPartitionData> dataset)
focal_class.full_signature: private Optional<GmmModel> fit(Dataset<EmptyContext, GmmPartitionData> dataset)
focal_class.identifier: fit
focal_class.modifiers: private
focal_class.parameters: (Dataset<EmptyContext, GmmPartitionData> dataset)
focal_class.return: Optional<GmmModel>
focal_class.signature: Optional<GmmModel> fit(Dataset<EmptyContext, GmmPartitionData> dataset)
focal_class.class_method_signature: GmmTrainer.withMinElementsForNewCluster(int minElementsForNewCluster)
focal_class.full_signature: public GmmTrainer withMinElementsForNewCluster(int minElementsForNewCluster)
focal_class.identifier: withMinElementsForNewCluster
focal_class.modifiers: public
focal_class.parameters: (int minElementsForNewCluster)
focal_class.return: GmmTrainer
focal_class.signature: GmmTrainer withMinElementsForNewCluster(int minElementsForNewCluster)
focal_class.class_method_signature: GmmTrainer.withMinClusterProbability(double minClusterProbability)
focal_class.full_signature: public GmmTrainer withMinClusterProbability(double minClusterProbability)
focal_class.identifier: withMinClusterProbability
focal_class.modifiers: public
focal_class.parameters: (double minClusterProbability)
focal_class.return: GmmTrainer
focal_class.signature: GmmTrainer withMinClusterProbability(double minClusterProbability)
focal_class.class_method_signature: GmmTrainer.filterModel(GmmModel model)
focal_class.full_signature: private GmmModel filterModel(GmmModel model)
focal_class.identifier: filterModel
focal_class.modifiers: private
focal_class.parameters: (GmmModel model)
focal_class.return: GmmModel
focal_class.signature: GmmModel filterModel(GmmModel model)
focal_class.class_method_signature: GmmTrainer.updateModel(Dataset<EmptyContext, GmmPartitionData> dataset, GmmModel model)
focal_class.full_signature: @NotNull private UpdateResult updateModel(Dataset<EmptyContext, GmmPartitionData> dataset, GmmModel model)
focal_class.identifier: updateModel
focal_class.modifiers: @NotNull private
focal_class.parameters: (Dataset<EmptyContext, GmmPartitionData> dataset, GmmModel model)
focal_class.return: UpdateResult
focal_class.signature: UpdateResult updateModel(Dataset<EmptyContext, GmmPartitionData> dataset, GmmModel model)
focal_class.class_method_signature: GmmTrainer.init(Dataset<EmptyContext, GmmPartitionData> dataset)
focal_class.full_signature: private Optional<GmmModel> init(Dataset<EmptyContext, GmmPartitionData> dataset)
focal_class.identifier: init
focal_class.modifiers: private
focal_class.parameters: (Dataset<EmptyContext, GmmPartitionData> dataset)
focal_class.return: Optional<GmmModel>
focal_class.signature: Optional<GmmModel> init(Dataset<EmptyContext, GmmPartitionData> dataset)
focal_class.class_method_signature: GmmTrainer.isUpdateable(GmmModel mdl)
focal_class.full_signature: @Override public boolean isUpdateable(GmmModel mdl)
focal_class.identifier: isUpdateable
focal_class.modifiers: @Override public
focal_class.parameters: (GmmModel mdl)
focal_class.return: boolean
focal_class.signature: boolean isUpdateable(GmmModel mdl)
focal_class.class_method_signature: GmmTrainer.updateModel(GmmModel mdl, DatasetBuilder<K, V> datasetBuilder,
          Preprocessor<K, V> extractor)
focal_class.full_signature: @Override protected GmmModel updateModel(GmmModel mdl, DatasetBuilder<K, V> datasetBuilder,
          Preprocessor<K, V> extractor)
focal_class.identifier: updateModel
focal_class.modifiers: @Override protected
focal_class.parameters: (GmmModel mdl, DatasetBuilder<K, V> datasetBuilder,
          Preprocessor<K, V> extractor)
focal_class.return: GmmModel
focal_class.signature: GmmModel updateModel(GmmModel mdl, DatasetBuilder<K, V> datasetBuilder,
          Preprocessor<K, V> extractor)
focal_class.class_method_signature: GmmTrainer.buildComponents(Vector[] means, List<Matrix> covs)
focal_class.full_signature: private List<MultivariateGaussianDistribution> buildComponents(Vector[] means, List<Matrix> covs)
focal_class.identifier: buildComponents
focal_class.modifiers: private
focal_class.parameters: (Vector[] means, List<Matrix> covs)
focal_class.return: List<MultivariateGaussianDistribution>
focal_class.signature: List<MultivariateGaussianDistribution> buildComponents(Vector[] means, List<Matrix> covs)
focal_class.class_method_signature: GmmTrainer.isConverged(GmmModel oldModel, GmmModel newModel)
focal_class.full_signature: private boolean isConverged(GmmModel oldModel, GmmModel newModel)
focal_class.identifier: isConverged
focal_class.modifiers: private
focal_class.parameters: (GmmModel oldModel, GmmModel newModel)
focal_class.return: boolean
focal_class.signature: boolean isConverged(GmmModel oldModel, GmmModel newModel)
focal_class.superclass: extends SingleLabelDatasetTrainer<GmmModel>
focal_method.body: private Optional<GmmModel> fit(Dataset<EmptyContext, GmmPartitionData> dataset) {
          return init(dataset).map(model -> {
              GmmModel currentModel = model;
  
              do {
                  UpdateResult updateResult = updateModel(dataset, currentModel);
                  currentModel = updateResult.model;
  
                  double minCompProb = currentModel.componentsProbs().minElement().get();
                  if (countOfComponents >= maxCountOfClusters || minCompProb < minClusterProbability)
                      break;
  
                  double maxXProb = updateResult.maxProbInDataset;
                  NewComponentStatisticsAggregator newMeanAdder = NewComponentStatisticsAggregator.computeNewMean(dataset,
                      maxXProb, maxLikelihoodDivergence, currentModel);
  
                  Vector newMean = newMeanAdder.mean();
                  if (newMeanAdder.rowCountForNewCluster() < minElementsForNewCluster)
                      break;
  
                  countOfComponents += 1;
                  Vector[] newMeans = new Vector[countOfComponents];
                  for (int i = 0; i < currentModel.countOfComponents(); i++)
                      newMeans[i] = currentModel.distributions().get(i).mean();
                  newMeans[countOfComponents - 1] = newMean;
  
                  initialMeans = newMeans;
  
                  Optional<GmmModel> newModelOpt = init(dataset);
                  if (newModelOpt.isPresent())
                      currentModel = newModelOpt.get();
                  else
                      break;
              }
              while (true);
  
              return filterModel(currentModel);
          });
      }
focal_method.class_method_signature: GmmTrainer.fit(Dataset<EmptyContext, GmmPartitionData> dataset)
focal_method.full_signature: private Optional<GmmModel> fit(Dataset<EmptyContext, GmmPartitionData> dataset)
focal_method.identifier: fit
focal_method.invocations: map init updateModel get minElement componentsProbs computeNewMean mean rowCountForNewCluster countOfComponents mean get distributions init isPresent get filterModel
focal_method.modifiers: private
focal_method.parameters: (Dataset<EmptyContext, GmmPartitionData> dataset)
focal_method.return: Optional<GmmModel>
focal_method.signature: Optional<GmmModel> fit(Dataset<EmptyContext, GmmPartitionData> dataset)