Compute model-agnostic feature importance weights
curl --request POST \
--url https://api.nixtla.io/v2/explain \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"series": {
"y": [
123
],
"sizes": [
123
],
"X": [
[
123
]
],
"categorical_exog": [
1
],
"start_datetime": [
"<string>"
]
},
"method": "granger"
}
'import requests
url = "https://api.nixtla.io/v2/explain"
payload = {
"series": {
"y": [123],
"sizes": [123],
"X": [[123]],
"categorical_exog": [1],
"start_datetime": ["<string>"]
},
"method": "granger"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
series: {
y: [123],
sizes: [123],
X: [[123]],
categorical_exog: [1],
start_datetime: ['<string>']
},
method: 'granger'
})
};
fetch('https://api.nixtla.io/v2/explain', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nixtla.io/v2/explain",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'series' => [
'y' => [
123
],
'sizes' => [
123
],
'X' => [
[
123
]
],
'categorical_exog' => [
1
],
'start_datetime' => [
'<string>'
]
],
'method' => 'granger'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nixtla.io/v2/explain"
payload := strings.NewReader("{\n \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ],\n \"start_datetime\": [\n \"<string>\"\n ]\n },\n \"method\": \"granger\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nixtla.io/v2/explain")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ],\n \"start_datetime\": [\n \"<string>\"\n ]\n },\n \"method\": \"granger\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixtla.io/v2/explain")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ],\n \"start_datetime\": [\n \"<string>\"\n ]\n },\n \"method\": \"granger\"\n}"
response = http.request(request)
puts response.read_body{
"weights": [
123
],
"method": "<string>",
"feature_names": [
"<string>"
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}API Reference
Compute model-agnostic feature importance weights
Compute model-agnostic feature importance weights for the provided exogenous features. It takes a JSON as an input containing the historical data with exogenous features and the attribution method to use. No foundation model is involved. The response contains one normalized weight per feature.
POST
/
v2
/
explain
Compute model-agnostic feature importance weights
curl --request POST \
--url https://api.nixtla.io/v2/explain \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"series": {
"y": [
123
],
"sizes": [
123
],
"X": [
[
123
]
],
"categorical_exog": [
1
],
"start_datetime": [
"<string>"
]
},
"method": "granger"
}
'import requests
url = "https://api.nixtla.io/v2/explain"
payload = {
"series": {
"y": [123],
"sizes": [123],
"X": [[123]],
"categorical_exog": [1],
"start_datetime": ["<string>"]
},
"method": "granger"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
series: {
y: [123],
sizes: [123],
X: [[123]],
categorical_exog: [1],
start_datetime: ['<string>']
},
method: 'granger'
})
};
fetch('https://api.nixtla.io/v2/explain', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nixtla.io/v2/explain",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'series' => [
'y' => [
123
],
'sizes' => [
123
],
'X' => [
[
123
]
],
'categorical_exog' => [
1
],
'start_datetime' => [
'<string>'
]
],
'method' => 'granger'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.nixtla.io/v2/explain"
payload := strings.NewReader("{\n \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ],\n \"start_datetime\": [\n \"<string>\"\n ]\n },\n \"method\": \"granger\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nixtla.io/v2/explain")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ],\n \"start_datetime\": [\n \"<string>\"\n ]\n },\n \"method\": \"granger\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixtla.io/v2/explain")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"series\": {\n \"y\": [\n 123\n ],\n \"sizes\": [\n 123\n ],\n \"X\": [\n [\n 123\n ]\n ],\n \"categorical_exog\": [\n 1\n ],\n \"start_datetime\": [\n \"<string>\"\n ]\n },\n \"method\": \"granger\"\n}"
response = http.request(request)
puts response.read_body{
"weights": [
123
],
"method": "<string>",
"feature_names": [
"<string>"
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
HTTPBearer
Body
application/json
Was this page helpful?