pywatts.summaries package

Submodules

pywatts.summaries.f1_summary module

class pywatts.summaries.f1_summary.F1Score(name: str = 'F1Score', average='micro', cuts=[], offset=0, filter_method=None)

Bases: pywatts.summaries.metric_base.MetricBase

Module to calculate the F1Score

Parameters:
  • offset (int) – Offset, which determines the number of ignored values in the beginning for calculating the F1 Score. Default 0
  • filter_method (Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]) – Filter which should performed on the data before calculating the F1 Score.
  • cuts (List[Tuple[pd.Timestamp, pd.Timestamp]]) – A list of Tuples of pd.Timestamps which specify intervals on which the metric should be calculated.
  • average (str) – The average param for the f1 score sklearn implementation. See `SKLearn https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html`_

pywatts.summaries.confusion_matrix module

class pywatts.summaries.confusion_matrix.ConfusionMatrix(name: str = 'Confusion Matrix')

Bases: pywatts_pipeline.core.summary.base_summary.BaseSummary

Summary to calculate the confusion matrix

Parameters:name (str) – Name of the confusion matrix
transform(file_manager: pywatts_pipeline.core.util.filemanager.FileManager, gt: xarray.core.dataarray.DataArray, **kwargs) → pywatts_pipeline.core.summary.summary_object.SummaryObjectTable

Calculates the confusion matrix for all predictions :param file_manager: The filemanager :type file_manager: FileManager :param gt: The ground truth data :type gt: xr.DataArray :param kwargs: The predictions :type kwargs: xr.DataArray :return: A summary containing all confusion matrices :rtype: SummaryObjectTable

pywatts.summaries.discriminative_score module

pywatts.summaries.mae_summary module

class pywatts.summaries.mae_summary.MAE(name: str = None, filter_method: Callable[[numpy.ndarray, numpy.ndarray], Tuple[numpy.ndarray, numpy.ndarray]] = None, offset: int = 0, cuts: List[Tuple[pandas._libs.tslibs.timestamps.Timestamp, pandas._libs.tslibs.timestamps.Timestamp]] = None)

Bases: pywatts.summaries.metric_base.MetricBase

Module to calculate the Mean Absolute Error (MAE)

Parameters:
  • offset (int) – Offset, which determines the number of ignored values in the beginning for calculating the MAE. Default 0
  • filter_method (Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]) – Filter which should performed on the data before calculating the MAE.

pywatts.summaries.mape_summary module

class pywatts.summaries.mape_summary.MAPE(name: str = None, filter_method: Callable[[numpy.ndarray, numpy.ndarray], Tuple[numpy.ndarray, numpy.ndarray]] = None, offset: int = 0, cuts: List[Tuple[pandas._libs.tslibs.timestamps.Timestamp, pandas._libs.tslibs.timestamps.Timestamp]] = None)

Bases: pywatts.summaries.metric_base.MetricBase

Module to calculate the Mean Absolute Percentage Error (MAPE)

Parameters:
  • offset (int) – Offset, which determines the number of ignored values in the beginning for calculating the MAPE. Default 0
  • filter_method (Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]) – Filter which should performed on the data before calculating the MAPE.

pywatts.summaries.mase_summary module

class pywatts.summaries.mase_summary.MASE(name: str = 'MASE', filter_method=None, offset: int = 0, cuts: Optional[List[Tuple[pandas._libs.tslibs.timestamps.Timestamp, pandas._libs.tslibs.timestamps.Timestamp]]] = None, lag: int = 1)

Bases: pywatts.summaries.metric_base.MetricBase

Module to calculate the Mean Absolute Scaled Error (MAPE)

Parameters:
  • offset (int) – Offset, which determines the number of ignored values in the beginning for calculating the MAPE. Default 0
  • filter_method (Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]) – Filter which should performed on the data before calculating the MAPE.
  • lag (int) – The lag determines the persistence forecast that is used for scaling the error.

pywatts.summaries.max_summary module

class pywatts.summaries.max_summary.MaxErr(name: str = None, filter_method: Callable[[numpy.ndarray, numpy.ndarray], Tuple[numpy.ndarray, numpy.ndarray]] = None, offset: int = 0, cuts: List[Tuple[pandas._libs.tslibs.timestamps.Timestamp, pandas._libs.tslibs.timestamps.Timestamp]] = None)

Bases: pywatts.summaries.metric_base.MetricBase

Module to calculate the maximal absolute error

Parameters:
  • offset (int) – Offset, which determines the number of ignored values in the beginning for calculating the max. Default 0
  • filter_method (Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]) – Filter which should performed on the data before calculating the max.

pywatts.summaries.metric_base module

class pywatts.summaries.metric_base.MetricBase(name: str = None, filter_method: Callable[[numpy.ndarray, numpy.ndarray], Tuple[numpy.ndarray, numpy.ndarray]] = None, offset: int = 0, cuts: List[Tuple[pandas._libs.tslibs.timestamps.Timestamp, pandas._libs.tslibs.timestamps.Timestamp]] = None)

Bases: pywatts_pipeline.core.summary.base_summary.BaseSummary, abc.ABC

Base Class for all Metrics

Parameters:
  • offset (int) – Offset, which determines the number of ignored values in the beginning for calculating the Metric. Default 0
  • filter_method (Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]) – Filter which should performed on the data before calculating the Metric.
classmethod load(load_information: Dict[KT, VT])

Uses the data in load_information for restoring the state of the module.

Parameters:load_information (Dict) – The data needed for restoring the state of the module
Returns:The restored module
Return type:Base
save(fm: pywatts_pipeline.core.util.filemanager.FileManager) → Dict[KT, VT]

Saves the modules and the state of the module and returns a dictionary containing the relevant information.

Parameters:fm (FileManager) – the filemanager which can be used by the module for saving information about the module.
Returns:A dictionary containing the information needed for restoring the module

:rtype:Dict

transform(file_manager: pywatts_pipeline.core.util.filemanager.FileManager, y: xarray.core.dataarray.DataArray, **kwargs) → pywatts_pipeline.core.summary.summary_object.SummaryObjectList

Calculates the MAE based on the predefined target and predictions variables. :param file_manager: The filemanager, it can be used to store data that corresponds to the summary as a file. :type: file_manager: FileManager :param y: the input dataset :type y: xr.DataArray :param kwargs: the predictions :type kwargs: xr.DataArray

Returns:The calculated MAE
Return type:xr.DataArray

pywatts.summaries.min_summary module

class pywatts.summaries.min_summary.MinErr(name: str = None, filter_method: Callable[[numpy.ndarray, numpy.ndarray], Tuple[numpy.ndarray, numpy.ndarray]] = None, offset: int = 0, cuts: List[Tuple[pandas._libs.tslibs.timestamps.Timestamp, pandas._libs.tslibs.timestamps.Timestamp]] = None)

Bases: pywatts.summaries.metric_base.MetricBase

Module to calculate the minimal absolute error

Parameters:
  • offset (int) – Offset, which determines the number of ignored values in the beginning for calculating the min. Default 0
  • filter_method (Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]) – Filter which should performed on the data before calculating the min.

pywatts.summaries.rmse_summary module

class pywatts.summaries.rmse_summary.RMSE(name: str = None, filter_method: Callable[[numpy.ndarray, numpy.ndarray], Tuple[numpy.ndarray, numpy.ndarray]] = None, offset: int = 0, cuts: List[Tuple[pandas._libs.tslibs.timestamps.Timestamp, pandas._libs.tslibs.timestamps.Timestamp]] = None)

Bases: pywatts.summaries.metric_base.MetricBase

Module to calculate the Root Mean Squared Error (RMSE)

Parameters:
  • offset (int) – Offset, which determines the number of ignored values in the beginning for calculating the RMSE. Default 0
  • filter_method (Callable[[np.ndarray, np.ndarray], Tuple[np.ndarray, np.ndarray]]) – Filter which should performed on the data before calculating the RMSE.

pywatts.summaries.train_synthetic_test_real module

pywatts.summaries.tsne_visualisation module

class pywatts.summaries.tsne_visualisation.TSNESummary(name='TSNE', max_points=10000, all_in_one_plot=False, tsne_params=None)

Bases: pywatts_pipeline.core.summary.base_summary.BaseSummary

Summary that performs a t-distributed stochastic neighbor embedding (t-SNE) to visualise the data. It is possible to specify masks by providing kwargs to the transform method that end with _masked. :param max_point: The maximum number of points per data set that should be plotted :type max_point: int :param all_in_one_plot: Flag indicating if all input data should be visualised in the same plot. If not the column

GT is visualised like all other in separate plots.
Parameters:tsne_params (Dict) – Params for the t-SNE visualisation (see sklearn at `sklearn https://scikit-learn.org/stable/modules/generated/sklearn.manifold.TSNE.html`_).
transform(file_manager, gt: xarray.core.dataarray.DataArray, **kwargs)

Calculates the TSNE and visualises it. kwargs that end with _masked are masks for the other input. For example, gt_masked is a mask for gt. :param file_manager: The filemanager, it can be used to store data that corresponds to the summary as a file. :type: file_manager: FileManager :param gt: the gt dataset :type gt: xr.DataArray :param kwargs: the predictions :type kwargs: xr.DataArray

Returns:A SummaryObjectList with the paths to all plots.
Return type:SummaryObjectList

Module contents