Item predictions

This part of the pipeline is responsible for predicting the future purchases of the items based on their purchase history. The predictions are done using the RandomForestRegressor algorithm from the scikit-learn library. The model is trained on the historical data and then used to predict the future purchases.

itemPredictions.predict_quantity_per_cluster(rfc_clustering: DataFrame, itemDataset: DataFrame, prediction_type: str = 'LSTM', distribution_center: str = None, product_subgroup: str = None, pred_weeks: int = 52) DataFrame

Predicts the quantity per cluster based on the provided distribution center and optionally, the product subgroup.

Parameters:
  • rfc_clustering (pd.DataFrame) – The DataFrame containing the clustered items.

  • itemDataset (pd.DataFrame) – The preprocessed DataFrame.

  • prediction_type (str) – The type of prediction model to be used, default is “LSTM”.

  • distribution_center (str) – The distribution center for which the prediction is made (must be provided).

  • product_subgroup (str or None) – The specific product subgroup for prediction, if provided.

  • pred_weeks (int) – The number of weeks for which the prediction is made.

Returns:

A DataFrame containing the predicted quantities.

Return type:

pd.DataFrame