test_class.declarator: thrown = ExpectedException.none()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public ExpectedException thrown = ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: thrown
test_class.declarator: SPARK_MDL_PATH = "models"
test_class.modifier: public static final
test_class.original_string: public static final String SPARK_MDL_PATH = "models";
test_class.type: String
test_class.var_name: SPARK_MDL_PATH
test_class.file: modules/ml/spark-model-parser/src/test/java/org/apache/ignite/ml/sparkmodelparser/SparkModelParserTest.java
test_class.identifier: SparkModelParserTest
test_case.body: @Test
      public void failOnEmptyDirectory() {
          URL url = getClass().getClassLoader().getResource(SPARK_MDL_PATH);
  
          try {
              SparkModelParser.parse(
                  url.getPath() + "empty", SupportedSparkModels.LINEAR_REGRESSION
              );
              fail("Expected IllegalArgumentException exception");
          }
          catch (IllegalArgumentException e) {
              assertTrue(e.getMessage().contains("Directory not found or empty"));
          }
      }
test_case.class_method_signature: SparkModelParserTest.failOnEmptyDirectory()
test_case.full_signature: @Test public void failOnEmptyDirectory()
test_case.identifier: failOnEmptyDirectory
test_case.invocations: getResource getClassLoader getClass parse getPath fail assertTrue contains getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void failOnEmptyDirectory()
focal_class.file: modules/ml/spark-model-parser/src/main/java/org/apache/ignite/ml/sparkmodelparser/SparkModelParser.java
focal_class.identifier: SparkModelParser
focal_class.class_method_signature: SparkModelParser.parse(String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_class.full_signature: public static Model parse(String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_class.identifier: parse
focal_class.modifiers: public static
focal_class.parameters: (String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_class.return: Model
focal_class.signature: Model parse(String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_class.class_method_signature: SparkModelParser.validateMetadata(String pathToMetadata,
          SupportedSparkModels parsedSparkMdl)
focal_class.full_signature: private static void validateMetadata(String pathToMetadata,
          SupportedSparkModels parsedSparkMdl)
focal_class.identifier: validateMetadata
focal_class.modifiers: private static
focal_class.parameters: (String pathToMetadata,
          SupportedSparkModels parsedSparkMdl)
focal_class.return: void
focal_class.signature: void validateMetadata(String pathToMetadata,
          SupportedSparkModels parsedSparkMdl)
focal_class.class_method_signature: SparkModelParser.shouldContainTreeMetadataSubDirectory(SupportedSparkModels parsedSparkMdl)
focal_class.full_signature: private static boolean shouldContainTreeMetadataSubDirectory(SupportedSparkModels parsedSparkMdl)
focal_class.identifier: shouldContainTreeMetadataSubDirectory
focal_class.modifiers: private static
focal_class.parameters: (SupportedSparkModels parsedSparkMdl)
focal_class.return: boolean
focal_class.signature: boolean shouldContainTreeMetadataSubDirectory(SupportedSparkModels parsedSparkMdl)
focal_class.class_method_signature: SparkModelParser.parseData(String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_class.full_signature: private static Model parseData(String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_class.identifier: parseData
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_class.return: Model
focal_class.signature: Model parseData(String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_class.class_method_signature: SparkModelParser.parseDataWithMetadata(String pathToMdl, String pathToMetaData,
          SupportedSparkModels parsedSparkMdl)
focal_class.full_signature: private static Model parseDataWithMetadata(String pathToMdl, String pathToMetaData,
          SupportedSparkModels parsedSparkMdl)
focal_class.identifier: parseDataWithMetadata
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl, String pathToMetaData,
          SupportedSparkModels parsedSparkMdl)
focal_class.return: Model
focal_class.signature: Model parseDataWithMetadata(String pathToMdl, String pathToMetaData,
          SupportedSparkModels parsedSparkMdl)
focal_class.class_method_signature: SparkModelParser.loadRandomForestRegressionModel(String pathToMdl)
focal_class.full_signature: private static Model loadRandomForestRegressionModel(String pathToMdl)
focal_class.identifier: loadRandomForestRegressionModel
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl)
focal_class.return: Model
focal_class.signature: Model loadRandomForestRegressionModel(String pathToMdl)
focal_class.class_method_signature: SparkModelParser.loadDecisionTreeRegressionModel(String pathToMdl)
focal_class.full_signature: private static Model loadDecisionTreeRegressionModel(String pathToMdl)
focal_class.identifier: loadDecisionTreeRegressionModel
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl)
focal_class.return: Model
focal_class.signature: Model loadDecisionTreeRegressionModel(String pathToMdl)
focal_class.class_method_signature: SparkModelParser.loadKMeansModel(String pathToMdl)
focal_class.full_signature: private static Model loadKMeansModel(String pathToMdl)
focal_class.identifier: loadKMeansModel
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl)
focal_class.return: Model
focal_class.signature: Model loadKMeansModel(String pathToMdl)
focal_class.class_method_signature: SparkModelParser.loadGBTRegressionModel(String pathToMdl, String pathToMdlMetaData)
focal_class.full_signature: private static Model loadGBTRegressionModel(String pathToMdl, String pathToMdlMetaData)
focal_class.identifier: loadGBTRegressionModel
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl, String pathToMdlMetaData)
focal_class.return: Model
focal_class.signature: Model loadGBTRegressionModel(String pathToMdl, String pathToMdlMetaData)
focal_class.class_method_signature: SparkModelParser.loadGBTClassifierModel(String pathToMdl, String pathToMdlMetaData)
focal_class.full_signature: private static Model loadGBTClassifierModel(String pathToMdl, String pathToMdlMetaData)
focal_class.identifier: loadGBTClassifierModel
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl, String pathToMdlMetaData)
focal_class.return: Model
focal_class.signature: Model loadGBTClassifierModel(String pathToMdl, String pathToMdlMetaData)
focal_class.class_method_signature: SparkModelParser.parseAndBuildGDBModel(String pathToMdl, String pathToMdlMetaData,
          IgniteFunction<Double, Double> lbMapper)
focal_class.full_signature: @Nullable private static Model parseAndBuildGDBModel(String pathToMdl, String pathToMdlMetaData,
          IgniteFunction<Double, Double> lbMapper)
focal_class.identifier: parseAndBuildGDBModel
focal_class.modifiers: @Nullable private static
focal_class.parameters: (String pathToMdl, String pathToMdlMetaData,
          IgniteFunction<Double, Double> lbMapper)
focal_class.return: Model
focal_class.signature: Model parseAndBuildGDBModel(String pathToMdl, String pathToMdlMetaData,
          IgniteFunction<Double, Double> lbMapper)
focal_class.class_method_signature: SparkModelParser.loadRandomForestModel(String pathToMdl)
focal_class.full_signature: private static Model loadRandomForestModel(String pathToMdl)
focal_class.identifier: loadRandomForestModel
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl)
focal_class.return: Model
focal_class.signature: Model loadRandomForestModel(String pathToMdl)
focal_class.class_method_signature: SparkModelParser.parseTreesForRandomForestAlgorithm(String pathToMdl)
focal_class.full_signature: private static List<IgniteModel<Vector, Double>> parseTreesForRandomForestAlgorithm(String pathToMdl)
focal_class.identifier: parseTreesForRandomForestAlgorithm
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl)
focal_class.return: List<IgniteModel<Vector, Double>>
focal_class.signature: List<IgniteModel<Vector, Double>> parseTreesForRandomForestAlgorithm(String pathToMdl)
focal_class.class_method_signature: SparkModelParser.loadDecisionTreeModel(String pathToMdl)
focal_class.full_signature: private static Model loadDecisionTreeModel(String pathToMdl)
focal_class.identifier: loadDecisionTreeModel
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl)
focal_class.return: Model
focal_class.signature: Model loadDecisionTreeModel(String pathToMdl)
focal_class.class_method_signature: SparkModelParser.buildDecisionTreeModel(Map<Integer, NodeData> nodes)
focal_class.full_signature: private static DecisionTreeNode buildDecisionTreeModel(Map<Integer, NodeData> nodes)
focal_class.identifier: buildDecisionTreeModel
focal_class.modifiers: private static
focal_class.parameters: (Map<Integer, NodeData> nodes)
focal_class.return: DecisionTreeNode
focal_class.signature: DecisionTreeNode buildDecisionTreeModel(Map<Integer, NodeData> nodes)
focal_class.class_method_signature: SparkModelParser.buildTree(Map<Integer, NodeData> nodes,
          NodeData rootNodeData)
focal_class.full_signature: @NotNull private static DecisionTreeNode buildTree(Map<Integer, NodeData> nodes,
          NodeData rootNodeData)
focal_class.identifier: buildTree
focal_class.modifiers: @NotNull private static
focal_class.parameters: (Map<Integer, NodeData> nodes,
          NodeData rootNodeData)
focal_class.return: DecisionTreeNode
focal_class.signature: DecisionTreeNode buildTree(Map<Integer, NodeData> nodes,
          NodeData rootNodeData)
focal_class.class_method_signature: SparkModelParser.extractNodeDataFromParquetRow(SimpleGroup g)
focal_class.full_signature: @NotNull private static SparkModelParser.NodeData extractNodeDataFromParquetRow(SimpleGroup g)
focal_class.identifier: extractNodeDataFromParquetRow
focal_class.modifiers: @NotNull private static
focal_class.parameters: (SimpleGroup g)
focal_class.return: SparkModelParser.NodeData
focal_class.signature: SparkModelParser.NodeData extractNodeDataFromParquetRow(SimpleGroup g)
focal_class.class_method_signature: SparkModelParser.printGroup(Group g)
focal_class.full_signature: private static void printGroup(Group g)
focal_class.identifier: printGroup
focal_class.modifiers: private static
focal_class.parameters: (Group g)
focal_class.return: void
focal_class.signature: void printGroup(Group g)
focal_class.class_method_signature: SparkModelParser.loadLinearSVMModel(String pathToMdl)
focal_class.full_signature: private static Model loadLinearSVMModel(String pathToMdl)
focal_class.identifier: loadLinearSVMModel
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl)
focal_class.return: Model
focal_class.signature: Model loadLinearSVMModel(String pathToMdl)
focal_class.class_method_signature: SparkModelParser.loadLinRegModel(String pathToMdl)
focal_class.full_signature: private static Model loadLinRegModel(String pathToMdl)
focal_class.identifier: loadLinRegModel
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl)
focal_class.return: Model
focal_class.signature: Model loadLinRegModel(String pathToMdl)
focal_class.class_method_signature: SparkModelParser.loadLogRegModel(String pathToMdl)
focal_class.full_signature: private static Model loadLogRegModel(String pathToMdl)
focal_class.identifier: loadLogRegModel
focal_class.modifiers: private static
focal_class.parameters: (String pathToMdl)
focal_class.return: Model
focal_class.signature: Model loadLogRegModel(String pathToMdl)
focal_class.class_method_signature: SparkModelParser.readSVMInterceptor(SimpleGroup g)
focal_class.full_signature: private static double readSVMInterceptor(SimpleGroup g)
focal_class.identifier: readSVMInterceptor
focal_class.modifiers: private static
focal_class.parameters: (SimpleGroup g)
focal_class.return: double
focal_class.signature: double readSVMInterceptor(SimpleGroup g)
focal_class.class_method_signature: SparkModelParser.readSVMCoefficients(SimpleGroup g)
focal_class.full_signature: private static Vector readSVMCoefficients(SimpleGroup g)
focal_class.identifier: readSVMCoefficients
focal_class.modifiers: private static
focal_class.parameters: (SimpleGroup g)
focal_class.return: Vector
focal_class.signature: Vector readSVMCoefficients(SimpleGroup g)
focal_class.class_method_signature: SparkModelParser.readLinRegInterceptor(SimpleGroup g)
focal_class.full_signature: private static double readLinRegInterceptor(SimpleGroup g)
focal_class.identifier: readLinRegInterceptor
focal_class.modifiers: private static
focal_class.parameters: (SimpleGroup g)
focal_class.return: double
focal_class.signature: double readLinRegInterceptor(SimpleGroup g)
focal_class.class_method_signature: SparkModelParser.readLinRegCoefficients(SimpleGroup g)
focal_class.full_signature: private static Vector readLinRegCoefficients(SimpleGroup g)
focal_class.identifier: readLinRegCoefficients
focal_class.modifiers: private static
focal_class.parameters: (SimpleGroup g)
focal_class.return: Vector
focal_class.signature: Vector readLinRegCoefficients(SimpleGroup g)
focal_class.class_method_signature: SparkModelParser.readInterceptor(SimpleGroup g)
focal_class.full_signature: private static double readInterceptor(SimpleGroup g)
focal_class.identifier: readInterceptor
focal_class.modifiers: private static
focal_class.parameters: (SimpleGroup g)
focal_class.return: double
focal_class.signature: double readInterceptor(SimpleGroup g)
focal_class.class_method_signature: SparkModelParser.readCoefficients(SimpleGroup g)
focal_class.full_signature: private static Vector readCoefficients(SimpleGroup g)
focal_class.identifier: readCoefficients
focal_class.modifiers: private static
focal_class.parameters: (SimpleGroup g)
focal_class.return: Vector
focal_class.signature: Vector readCoefficients(SimpleGroup g)
focal_method.body: public static Model parse(String pathToMdl, SupportedSparkModels parsedSparkMdl) throws IllegalArgumentException {
          File mdlDir = IgniteUtils.resolveIgnitePath(pathToMdl);
  
          if (mdlDir == null)
              throw new IllegalArgumentException("Directory not found or empty [directory_path=" + pathToMdl + "]");
  
          if (!mdlDir.isDirectory())
              throw new IllegalArgumentException("Spark Model Parser supports loading from directory only. " +
                  "The specified path " + pathToMdl + " is not the path to directory.");
  
          String[] files = mdlDir.list();
          if (files.length == 0)
              throw new IllegalArgumentException("Directory contain 0 files and sub-directories [directory_path=" + pathToMdl + "]");
  
          if (Arrays.stream(files).noneMatch("data"::equals))
              throw new IllegalArgumentException("Directory should contain data sub-directory [directory_path=" + pathToMdl + "]");
  
          if (Arrays.stream(files).noneMatch("metadata"::equals))
              throw new IllegalArgumentException("Directory should contain metadata sub-directory [directory_path=" + pathToMdl + "]");
  
          String pathToData = pathToMdl + File.separator + "data";
          File dataDir = IgniteUtils.resolveIgnitePath(pathToData);
  
          File[] dataParquetFiles = dataDir.listFiles((dir, name) -> name.matches("^part-.*\\.snappy\\.parquet$"));
          if (dataParquetFiles.length == 0)
              throw new IllegalArgumentException("Directory should contain parquet file " +
                  "with model [directory_path=" + pathToData + "]");
  
          if (dataParquetFiles.length > 1)
              throw new IllegalArgumentException("Directory should contain only one parquet file " +
                  "with model [directory_path=" + pathToData + "]");
  
          String pathToMdlFile = dataParquetFiles[0].getPath();
  
          String pathToMetadata = pathToMdl + File.separator + "metadata";
          File metadataDir = IgniteUtils.resolveIgnitePath(pathToMetadata);
          String[] metadataFiles = metadataDir.list();
  
          if (Arrays.stream(metadataFiles).noneMatch("part-00000"::equals))
              throw new IllegalArgumentException("Directory should contain json file with model metadata " +
                  "with name part-00000 [directory_path=" + pathToMetadata + "]");
  
          try {
              validateMetadata(pathToMetadata, parsedSparkMdl);
          }
          catch (FileNotFoundException e) {
              throw new IllegalArgumentException("Directory should contain json file with model metadata " +
                  "with name part-00000 [directory_path=" + pathToMetadata + "]");
          }
  
          if (shouldContainTreeMetadataSubDirectory(parsedSparkMdl)) {
              if (Arrays.stream(files).noneMatch("treesMetadata"::equals))
                  throw new IllegalArgumentException("Directory should contain treeMetadata sub-directory [directory_path=" + pathToMdl + "]");
  
              String pathToTreesMetadata = pathToMdl + File.separator + "treesMetadata";
              File treesMetadataDir = IgniteUtils.resolveIgnitePath(pathToTreesMetadata);
  
              File[] treesMetadataParquetFiles = treesMetadataDir.listFiles((dir, name) -> name.matches("^part-.*\\.snappy\\.parquet$"));
              if (treesMetadataParquetFiles.length == 0)
                  throw new IllegalArgumentException("Directory should contain parquet file " +
                      "with model treesMetadata [directory_path=" + pathToTreesMetadata + "]");
  
              if (treesMetadataParquetFiles.length > 1)
                  throw new IllegalArgumentException("Directory should contain only one parquet file " +
                      "with model [directory_path=" + pathToTreesMetadata + "]");
  
              String pathToTreesMetadataFile = treesMetadataParquetFiles[0].getPath();
  
              return parseDataWithMetadata(pathToMdlFile, pathToTreesMetadataFile, parsedSparkMdl);
          }
          else
              return parseData(pathToMdlFile, parsedSparkMdl);
      }
focal_method.class_method_signature: SparkModelParser.parse(String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_method.full_signature: public static Model parse(String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_method.identifier: parse
focal_method.invocations: resolveIgnitePath isDirectory list noneMatch stream noneMatch stream resolveIgnitePath listFiles matches getPath resolveIgnitePath list noneMatch stream validateMetadata shouldContainTreeMetadataSubDirectory noneMatch stream resolveIgnitePath listFiles matches getPath parseDataWithMetadata parseData
focal_method.modifiers: public static
focal_method.parameters: (String pathToMdl, SupportedSparkModels parsedSparkMdl)
focal_method.return: Model
focal_method.signature: Model parse(String pathToMdl, SupportedSparkModels parsedSparkMdl)