API
HourlyModel(settings=None)
🔗
A class to fit a model to the input meter data.
Attributes:
Name | Type | Description |
---|---|---|
settings |
dict
|
A dictionary of settings. |
baseline_metrics |
dict
|
A dictionary of metrics based on input baseline data and model fit. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
settings |
dict | BaseHourlySettings | None
|
HourlySettings to use (generally left default). Will default to solar model if GHI is given to the fit step. |
None
|
settings = _settings.BaseHourlySettings()
instance-attribute
🔗
is_fitted = False
instance-attribute
🔗
baseline_metrics = None
instance-attribute
🔗
baseline_hour_metrics = None
instance-attribute
🔗
warnings: list[EEMeterWarning] = []
instance-attribute
🔗
disqualification: list[EEMeterWarning] = []
instance-attribute
🔗
baseline_timezone = None
instance-attribute
🔗
error = dict()
instance-attribute
🔗
version = __version__
instance-attribute
🔗
fit(baseline_data, ignore_disqualification=False)
🔗
Fit the model using baseline data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
baseline_data |
HourlyBaselineData
|
HourlyBaselineData object. |
required |
ignore_disqualification |
bool
|
Whether to ignore disqualification errors / warnings. |
False
|
Returns:
Type | Description |
---|---|
HourlyModel
|
The fitted model. |
Raises:
Type | Description |
---|---|
TypeError
|
If baseline_data is not an HourlyBaselineData object. |
DataSufficiencyError
|
If the model can’t be fit on disqualified baseline data. |
predict(reporting_data, ignore_disqualification=False)
🔗
Predicts the energy consumption using the fitted model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reporting_data |
Union[HourlyBaselineData, HourlyReportingData]
|
The data used for prediction. |
required |
ignore_disqualification |
bool
|
Whether to ignore model disqualification. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
DataFrame
|
Dataframe with input data along with predicted energy consumption. |
Raises:
Type | Description |
---|---|
RuntimeError
|
If the model is not fitted. |
DisqualifiedModelError
|
If the model is disqualified and ignore_disqualification is False. |
TypeError
|
If the reporting data is not of type HourlyBaselineData or HourlyReportingData. |
to_dict()
🔗
Returns a dictionary of model parameters.
Returns:
Type | Description |
---|---|
dict
|
Model parameters. |
to_json()
🔗
Returns a JSON string of model parameters.
Returns:
Type | Description |
---|---|
str
|
Model parameters. |
from_dict(data)
classmethod
🔗
Create a instance of the class from a dictionary (such as one produced from the to_dict method).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
dict
|
The dictionary containing the model data. |
required |
Returns:
Type | Description |
---|---|
HourlyModel
|
An instance of the class. |
from_json(str_data)
classmethod
🔗
Create an instance of the class from a JSON string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
str_data |
The JSON string representing the object. |
required |
Returns:
Type | Description |
---|---|
HourlyModel
|
An instance of the class. |
plot(df_eval)
🔗
Plot a model fit with baseline or reporting data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df_eval |
HourlyBaselineData | HourlyReportingData
|
The baseline or reporting data object to plot. |
required |
HourlyBaselineData(df, is_electricity_data, pv_start=None, settings=None, **kwargs)
🔗
Data class to represent Hourly Baseline Data.
Only baseline data should go into the dataframe input, no blackout data should be input. Checks sufficiency for the data provided as input depending on OpenEEMeter specifications and populates disqualifications and warnings based on it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
A dataframe having a datetime index or a datetime column with the timezone also being set. It also requires 2 more columns - ‘observed’ for meter data, and ‘temperature’ for temperature data. Optionally, column ‘ghi’ can be included in order to fit on solar data. The temperature column should have values in Fahrenheit. Please convert your temperatures accordingly. |
required |
is_electricity_data |
bool
|
Flag to ascertain if this is electricity data or not. Electricity data values of 0 are set to NaN. |
required |
Attributes:
Name | Type | Description |
---|---|---|
df |
DataFrame
|
Immutable dataframe that contains the meter and temperature values for the baseline data period. |
disqualification |
list[EEMeterWarning]
|
A list of serious issues with the data that can degrade the quality of the model. If you want to go ahead with building the model while ignoring them, set the ignore_disqualification = True flag in the model. By default disqualifications are not ignored. |
warnings |
list[EEMeterWarning]
|
A list of issues with the data, but none that will severely reduce the quality of the model built. |
pv_start |
date
|
Solar install date. If left unset, assumed to be at beginning of data. |
is_electricity_data = is_electricity_data
instance-attribute
🔗
tz = None
instance-attribute
🔗
warnings = []
instance-attribute
🔗
disqualification = []
instance-attribute
🔗
pv_start = None
instance-attribute
🔗
settings = HourlyDataSettings()
instance-attribute
🔗
df
property
🔗
Get the corrected input data stored in the class. The actual dataframe is immutable, this returns a copy.
log_warnings()
🔗
Logs the warnings and disqualifications associated with the data.
HourlyReportingData(df, is_electricity_data, pv_start=None, settings=None, **kwargs)
🔗
Data class to represent Hourly Reporting Data.
Only reporting data should go into the dataframe input, no blackout data should be input. Checks sufficiency for the data provided as input depending on OpenEEMeter specifications and populates disqualifications and warnings based on it.
Meter data input is optional for the reporting class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
A dataframe having a datetime index or a datetime column with the timezone also being set. It also requires 2 more columns - ‘observed’ for meter data, and ‘temperature’ for temperature data. If GHI was provided during the baseline period, it should also be supplied for the reporting period with column name ‘ghi’. The temperature column should have values in Fahrenheit. Please convert your temperatures accordingly. |
required |
is_electricity_data |
bool
|
Flag to ascertain if this is electricity data or not. Electricity data values of 0 are set to NaN. |
required |
Attributes:
Name | Type | Description |
---|---|---|
df |
DataFrame
|
Immutable dataframe that contains the meter and temperature values for the baseline data period. |
disqualification |
list[EEMeterWarning]
|
A list of serious issues with the data that can degrade the quality of the model. If you want to go ahead with building the model while ignoring them, set the ignore_disqualification = True flag in the model. By default disqualifications are not ignored. |
warnings |
list[EEMeterWarning]
|
A list of issues with the data, but none that will severely reduce the quality of the model built. |
pv_start |
date
|
Solar install date. If left unset, assumed to be at beginning of data. |
is_electricity_data = is_electricity_data
instance-attribute
🔗
tz = None
instance-attribute
🔗
warnings = []
instance-attribute
🔗
disqualification = []
instance-attribute
🔗
pv_start = None
instance-attribute
🔗
settings = HourlyDataSettings()
instance-attribute
🔗
df
property
🔗
Get the corrected input data stored in the class. The actual dataframe is immutable, this returns a copy.
log_warnings()
🔗
Logs the warnings and disqualifications associated with the data.