pl_models#


class PLWrappedModel(model: pytorch_lightning.LightningModule, trainer: pytorch_lightning.Trainer, validation_fraction=0.1, shuffle=True, batch_size=32)[source]#

Bases: object

fit(x: ndarray, y: ndarray)[source]#
predict(x: ndarray) ndarray[source]#
class PLTensorToScalarClassificationModel(model: pytorch_lightning.LightningModule, trainer: pytorch_lightning.Trainer, validation_fraction=0.1, shuffle=True, batch_size=64, check_input_shape=True, check_input_columns=True)[source]#

Bases: TensorToScalarClassificationModel

Base class for classification models that take tensors as input and output scalars. They can be evaluated in the same way as non-tensor classification models

Parameters:
  • check_input_shape – Whether to check if during predict input tensors have the same shape as during fit. For certain applications, e.g. using CNNs on larger inputs than the training set, this has to be disabled

  • check_input_columns – Whether to check if input columns at predict time coincide with those at fit time

class PLTensorToScalarRegressionModel(model: pytorch_lightning.LightningModule, trainer: pytorch_lightning.Trainer, validation_fraction=0.1, shuffle=True, batch_size=32, check_input_shape=True, check_input_columns=True)[source]#

Bases: TensorToScalarRegressionModel

Base class for regression models that take tensors as input and output scalars. They can be evaluated in the same way as non-tensor regression models

Parameters:
  • check_input_shape – Whether to check if during predict input tensors have the same shape as during fit. For certain applications, e.g. using CNNs on larger inputs than the training set, this has to be disabled

  • check_input_columns – Whether to check if input columns at predict time coincide with those at fit time

class PLTensorToTensorClassificationModel(model: pytorch_lightning.LightningModule, trainer: pytorch_lightning.Trainer, validation_fraction=0.1, shuffle=True, batch_size=32, check_input_shape=True, check_input_columns=True)[source]#

Bases: TensorToTensorClassificationModel

Base class for classification models that output tensors, e.g. for semantic segregation. The models can be fit on a ground truth data frame with a single column. The entries in this column should be binary tensors with one-hot-encoded labels, i.e. of shape (*predictionShape, numLabels)

Parameters:
  • check_input_shape – Whether to check if during predict tensors have the same shape as during fit. For certain applications, e.g. using CNNs on larger inputs than the training set, this has to be disabled

  • check_output_shape – Whether to check if predictions have the same shape as ground truth data during fit. For certain applications, e.g. using CNNs on larger inputs than the training set, this has to be disabled

  • check_input_columns – Whether to check if input columns at predict time coincide with those at fit time

class PLTensorToTensorRegressionModel(model: pytorch_lightning.LightningModule, trainer: pytorch_lightning.Trainer, validation_fraction=0.1, shuffle=True, batch_size=32, check_input_shape=True, check_input_columns=True)[source]#

Bases: TensorToTensorRegressionModel

Base class for regression models that output tensors. Multiple targets can be used by putting them into separate columns. In that case it is required that all target tensors have the same shape.

Parameters:
  • check_input_shape – Whether to check if during predict tensors have the same shape as during fit. For certain applications, e.g. using CNNs on larger inputs than the training set, this has to be disabled

  • check_output_shape – Whether to check if predictions have the same shape as ground truth data during fit. For certain applications, e.g. using CNNs on larger inputs than the training set, this has to be disabled

  • check_input_columns – Whether to check if input columns at predict time coincide with those at fit time