Partial-Sample Regression

Post a relevance-based partial sample regression prediction task to the CSA Prediction Engine

The psr (partial sample regression) endpoint implements a two-step prediction process that identifies a subset of relevant observations and forms predictions as a relevance-weighted average of past outcomes. This approach allows for more targeted insights by focusing on the most pertinent data. When the subset equals the full sample, the process converges to classical linear regression, providing a flexible solution that adapts to varying levels of relevance.

Quick Start

Getting started with the psr endpoint is straightforward. Provide the access ID along with key prediction inputs: dependent variable, independent variables, and prediction parameters. The API will submit your prediction task for partial sample regression analysis, providing rapid insights tailored to your data.

post

Essential input arguments for invoking relevance-based partial sample regression predictions.

Authorizations
Header parameters
Content-TypestringOptional

The content type of the request (application/json)

Example: application/json
ConnectionstringOptional

Connection header value (keep-alive)

Example: keep-alive
Body
all ofOptional
Responses
200

The response body returns a job id and job code.

application/json
post
Python Example
import requests
import json

url = "https://api.csanalytics.io/v2/prediction-engine/psr"

payload = {
    "y": [[18.8], [2.3], [3.0], [6.7], [15.2], [20.9], [4.0]],
    "X": [[25.0,2.0,76.0,53.7,23.1],[29.0,1.0,78.0,39.1,5.7],[32.0,2.0,77.0,54.1,5.3],[30.0,5.0,82.0,68.7,8.7],[24.0,1.0,69.0,51.0,20.3],[25.0,2.0,79.0,50.2,20.0],[35.0,3.0,80.0,51.5,9.4]],
    "theta": [[24.0, 5.0, 81.0, 60.0, 11.0]]
}

headers = {
  'x-api-key': 'CSA_API_KEY',
  'Content-Type': 'application/json',
  'Connection': 'keep-alive'
}

response = requests.request("POST", url, headers=headers, data=json.dumps(payload))

200

The response body returns a job id and job code.

{
  "job_id": 1074,
  "job_code": "66cfc21f7effa501"
}

Custom Settings

The psr endpoint allows for extensive customization, giving you the flexibility to modify key options such as censor evaluation types, censor thresholds, and censor sign direction. These settings help refine the regression process, ensuring the outputs are tailored to the specific nuances of your experiment. Perfect for users seeking more control over the relevance-based analysis.

post

Extended specifications for invoking relevance-based partial sample regression predictions.

Authorizations
Header parameters
Content-TypestringOptional

The content type of the request (application/json)

Example: application/json
ConnectionstringOptional

Connection header value (keep-alive)

Example: keep-alive
Body
all ofOptional
and
Responses
200

Response body of a successful post job (psr).

application/json
post
Python Example
import requests
import json

url = "https://api.csanalytics.io/v2/prediction-engine/psr"

payload = {
    "y": [[18.8], [2.3], [3.0], [6.7], [15.2], [20.9], [4.0]],
    "X": [[25.0, 2.0, 76.0, 53.7, 23.1], [29.0, 1.0, 78.0, 39.1, 5.7], [32.0, 2.0, 77.0, 54.1, 5.3], [30.0, 5.0, 82.0, 68.7, 8.7], [24.0, 1.0, 69.0, 51.0, 20.3], [25.0, 2.0, 79.0, 50.2, 20.0], [35.0, 3.0, 80.0, 51.5, 9.4]],
    "theta": [[24.0, 5.0, 81.0, 60.0, 11.0]],
    "threshold": 0.50,
    "is_threshold_percent": true,
    "most_eval": true,
    "eval_type": "both"
}

headers = {
  'x-api-key': 'CSA_API_KEY',
  'Content-Type': 'application/json',
  'Connection': 'keep-alive'
}

response = requests.request("POST", url, headers=headers, data=json.dumps(payload))

print(response.text)
200

Response body of a successful post job (psr).

{
  "job_id": 1074,
  "job_code": "66cfc21f7effa501"
}

Last updated