bill2watt.utils package
Submodules
bill2watt.utils.check_sizes module
This module contains functions for checking the size of various arrays.
Functions
- check_y(y)
Check the size of y ndarray and return y.
- check_x(x)
Check the size of x ndarray and return x.
- check_nd(nd)
Check the size of nd ndarray and return nd.
Notes
Info
Author: G. Lorenti Email: gianmarco.lorenti@polito
- bill2watt.utils.check_sizes.check_y(y)
Check the size of y ndarray.
Parameters
- yndarray
Typical load profile to be checked.
Returns
- ndarray
The input ‘y’.
Raises
- AssertionError
If the size of ‘y’ does not comply with the requirements.
bill2watt.utils.eval_x module
bill2watt.utils.normalizing module
Info
Author: G. Lorenti Email: gianmarco.lorenti@polito.it
- bill2watt.utils.normalizing.check_array(x)
Validate the input array and return a reshaped version if necessary.
Parameters
- xndarray
The input array to validate.
Returns
- ndarray
The reshaped input array.
- bool
Whether the input array is mono-dimensional or not.
Raises
- AssertionError
If the input is not a 1D or 2D NumPy array.
- class bill2watt.utils.normalizing.XRowNormalizer
Bases:
object
Row-wise normalizer for X data.
This class provides methods to normalize and denormalize row-wise data based on the sum of each row.
Parameters
Attributes
- x_sum (property)ndarray or None
Normalization values in the X data.
- n (property)int
Number of points in the fitting data.
Methods
- fit(x)
Fit the normalizer to the given X data.
- transform(x)
Normalize the input X data.
- inverse_transform(x_norm)
Denormalize the normalized X data.
- fit_transform(x)
Fit the normalizer to the given X data and normalize it.
- property x_sum
Get the normalization values of the X data.
Returns
- ndarray or None
Values of self._x_sum
- property n
Get the number of rows in the X data.
Returns
- int or None
The number of rows in the X data.
- fit(x)
Fit the normalizer to the given X data.
Parameters
- xndarray
The input X data.
Raises
- AssertionError
If the input ‘x’ does not meet the requirements. See function ‘check_array’ for further details.
- transform(x)
Normalize the input X data.
Parameters
- xndarray
The input X data.
Returns
- ndarray
The normalized X data.
Raises
- AssertionError
If the input ‘x’ does not meet the requirements. See function ‘check_array’ for further details. If the length of ‘x’ does not match the number of rows in the X data.
- inverse_transform(x_norm)
Denormalize the normalized X data.
Parameters
- x_normndarray
The normalized X data.
Returns
- ndarray
The denormalized X data.
Raises
- AssertionError
If the input ‘x_norm’ does not meet the requirements. See function ‘check_array’ for further details. If the length of ‘x’ does not match the number of rows in the X data.
- class bill2watt.utils.normalizing.YRowNormalizer
Bases:
XRowNormalizer
Row-wise normalizer for Y data.
This class provides methods to normalize and denormalize row-wise data based on the sum of each row, using the sum of X data for normalization.
Attributes
- x_sum (property)ndarray or None
Normalization values in the X data.
- n (property)int
Number of points in the fitting data.
Methods
- transform(y)
Normalize the input Y data.
- inverse_transform(y_norm)
Denormalize the normalized Y data.
- fit_transform(y)
Fit the normalizer to the given Y data and normalize it.
- transform(y)
Normalize the input Y data.
Parameters
- yndarray
The input Y data.
Returns
- ndarray
The normalized Y data.
Raises
- AssertionError
If the input ‘y’ does not meet the requirements. See function ‘check_array’ for further details. If the length of ‘y’ does not match the number of rows in the Y data.
- inverse_transform(y_norm)
Denormalize the normalized Y data.
Parameters
- y_normndarray
The normalized Y data.
Returns
- ndarray
The denormalized Y data.
Raises
- AssertionError
If the input ‘y_norm’ does not meet the requirements. See function ‘check_array’ for further details. If the length of ‘y’ does not match the number of rows in the Y data.