use of io.hops.hopsworks.common.featurestore.trainingdatasets.split.TrainingDatasetSplitDTO in project hopsworks by logicalclocks.
the class TestTrainingDatasetInputValidation method setup.
@Before
public void setup() {
splits = new ArrayList<>();
splits.add(new TrainingDatasetSplitDTO("train", 0.8f));
splits.add(new TrainingDatasetSplitDTO("test", 0.2f));
}
use of io.hops.hopsworks.common.featurestore.trainingdatasets.split.TrainingDatasetSplitDTO in project hopsworks by logicalclocks.
the class TrainingDatasetInputValidation method validateSplits.
private void validateSplits(List<TrainingDatasetSplitDTO> trainingDatasetSplitDTOs) throws FeaturestoreException {
if (trainingDatasetSplitDTOs != null && !trainingDatasetSplitDTOs.isEmpty()) {
Pattern namePattern = FeaturestoreConstants.FEATURESTORE_REGEX;
Set<String> splitNames = new HashSet<>();
for (TrainingDatasetSplitDTO trainingDatasetSplitDTO : trainingDatasetSplitDTOs) {
if (!namePattern.matcher(trainingDatasetSplitDTO.getName()).matches()) {
throw new FeaturestoreException(RESTCodes.FeaturestoreErrorCode.ILLEGAL_TRAINING_DATASET_SPLIT_NAME, Level.FINE, ", the provided training dataset split name " + trainingDatasetSplitDTO.getName() + " is " + "invalid. Split names can only contain lower case characters, numbers and underscores and cannot be " + "longer than " + FeaturestoreConstants.FEATURESTORE_ENTITY_NAME_MAX_LENGTH + " characters or empty.");
}
if (trainingDatasetSplitDTO.getPercentage() == null) {
throw new FeaturestoreException(RESTCodes.FeaturestoreErrorCode.ILLEGAL_TRAINING_DATASET_SPLIT_PERCENTAGE, Level.FINE, ", the provided training dataset split percentage is invalid. " + "Percentages can only be numeric. Weights will be normalized if they don’t sum up to 1.0.");
}
if (!splitNames.add(trainingDatasetSplitDTO.getName())) {
throw new FeaturestoreException(RESTCodes.FeaturestoreErrorCode.TRAINING_DATASET_DUPLICATE_SPLIT_NAMES, Level.FINE, " The split names must be unique");
}
}
}
}
Aggregations