dgbpy.zipmodelbase

Classes

PlatformType

Enum where members are also (and must be) strings

LearnType

Enum where members are also (and must be) strings

PredType

Enum where members are also (and must be) strings

ScalingType

Enum where members are also (and must be) strings

ZipModelInfo

Summary information for an external model.

ZipPredictModel

Abstract base class for ZipModel format machine learning models for prediction only

ZipTrainableModel

Abstract base class for ZipModel format machine learning models that can be used for prediction and training

Functions

load(modelfnm)

apply(model, infos, samples, scaler, isclassification, ...)

Module Contents

class dgbpy.zipmodelbase.PlatformType

Bases: enum.StrEnum

Enum where members are also (and must be) strings

Keras = 'keras'
Sklearn = 'scikit'
PyTorch = 'torch'
Onnx = 'onnx'
class dgbpy.zipmodelbase.LearnType

Bases: enum.StrEnum

Enum where members are also (and must be) strings

SeisClass = 'Seismic Classification'
SeisLogPred = 'Property Prediction from Seismics'
LogLogPred = 'Log-Log Prediction'
LogCluster = 'Log Clustering'
SeisImg2Img = 'Seismic Image Transformation'
class dgbpy.zipmodelbase.PredType

Bases: enum.StrEnum

Enum where members are also (and must be) strings

Continuous = 'Continuous Data'
Classification = 'Classification Data'
Segments = 'Segmentation'
Unknown = 'Undetermined'
class dgbpy.zipmodelbase.ScalingType

Bases: enum.StrEnum

Enum where members are also (and must be) strings

GlobalStd = 'Global Standardization'
LocalStd = 'Local Standardization'
LocalNormalized = 'Normalization'
LocalMinMax = 'MinMax'
RangeStd = 'Range Standardization'
class dgbpy.zipmodelbase.ZipModelInfo

Summary information for an external model.

pred_type: PredType
platform: PlatformType
learn_type: LearnType
scale_type: ScalingType
scale_output: bool = False
input_names: [str] = []
output_names: [str] = []
input_shape: [int] = []
output_shape: [int] = []
data_format: str = 'channels_first'
info() dict
class dgbpy.zipmodelbase.ZipPredictModel(params: dict = {})

Bases: abc.ABC

Abstract base class for ZipModel format machine learning models for prediction only

This module defines the interface for ZipModel packaging of machine learning models for import into OpendTect for prediction only

modelinfo = None
__repr__() str

Return a string representing the model object.

abstractmethod predict(model_input: numpy.typing.ArrayLike, params: dict = {}) numpy.ndarray

Prediction method

Parameters

model_input A ZipModel compatible input for the model to evaluate. params Additional parameters to pass to the model for inference.

Returns

Model predictions

classmethod info() str

Get information about the ZipModel

Returns

JSON formatted str

class dgbpy.zipmodelbase.ZipTrainableModel(params: dict = {})

Bases: ZipPredictModel

Abstract base class for ZipModel format machine learning models that can be used for prediction and training

This module defines the interface for ZipModel packaging of machine learning models for import into OpendTect for both training and prediction

saveas(fname: str) None

Save the model artifacts

Parameters

fname: str the filename to save to

abstractmethod train_one_epoch()

Abstract method defining what the model does during a single training step

Parameters

Returns

abstractmethod _dosave(fname: str) None
dgbpy.zipmodelbase.load(modelfnm: str)
dgbpy.zipmodelbase.apply(model, infos, samples, scaler, isclassification, withpred, withprobs, withconfidence, doprobabilities, dictinpshape, dictoutshape, nroutputs)