Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.woodwide.ai/llms.txt

Use this file to discover all available pages before exploring further.

Prediction models learn to predict a target column from the remaining columns in your dataset. Wood Wide AI automatically detects whether the task is binary classification, multiclass classification, or regression based on the target column’s values.

Training

At training time, you must specify the label_column — the column to be predicted. All other columns (or those specified via input_columns) are used as input features. A portion of the training data is automatically held out for validation. After training, validation metrics are reported on this holdout set:
TaskMetricDescription
Binary / multiclass classificationaccuracyFraction of correct predictions on the holdout set.
Regressionr2R-squared (coefficient of determination) on the holdout set.
These metrics are available on the model object via GET /models/{model_id} in the current_metrics field, and on each model version via GET /models/{model_id}/versions.
Python
import os, time, requests

api_key = os.getenv("WOODWIDE_API_KEY")
base_url = "https://api.woodwide.ai"
headers = {"Authorization": f"Bearer {api_key}"}

# Upload training data
with open("train.csv", "rb") as f:
    resp = requests.post(
        f"{base_url}/datasets",
        headers=headers,
        files={"file": ("train.csv", f, "text/csv")},
        data={"dataset_name": "customer_churn"},
    )
dataset_id = resp.json()["dataset"]["id"]

# Train a prediction model
resp = requests.post(
    f"{base_url}/models/train",
    headers=headers,
    json={
        "model_name": "churn_predictor",
        "model_type": "prediction",
        "dataset_id": dataset_id,
        "label_column": "churned",
    },
)
model_id = resp.json()["model"]["id"]

# Wait for training
while True:
    model = requests.get(
        f"{base_url}/models/{model_id}", headers=headers
    ).json()
    if model["status"] == "ready":
        break
    time.sleep(5)

# Check validation metrics
print(model["current_metrics"])  # e.g. {"accuracy": 0.92}

Inference

At inference time, provide a CSV with the same input columns as the training data. The target column need not be present — if it is, it will be ignored. The model predicts the target column for each row.
Python
# Run inference on new data
with open("test.csv", "rb") as f:
    resp = requests.post(
        f"{base_url}/models/{model_id}/infer",
        headers=headers,
        files={"file": ("test.csv", f, "text/csv")},
        data={"output_type": "json"},
    )

results = resp.json()["data"]
print(results)
See Output Formats for the full output schema.