@Test public void testCheckNoFieldsOfTypeOK() { final DatasetSchema schemaWithoutCat = TestDatasetSchemaBuilder.builder() .withNumericalFields(3) .withStringFields(3) .build(); assertThat(ValidationUtils.checkNoFieldsOfType(schemaWithoutCat, CategoricalValueSchema.class)) .as("Validation of a schema without categoricals") .isEmpty(); }
public static List<ParamValidationError> checkNoFieldsOfType(final DatasetSchema schema, final Class<? extends AbstractValueSchema> fieldClass) { final ImmutableList.Builder<ParamValidationError> errors = ImmutableList.builder(); schema.getPredictiveFields().stream() .filter(field -> fieldClass.isInstance(field.getValueSchema())) .forEach(field -> errors.add( new ParamValidationError(String.format( "field [%s] is of unsupported type [%s]", field.getFieldName(), LoadSchemaUtils.getValueSchemaTypeToString(field.getValueSchema()) )) )); return errors.build(); }
ValidationUtils { public static List<ParamValidationError> checkNoFieldsOfType(final DatasetSchema schema, final Class<? extends AbstractValueSchema> fieldClass) { final ImmutableList.Builder<ParamValidationError> errors = ImmutableList.builder(); schema.getPredictiveFields().stream() .filter(field -> fieldClass.isInstance(field.getValueSchema())) .forEach(field -> errors.add( new ParamValidationError(String.format( "field [%s] is of unsupported type [%s]", field.getFieldName(), LoadSchemaUtils.getValueSchemaTypeToString(field.getValueSchema()) )) )); return errors.build(); } }
ValidationUtils { public static List<ParamValidationError> checkNoFieldsOfType(final DatasetSchema schema, final Class<? extends AbstractValueSchema> fieldClass) { final ImmutableList.Builder<ParamValidationError> errors = ImmutableList.builder(); schema.getPredictiveFields().stream() .filter(field -> fieldClass.isInstance(field.getValueSchema())) .forEach(field -> errors.add( new ParamValidationError(String.format( "field [%s] is of unsupported type [%s]", field.getFieldName(), LoadSchemaUtils.getValueSchemaTypeToString(field.getValueSchema()) )) )); return errors.build(); } private  ValidationUtils(); }
ValidationUtils { public static List<ParamValidationError> checkNoFieldsOfType(final DatasetSchema schema, final Class<? extends AbstractValueSchema> fieldClass) { final ImmutableList.Builder<ParamValidationError> errors = ImmutableList.builder(); schema.getPredictiveFields().stream() .filter(field -> fieldClass.isInstance(field.getValueSchema())) .forEach(field -> errors.add( new ParamValidationError(String.format( "field [%s] is of unsupported type [%s]", field.getFieldName(), LoadSchemaUtils.getValueSchemaTypeToString(field.getValueSchema()) )) )); return errors.build(); } private  ValidationUtils(); static List<ParamValidationError> checkParams(final MLAlgorithmDescriptor algorithmDescriptor, final Map<String, String> params); static Optional<ParamValidationError> validateCategoricalSchema(final DatasetSchema schema); static List<ParamValidationError> validateModelInDir(final Path modelPath); static List<ParamValidationError> baseLoadValidations(final DatasetSchema schema, final Map<String, String> params); static List<ParamValidationError> checkNoFieldsOfType(final DatasetSchema schema,
                                                                 final Class<? extends AbstractValueSchema> fieldClass); static List<ParamValidationError> validateModelPathToTrain(final Path pathToPersist); }
ValidationUtils { public static List<ParamValidationError> checkNoFieldsOfType(final DatasetSchema schema, final Class<? extends AbstractValueSchema> fieldClass) { final ImmutableList.Builder<ParamValidationError> errors = ImmutableList.builder(); schema.getPredictiveFields().stream() .filter(field -> fieldClass.isInstance(field.getValueSchema())) .forEach(field -> errors.add( new ParamValidationError(String.format( "field [%s] is of unsupported type [%s]", field.getFieldName(), LoadSchemaUtils.getValueSchemaTypeToString(field.getValueSchema()) )) )); return errors.build(); } private  ValidationUtils(); static List<ParamValidationError> checkParams(final MLAlgorithmDescriptor algorithmDescriptor, final Map<String, String> params); static Optional<ParamValidationError> validateCategoricalSchema(final DatasetSchema schema); static List<ParamValidationError> validateModelInDir(final Path modelPath); static List<ParamValidationError> baseLoadValidations(final DatasetSchema schema, final Map<String, String> params); static List<ParamValidationError> checkNoFieldsOfType(final DatasetSchema schema,
                                                                 final Class<? extends AbstractValueSchema> fieldClass); static List<ParamValidationError> validateModelPathToTrain(final Path pathToPersist);  }