use of io.automatiko.engine.addons.predictions.api.PredictionAwareHumanTaskLifeCycle in project automatiko-engine by automatiko-io.
the class SmileRandomForestPredictionTest method configure.
@BeforeEach
public void configure() {
final RandomForestConfiguration configuration = new RandomForestConfiguration();
final Map<String, AttributeType> inputFeatures = new HashMap<>();
inputFeatures.put("ActorId", AttributeType.NOMINAL);
configuration.setInputFeatures(inputFeatures);
configuration.setOutcomeName("output");
configuration.setOutcomeType(AttributeType.NOMINAL);
configuration.setConfidenceThreshold(0.7);
configuration.setNumTrees(1);
predictionService = new SmileRandomForest(configuration);
CachedWorkItemHandlerConfig wiConfig = new CachedWorkItemHandlerConfig();
wiConfig.register("Human Task", new HumanTaskWorkItemHandler(new PredictionAwareHumanTaskLifeCycle(predictionService)));
config = new StaticProcessConfig(wiConfig, new DefaultProcessEventListenerConfig(), new DefaultUnitOfWorkManager(new CollectingUnitOfWorkFactory()), null, new DefaultVariableInitializer(), null);
for (int i = 0; i < 10; i++) {
predictionService.train(null, Collections.singletonMap("ActorId", "john"), Collections.singletonMap("output", "predicted value"));
}
for (int i = 0; i < 8; i++) {
predictionService.train(null, Collections.singletonMap("ActorId", "mary"), Collections.singletonMap("output", "value"));
}
}
Aggregations