Skip navigation links

Package ai.h2o.mojos.runtime.frame

The package exposes classes to support frame and row creation.

See: Description

Package ai.h2o.mojos.runtime.frame Description

The package exposes classes to support frame and row creation.

The package expose the following concepts:

The MojoFrame represents data which are transformed by MojoPipeline. The frame consists of columns MojoColumn, each column has defined type MojoColumn.Type.

The MojoFrame is constructed with help of MojoFrameBuilder. The builder which helps to create input frame for a given MOJO pipeline can be obtain by calling MojoPipeline.getInputFrameBuilder().

The frame builder provides a method MojoFrameBuilder.getMojoRowBuilder() to obtain an instance of MojoRowBuilder. The row builder helps to create representation of row. The row constructed by the row builder, is appended to the frame builder by calling method MojoFrameBuilder.addRow(ai.h2o.mojos.runtime.frame.MojoRowBuilder).

The row can be constructed in two ways:

Note: Instances of MojoRowBuilder can be reused after calling MojoRowBuilder


Example:

Given a pipeline modelPipeline we can construct an input frame in the following way:

// Get an input frame builder for given modelPipeline
MojoFrameBuilder frameBuilder = modelPipeline.getInputFrameBuilder();

// Create a new row builder
MojoRowBuilder rowBuilder = frameBuilder.getMojoRowBuilder();
rowBuilder.setValue("AGE", "68");
rowBuilder.setValue("RACE", "2");
rowBuilder.setValue("DCAPS", "2");
rowBuilder.setValue("VOL", "0");
rowBuilder.setValue("GLEASON", "6");
frameBuilder.addRow(rowBuilder);

// Create a frame which can be transformed by MOJO pipeline
MojoFrame iframe = frameBuilder.toMojoFrame();

// Transform frame by the given modelPipeline:
MojoFrame oframe = modelPipeline.transform(iframe);
Skip navigation links