Skip to main content

ML

The

ML module facilitates creation of Automated Machine Learning models to embed into Templates.

Example

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

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

// create a GP to predict demand based on price
const demand = new MLModelBuilder("Demand")
.feature("price", FloatType)
.output(FloatType)
.trainFromStream({
output_name: "qty",
input: training_stream,
});

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

// or alternatively use the model to predict in a process
// create the sales process and add the ml function
// which is evaluated in each sale
const sales = new ProcessBuilder("sales")
// the ml function can be added
.ml(demand)
// the sale needs a price
.value("price", FloatType)
// the ml can be evaluated
.let(
"qty",
(props, _resources, mls) => mls.demand(Struct({ price: props.price }))
)
.mapFromValue({ date: new Date(0), price: 10 });

Classes

  • FloatMLBuilder
  • MLExamplesEvaluatorBuilder
  • MLModelBuilder
  • MLModelEvaluatorBuilder
  • MLPredictionBuilder

Other

FloatMLModel

Ƭ FloatMLModel: Object

The machine learning model applicable to

FloatType outputs

Type declaration

NameType
noiseFloatMLModelNoise
typeFloatMLModelType

FloatMLModelNoise

Ƭ FloatMLModelNoise: "none" | "gaussian"

The noise modelled in the

FloatMLModel output.


FloatMLModelType

Ƭ FloatMLModelType: "boosted_trees" | "constant" | "gaussian_process" | "linear" | "neural_network"

The machine learning model types that can be used for a

FloatMLModel.


MLModelType

Ƭ MLModelType:

FloatMLModelType | StringMLModelType

The machine learning model types that can be used for a MLModel.


MLPredictionConfiguration

Ƭ MLPredictionConfiguration<T>: T extends

FloatType ? { max: EastFunction<FloatType> ; min: EastFunction<FloatType> } : Record<string, never>

Extra configuration that can modify ML evaluation

Type parameters

NameType
Textends EastType = EastType

StringMLModel

Ƭ StringMLModel: Object

The machine learning model applicable to

StringType outputs

Type declaration

NameType
noiseStringMLModelNoise
typeStringMLModelType

StringMLModelNoise

Ƭ StringMLModelNoise: "maximum_likelihood" | "weighted"

The noise modelled in the

StringMLModel output.


StringMLModelType

Ƭ StringMLModelType: "boosted_trees_string" | "neural_network_string"

The machine learning model types that can be used for a

StringMLModel.