예제 #1
0
def export(output: str = typer.Argument(".", help="Location to export")):
    """
        Export previosly trained AutoML instance.
        """

    model = AutoML.folder_load(Path("."))
    model.export_portable(output)
예제 #2
0
def automl_predict(
        input: Path,
        output: Path = Path("output.csv"),
        model: Path = Path("."),
        ignore_cols: List[int] = typer.Option([]),
        format: str = None,
):
    """
    🔮 Predict with a previously trained AutoML instance.
    """

    try:
        dataset = _load_dataset(format, input, ignore_cols)
    except ValueError as e:
        logger.error(f"⚠️  Error: {str(e)}")
        return

    try:
        automl = AutoML.folder_load(model)
    except TypeError as e:
        logger.error(f"⚠️  Error: {str(e)}")
        return

    console.print(f"🔮 Predicting {len(dataset)} items with the pipeline:")
    console.print(repr(automl.best_pipeline_))

    X = dataset.values
    y = automl.predict(X)

    with output.open("wt") as fp:
        df = pd.DataFrame(y, columns=["y"])
        df.to_csv(fp)

    console.print(f"💾 Predictions saved to [blue]{output.absolute()}[/]")
예제 #3
0
def automl_server(
        path: str = typer.Argument(".", help="Autogoal serialized model"),
        ip: str = typer.Argument(
            "0.0.0.0", help="Interface ip to be used by the HTTP API"),
        port: int = typer.Argument(8000, help="Port to be bind by the server"),
):
    console.print(f"Loading model from folder: {path}")
    model = AutoML.folder_load(Path(path))
    run(model, ip, port)