Search in sources :

Example 1 with IRCFComputeDescriptor

use of com.amazon.randomcutforest.parkservices.IRCFComputeDescriptor in project random-cut-forest-by-aws by aws.

the class ThresholdedRandomCutForestMapper method toState.

@Override
public ThresholdedRandomCutForestState toState(ThresholdedRandomCutForest model) {
    ThresholdedRandomCutForestState state = new ThresholdedRandomCutForestState();
    RandomCutForestMapper randomCutForestMapper = new RandomCutForestMapper();
    randomCutForestMapper.setPartialTreeStateEnabled(true);
    randomCutForestMapper.setSaveTreeStateEnabled(true);
    randomCutForestMapper.setCompressionEnabled(true);
    randomCutForestMapper.setSaveCoordinatorStateEnabled(true);
    randomCutForestMapper.setSaveExecutorContextEnabled(true);
    state.setForestState(randomCutForestMapper.toState(model.getForest()));
    BasicThresholderMapper thresholderMapper = new BasicThresholderMapper();
    state.setThresholderState(thresholderMapper.toState(model.getThresholder()));
    PreprocessorMapper preprocessorMapper = new PreprocessorMapper();
    state.setPreprocessorStates(new PreprocessorState[] { preprocessorMapper.toState((Preprocessor) model.getPreprocessor()) });
    state.setTriggerFactor(model.getPredictorCorrector().getTriggerFactor());
    state.setIgnoreSimilar(model.getPredictorCorrector().isIgnoreSimilar());
    state.setIgnoreSimilarFactor(model.getPredictorCorrector().getIgnoreSimilarFactor());
    state.setNumberOfAttributors(model.getPredictorCorrector().getNumberOfAttributors());
    state.setForestMode(model.getForestMode().name());
    state.setTransformMethod(model.getTransformMethod().name());
    IRCFComputeDescriptor descriptor = model.getLastAnomalyDescriptor();
    state.setLastAnomalyTimeStamp(descriptor.getInternalTimeStamp());
    state.setLastAnomalyScore(descriptor.getRCFScore());
    state.setLastAnomalyAttribution(new DiVectorMapper().toState(descriptor.getAttribution()));
    state.setLastAnomalyPoint(descriptor.getRCFPoint());
    state.setLastExpectedPoint(descriptor.getExpectedRCFPoint());
    state.setLastRelativeIndex(descriptor.getRelativeIndex());
    return state;
}
Also used : IRCFComputeDescriptor(com.amazon.randomcutforest.parkservices.IRCFComputeDescriptor) BasicThresholderMapper(com.amazon.randomcutforest.parkservices.state.threshold.BasicThresholderMapper) RandomCutForestMapper(com.amazon.randomcutforest.state.RandomCutForestMapper) DiVectorMapper(com.amazon.randomcutforest.state.returntypes.DiVectorMapper) Preprocessor(com.amazon.randomcutforest.parkservices.preprocessor.Preprocessor) PreprocessorMapper(com.amazon.randomcutforest.parkservices.state.preprocessor.PreprocessorMapper)

Aggregations

IRCFComputeDescriptor (com.amazon.randomcutforest.parkservices.IRCFComputeDescriptor)1 Preprocessor (com.amazon.randomcutforest.parkservices.preprocessor.Preprocessor)1 PreprocessorMapper (com.amazon.randomcutforest.parkservices.state.preprocessor.PreprocessorMapper)1 BasicThresholderMapper (com.amazon.randomcutforest.parkservices.state.threshold.BasicThresholderMapper)1 RandomCutForestMapper (com.amazon.randomcutforest.state.RandomCutForestMapper)1 DiVectorMapper (com.amazon.randomcutforest.state.returntypes.DiVectorMapper)1