> ## Documentation Index
> Fetch the complete documentation index at: https://docs.synthefy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Amazon SageMaker

> Deploy Nori from AWS Marketplace as a SageMaker endpoint and predict in your own AWS account.

Deploy Nori in your **own AWS account** from AWS Marketplace. Nori runs as an
Amazon SageMaker endpoint, so your data never leaves your environment. It's
**in-context**: you pass labeled rows as examples and the rows you want scored,
and it returns one prediction per row in a single forward pass — no training.

<Note>
  The model runs inside your account. Inputs and predictions stay in your AWS
  environment; nothing is sent to Synthefy.
</Note>

**Prerequisites**

<Steps>
  <Step title="AWS account with SageMaker access">
    And permission to subscribe to products on AWS Marketplace.
  </Step>

  <Step title="A GPU instance">
    Nori deploys on GPU instances (e.g. `ml.g5.xlarge`). Make sure your account has quota for one.
  </Step>
</Steps>

### Deploy

<Steps>
  <Step title="Subscribe on AWS Marketplace">
    Find the **Synthefy-Nori** listing on AWS Marketplace, choose **View purchase options**, and **Subscribe**. It's free — you pay only for the AWS compute you run.
  </Step>

  <Step title="Create a model">
    In the SageMaker console, go to **Inference → Marketplace model packages** (or **Create model**). Under the container definition, choose **Use a model package subscription** and select **Synthefy-Nori**.
  </Step>

  <Step title="Create an endpoint">
    Select the model and choose **Create endpoint**. Pick a GPU instance (`ml.g5.xlarge`) and wait for the endpoint to reach **InService** (typically a few minutes).
  </Step>
</Steps>

### Predict

<Tabs>
  <Tab title="Python (boto3)">
    ```python nori_predict.py theme={null}
    import boto3, json

    rt = boto3.client("sagemaker-runtime", region_name="us-east-1")

    X_train = [[0.0, 1.0], [1.0, 0.0], [0.5, 0.5], [0.2, 0.8]]
    y_train = [0.1, 0.9, 0.5, 0.3]
    X_test  = [[0.3, 0.7], [0.8, 0.2]]

    resp = rt.invoke_endpoint(
        EndpointName="your-nori-endpoint",
        ContentType="application/json",
        Body=json.dumps({
            "task": "regression",
            "X_train": X_train,
            "y_train": y_train,
            "X_test": X_test,
        }),
    )
    out = json.loads(resp["Body"].read())
    print(out["predictions"])   # [0.37, 0.75]
    ```
  </Tab>

  <Tab title="AWS CLI">
    ```bash Invoke theme={null}
    cat > payload.json <<'EOF'
    {"task":"regression","X_train":[[0.0,1.0],[1.0,0.0],[0.5,0.5],[0.2,0.8]],"y_train":[0.1,0.9,0.5,0.3],"X_test":[[0.3,0.7],[0.8,0.2]]}
    EOF

    aws sagemaker-runtime invoke-endpoint \
      --endpoint-name your-nori-endpoint \
      --content-type application/json \
      --body fileb://payload.json \
      out.json && cat out.json
    ```
  </Tab>
</Tabs>

**Request / response**

```json Contract theme={null}
// request
{ "task": "regression", "X_train": [[...]], "y_train": [...], "X_test": [[...]] }

// response
{ "task": "regression", "predictions": [ ... ], "usage": { ... } }
```

`predictions[i]` corresponds to `X_test[i]`, in the original target units.

### Notes

<Note>
  **Numeric features only.** Encode categorical columns (one-hot or ordinal) before sending; the same columns and order for `X_train` and `X_test`.
</Note>

<Warning>
  **Real-time limits.** A single invocation is capped at 6 MB and 60 seconds. For large tables, run a **batch transform** job (or split `X_test` across requests).
</Warning>

<Note>
  **Instances.** Supported GPU instances: `ml.g5.xlarge`, `ml.g5.2xlarge`, `ml.g6.xlarge`.
</Note>
