Search in sources :

Example 1 with IterativeStreamingWindowedCompute

use of edu.iu.dsc.tws.examples.ml.svm.compute.window.IterativeStreamingWindowedCompute in project twister2 by DSC-SPIDAL.

the class SvmSgdOnlineRunner method getWindowSinkInstance.

private BaseWindowedSink getWindowSinkInstance() {
    BaseWindowedSink baseWindowedSink = new IterativeStreamingWindowedCompute(new ProcessWindowFunctionImpl(), OperationMode.STREAMING, this.svmJobParameters, this.binaryBatchModel, "online-training-graph");
    WindowArguments windowArguments = this.svmJobParameters.getWindowArguments();
    TimeUnit timeUnit = TimeUnit.MICROSECONDS;
    if (windowArguments != null) {
        WindowType windowType = windowArguments.getWindowType();
        if (windowArguments.isDuration()) {
            if (windowType.equals(WindowType.TUMBLING)) {
                baseWindowedSink.withTumblingDurationWindow(windowArguments.getWindowLength(), timeUnit);
            }
            if (windowType.equals(WindowType.SLIDING)) {
                baseWindowedSink.withSlidingDurationWindow(windowArguments.getWindowLength(), timeUnit, windowArguments.getSlidingLength(), timeUnit);
            }
        } else {
            if (windowType.equals(WindowType.TUMBLING)) {
                baseWindowedSink.withTumblingCountWindow(windowArguments.getWindowLength());
            }
            if (windowType.equals(WindowType.SLIDING)) {
                baseWindowedSink.withSlidingCountWindow(windowArguments.getWindowLength(), windowArguments.getSlidingLength());
            }
        }
    }
    return baseWindowedSink;
}
Also used : IterativeStreamingWindowedCompute(edu.iu.dsc.tws.examples.ml.svm.compute.window.IterativeStreamingWindowedCompute) BaseWindowedSink(edu.iu.dsc.tws.task.window.core.BaseWindowedSink) WindowArguments(edu.iu.dsc.tws.examples.ml.svm.util.WindowArguments) TimeUnit(java.util.concurrent.TimeUnit) WindowType(edu.iu.dsc.tws.task.window.constant.WindowType)

Aggregations

IterativeStreamingWindowedCompute (edu.iu.dsc.tws.examples.ml.svm.compute.window.IterativeStreamingWindowedCompute)1 WindowArguments (edu.iu.dsc.tws.examples.ml.svm.util.WindowArguments)1 WindowType (edu.iu.dsc.tws.task.window.constant.WindowType)1 BaseWindowedSink (edu.iu.dsc.tws.task.window.core.BaseWindowedSink)1 TimeUnit (java.util.concurrent.TimeUnit)1