meridian.data.load.XrDatasetDataLoader

Reads data from an xarray.Dataset object.

Inherits From: InputDataLoader

Example:

  data_loader = XrDatasetDataLoader(pickle.loads('data.pickle'))
  data = data_loader.load()

dataset An xarray.Dataset object containing the input data.
kpi_type A string denoting whether the KPI is of a 'revenue' or 'non-revenue' type. When the kpi_type is 'non-revenue' and revenue_per_kpi exists, ROI calibration is used and the analysis is run on revenue. When revenue_per_kpi doesn't exist for the same kpi_type, custom ROI calibration is used and the analysis is run on KPI.
name_mapping An optional dictionary whose keys are the current coordinates or array names in the input dataset and whose values are the desired coordinates (geo, time, media_time, media_channel and/or rf_channel, control_variable, non_media_channel, organic_media_channel, organic_rf_channel) or array names (kpi, revenue_per_kpi, media, media_spend and/or rf_spend, controls, population, non_media_treatments, organic_media, organic_reach, organic_frequency). Mapping must be provided if the names in the input dataset are different from the required ones, otherwise errors are thrown.

dataset An xr.Dataset object containing the input data.
kpi_type A string denoting whether the KPI is of a 'revenue' or 'non-revenue' type. When the kpi_type is 'non-revenue' and revenue_per_kpi exists, ROI calibration is used and the analysis is run on revenue. When revenue_per_kpi doesn't exist for the same kpi_type, custom ROI calibration is used and the analysis is run on KPI.

Methods

load

View source

Returns an InputData object containing the data from the dataset.