Model
CatBoostModel
¶
Bases: ModelInterface
Source code in python/opsml/model/_model.pyi
preprocessor
property
writable
¶
Returns the preprocessor
preprocessor_name
property
¶
Returns the preprocessor name
__init__(model=None, preprocessor=None, sample_data=None, task_type=None, drift_profile=None)
¶
Interface for saving CatBoost models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Optional[Any]
|
Model to associate with the interface. This model must be a CatBoost model. |
None
|
preprocessor
|
Optional[Any]
|
Preprocessor to associate with the model. |
None
|
sample_data
|
Optional[Any]
|
Sample data to use to make predictions. |
None
|
task_type
|
Optional[TaskType]
|
The type of task the model performs |
None
|
drift_profile
|
Optional[DriftProfileType]
|
Drift profile(s) to associate with the model. Must be a dictionary of alias and drift profile. |
None
|
Source code in python/opsml/model/_model.pyi
DataProcessor
¶
Generic class that holds uri information for data preprocessors and postprocessors
Source code in python/opsml/model/_model.pyi
__init__(name, uri)
¶
Define a data processor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the data processor |
required |
uri
|
Path
|
Path to the data processor |
required |
DriftArgs
¶
Source code in python/opsml/model/_model.pyi
active
property
¶
Return the active status of the drift profile.
deactivate_others
property
¶
Return the deactivate_others status of the drift profile.
__init__(active=True, deactivate_others=False)
¶
Define a drift config
Parameters:
Name | Type | Description | Default |
---|---|---|---|
active
|
bool
|
Whether to set the drift profile to active |
True
|
deactivate_others
|
bool
|
Whether to deactivate all other drift profiles of the same space and name |
False
|
Source code in python/opsml/model/_model.pyi
DriftProfileMap
¶
Source code in python/opsml/model/_model.pyi
Feature
¶
Source code in python/opsml/model/_model.pyi
__init__(feature_type, shape, extra_args=None)
¶
Define a feature
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feature_type
|
str
|
The type of the feature |
required |
shape
|
List[int]
|
The shape of the feature |
required |
extra_args
|
Optional[Dict[str, str]]
|
Extra arguments to pass to the feature |
None
|
Source code in python/opsml/model/_model.pyi
__str__()
¶
Return a string representation of the Feature.
Returns:
Type | Description |
---|---|
str
|
String representation of the Feature. |
FeatureSchema
¶
Source code in python/opsml/model/_model.pyi
HuggingFaceModel
¶
Bases: ModelInterface
Source code in python/opsml/model/_model.pyi
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 |
|
feature_extractor
property
writable
¶
Returns the feature extractor. Can be None if the model is a pipeline. If present, will be of type PreTrainedFeatureExtractor
image_processor
property
writable
¶
Returns the image processor. Can be None if the model is a pipeline. If present, will be of type BaseImageProcessor
model
property
writable
¶
Returns as HuggingFace model (PreTrainedModel, TFPreTrainedModel). Can be None if the model is a pipeline.
tokenizer
property
writable
¶
Returns the tokenizer. Can be None if the model is a pipeline. If present, will be of type PreTrainedTokenizerBase
__init__(model=None, tokenizer=None, feature_extractor=None, image_processor=None, sample_data=None, hf_task=None, task_type=None, drift_profile=None)
¶
Interface for saving HuggingFace models and pipelines
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Optional[Any]
|
Model to associate with interface. This can be a HuggingFace pipeline (inherits from Pipeline), or a HuggingFace model (inherits from PreTrainedModel or TFPreTrainedModel). |
None
|
tokenizer
|
Optional[Any]
|
Tokenizer to associate with the model. This must be a HuggingFace tokenizer (PreTrainedTokenizerBase). If using a pipeline that already has a tokenizer, this can be None. |
None
|
feature_extractor
|
Optional[Any]
|
Feature extractor to associate with the model. This must be a HuggingFace feature extractor (PreTrainedFeatureExtractor). If using a pipeline that already has a feature extractor, this can be None. |
None
|
image_processor
|
Optional[Any]
|
Image processor to associate with the model. This must be a HuggingFace image processor (BaseImageProcessor). If using a pipeline that already has an image processor, this can be None. |
None
|
sample_data
|
Optional[Any]
|
Sample data to use to convert to ONNX and make sample predictions. This data must be a HuggingFace-supported type. |
None
|
hf_task
|
Optional[HuggingFaceTask]
|
HuggingFace task to associate with the model. Defaults to Undefined.
Accepted tasks are as follows (taken from HuggingFace pipeline docs):
- |
None
|
task_type
|
Optional[TaskType]
|
The intended task type for the model. Note: This is the OpsML task type, not the HuggingFace task type. |
None
|
drift_profile
|
Optional[DriftProfileType]
|
Drift profile(s) to associate with the model. Must be a dictionary of alias and drift profile. |
None
|
Source code in python/opsml/model/_model.pyi
980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 |
|
save(path, save_kwargs=None)
¶
Save the HuggingFaceModel interface
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Path
|
Base path to save artifacts |
required |
save_kwargs
|
ModelSaveKwargs
|
Optional kwargs to pass to the various underlying methods. This is a passthrough object meaning that the kwargs will be passed to the underlying methods as is and are expected to be supported by the underlying library.
|
None
|
Source code in python/opsml/model/_model.pyi
HuggingFaceOnnxArgs
¶
Source code in python/opsml/model/_model.pyi
__init__(ort_type, provider, quantize=False, config=None, extra_kwargs=None)
¶
Optional Args to use with a huggingface model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ort_type
|
HuggingFaceORTModel
|
Optimum onnx class name |
required |
provider
|
str
|
Onnx runtime provider to use |
required |
config
|
Optional[Any]
|
Optional optimum config to use |
None
|
quantize
|
bool
|
Whether to quantize the model |
False
|
extra_kwargs
|
Optional[Dict[str, Any]]
|
Extra kwargs to pass to the onnx conversion (save_pretrained method for ort models) |
None
|
Source code in python/opsml/model/_model.pyi
LightGBMModel
¶
Bases: ModelInterface
Source code in python/opsml/model/_model.pyi
preprocessor
property
writable
¶
Returns the preprocessor
preprocessor_name
property
¶
Returns the preprocessor name
__init__(model=None, preprocessor=None, sample_data=None, task_type=None, drift_profile=None)
¶
Instantiate a LightGBMModel interface
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Optional[Any]
|
Model to associate with interface. This model must be a lightgbm booster. |
None
|
preprocessor
|
Optional[Any]
|
Preprocessor to associate with the model. |
None
|
sample_data
|
Optional[Any]
|
Sample data to use to make predictions |
None
|
task_type
|
Optional[TaskType]
|
The type of task the model performs |
None
|
drift_profile
|
Optional[DriftProfileType]
|
Drift profile(s) to associate with the model. Must be a dictionary of alias and drift profile. |
None
|
Source code in python/opsml/model/_model.pyi
LightningModel
¶
Bases: ModelInterface
Source code in python/opsml/model/_model.pyi
preprocessor
property
writable
¶
Returns the preprocessor
preprocessor_name
property
¶
Returns the preprocessor name
trainer
property
writable
¶
Returns the trainer
__init__(trainer=None, preprocessor=None, sample_data=None, task_type=None, drift_profile=None)
¶
Interface for saving PyTorch Lightning models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
trainer
|
Optional[Any]
|
Pytorch lightning trainer to associate with interface. |
None
|
preprocessor
|
Optional[Any]
|
Preprocessor to associate with model. |
None
|
sample_data
|
Optional[Any]
|
Sample data to use to convert to ONNX and make sample predictions. This data must be a pytorch-supported type. TorchData interface, torch tensor, torch dataset, Dict[str, torch.Tensor], List[torch.Tensor], Tuple[torch.Tensor]. |
None
|
task_type
|
Optional[TaskType]
|
The intended task type of the model. |
None
|
drift_profile
|
Optional[DriftProfileType]
|
Drift profile(s) to associate with the model. Must be a dictionary of alias and drift profile. |
None
|
Source code in python/opsml/model/_model.pyi
save(path, save_kwargs=None)
¶
Save the LightningModel interface. Lightning models are saved via checkpoints.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Path
|
Base path to save artifacts |
required |
save_kwargs
|
ModelSaveKwargs
|
Optional kwargs to pass to the various underlying methods. This is a passthrough object meaning that the kwargs will be passed to the underlying methods as is and are expected to be supported by the underlying library.
|
None
|
Source code in python/opsml/model/_model.pyi
ModelInterface
¶
Source code in python/opsml/model/_model.pyi
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 |
|
data_type
property
¶
Returns the task type
drift_profile
property
¶
Returns the drift profile mapping
interface_type
property
¶
Returns the model type
model
property
writable
¶
Returns the model
model_type
property
¶
Returns the model type
onnx_session
property
writable
¶
Returns the onnx session if it exists
sample_data
property
writable
¶
Returns the sample data
schema
property
¶
Returns the feature schema
task_type
property
¶
Returns the task type
__init__(model=None, sample_data=None, task_type=None, drift_profile=None)
¶
Base class for ModelInterface
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Any
|
Model to associate with interface. |
None
|
sample_data
|
Any
|
Sample data to use to make predictions |
None
|
task_type
|
Optional[TaskType]
|
The type of task the model performs |
None
|
drift_profile
|
Optional[DriftProfileType]
|
Drift profile(s) to associate with the model. Must be a dictionary of alias and drift profile. |
None
|
Source code in python/opsml/model/_model.pyi
create_drift_profile(alias, data, config=None, data_type=None)
¶
create_drift_profile(
alias: str,
data: CustomMetric | List[CustomMetric],
config: CustomMetricDriftConfig,
data_type: Optional[DataType] = None,
) -> CustomDriftProfile
create_drift_profile(
alias: str,
data: Any,
config: SpcDriftConfig,
data_type: Optional[DataType] = None,
) -> SpcDriftProfile
Create a drift profile and append it to the drift profile list
Parameters:
Name | Type | Description | Default |
---|---|---|---|
alias
|
str
|
Alias to use for the drift profile |
required |
data
|
Any
|
Data to use to create the drift profile. Can be a pandas dataframe, polars dataframe, pyarrow table or numpy array. |
required |
config
|
None | SpcDriftConfig | PsiDriftConfig | CustomMetricDriftConfig
|
Drift config to use. If None, defaults to SpcDriftConfig. |
None
|
data_type
|
None | DataType
|
Data type to use. If None, data_type will be inferred from the data. |
None
|
Returns:
Type | Description |
---|---|
Any
|
Drift profile SPcDriftProfile, PsiDriftProfile or CustomDriftProfile |
Source code in python/opsml/model/_model.pyi
from_metadata(metadata)
staticmethod
¶
Create a ModelInterface from metadata
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metadata
|
ModelInterfaceMetadata
|
Model interface metadata |
required |
Returns:
Type | Description |
---|---|
ModelInterface
|
Model interface |
load(path, metadata, load_kwargs=None)
¶
Load ModelInterface components
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Path
|
Path to load the model |
required |
metadata
|
ModelInterfaceSaveMetadata
|
Metadata to use to load the model |
required |
load_kwargs
|
ModelLoadKwargs
|
Optional load kwargs to pass to the different load methods |
None
|
Source code in python/opsml/model/_model.pyi
save(path, save_kwargs=None)
¶
Save the model interface
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Path
|
Path to save the model |
required |
save_kwargs
|
ModelSaveKwargs
|
Optional kwargs to pass to the various underlying methods. This is a passthrough object meaning that the kwargs will be passed to the underlying methods as is and are expected to be supported by the underlying library.
|
None
|
Source code in python/opsml/model/_model.pyi
ModelInterfaceMetadata
¶
Source code in python/opsml/model/_model.pyi
__init__(save_metadata, task_type=TaskType.Undefined, model_type=ModelType.Unknown, data_type=DataType.NotProvided, schema=FeatureSchema(), onnx_session=None, extra_metadata={})
¶
Define a model interface
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_type
|
TaskType
|
Task type |
Undefined
|
model_type
|
ModelType
|
Model type |
Unknown
|
data_type
|
DataType
|
Data type |
NotProvided
|
onnx_session
|
Optional[OnnxSession]
|
Onnx session |
None
|
schema
|
FeatureSchema
|
Feature schema |
FeatureSchema()
|
data_type
|
DataType
|
Sample data type |
NotProvided
|
save_metadata
|
ModelInterfaceSaveMetadata
|
Save metadata |
required |
extra_metadata
|
dict[str, str]
|
Extra metadata. Must be a dictionary of strings |
{}
|
Source code in python/opsml/model/_model.pyi
__str__()
¶
model_dump_json()
¶
ModelInterfaceSaveMetadata
¶
Source code in python/opsml/model/_model.pyi
__init__(model_uri, data_processor_map={}, sample_data_uri=None, onnx_model_uri=None, drift_profile_uri_map=None, extra=None, save_kwargs=None)
¶
Define model interface save arguments
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_uri
|
Path
|
Path to the model |
required |
data_processor_map
|
Optional[Dict[str, DataProcessor]]
|
Dictionary of data processors |
{}
|
sample_data_uri
|
Optional[Path]
|
Path to the sample data |
None
|
onnx_model_uri
|
Optional[Path]
|
Path to the onnx model |
None
|
drift_profile_uri_map
|
Optional[Dict[str, DriftProfileUri]]
|
Dictionary of drift profiles |
None
|
extra_metadata
|
Extra metadata |
required | |
save_kwargs
|
Optional[ModelSaveKwargs]
|
Optional save args |
None
|
Source code in python/opsml/model/_model.pyi
ModelLoadKwargs
¶
Source code in python/opsml/model/_model.pyi
__init__(onnx=None, model=None, preprocessor=None, load_onnx=False)
¶
Optional arguments to pass to load_model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
onnx
|
Dict
|
Optional onnx arguments to use when loading |
None
|
model
|
Dict
|
Optional model arguments to use when loading |
None
|
preprocessor
|
Dict
|
Optional preprocessor arguments to use when loading |
None
|
load_onnx
|
bool
|
Whether to load the onnx model. Defaults to false unless onnx args are provided. If true, the onnx model will be loaded. |
False
|
Source code in python/opsml/model/_model.pyi
ModelSaveKwargs
¶
Source code in python/opsml/model/_model.pyi
__init__(onnx=None, model=None, preprocessor=None, save_onnx=False, drift=None)
¶
Optional arguments to pass to save_model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
onnx
|
Dict or HuggingFaceOnnxArgs
|
Optional onnx arguments to use when saving model to onnx format |
None
|
model
|
Dict
|
Optional model arguments to use when saving |
None
|
preprocessor
|
Dict
|
Optional preprocessor arguments to use when saving |
None
|
save_onnx
|
bool
|
Whether to save the onnx model. Defaults to false. This is independent of the onnx argument since it's possible to convert a model to onnx without additional kwargs. If onnx args are provided, this will be set to true. |
False
|
drift
|
DriftArgs
|
Optional drift args to use when saving and registering a model. |
None
|
Source code in python/opsml/model/_model.pyi
OnnxModel
¶
Bases: ModelInterface
Source code in python/opsml/model/_model.pyi
session
property
¶
Returns the onnx session. This will error if the OnnxSession is not set
__init__(model=None, sample_data=None, task_type=None, drift_profile=None)
¶
Interface for saving an OnnxModel
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Optional[Any]
|
Onnx model to associate with the interface. This model must be an Onnx ModelProto |
None
|
sample_data
|
Optional[Any]
|
Sample data to use to make predictions |
None
|
task_type
|
Optional[TaskType]
|
The type of task the model performs |
None
|
drift_profile
|
Optional[DriftProfileType]
|
Drift profile(s) to associate with the model. Must be a dictionary of alias and drift profile. |
None
|
Example
from sklearn.datasets import load_iris # type: ignore
from sklearn.model_selection import train_test_split # type: ignore
from sklearn.ensemble import RandomForestClassifier # type: ignore
from skl2onnx import to_onnx # type: ignore
import onnxruntime as rt # type: ignore
iris = load_iris()
X, y = iris.data, iris.target
X = X.astype(np.float32)
X_train, X_test, y_train, y_test = train_test_split(X, y)
clr = RandomForestClassifier()
clr.fit(X_train, y_train)
onx = to_onnx(clr, X[:1])
interface = OnnxModel(model=onx, sample_data=X_train)
Source code in python/opsml/model/_model.pyi
OnnxSchema
¶
Source code in python/opsml/model/_model.pyi
feature_names
property
¶
Return the feature names and order for onnx.
input_features
property
¶
Return the input features of the OnnxSchema.
onnx_version
property
¶
Return the onnx version of the OnnxSchema.
output_features
property
¶
Return the output features of the OnnxSchema.
__init__(input_features, output_features, onnx_version, feature_names=None)
¶
Define an onnx schema
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_features
|
FeatureSchema
|
The input features of the onnx schema |
required |
output_features
|
FeatureSchema
|
The output features of the onnx schema |
required |
onnx_version
|
str
|
The onnx version of the schema |
required |
feature_names
|
List[str] | None
|
The feature names and order for onnx. |
None
|
Source code in python/opsml/model/_model.pyi
__str__()
¶
Return a string representation of the OnnxSchema.
Returns:
Type | Description |
---|---|
str
|
String representation of the OnnxSchema. |
OnnxSession
¶
Source code in python/opsml/model/_model.pyi
schema
property
¶
Returns the onnx schema
session
property
writable
¶
Returns the onnx session
model_dump_json()
¶
model_validate_json(json_string)
staticmethod
¶
run(input_feed, output_names=None, run_options=None)
¶
Run the onnx session
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_feed
|
Dict[str, Any]
|
Dictionary of input data |
required |
output_names
|
Optional[list[str]]
|
List of output names |
None
|
run_options
|
Optional[Dict[str, Any]]
|
Optional run options |
None
|
Returns:
Type | Description |
---|---|
Any
|
Output data |
Source code in python/opsml/model/_model.pyi
SklearnModel
¶
Bases: ModelInterface
Source code in python/opsml/model/_model.pyi
preprocessor
property
writable
¶
Returns the preprocessor
preprocessor_name
property
¶
Returns the preprocessor name
__init__(model=None, preprocessor=None, sample_data=None, task_type=None, drift_profile=None)
¶
Instantiate an SklearnModel interface
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Optional[Any]
|
Model to associate with interface. This model must be from the scikit-learn ecosystem |
None
|
preprocessor
|
Optional[Any]
|
Preprocessor to associate with the model. This preprocessor must be from the scikit-learn ecosystem |
None
|
sample_data
|
Optional[Any]
|
Sample data to use to make predictions |
None
|
task_type
|
Optional[TaskType]
|
The type of task the model performs |
None
|
drift_profile
|
Optional[DriftProfileType]
|
Drift profile(s) to associate with the model. Must be a dictionary of alias and drift profile. |
None
|
Source code in python/opsml/model/_model.pyi
TensorFlowModel
¶
Bases: ModelInterface
Source code in python/opsml/model/_model.pyi
preprocessor
property
writable
¶
Returns the preprocessor
preprocessor_name
property
¶
Returns the preprocessor name
__init__(model=None, preprocessor=None, sample_data=None, task_type=None, drift_profile=None)
¶
Interface for saving PyTorch models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Optional[Any]
|
Model to associate with interface. This model must inherit from tensorflow.keras.Model |
None
|
preprocessor
|
Optional[Any]
|
Preprocessor to associate with model. |
None
|
sample_data
|
Optional[Any]
|
Sample data to use to convert to ONNX and make sample predictions. This data must be a tensorflow-supported type. numpy array, tf.Tensor, torch dataset, Dict[str, tf.Tensor], List[tf.Tensor], Tuple[tf.Tensor]. |
None
|
task_type
|
Optional[TaskType]
|
The intended task type of the model. |
None
|
drift_profile
|
Optional[DriftProfileType]
|
Drift profile(s) to associate with the model. Must be a dictionary of alias and drift profile. |
None
|
Source code in python/opsml/model/_model.pyi
TorchModel
¶
Bases: ModelInterface
Source code in python/opsml/model/_model.pyi
preprocessor
property
writable
¶
Returns the preprocessor
preprocessor_name
property
¶
Returns the preprocessor name
__init__(model=None, preprocessor=None, sample_data=None, task_type=None, drift_profile=None)
¶
Interface for saving PyTorch models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Optional[Any]
|
Model to associate with interface. This model must inherit from torch.nn.Module. |
None
|
preprocessor
|
Optional[Any]
|
Preprocessor to associate with model. |
None
|
sample_data
|
Optional[Any]
|
Sample data to use to convert to ONNX and make sample predictions. This data must be a pytorch-supported type. TorchData interface, torch tensor, torch dataset, Dict[str, torch.Tensor], List[torch.Tensor], Tuple[torch.Tensor]. |
None
|
task_type
|
Optional[TaskType]
|
The intended task type of the model. |
None
|
drift_profile
|
Optional[DriftProfileType]
|
Drift profile(s) to associate with the model. Must be a dictionary of alias and drift profile. |
None
|
Source code in python/opsml/model/_model.pyi
save(path, save_kwargs=None)
¶
Save the TorchModel interface. Torch models are saved as state_dicts as is the standard for PyTorch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Path
|
Base path to save artifacts |
required |
save_kwargs
|
ModelSaveKwargs
|
Optional kwargs to pass to the various underlying methods. This is a passthrough object meaning that the kwargs will be passed to the underlying methods as is and are expected to be supported by the underlying library. |
None
|
Source code in python/opsml/model/_model.pyi
XGBoostModel
¶
Bases: ModelInterface
Source code in python/opsml/model/_model.pyi
preprocessor
property
writable
¶
Returns the preprocessor
preprocessor_name
property
¶
Returns the preprocessor name
__init__(model=None, preprocessor=None, sample_data=None, task_type=None, drift_profile=None)
¶
Interface for saving XGBoost Booster models
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
Optional[Any]
|
Model to associate with interface. This model must be an xgboost booster. |
None
|
preprocessor
|
Optional[Any]
|
Preprocessor to associate with the model. |
None
|
sample_data
|
Optional[Any]
|
Sample data to use to make predictions. |
None
|
task_type
|
Optional[TaskType]
|
The type of task the model performs |
None
|
drift_profile
|
Optional[DriftProfileType]
|
Drift profile(s) to associate with the model. Must be a dictionary of alias and drift profile. |
None
|