Merge pull request #918 from orange-crow/add_sales_forecast_in_machine_learning

Add sales forecast in machine learning
This commit is contained in:
garylin2099 2024-02-28 11:20:52 +08:00 committed by GitHub
commit 79262f392e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 3 deletions

View file

@ -2,10 +2,20 @@ import fire
from metagpt.roles.mi.interpreter import Interpreter
WINE_REQ = "Run data analysis on sklearn Wine recognition dataset, include a plot, and train a model to predict wine class (20% as validation), and show validation accuracy."
async def main(auto_run: bool = True):
requirement = "Run data analysis on sklearn Wine recognition dataset, include a plot, and train a model to predict wine class (20% as validation), and show validation accuracy."
DATA_DIR = "path/to/your/data"
# sales_forecast data from https://www.kaggle.com/datasets/aslanahmedov/walmart-sales-forecast/data
SALES_FORECAST_REQ = f"""Train a model to predict sales for each department in every store (split the last 40 weeks records as validation dataset, the others is train dataset), include plot total sales trends, print metric and plot scatter plots of
groud truth and predictions on validation data. Dataset is {DATA_DIR}/train.csv, the metric is weighted mean absolute error (WMAE) for test data. Notice: *print* key variables to get more information for next task step.
"""
REQUIREMENTS = {"wine": WINE_REQ, "sales_forecast": SALES_FORECAST_REQ}
async def main(auto_run: bool = True, use_case: str = "wine"):
mi = Interpreter(auto_run=auto_run)
requirement = REQUIREMENTS[use_case]
await mi.run(requirement)

View file

@ -182,7 +182,7 @@ class ExecuteNbCode(Action):
outputs = self.parse_outputs(self.nb.cells[-1].outputs)
outputs, success = truncate(remove_escape_and_color_codes(outputs), is_success=success)
if "!pip" in outputs:
if "!pip" in code:
success = False
return outputs, success