learn
ies_pi_predict.learn
learned_predict
learned_predict(
df: DataFrame,
output_column: str,
predict_start: datetime,
predict_end: datetime,
algorhythms: list[Algorhythm] = default_algorhythms,
random_state: int | None = None,
) -> tuple[pd.Series, Algorhythm, float, float]
learned_predict uses machine learning to predict unknown values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
A dataframe with a datetime index and columns representing input variables and an output variables of a system. |
required |
output_column
|
str
|
The name of the output column |
required |
predict_start
|
datetime
|
The date for which to start predicting values. |
required |
predict_end
|
datetime
|
The date for which to stop predicting values. |
required |
algorhythms
|
list[Algorhythm]
|
The list of algorhythm to use. |
default_algorhythms
|
random_state
|
int | None
|
The random state, used for testing and debugging. Defaults to None. |
None
|
It firsts enriches the provided DataFrame with columns calculated from the datetime index. They will provide to the model more info regarding the date and time of day.
It then instantiates models with the provided algorhytms and train them with the provided data (input columns and output columns).
The algorhythms that best fits the data (calculated with a mean squared error function) is then used to predict data for the portion of time between the provided dates.
Returns:
| Type | Description |
|---|---|
tuple[Series, Algorhythm, float, float]
|
tuple[pd.Series, Algorhythm, float, float]: A tuple containing: - a series of predicted values (with a datetime index) - the algorhythm that was used - the score (coefficient of determination) it obtained during training - the RMSE (Root mean square error) it obtained during training |