Container for data variable arguments of Analyzer methods.
Inherits From: ExtensionType
meridian
.
analysis
.
analyzer
.
DataTensors
(
media
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
media_spend
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
reach
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
frequency
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
rf_impressions
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
rf_spend
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
organic_media
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
organic_reach
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
organic_frequency
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
non_media_treatments
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
controls
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
revenue_per_kpi
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
,
time
:
Optional
[
meridian
.
backend
.
Tensor
]
=
None
)
Attributes
(n_media_channels,)
or (n_geos, T, n_media_channels)
for any time dimension T
. If the object
includes variables with modified time periods, then this tensor must be
provided at the geo and time granularity.(n_geos, T, n_rf_channels)
for any time dimension T
.(n_rf_channels,)
or (n_geos, T,
n_rf_channels)
for any time dimension T
. If the object includes
variables with modified time periods, then this tensor must be provided at
the geo and time granularity.(n_geos, T,
n_organic_media_channels)
for any time dimension T
.(n_geos, T,
n_organic_rf_channels)
for any time dimension T
.(n_geos, T,
n_organic_rf_channels)
for any time dimension T
.(n_geos, T,
n_non_media_channels)
for any time dimension T
.Child Classes
Methods
filter_fields
filter_fields
(
fields
:
Sequence
[
str
]
)
->
Self
Returns a new DataTensors object with only the specified fields.
get_modified_times
get_modified_times
(
meridian
:
meridian
.
model
.
model
.
Meridian
)
->
(
int
|
None
)
Returns n_times
of any tensor where n_times
has been modified.
This method compares the time dimensions of the attributes in the DataTensors
object with the corresponding tensors in the meridian
object. If any of the time dimensions are different, then this method
returns the modified number of time periods of the tensor in the DataTensors
object. If all time dimensions are the same, returns None
.
meridian
n_times
of any tensor where n_times
is different from the times
of the corresponding tensor in the meridian
object. If all time
dimensions are the same, returns None
. total_spend
total_spend
()
->
(
meridian
.
backend
.
Tensor
|
None
)
Returns the total spend tensor.
media_spend
tensor (if present) concatenated with the rf_spend
tensor (if present), in this order. If both tensors are missing, returns None
. validate_and_fill_missing_data
validate_and_fill_missing_data
(
required_tensors_names
:
Sequence
[
str
],
meridian
:
meridian
.
model
.
model
.
Meridian
,
allow_modified_times
:
bool
=
True
)
->
Self
Fills missing data tensors with their original values from the model.
This method uses the collection of data tensors set in the DataTensor class
and fills in the missing tensors with their original values from the
Meridian object that is passed in. For example, if required_tensors_names =
["media", "reach", "frequency"]
and only media
is set in the DataTensors
class, then this method will output a new DataTensors object with the media
value in this object plus the values of the reach
and frequency
from the meridian
object.
required_tensors_names
meridian
object.meridian
allow_modified_times
DataTensors
container with the original values from the Meridian
object filled in for the missing data tensors. __eq__
__eq__
(
other
:
Any
)
->
bool
Provides safe equality comparison for mixed tensor/non-tensor fields.
__ne__
__ne__
(
other
)
Return self!=value.



