Skip to main content

ML - MLModelEvaluatorBuilder

ML.MLModelEvaluatorBuilder

A builder to create ML predictions made from provided features

Type parameters

NameType
Outputextends EastType
Featuresextends Record

ML

predict

predict(featureStream):

MLExamplesEvaluatorBuilder

Predict outputs from a stream of features

Parameters

NameType
featureStreamStream<DictType<StringType, StructType>>

Returns

MLExamplesEvaluatorBuilder

Example

  // use a DictType stream
const training_stream = Stream(
"My Training Stream",
DictType(
StringType,
StructType({
x: FloatType,
y: FloatType,
})
)
);

const prediction_stream = Stream(
"My Prediction Stream",
DictType(
StringType,
StructType({
x: FloatType,
})
)
);

// create a gradient boosted tree
const ml_model = new MLModelBuilder("ML Training")
.feature("x", FloatType)
.output(FloatType)
.model({ type: "boosted_trees", noise: "none" })
.trainFromStream({
output_name: "y",
input: training_stream,
});

// predict the model outputs from features
const ml_prediction = new MLPredictionBuilder("ML Prediction")
.model(ml_model)
.predict(prediction_stream);