credit.transforms.transforms_quantile
=====================================

.. py:module:: credit.transforms.transforms_quantile

.. autoapi-nested-parse::

   normalize_quantile.py
   -------------------------------------------------------
   Content
       - BridgescalerScaleState
       - NormalizeState_Quantile_Bridgescalar
       - ToTensor_BridgeScaler



Attributes
----------

.. autoapisummary::

   credit.transforms.transforms_quantile.read_scaler
   credit.transforms.transforms_quantile.logger


Classes
-------

.. autoapisummary::

   credit.transforms.transforms_quantile.BridgescalerScaleState
   credit.transforms.transforms_quantile.NormalizeState_Quantile_Bridgescalar
   credit.transforms.transforms_quantile.ToTensor_BridgeScaler


Module Contents
---------------

.. py:data:: read_scaler
   :value: None


.. py:data:: logger

.. py:class:: BridgescalerScaleState(conf)

   Bases: :py:obj:`object`


   Convert to rescaled tensor using Bridgescaler.


   .. py:attribute:: scaler_file


   .. py:attribute:: variables


   .. py:attribute:: surface_variables


   .. py:attribute:: n_levels


   .. py:attribute:: var_levels
      :value: []



   .. py:attribute:: n_surface_variables


   .. py:attribute:: n_3dvar_levels


   .. py:attribute:: scaler_df


   .. py:attribute:: scaler_3d


   .. py:attribute:: scaler_surf


   .. py:method:: inverse_transform(x: torch.Tensor) -> torch.Tensor

      Inverse transform.

      Inverse transform.

      :param x: batch.

      :returns: inverse transformed batch.



   .. py:method:: transform_array(x: torch.Tensor) -> torch.Tensor

      Transform.

      Transform.

      :param x: batch.

      :returns: transformed batch.



   .. py:method:: transform(sample: Dict[str, numpy.ndarray]) -> Dict[str, numpy.ndarray]

      Transform.

      Transform.

      :param sample: batch.

      :returns: transformed batch.



.. py:class:: NormalizeState_Quantile_Bridgescalar(conf)

   Class to use the bridgescaler Quantile functionality.

   Some hoops have to be jumped thorugh, and the efficiency could be
   improved if we were to retrain the bridgescaler.


   .. py:attribute:: scaler_file


   .. py:attribute:: variables


   .. py:attribute:: surface_variables


   .. py:attribute:: levels


   .. py:attribute:: scaler_df


   .. py:attribute:: scaler_3ds


   .. py:attribute:: scaler_surfs


   .. py:attribute:: scaler_3d


   .. py:attribute:: scaler_surf


   .. py:method:: __call__(sample: credit.data.Sample, inverse: bool = False) -> credit.data.Sample

      Normalize via quantile transform with bridgescaler.

      Normalize via provided scaler file/s.

      :param sample: batch.
      :type sample: iterator

      :returns: transformed torch tensor.
      :rtype: torch.tensor



   .. py:method:: inverse_transform(x: torch.Tensor) -> torch.Tensor

      Inverse transform.

      Inverse transform via provided scaler file/s.

      :param x: batch.

      :returns: inverse transformed torch tensor.



   .. py:method:: transform(sample)

      Transform.

      Transform via provided scaler file/s.

      :param sample: batch.
      :type sample: iterator

      :returns: transformed torch tensor.
      :rtype: torch.Tensor



.. py:class:: ToTensor_BridgeScaler(conf)

   Convert to reshaped tensor.


   .. py:attribute:: conf


   .. py:attribute:: hist_len


   .. py:attribute:: for_len


   .. py:attribute:: variables


   .. py:attribute:: surface_variables


   .. py:attribute:: allvars


   .. py:attribute:: static_variables


   .. py:attribute:: latN


   .. py:attribute:: lonN


   .. py:attribute:: levels


   .. py:attribute:: one_shot


   .. py:method:: __call__(sample: credit.data.Sample) -> credit.data.Sample

      Convert to reshaped tensor.

      Reshape and convert to torch tensor.

      :param sample: batch.
      :type sample: interator

      :returns: reshaped torch tensor.
      :rtype: torch.tensor



