MemoryMapState.Factory perceptronModelStateFactory = new MemoryMapState.Factory();
TridentState perceptronModel = toppology.newStaticState(perceptronModelStateFactory);
TridentState perceptronEvaluation = toppology.newStaticState(evaluationStateFactory);
// Predict
Stream predictionStream = toppology.newStream("nandsamples", new NANDSpout()) //
.stateQuery(perceptronModel, new Fields("instance"), new ClassifyQuery<Boolean>("perceptron"), new Fields("prediction"));
// Update evaluation
predictionStream //
.persistentAggregate(evaluationStateFactory, new Fields("instance", "prediction"), new AccuracyAggregator<Boolean>(), new Fields("accuracy"));