preprocessor
Feature preprocessor.
Classes:
| Name | Description | 
|---|---|
Preprocessor | 
            
               Preprocessor class to preprocess the raw data.  | 
          
IdentityPreprocessor | 
            
               Identity Preprocessor class.  | 
          
SklearnPreprocessor | 
            
               Preprocessor class based on sklearn preprocessing classes.  | 
          
TorchPreprocessor | 
            
               Preprocessor class based on pytorch.  | 
          
            Preprocessor
#
    Preprocessor class to preprocess the raw data.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                               | 
            
               None indicates that the preprocessor was not fitted. Otherwise, it represents the feature size after being preprocessed, without the batch size.  | 
            required | 
Attributes:
| Name | Type | Description | 
|---|---|---|
preprocessed_size | 
            
                  tuple[int, ...] | None
             | 
            
               | 
          
            preprocessed_size: tuple[int, ...] | None = None
#
    
            IdentityPreprocessor
#
    Identity Preprocessor class.
Methods:
| Name | Description | 
|---|---|
from_exposed | 
              
                 Unparse the serialized preprocessor to use it on client side.  | 
            
Attributes:
| Name | Type | Description | 
|---|---|---|
as_exposed | 
            
                  ExposedIdentityPreprocessor
             | 
            
               Parse the preprocessor to send it to xpdeep server.  | 
          
            SklearnPreprocessor
#
    Preprocessor class based on sklearn preprocessing classes.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                               | 
            
                  TransformerMixin | ExposedPreprocessFunction
             | 
            
               | 
            required | 
Methods:
| Name | Description | 
|---|---|
from_exposed | 
              
                 Unparse the serialized preprocessor to use it on client side.  | 
            
transform | 
              
                 Transform a feature raw value into its preprocessed value.  | 
            
inverse_transform | 
              
                 Inverse transform a feature preprocessed value into its raw value.  | 
            
Attributes:
| Name | Type | Description | 
|---|---|---|
preprocess_function | 
            
                  TransformerMixin | ExposedPreprocessFunction
             | 
            
               | 
          
as_exposed | 
            
                  ExposedNumpyPreprocessor
             | 
            
               Parse the preprocessor to send it to xpdeep server.  | 
          
            preprocess_function: TransformerMixin | ExposedPreprocessFunction
#
    
            as_exposed: ExposedNumpyPreprocessor
#
    Parse the preprocessor to send it to xpdeep server.
            from_exposed(numpy_preprocessor: ExposedNumpyPreprocessor) -> Self
#
    Unparse the serialized preprocessor to use it on client side.
Unparsing requires the adequate external modules, like scikit-learn if it used it originally.
Source code in src/xpdeep/dataset/schema/preprocessor.py
              
            transform(feature_raw_value: object) -> torch.Tensor
#
    Transform a feature raw value into its preprocessed value.
Source code in src/xpdeep/dataset/schema/preprocessor.py
              
            inverse_transform(preprocessed_value: torch.Tensor) -> object
#
    Inverse transform a feature preprocessed value into its raw value.
Source code in src/xpdeep/dataset/schema/preprocessor.py
              
              TorchPreprocessor(input_size: tuple[int, ...], module_transform: torch.nn.Module | None = None, module_inverse_transform: torch.nn.Module | None = None)
#
    Preprocessor class based on pytorch.
To customize your preprocessor, inherit from this class and implement the transform and inverse_transform methods. Additionally, you can define module_transform and module_inverse_transform in the init method.
Initialize the preprocessor.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
                               | 
            
                  tuple[int, ...]
             | 
            
               The dimensions of the data that the preprocessor expects, excluding the batch size.
  | 
            required | 
                               | 
            
                  Module | None
             | 
            
               A PyTorch module to preprocess data from the raw input space to the preprocessed space.
If   | 
            
                  None
             | 
          
                               | 
            
                  Module | None
             | 
            
               A PyTorch module to reverse the preprocessing, converting data from the preprocessed space
back to the raw input space.
If   | 
            
                  None
             | 
          
Methods:
| Name | Description | 
|---|---|
forward | 
              
                 Transform.  | 
            
transform | 
              
                 Process data: ie take in input a tensor and return the tensor preprocessed.  | 
            
inverse_transform | 
              
                 Reciprocal of preprocess.  | 
            
from_exposed | 
              
                 Unparse the serialized preprocessor to use it on client side.  | 
            
Attributes:
| Name | Type | Description | 
|---|---|---|
input_size | 
            
               | 
          |
ward | 
            
               | 
          |
module_transform | 
            
               | 
          |
module_inverse_transform | 
            
               | 
          |
as_exposed | 
            
                  ExposedTorchPreprocessor
             | 
            
               Parse the preprocessor to send it to xpdeep server.  | 
          
Source code in src/xpdeep/dataset/schema/preprocessor.py
                    
            input_size = input_size
#
    
            ward = True
#
    
            module_transform = module_transform
#
    
            module_inverse_transform = module_inverse_transform
#
    
            as_exposed: ExposedTorchPreprocessor
#
    Parse the preprocessor to send it to xpdeep server.
            forward(inputs: torch.Tensor) -> torch.Tensor
#
    
            transform(inputs: torch.Tensor) -> torch.Tensor
#
    Process data: ie take in input a tensor and return the tensor preprocessed.
Source code in src/xpdeep/dataset/schema/preprocessor.py
              
            inverse_transform(output: torch.Tensor) -> torch.Tensor
#
    Reciprocal of preprocess.
ie \forall x inverse_transform(transform(x)) = transform(inverse_transform(x)) = x.
Source code in src/xpdeep/dataset/schema/preprocessor.py
              
            from_exposed(exposed_torch_preprocessor: ExposedTorchPreprocessor) -> Self
#
    Unparse the serialized preprocessor to use it on client side.