Skip to main content

ML - FloatMLBuilder

ML.FloatMLBuilder

A builder to define (and optionally train) a machine learning model.

Type parameters

NameType
Nameextends string
Featuresextends Record
Modelextends FloatMLModel

Hierarchy

  • AbstractMLBuilder

    FloatMLBuilder

ML

model

model(model_type):

FloatMLBuilder

Define which MLModel to use.

Type parameters

NameType
Mextends FloatMLModel

Parameters

NameTypeDescription
model_typeMthe FloatMLModel to apply

Returns

FloatMLBuilder

Example

  // create a gradient boosted tree
const boosted_tree = new MLModelBuilder("ML Training")
.feature("x", FloatType)
.output(FloatType)
.model({ type: "boosted_tree", noise: "none" })

// create a gradient boosted tree
const gaussian_process = new MLModelBuilder("ML Training")
.feature("x", FloatType)
.output(FloatType)
.model({ type: "gaussian_process", noise: "gaussian" })

modelStream

modelStream():

Stream

Return the datastream containing the parameters of trained ML model.

Returns

Stream

The parameter

Stream

Overrides

AbstractMLBuilder.modelStream


toTemplate

toTemplate():

Template

Convert the built ML model into an

Template, for inclusion in an EDK project.

Returns

Template

The

Template containing the ML Model

Overrides

AbstractMLBuilder.toTemplate


trainFromPipeline

trainFromPipeline(config):

FloatMLBuilder

Create a training task based on some input data assembed by a pipeline.

Type parameters

NameType
Outputextends string

Parameters

NameTypeDescription
configObject(optional) the training configuration MLTrainingConfiguration
config.config?Partial<MLTrainingConfiguration>-
config.output_nameOutput-
config.pipeline(builder: PipelineBuilder) => TabularPipelineBuilder<DictType<StringType, StructType<Features & { [K in string]: FloatType }>>, Record>-

Returns

FloatMLBuilder

Example

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

// create a gradient boosted tree
const ml_model = new MLModelBuilder("ML Training")
.feature("x", FloatType)
.output(FloatType)
.model({ type: "boosted_trees", noise: "none" })
.trainFromPipeline({
output_name: "y",
pipeline: builder => builder
.from(training_stream)
.filter(fields => Greater(fields.x, 0)),
});

trainFromStream

trainFromStream(config):

FloatMLBuilder

Create a training task based on some input data in an existing datastream.

Type parameters

NameType
Outputextends string

Parameters

NameTypeDescription
configObjectthe configuration for training (optional)
config.config?Partial<MLTrainingConfiguration>-
config.inputStream<DictType<StringType, StructType<Features & { [K in string]: FloatType }>>>-
config.output_nameOutput-

Returns

FloatMLBuilder

Example

  // use a DictType stream
const training_stream = Stream(
"My Stream",
DictType(
StringType,
StructType({
x: FloatType,
y: 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,
});

trainingStream

trainingStream():

Stream<DictType<StringType, StructType<{ features: StructType ; output: FloatType ; test: BooleanType ; train: BooleanType }>>>

Return a datastream containing the training data associated predictions.

Returns

Stream<DictType<StringType, StructType<{ features: StructType ; output: FloatType ; test: BooleanType ; train: BooleanType }>>>

The training

Stream

Overrides

AbstractMLBuilder.trainingStream


validationStream

validationStream():

Stream<DictType<StringType, StructType<{ hyperparameters: DictType ; n_test: IntegerType ; n_train: IntegerType ; test_rmse: FloatType ; test_stddev: FloatType ; train_rmse: FloatType ; train_stddev: FloatType }>>>

Return a datastream containing training statistics per training iteration

Returns

Stream<DictType<StringType, StructType<{ hyperparameters: DictType ; n_test: IntegerType ; n_train: IntegerType ; test_rmse: FloatType ; test_stddev: FloatType ; train_rmse: FloatType ; train_stddev: FloatType }>>>

The validation

Stream