code: public static void validatePMMLVsSchema(PMML pmml, InputSchema schema) {
      List<Model> models = pmml.getModels();
      Preconditions.checkArgument(models.size() == 1,
                                  "Should have exactly one model, but had %s", models.size());
  
      Model model = models.get(0);
      MiningFunction function = model.getMiningFunction();
      if (schema.isClassification()) {
        Preconditions.checkArgument(function == MiningFunction.CLASSIFICATION,
                                    "Expected classification function type but got %s",
                                    function);
      } else {
        Preconditions.checkArgument(function == MiningFunction.REGRESSION,
                                    "Expected regression function type but got %s",
                                    function);
      }
  
      DataDictionary dictionary = pmml.getDataDictionary();
      Preconditions.checkArgument(
          schema.getFeatureNames().equals(AppPMMLUtils.getFeatureNames(dictionary)),
          "Feature names in schema don't match names in PMML");
  
      MiningSchema miningSchema = model.getMiningSchema();
      Preconditions.checkArgument(schema.getFeatureNames().equals(
          AppPMMLUtils.getFeatureNames(miningSchema)));
  
      Integer pmmlIndex = AppPMMLUtils.findTargetIndex(miningSchema);
      if (schema.hasTarget()) {
        int schemaIndex = schema.getTargetFeatureIndex();
        Preconditions.checkArgument(
            pmmlIndex != null && schemaIndex == pmmlIndex,
            "Configured schema expects target at index %s, but PMML has target at index %s",
            schemaIndex, pmmlIndex);
      } else {
        Preconditions.checkArgument(pmmlIndex == null);
      }
    }
docs: Validates that the encoded PMML model received matches expected schema.
  
  @param pmml {@link PMML} encoding of a decision forest
  @param schema expected schema attributes of decision forest