ML - FloatMLBuilder
ML.FloatMLBuilderA builder to define (and optionally train) a machine learning model.
Type parameters
| Name | Type |
|---|---|
Name | extends string |
Features | extends Record |
Model | extends FloatMLModel |
Hierarchy
-
AbstractMLBuilder↳
FloatMLBuilder
ML
model
▸ model(model_type):
FloatMLBuilder
Define which MLModel to use.
Type parameters
| Name | Type |
|---|---|
M | extends FloatMLModel |
Parameters
| Name | Type | Description |
|---|---|---|
model_type | M | the 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
StreamOverrides
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 ModelOverrides
AbstractMLBuilder.toTemplate
trainFromPipeline
▸ trainFromPipeline(config):
FloatMLBuilder
Create a training task based on some input data assembed by a pipeline.
Type parameters
| Name | Type |
|---|---|
Output | extends string |
Parameters
| Name | Type | Description |
|---|---|---|
config | Object | (optional) the training configuration MLTrainingConfiguration |
config.config? | Partial<MLTrainingConfiguration> | - |
config.output_name | Output | - |
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
| Name | Type |
|---|---|
Output | extends string |
Parameters
| Name | Type | Description |
|---|---|---|
config | Object | the configuration for training (optional) |
config.config? | Partial<MLTrainingConfiguration> | - |
config.input | Stream<DictType<StringType, StructType<Features & { [K in string]: FloatType }>>> | - |
config.output_name | Output | - |
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
StreamOverrides
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