bridgescaler.group
==================

.. py:module:: bridgescaler.group


Classes
-------

.. autoapisummary::

   bridgescaler.group.GroupBaseScaler
   bridgescaler.group.GroupStandardScaler
   bridgescaler.group.GroupMinMaxScaler
   bridgescaler.group.GroupRobustScaler


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

.. py:class:: GroupBaseScaler

   Bases: :py:obj:`object`


   .. py:attribute:: groups_
      :value: None



   .. py:attribute:: group_index_
      :value: None



   .. py:attribute:: x_columns_
      :value: None



   .. py:method:: extract_x_columns(x)

      Extract the variable names to be transformed from x depending on if x is a pandas DataFrame, an
      xarray DataArray, or a numpy array. All of these assume that the columns are in the last dimension.
      If x is an xarray DataArray, there should be a coorindate variable with the same name as the last dimension
      of the DataArray being transformed.

      :param x: array of values to be transformed.
      :type x: Union[pandas.DataFrame, xarray.DataArray, numpy.ndarray]

      :returns: Array of values to be transformed.
      :rtype: xv (numpy.ndarray)



   .. py:method:: package_transformed_x(x_transformed, x)
      :staticmethod:


      Repackaged a transformed numpy array into the same datatype as the original x, including
      all metadata.

      :param x_transformed: array after being transformed or inverse transformed
      :type x_transformed: numpy.ndarray
      :param x:
      :type x: Union[pandas.DataFrame, xarray.DataArray, numpy.ndarray]

      Returns:




   .. py:method:: fit(x, groups=None)


   .. py:method:: fit_transform(x, groups=None)


   .. py:method:: transform(x)


   .. py:method:: inverse_transform(x)


   .. py:method:: set_groups(x, groups)


   .. py:method:: find_group(var_name)


   .. py:method:: _fit(x, groups)
      :abstractmethod:



   .. py:method:: _transform_column(x, group_index)
      :abstractmethod:



   .. py:method:: _inverse_transform_column(x, group_index)
      :abstractmethod:



.. py:class:: GroupStandardScaler

   Bases: :py:obj:`GroupBaseScaler`


   Scaler that enables calculation and sharing of scaling parameters among multiple variables via variable groupings.
   This is useful for situations where variables are related, such as temperatures at different height levels.

   Groups are specified as a list of column ids, which can be column names for pandas dataframes or column indices
   for numpy arrays.

   For example:
   ```
   groups = [["a", "b"], ["c", "d"], "e"]
   ```
   "a" and "b" are a single group and all values of both will be included when calculating the mean and standard
   deviation for that group.


   .. py:attribute:: center_
      :value: None



   .. py:attribute:: scale_
      :value: None



   .. py:method:: _fit(x, groups=None)


   .. py:method:: _transform_column(x_column, group_index)


   .. py:method:: _inverse_transform_column(x_column, group_index)


.. py:class:: GroupMinMaxScaler(feature_range=(0, 1))

   Bases: :py:obj:`GroupBaseScaler`


   Group version of MinMaxScaler


   .. py:attribute:: feature_range
      :value: (0, 1)



   .. py:attribute:: mins_
      :value: None



   .. py:attribute:: maxes_
      :value: None



   .. py:method:: _fit(x, groups)


   .. py:method:: _transform_column(x_column, group_index)


   .. py:method:: _inverse_transform_column(x_column, group_index)


.. py:class:: GroupRobustScaler(quartile_range=(25.0, 75.0))

   Bases: :py:obj:`GroupBaseScaler`


   Group version of RobustScaler



   .. py:attribute:: quartile_range
      :value: (25.0, 75.0)



   .. py:attribute:: center_
      :value: None



   .. py:attribute:: scale_
      :value: None



   .. py:method:: _fit(x, groups)


   .. py:method:: _transform_column(x_column, group_index)


   .. py:method:: _inverse_transform_column(x_column, group_index)


