coremltools.models.pipeline¶
Pipeline utils for this package.
Functions
set_classifier_interface_params (spec, ...[, ...]) |
Common utilities to set the regression interface params. |
set_regressor_interface_params (spec, ...) |
Common utilities to set the regresson interface params. |
set_transform_interface_params (spec, ...[, ...]) |
Common utilities to set transform interface params. |
Classes
Pipeline (input_features, output_features) |
A pipeline model that exposes a sequence of models as a single model, It requires a set of inputs, a sequence of other models and a set of outputs. |
PipelineClassifier (input_features, class_labels) |
A pipeline model that exposes a sequence of models as a single model, It requires a set of inputs, a sequence of other models and a set of outputs. |
PipelineRegressor (input_features, ...) |
A pipeline model that exposes a sequence of models as a single model, It requires a set of inputs, a sequence of other models and a set of outputs. |
-
class
coremltools.models.pipeline.
Pipeline
(input_features, output_features)¶ A pipeline model that exposes a sequence of models as a single model, It requires a set of inputs, a sequence of other models and a set of outputs.
This class is the base class for
PipelineClassifier
andPipelineRegressor
, which contain a sequence ending in a classifier or regressor and themselves behave like a classifier or regressor. This class may be used directly for a sequence of feature transformer objects.-
__init__
(input_features, output_features)¶ Create a pipleine of models to be executed sequentially.
Parameters: input_features: [list of 2-tuples]
Name(s) of the input features, given as a list of (‘name’, datatype) tuples. The datatypes entry can be any of the data types defined in the
models.datatypes
module.output_features: [list of features]
Name(s) of the output features, given as a list of (‘name’,datatype) tuples. The datatypes entry can be any of the data types defined in the
models.datatypes
module. All features must be either defined in the inputs or be produced by one of the contained models.
-
add_model
(spec)¶ Add a protobuf spec or
models.MLModel
instance to the pipeline.All input features of this model must either match the input_features of the pipeline, or match the outputs of a previous model.
Parameters: spec: [MLModel, Model_pb2]
A protobuf spec or MLModel instance containing a model.
-
-
class
coremltools.models.pipeline.
PipelineClassifier
(input_features, class_labels, output_features=None)¶ A pipeline model that exposes a sequence of models as a single model, It requires a set of inputs, a sequence of other models and a set of outputs. In this case, the sequence of models must end in a regression model, and the pipeline itself behaves as a regression model.
-
__init__
(input_features, class_labels, output_features=None)¶ Create a set of pipleine models given a set of model specs. The last model in this list must be a classifier model.
Parameters: input_features: [list of 2-tuples]
Name(s) of the input features, given as a list of (‘name’, datatype) tuples. The datatypes entry can be any of the data types defined in the
models.datatypes
module.class_labels: [list]
A list of string or integer class labels to use in making predictions. This list must match the class labels in the final classifier model.
output_features: [list]
A string or a list of two strings specifying the names of the two output features, the first being a class label corresponding to the class with the highest predicted score, and the second being a dictionary mapping each class to its score. If output_features is a string, it specifies the predicted class label and the class scores is set to the default value of “classProbability.”
-
add_model
(spec)¶ Add a protobuf spec or
models.MLModel
instance to the pipeline.All input features of this model must either match the input_features of the pipeline, or match the outputs of a previous model.
Parameters: spec: [MLModel, Model_pb2]
A protobuf spec or MLModel instance containing a model.
-
-
class
coremltools.models.pipeline.
PipelineRegressor
(input_features, output_features)¶ A pipeline model that exposes a sequence of models as a single model, It requires a set of inputs, a sequence of other models and a set of outputs. In this case, the sequence of models must end in a regression model, and the pipeline itself behaves as a regression model.
-
__init__
(input_features, output_features)¶ Create a set of pipleine models given a set of model specs. The final output model must be a regression model.
Parameters: input_features: [list of 2-tuples]
Name(s) of the input features, given as a list of (‘name’, datatype) tuples. The datatypes entry can be any of the data types defined in the
models.datatypes
module.output_features: [list of features]
Name(s) of the output features, given as a list of (‘name’,datatype) tuples. The datatypes entry can be any of the data types defined in the
models.datatypes
module. All features must be either defined in the inputs or be produced by one of the contained models.
-
add_model
(spec)¶ Add a protobuf spec or
models.MLModel
instance to the pipeline.All input features of this model must either match the input_features of the pipeline, or match the outputs of a previous model.
Parameters: spec: [MLModel, Model_pb2]
A protobuf spec or MLModel instance containing a model.
-