> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.umnai.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.umnai.com/_mcp/server.

# Dataset histogram

The Dataset histogram view describes the distribution of values in a dataset.

Use it to inspect categorical frequencies, numeric bins, target statistics, and masked or infrequent values before training, model review, or explanation work.

## When to use

| Use case                     | Description                                                                                   |
| ---------------------------- | --------------------------------------------------------------------------------------------- |
| Inspect data distribution    | Review how feature and target values are distributed across the dataset.                      |
| Check categorical balance    | Compare category frequencies and frequency fractions for categorical fields.                  |
| Review numeric bins          | Inspect bin ranges and frequencies for numeric fields.                                        |
| Investigate target behaviour | Use target summary statistics to understand how target values vary across bins or categories. |
| Focus on selected fields     | Use `fields` to return histogram data for specific dataset fields.                            |

## Generate the view

Generate the Dataset histogram view from a dataset.

### Request

POST [https://api.hi.umnai.com/datasets/\{datasetId}/views](https://api.hi.umnai.com/datasets/\{datasetId}/views)

```curl Histogram View with default values
curl -X POST https://api.hi.umnai.com/datasets/datasetId/views \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "data": [
    {
      "view_type": "HISTOGRAM"
    }
  ]
}'
```

```python Histogram View with default values
import requests

url = "https://api.hi.umnai.com/datasets/:datasetId/views"

payload = { "data": [{ "view_type": "HISTOGRAM" }] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Histogram View with default values
const url = 'https://api.hi.umnai.com/datasets/:datasetId/views';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"data":[{"view_type":"HISTOGRAM"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Histogram View with default values
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.hi.umnai.com/datasets/:datasetId/views"

	payload := strings.NewReader("{\n  \"data\": [\n    {\n      \"view_type\": \"HISTOGRAM\"\n    }\n  ]\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(res)
	fmt.Println(string(body))

}
```

```ruby Histogram View with default values
require 'uri'
require 'net/http'

url = URI("https://api.hi.umnai.com/datasets/:datasetId/views")

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  \"data\": [\n    {\n      \"view_type\": \"HISTOGRAM\"\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Histogram View with default values
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.hi.umnai.com/datasets/:datasetId/views")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"data\": [\n    {\n      \"view_type\": \"HISTOGRAM\"\n    }\n  ]\n}")
  .asString();
```

```php Histogram View with default values
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.hi.umnai.com/datasets/:datasetId/views', [
  'body' => '{
  "data": [
    {
      "view_type": "HISTOGRAM"
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Histogram View with default values
using RestSharp;

var client = new RestClient("https://api.hi.umnai.com/datasets/:datasetId/views");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"data\": [\n    {\n      \"view_type\": \"HISTOGRAM\"\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Histogram View with default values
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["data": [["view_type": "HISTOGRAM"]]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hi.umnai.com/datasets/:datasetId/views")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Response (200)

```json
{
  "data": [
    {
      "view_type": "HISTOGRAM",
      "view_data": {
        "columns": [
          "bin_index",
          "bin_low",
          "bin_high",
          "token",
          "field_type",
          "is_categorical",
          "frequency",
          "target_min",
          "target_max",
          "target_mean",
          "target_sum",
          "target_var",
          "target_stddev",
          "frequency_fraction",
          "is_masked_token",
          "is_infrequent",
          "field"
        ],
        "index": [
          0,
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9,
          10,
          11,
          12,
          13,
          14,
          15,
          16,
          17,
          18,
          19,
          20,
          21,
          22,
          23,
          24,
          25,
          26,
          27,
          28,
          29,
          30,
          31,
          32,
          33,
          34,
          35,
          36,
          37,
          38,
          39,
          40,
          41,
          42,
          43,
          44,
          45,
          46,
          47,
          48,
          49,
          50,
          51,
          52,
          53,
          54,
          55,
          56,
          57,
          58,
          59,
          60,
          61,
          62,
          63,
          64,
          65,
          66,
          67,
          68,
          69,
          70,
          71,
          72,
          73,
          74,
          75,
          76,
          77,
          78,
          79,
          80,
          81,
          82,
          83,
          84,
          85,
          86,
          87,
          88,
          89,
          90,
          91,
          92,
          93,
          94,
          95,
          96,
          97,
          98,
          99,
          100,
          101,
          102,
          103,
          104,
          105,
          106,
          107,
          108,
          109,
          110,
          111,
          112
        ],
        "data": [
          [
            null,
            null,
            null,
            "10th",
            "FEATURE",
            true,
            1950,
            [
              0
            ],
            [
              1
            ],
            [
              0.0594871795
            ],
            [
              116
            ],
            [
              0.055948455
            ],
            [
              0.2365342575
            ],
            0.0278547553,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "11th",
            "FEATURE",
            true,
            2499,
            [
              0
            ],
            [
              1
            ],
            [
              0.0496198479
            ],
            [
              124
            ],
            [
              0.0471577186
            ],
            [
              0.2171582801
            ],
            0.0356969403,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "12th",
            "FEATURE",
            true,
            929,
            [
              0
            ],
            [
              1
            ],
            [
              0.0656620022
            ],
            [
              61
            ],
            [
              0.0613505036
            ],
            [
              0.2476903382
            ],
            0.0132702911,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "1st-4th",
            "FEATURE",
            true,
            374,
            [
              0
            ],
            [
              1
            ],
            [
              0.0294117647
            ],
            [
              11
            ],
            [
              0.0285467128
            ],
            [
              0.1689577249
            ],
            0.0053423992,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "5th-6th",
            "FEATURE",
            true,
            758,
            [
              0
            ],
            [
              1
            ],
            [
              0.0540897098
            ],
            [
              41
            ],
            [
              0.0511640131
            ],
            [
              0.2261946353
            ],
            0.0108276433,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "7th-8th",
            "FEATURE",
            true,
            1363,
            [
              0
            ],
            [
              1
            ],
            [
              0.0652971387
            ],
            [
              89
            ],
            [
              0.0610334223
            ],
            [
              0.247049433
            ],
            0.0194697597,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "9th",
            "FEATURE",
            true,
            1087,
            [
              0
            ],
            [
              1
            ],
            [
              0.0441582337
            ],
            [
              48
            ],
            [
              0.0422082841
            ],
            [
              0.205446548
            ],
            0.0155272405,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "Assoc-acdm",
            "FEATURE",
            true,
            2194,
            [
              0
            ],
            [
              1
            ],
            [
              0.2525068368
            ],
            [
              554
            ],
            [
              0.1887471342
            ],
            [
              0.4344503817
            ],
            0.0313401708,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "Assoc-voc",
            "FEATURE",
            true,
            2845,
            [
              0
            ],
            [
              1
            ],
            [
              0.2358523726
            ],
            [
              671
            ],
            [
              0.1802260309
            ],
            [
              0.4245303651
            ],
            0.0406393738,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "Bachelors",
            "FEATURE",
            true,
            10936,
            [
              0
            ],
            [
              1
            ],
            [
              0.404444038
            ],
            [
              4423
            ],
            [
              0.2408690581
            ],
            [
              0.4907841258
            ],
            0.1562151816,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "Doctorate",
            "FEATURE",
            true,
            801,
            [
              0
            ],
            [
              1
            ],
            [
              0.7116104869
            ],
            [
              570
            ],
            [
              0.2052210018
            ],
            [
              0.4530132469
            ],
            0.0114418764,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "HS-grad",
            "FEATURE",
            true,
            21970,
            [
              0
            ],
            [
              1
            ],
            [
              0.1511606736
            ],
            [
              3321
            ],
            [
              0.1283111244
            ],
            [
              0.3582054221
            ],
            0.3138302431,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "Masters",
            "FEATURE",
            true,
            3626,
            [
              0
            ],
            [
              1
            ],
            [
              0.5383342526
            ],
            [
              1952
            ],
            [
              0.2485304851
            ],
            [
              0.4985283192
            ],
            0.0517955604,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "Preschool",
            "FEATURE",
            true,
            117,
            [
              0
            ],
            [
              1
            ],
            [
              0.0085470085
            ],
            [
              1
            ],
            [
              0.0084739572
            ],
            [
              0.0920540993
            ],
            0.0016712853,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "Prof-school",
            "FEATURE",
            true,
            1116,
            [
              0
            ],
            [
              1
            ],
            [
              0.7419354839
            ],
            [
              828
            ],
            [
              0.1914672216
            ],
            [
              0.4375696763
            ],
            0.0159414907,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "Some-college",
            "FEATURE",
            true,
            15265,
            [
              0
            ],
            [
              1
            ],
            [
              0.1816573862
            ],
            [
              2773
            ],
            [
              0.1486579802
            ],
            [
              0.3855619019
            ],
            0.2180527383,
            false,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "__MASK__",
            "FEATURE",
            true,
            2176,
            [
              0
            ],
            [
              1
            ],
            [
              0.2329963235
            ],
            [
              507
            ],
            [
              0.1787090368
            ],
            [
              0.4228370866
            ],
            0.03108305,
            true,
            false,
            "education"
          ],
          [
            null,
            null,
            null,
            "Female",
            "FEATURE",
            true,
            22198,
            [
              0
            ],
            [
              1
            ],
            [
              0.1159113434
            ],
            [
              2573
            ],
            [
              0.1024759038
            ],
            [
              0.3201185778
            ],
            0.3170871068,
            false,
            false,
            "gender"
          ],
          [
            null,
            null,
            null,
            "Male",
            "FEATURE",
            true,
            41938,
            [
              0
            ],
            [
              1
            ],
            [
              0.2931708713
            ],
            [
              12295
            ],
            [
              0.2072217115
            ],
            [
              0.4552161152
            ],
            0.5990629375,
            false,
            false,
            "gender"
          ],
          [
            null,
            null,
            null,
            "__MASK__",
            "FEATURE",
            true,
            5870,
            [
              0
            ],
            [
              1
            ],
            [
              0.2081771721
            ],
            [
              1222
            ],
            [
              0.1648394371
            ],
            [
              0.4060388203
            ],
            0.0838499557,
            true,
            false,
            "gender"
          ],
          [
            null,
            null,
            null,
            "0",
            "TARGET",
            true,
            53916,
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            0.7701625575,
            false,
            false,
            "income"
          ],
          [
            null,
            null,
            null,
            "1",
            "TARGET",
            true,
            16090,
            [
              1
            ],
            [
              1
            ],
            [
              1
            ],
            [
              16090
            ],
            [
              0
            ],
            [
              0
            ],
            0.2298374425,
            false,
            false,
            "income"
          ],
          [
            null,
            null,
            null,
            "Divorced",
            "FEATURE",
            true,
            9511,
            [
              0
            ],
            [
              1
            ],
            [
              0.0990432131
            ],
            [
              942
            ],
            [
              0.0892336551
            ],
            [
              0.2987200279
            ],
            0.1358597834,
            false,
            false,
            "marital_45_status"
          ],
          [
            null,
            null,
            null,
            "Married-AF-spouse",
            "FEATURE",
            true,
            54,
            [
              0
            ],
            [
              1
            ],
            [
              0.4074074074
            ],
            [
              22
            ],
            [
              0.2414266118
            ],
            [
              0.4913518208
            ],
            0.0007713625,
            false,
            false,
            "marital_45_status"
          ],
          [
            null,
            null,
            null,
            "Married-civ-spouse",
            "FEATURE",
            true,
            30696,
            [
              0
            ],
            [
              1
            ],
            [
              0.4401224915
            ],
            [
              13510
            ],
            [
              0.246414684
            ],
            [
              0.4964017365
            ],
            0.438476702,
            false,
            false,
            "marital_45_status"
          ],
          [
            null,
            null,
            null,
            "Married-spouse-absent",
            "FEATURE",
            true,
            970,
            [
              0
            ],
            [
              1
            ],
            [
              0.0855670103
            ],
            [
              83
            ],
            [
              0.0782452971
            ],
            [
              0.2797236083
            ],
            0.0138559552,
            false,
            false,
            "marital_45_status"
          ],
          [
            null,
            null,
            null,
            "Never-married",
            "FEATURE",
            true,
            23163,
            [
              0
            ],
            [
              1
            ],
            [
              0.0441652636
            ],
            [
              1023
            ],
            [
              0.0422146931
            ],
            [
              0.2054621451
            ],
            0.3308716396,
            false,
            false,
            "marital_45_status"
          ],
          [
            null,
            null,
            null,
            "Separated",
            "FEATURE",
            true,
            2237,
            [
              0
            ],
            [
              1
            ],
            [
              0.0621367903
            ],
            [
              139
            ],
            [
              0.0582758096
            ],
            [
              0.241403831
            ],
            0.0319544039,
            false,
            false,
            "marital_45_status"
          ],
          [
            null,
            null,
            null,
            "Widowed",
            "FEATURE",
            true,
            2266,
            [
              0
            ],
            [
              1
            ],
            [
              0.0820829656
            ],
            [
              186
            ],
            [
              0.0753453523
            ],
            [
              0.2744910788
            ],
            0.0323686541,
            false,
            false,
            "marital_45_status"
          ],
          [
            null,
            null,
            null,
            "__MASK__",
            "FEATURE",
            true,
            1109,
            [
              0
            ],
            [
              1
            ],
            [
              0.1668169522
            ],
            [
              185
            ],
            [
              0.1389890567
            ],
            [
              0.3729805599
            ],
            0.0158414993,
            true,
            false,
            "marital_45_status"
          ],
          [
            null,
            null,
            null,
            "?",
            "FEATURE",
            true,
            1261,
            [
              0
            ],
            [
              1
            ],
            [
              0.2394924663
            ],
            [
              302
            ],
            [
              0.1821358249
            ],
            [
              0.4267737397
            ],
            0.0180127418,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Cambodia",
            "FEATURE",
            true,
            40,
            [
              0
            ],
            [
              1
            ],
            [
              0.3
            ],
            [
              12
            ],
            [
              0.21
            ],
            [
              0.4582575695
            ],
            0.0005713796,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Canada",
            "FEATURE",
            true,
            263,
            [
              0
            ],
            [
              1
            ],
            [
              0.36121673
            ],
            [
              95
            ],
            [
              0.230739204
            ],
            [
              0.4803532075
            ],
            0.0037568208,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "China",
            "FEATURE",
            true,
            196,
            [
              0
            ],
            [
              1
            ],
            [
              0.3010204082
            ],
            [
              59
            ],
            [
              0.210407122
            ],
            [
              0.458701561
            ],
            0.00279976,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Columbia",
            "FEATURE",
            true,
            134,
            [
              0
            ],
            [
              1
            ],
            [
              0.052238806
            ],
            [
              7
            ],
            [
              0.0495099131
            ],
            [
              0.2225082316
            ],
            0.0019141216,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Cuba",
            "FEATURE",
            true,
            217,
            [
              0
            ],
            [
              1
            ],
            [
              0.2211981567
            ],
            [
              48
            ],
            [
              0.1722695322
            ],
            [
              0.4150536497
            ],
            0.0030997343,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Dominican-Republic",
            "FEATURE",
            true,
            165,
            [
              0
            ],
            [
              1
            ],
            [
              0.0484848485
            ],
            [
              8
            ],
            [
              0.046134068
            ],
            [
              0.214788426
            ],
            0.0023569408,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Ecuador",
            "FEATURE",
            true,
            76,
            [
              0
            ],
            [
              1
            ],
            [
              0.1052631579
            ],
            [
              8
            ],
            [
              0.0941828255
            ],
            [
              0.306892205
            ],
            0.0010856212,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "El-Salvador",
            "FEATURE",
            true,
            253,
            [
              0
            ],
            [
              1
            ],
            [
              0.0513833992
            ],
            [
              13
            ],
            [
              0.0487431455
            ],
            [
              0.2207784987
            ],
            0.0036139759,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "England",
            "FEATURE",
            true,
            170,
            [
              0
            ],
            [
              1
            ],
            [
              0.3705882353
            ],
            [
              63
            ],
            [
              0.2332525952
            ],
            [
              0.4829623124
            ],
            0.0024283633,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "France",
            "FEATURE",
            true,
            58,
            [
              0
            ],
            [
              1
            ],
            [
              0.4310344828
            ],
            [
              25
            ],
            [
              0.2452437574
            ],
            [
              0.4952209178
            ],
            0.0008285004,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Germany",
            "FEATURE",
            true,
            298,
            [
              0
            ],
            [
              1
            ],
            [
              0.2953020134
            ],
            [
              88
            ],
            [
              0.2080987343
            ],
            [
              0.4561784018
            ],
            0.004256778,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Greece",
            "FEATURE",
            true,
            66,
            [
              0
            ],
            [
              1
            ],
            [
              0.3181818182
            ],
            [
              21
            ],
            [
              0.2169421488
            ],
            [
              0.4657704894
            ],
            0.0009427763,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Guatemala",
            "FEATURE",
            true,
            154,
            [
              0
            ],
            [
              1
            ],
            [
              0.0194805195
            ],
            [
              3
            ],
            [
              0.0191010288
            ],
            [
              0.1382064718
            ],
            0.0021998114,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Haiti",
            "FEATURE",
            true,
            118,
            [
              0
            ],
            [
              1
            ],
            [
              0.1355932203
            ],
            [
              16
            ],
            [
              0.1172076989
            ],
            [
              0.3423560996
            ],
            0.0016855698,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Holand-Netherlands",
            "FEATURE",
            true,
            1,
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              null
            ],
            0.0000142845,
            false,
            true,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Honduras",
            "FEATURE",
            true,
            30,
            [
              0
            ],
            [
              1
            ],
            [
              0.0666666667
            ],
            [
              2
            ],
            [
              0.0622222222
            ],
            [
              0.2494438258
            ],
            0.0004285347,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Hong",
            "FEATURE",
            true,
            53,
            [
              0
            ],
            [
              1
            ],
            [
              0.2452830189
            ],
            [
              13
            ],
            [
              0.1851192595
            ],
            [
              0.4302548774
            ],
            0.000757078,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Hungary",
            "FEATURE",
            true,
            29,
            [
              0
            ],
            [
              1
            ],
            [
              0.3103448276
            ],
            [
              9
            ],
            [
              0.2140309156
            ],
            [
              0.462634754
            ],
            0.0004142502,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "India",
            "FEATURE",
            true,
            222,
            [
              0
            ],
            [
              1
            ],
            [
              0.3738738739
            ],
            [
              83
            ],
            [
              0.2340922003
            ],
            [
              0.4838307559
            ],
            0.0031711568,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Iran",
            "FEATURE",
            true,
            83,
            [
              0
            ],
            [
              1
            ],
            [
              0.3493975904
            ],
            [
              29
            ],
            [
              0.2273189142
            ],
            [
              0.4767797334
            ],
            0.0011856127,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Ireland",
            "FEATURE",
            true,
            49,
            [
              0
            ],
            [
              1
            ],
            [
              0.2857142857
            ],
            [
              14
            ],
            [
              0.2040816327
            ],
            [
              0.4517539515
            ],
            0.00069994,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Italy",
            "FEATURE",
            true,
            152,
            [
              0
            ],
            [
              1
            ],
            [
              0.3421052632
            ],
            [
              52
            ],
            [
              0.2250692521
            ],
            [
              0.4744146415
            ],
            0.0021712425,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Jamaica",
            "FEATURE",
            true,
            170,
            [
              0
            ],
            [
              1
            ],
            [
              0.1529411765
            ],
            [
              26
            ],
            [
              0.129550173
            ],
            [
              0.3599307892
            ],
            0.0024283633,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Japan",
            "FEATURE",
            true,
            138,
            [
              0
            ],
            [
              1
            ],
            [
              0.3913043478
            ],
            [
              54
            ],
            [
              0.2381852552
            ],
            [
              0.4880422678
            ],
            0.0019712596,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Laos",
            "FEATURE",
            true,
            41,
            [
              0
            ],
            [
              1
            ],
            [
              0.0487804878
            ],
            [
              2
            ],
            [
              0.0464009518
            ],
            [
              0.2154088016
            ],
            0.0005856641,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Mexico",
            "FEATURE",
            true,
            1587,
            [
              0
            ],
            [
              1
            ],
            [
              0.0441083806
            ],
            [
              70
            ],
            [
              0.0421628314
            ],
            [
              0.2053358988
            ],
            0.0226694855,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Nicaragua",
            "FEATURE",
            true,
            77,
            [
              0
            ],
            [
              1
            ],
            [
              0.0519480519
            ],
            [
              4
            ],
            [
              0.0492494518
            ],
            [
              0.2219221752
            ],
            0.0010999057,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Outlying-US(Guam-USVI-etc)",
            "FEATURE",
            true,
            30,
            [
              0
            ],
            [
              1
            ],
            [
              0.0333333333
            ],
            [
              1
            ],
            [
              0.0322222222
            ],
            [
              0.1795054936
            ],
            0.0004285347,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Peru",
            "FEATURE",
            true,
            75,
            [
              0
            ],
            [
              1
            ],
            [
              0.08
            ],
            [
              6
            ],
            [
              0.0736
            ],
            [
              0.2712931993
            ],
            0.0010713367,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Philippines",
            "FEATURE",
            true,
            495,
            [
              0
            ],
            [
              1
            ],
            [
              0.2767676768
            ],
            [
              137
            ],
            [
              0.2001673299
            ],
            [
              0.4474006369
            ],
            0.0070708225,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Poland",
            "FEATURE",
            true,
            127,
            [
              0
            ],
            [
              1
            ],
            [
              0.1732283465
            ],
            [
              22
            ],
            [
              0.1432202864
            ],
            [
              0.3784445619
            ],
            0.0018141302,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Portugal",
            "FEATURE",
            true,
            102,
            [
              0
            ],
            [
              1
            ],
            [
              0.1764705882
            ],
            [
              18
            ],
            [
              0.1453287197
            ],
            [
              0.3812200411
            ],
            0.001457018,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Puerto-Rico",
            "FEATURE",
            true,
            286,
            [
              0
            ],
            [
              1
            ],
            [
              0.1048951049
            ],
            [
              30
            ],
            [
              0.0938921219
            ],
            [
              0.306418214
            ],
            0.0040853641,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Scotland",
            "FEATURE",
            true,
            31,
            [
              0
            ],
            [
              1
            ],
            [
              0.1290322581
            ],
            [
              4
            ],
            [
              0.1123829344
            ],
            [
              0.3352356402
            ],
            0.0004428192,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "South",
            "FEATURE",
            true,
            181,
            [
              0
            ],
            [
              1
            ],
            [
              0.1878453039
            ],
            [
              34
            ],
            [
              0.1525594457
            ],
            [
              0.3905885888
            ],
            0.0025854927,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Taiwan",
            "FEATURE",
            true,
            100,
            [
              0
            ],
            [
              1
            ],
            [
              0.36
            ],
            [
              36
            ],
            [
              0.2304
            ],
            [
              0.48
            ],
            0.001428449,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Thailand",
            "FEATURE",
            true,
            56,
            [
              0
            ],
            [
              1
            ],
            [
              0.2142857143
            ],
            [
              12
            ],
            [
              0.1683673469
            ],
            [
              0.4103259033
            ],
            0.0007999314,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Trinadad&Tobago",
            "FEATURE",
            true,
            43,
            [
              0
            ],
            [
              1
            ],
            [
              0.0465116279
            ],
            [
              2
            ],
            [
              0.0443482964
            ],
            [
              0.210590352
            ],
            0.0006142331,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "United-States",
            "FEATURE",
            true,
            61883,
            [
              0
            ],
            [
              1
            ],
            [
              0.2357351777
            ],
            [
              14588
            ],
            [
              0.1801641037
            ],
            [
              0.4244574227
            ],
            0.8839670885,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Vietnam",
            "FEATURE",
            true,
            134,
            [
              0
            ],
            [
              1
            ],
            [
              0.0746268657
            ],
            [
              10
            ],
            [
              0.0690576966
            ],
            [
              0.2627883114
            ],
            0.0019141216,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "Yugoslavia",
            "FEATURE",
            true,
            33,
            [
              0
            ],
            [
              1
            ],
            [
              0.3333333333
            ],
            [
              11
            ],
            [
              0.2222222222
            ],
            [
              0.4714045208
            ],
            0.0004713882,
            false,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "__MASK__",
            "FEATURE",
            true,
            329,
            [
              0
            ],
            [
              1
            ],
            [
              0.1610942249
            ],
            [
              53
            ],
            [
              0.1351428756
            ],
            [
              0.3681778057
            ],
            0.0046995972,
            true,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "__INFREQUENT__",
            "FEATURE",
            true,
            1,
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            null,
            true,
            false,
            "native_45_country"
          ],
          [
            null,
            null,
            null,
            "?",
            "FEATURE",
            true,
            4077,
            [
              0
            ],
            [
              1
            ],
            [
              0.0892813343
            ],
            [
              364
            ],
            [
              0.0813101777
            ],
            [
              0.2851493953
            ],
            0.0582378653,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Adm-clerical",
            "FEATURE",
            true,
            7758,
            [
              0
            ],
            [
              1
            ],
            [
              0.1318638824
            ],
            [
              1023
            ],
            [
              0.114475799
            ],
            [
              0.3383427241
            ],
            0.1108190727,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Armed-Forces",
            "FEATURE",
            true,
            19,
            [
              0
            ],
            [
              1
            ],
            [
              0.3684210526
            ],
            [
              7
            ],
            [
              0.2326869806
            ],
            [
              0.4823763889
            ],
            0.0002714053,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Craft-repair",
            "FEATURE",
            true,
            7847,
            [
              0
            ],
            [
              1
            ],
            [
              0.2197017969
            ],
            [
              1724
            ],
            [
              0.1714329173
            ],
            [
              0.4140445837
            ],
            0.1120903923,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Exec-managerial",
            "FEATURE",
            true,
            7970,
            [
              0
            ],
            [
              1
            ],
            [
              0.4681304893
            ],
            [
              3731
            ],
            [
              0.2489843343
            ],
            [
              0.4989833006
            ],
            0.1138473845,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Farming-fishing",
            "FEATURE",
            true,
            1994,
            [
              0
            ],
            [
              1
            ],
            [
              0.1088264794
            ],
            [
              217
            ],
            [
              0.0969832768
            ],
            [
              0.3114213814
            ],
            0.0284832729,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Handlers-cleaners",
            "FEATURE",
            true,
            2710,
            [
              0
            ],
            [
              1
            ],
            [
              0.0612546125
            ],
            [
              166
            ],
            [
              0.057502485
            ],
            [
              0.2397967577
            ],
            0.0387109676,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Machine-op-inspct",
            "FEATURE",
            true,
            4016,
            [
              0
            ],
            [
              1
            ],
            [
              0.1118027888
            ],
            [
              449
            ],
            [
              0.0993029253
            ],
            [
              0.3151236666
            ],
            0.0573665114,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Other-service",
            "FEATURE",
            true,
            6854,
            [
              0
            ],
            [
              1
            ],
            [
              0.0398307558
            ],
            [
              273
            ],
            [
              0.0382442667
            ],
            [
              0.195561414
            ],
            0.0979058938,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Priv-house-serv",
            "FEATURE",
            true,
            380,
            [
              0
            ],
            [
              1
            ],
            [
              0.0131578947
            ],
            [
              5
            ],
            [
              0.0129847645
            ],
            [
              0.113950711
            ],
            0.0054281062,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Prof-specialty",
            "FEATURE",
            true,
            8463,
            [
              0
            ],
            [
              1
            ],
            [
              0.450667612
            ],
            [
              3814
            ],
            [
              0.2475663155
            ],
            [
              0.4975603637
            ],
            0.120889638,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Protective-serv",
            "FEATURE",
            true,
            1282,
            [
              0
            ],
            [
              1
            ],
            [
              0.3042121685
            ],
            [
              390
            ],
            [
              0.211667125
            ],
            [
              0.4600729562
            ],
            0.0183127161,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Sales",
            "FEATURE",
            true,
            7212,
            [
              0
            ],
            [
              1
            ],
            [
              0.2534664448
            ],
            [
              1828
            ],
            [
              0.1892212062
            ],
            [
              0.4349956393
            ],
            0.1030197412,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Tech-support",
            "FEATURE",
            true,
            1939,
            [
              0
            ],
            [
              1
            ],
            [
              0.2841670964
            ],
            [
              551
            ],
            [
              0.2034161577
            ],
            [
              0.4510168043
            ],
            0.0276976259,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Transport-moving",
            "FEATURE",
            true,
            2975,
            [
              0
            ],
            [
              1
            ],
            [
              0.2
            ],
            [
              595
            ],
            [
              0.16
            ],
            [
              0.4
            ],
            0.0424963575,
            false,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "__MASK__",
            "FEATURE",
            true,
            4510,
            [
              0
            ],
            [
              1
            ],
            [
              0.211308204
            ],
            [
              953
            ],
            [
              0.1666570469
            ],
            [
              0.4082817751
            ],
            0.0644230495,
            true,
            false,
            "occupation"
          ],
          [
            null,
            null,
            null,
            "Amer-Indian-Eskimo",
            "FEATURE",
            true,
            693,
            [
              0
            ],
            [
              1
            ],
            [
              0.1183261183
            ],
            [
              82
            ],
            [
              0.104325048
            ],
            [
              0.3229938824
            ],
            0.0098991515,
            false,
            false,
            "race"
          ],
          [
            null,
            null,
            null,
            "Asian-Pac-Islander",
            "FEATURE",
            true,
            2278,
            [
              0
            ],
            [
              1
            ],
            [
              0.2572431958
            ],
            [
              586
            ],
            [
              0.191069134
            ],
            [
              0.4371145548
            ],
            0.032540068,
            false,
            false,
            "race"
          ],
          [
            null,
            null,
            null,
            "Black",
            "FEATURE",
            true,
            6889,
            [
              0
            ],
            [
              1
            ],
            [
              0.1154013645
            ],
            [
              795
            ],
            [
              0.1020838896
            ],
            [
              0.3195056957
            ],
            0.0984058509,
            false,
            false,
            "race"
          ],
          [
            null,
            null,
            null,
            "Other",
            "FEATURE",
            true,
            654,
            [
              0
            ],
            [
              1
            ],
            [
              0.1177370031
            ],
            [
              77
            ],
            [
              0.1038750012
            ],
            [
              0.3222964492
            ],
            0.0093420564,
            false,
            false,
            "race"
          ],
          [
            null,
            null,
            null,
            "White",
            "FEATURE",
            true,
            58592,
            [
              0
            ],
            [
              1
            ],
            [
              0.2456137357
            ],
            [
              14391
            ],
            [
              0.1852876285
            ],
            [
              0.4304504949
            ],
            0.8369568323,
            false,
            false,
            "race"
          ],
          [
            null,
            null,
            null,
            "__MASK__",
            "FEATURE",
            true,
            900,
            [
              0
            ],
            [
              1
            ],
            [
              0.1766666667
            ],
            [
              159
            ],
            [
              0.1454555556
            ],
            [
              0.381598418
            ],
            0.0128560409,
            true,
            false,
            "race"
          ],
          [
            null,
            null,
            null,
            "Husband",
            "FEATURE",
            true,
            25550,
            [
              0
            ],
            [
              1
            ],
            [
              0.4444227006
            ],
            [
              11355
            ],
            [
              0.2469111638
            ],
            [
              0.4969015635
            ],
            0.364968717,
            false,
            false,
            "relationship"
          ],
          [
            null,
            null,
            null,
            "Not-in-family",
            "FEATURE",
            true,
            17179,
            [
              0
            ],
            [
              1
            ],
            [
              0.1016939286
            ],
            [
              1747
            ],
            [
              0.0913522735
            ],
            [
              0.3022453863
            ],
            0.245393252,
            false,
            false,
            "relationship"
          ],
          [
            null,
            null,
            null,
            "Other-relative",
            "FEATURE",
            true,
            2118,
            [
              0
            ],
            [
              1
            ],
            [
              0.0325779037
            ],
            [
              69
            ],
            [
              0.0315165839
            ],
            [
              0.1775291071
            ],
            0.0302545496,
            false,
            false,
            "relationship"
          ],
          [
            null,
            null,
            null,
            "Own-child",
            "FEATURE",
            true,
            10095,
            [
              0
            ],
            [
              1
            ],
            [
              0.0140663695
            ],
            [
              142
            ],
            [
              0.0138685067
            ],
            [
              0.1177646243
            ],
            0.1442019255,
            false,
            false,
            "relationship"
          ],
          [
            null,
            null,
            null,
            "Unmarried",
            "FEATURE",
            true,
            7250,
            [
              0
            ],
            [
              1
            ],
            [
              0.0591724138
            ],
            [
              429
            ],
            [
              0.0556710392
            ],
            [
              0.2359471111
            ],
            0.1035625518,
            false,
            false,
            "relationship"
          ],
          [
            null,
            null,
            null,
            "Wife",
            "FEATURE",
            true,
            3236,
            [
              0
            ],
            [
              1
            ],
            [
              0.4598269468
            ],
            [
              1488
            ],
            [
              0.2483861258
            ],
            [
              0.4983835128
            ],
            0.0462246093,
            false,
            false,
            "relationship"
          ],
          [
            null,
            null,
            null,
            "__MASK__",
            "FEATURE",
            true,
            4578,
            [
              0
            ],
            [
              1
            ],
            [
              0.1878549585
            ],
            [
              860
            ],
            [
              0.1525654731
            ],
            [
              0.3906389716
            ],
            0.0653943948,
            true,
            false,
            "relationship"
          ],
          [
            null,
            null,
            null,
            "?",
            "FEATURE",
            true,
            4145,
            [
              0
            ],
            [
              1
            ],
            [
              0.0911942099
            ],
            [
              378
            ],
            [
              0.082877826
            ],
            [
              0.2878850916
            ],
            0.0592092106,
            false,
            false,
            "workclass"
          ],
          [
            null,
            null,
            null,
            "Federal-gov",
            "FEATURE",
            true,
            1969,
            [
              0
            ],
            [
              1
            ],
            [
              0.376333164
            ],
            [
              741
            ],
            [
              0.2347065137
            ],
            [
              0.4844651831
            ],
            0.0281261606,
            false,
            false,
            "workclass"
          ],
          [
            null,
            null,
            null,
            "Local-gov",
            "FEATURE",
            true,
            4443,
            [
              0
            ],
            [
              1
            ],
            [
              0.2959711906
            ],
            [
              1315
            ],
            [
              0.2083722449
            ],
            [
              0.4564780881
            ],
            0.0634659886,
            false,
            false,
            "workclass"
          ],
          [
            null,
            null,
            null,
            "Never-worked",
            "FEATURE",
            true,
            16,
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            [
              0
            ],
            0.0002285518,
            false,
            false,
            "workclass"
          ],
          [
            null,
            null,
            null,
            "Private",
            "FEATURE",
            true,
            47468,
            [
              0
            ],
            [
              1
            ],
            [
              0.2063916744
            ],
            [
              9797
            ],
            [
              0.1637941511
            ],
            [
              0.4047149011
            ],
            0.6780561666,
            false,
            false,
            "workclass"
          ],
          [
            null,
            null,
            null,
            "Self-emp-inc",
            "FEATURE",
            true,
            2223,
            [
              0
            ],
            [
              1
            ],
            [
              0.5537561853
            ],
            [
              1231
            ],
            [
              0.2471102725
            ],
            [
              0.4971018734
            ],
            0.031754421,
            false,
            false,
            "workclass"
          ],
          [
            null,
            null,
            null,
            "Self-emp-not-inc",
            "FEATURE",
            true,
            5225,
            [
              0
            ],
            [
              1
            ],
            [
              0.2750239234
            ],
            [
              1437
            ],
            [
              0.199385765
            ],
            [
              0.4465263318
            ],
            0.0746364597,
            false,
            false,
            "workclass"
          ],
          [
            null,
            null,
            null,
            "State-gov",
            "FEATURE",
            true,
            2792,
            [
              0
            ],
            [
              1
            ],
            [
              0.2596704871
            ],
            [
              725
            ],
            [
              0.1922417252
            ],
            [
              0.4384537892
            ],
            0.0398822958,
            false,
            false,
            "workclass"
          ],
          [
            null,
            null,
            null,
            "Without-pay",
            "FEATURE",
            true,
            33,
            [
              0
            ],
            [
              1
            ],
            [
              0.0606060606
            ],
            [
              2
            ],
            [
              0.056932966
            ],
            [
              0.2386062992
            ],
            0.0004713882,
            false,
            false,
            "workclass"
          ],
          [
            null,
            null,
            null,
            "__MASK__",
            "FEATURE",
            true,
            1692,
            [
              0
            ],
            [
              1
            ],
            [
              0.2742316785
            ],
            [
              464
            ],
            [
              0.199028665
            ],
            [
              0.4462581807
            ],
            0.0241693569,
            true,
            false,
            "workclass"
          ]
        ],
        "foreign_keys": [],
        "labels": [],
        "types": [
          {
            "data_type": "ANY"
          },
          {
            "data_type": "ANY"
          },
          {
            "data_type": "ANY"
          },
          {
            "data_type": "STRING",
            "format": null
          },
          {
            "data_type": "STRING",
            "format": null
          },
          {
            "data_type": "BOOLEAN"
          },
          {
            "data_type": "NUMBER",
            "format": "INT64"
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "INT64"
            }
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "INT64"
            }
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "FLOAT64"
            }
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "INT64"
            }
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "FLOAT64"
            }
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "FLOAT64"
            }
          },
          {
            "data_type": "NUMBER",
            "format": "FLOAT64"
          },
          {
            "data_type": "BOOLEAN"
          },
          {
            "data_type": "BOOLEAN"
          },
          {
            "data_type": "STRING",
            "format": null
          }
        ]
      },
      "views_version": {
        "major_version": 0,
        "minor_version": 5,
        "patch_version": 0,
        "build_version": "dev76"
      },
      "output_version": {
        "major_version": 1,
        "minor_version": 1,
        "patch_version": 1,
        "build_version": null
      }
    }
  ]
}
```

The request needs `view_type` set to `HISTOGRAM`.

## Filter by field

Use `fields` when you only need histogram rows for specific dataset fields.

### Request

POST [https://api.hi.umnai.com/datasets/\{datasetId}/views](https://api.hi.umnai.com/datasets/\{datasetId}/views)

```curl Histogram View with fields gender
curl -X POST https://api.hi.umnai.com/datasets/datasetId/views \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "data": [
    {
      "view_type": "HISTOGRAM",
      "fields": [
        "gender"
      ]
    }
  ]
}'
```

```python Histogram View with fields gender
import requests

url = "https://api.hi.umnai.com/datasets/:datasetId/views"

payload = { "data": [
        {
            "view_type": "HISTOGRAM",
            "fields": ["gender"]
        }
    ] }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Histogram View with fields gender
const url = 'https://api.hi.umnai.com/datasets/:datasetId/views';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"data":[{"view_type":"HISTOGRAM","fields":["gender"]}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Histogram View with fields gender
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.hi.umnai.com/datasets/:datasetId/views"

	payload := strings.NewReader("{\n  \"data\": [\n    {\n      \"view_type\": \"HISTOGRAM\",\n      \"fields\": [\n        \"gender\"\n      ]\n    }\n  ]\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(res)
	fmt.Println(string(body))

}
```

```ruby Histogram View with fields gender
require 'uri'
require 'net/http'

url = URI("https://api.hi.umnai.com/datasets/:datasetId/views")

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  \"data\": [\n    {\n      \"view_type\": \"HISTOGRAM\",\n      \"fields\": [\n        \"gender\"\n      ]\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java Histogram View with fields gender
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.hi.umnai.com/datasets/:datasetId/views")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"data\": [\n    {\n      \"view_type\": \"HISTOGRAM\",\n      \"fields\": [\n        \"gender\"\n      ]\n    }\n  ]\n}")
  .asString();
```

```php Histogram View with fields gender
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.hi.umnai.com/datasets/:datasetId/views', [
  'body' => '{
  "data": [
    {
      "view_type": "HISTOGRAM",
      "fields": [
        "gender"
      ]
    }
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Histogram View with fields gender
using RestSharp;

var client = new RestClient("https://api.hi.umnai.com/datasets/:datasetId/views");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"data\": [\n    {\n      \"view_type\": \"HISTOGRAM\",\n      \"fields\": [\n        \"gender\"\n      ]\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Histogram View with fields gender
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["data": [
    [
      "view_type": "HISTOGRAM",
      "fields": ["gender"]
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hi.umnai.com/datasets/:datasetId/views")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Response (200)

```json
{
  "data": [
    {
      "view_type": "HISTOGRAM",
      "view_data": {
        "columns": [
          "bin_index",
          "bin_low",
          "bin_high",
          "token",
          "field_type",
          "is_categorical",
          "frequency",
          "target_min",
          "target_max",
          "target_mean",
          "target_sum",
          "target_var",
          "target_stddev",
          "frequency_fraction",
          "is_masked_token",
          "is_infrequent",
          "field"
        ],
        "index": [
          17,
          18,
          19
        ],
        "data": [
          [
            null,
            null,
            null,
            "Female",
            "FEATURE",
            true,
            22198,
            [
              0
            ],
            [
              1
            ],
            [
              0.1159113434
            ],
            [
              2573
            ],
            [
              0.1024759038
            ],
            [
              0.3201185778
            ],
            0.3170871068,
            false,
            false,
            "gender"
          ],
          [
            null,
            null,
            null,
            "Male",
            "FEATURE",
            true,
            41938,
            [
              0
            ],
            [
              1
            ],
            [
              0.2931708713
            ],
            [
              12295
            ],
            [
              0.2072217115
            ],
            [
              0.4552161152
            ],
            0.5990629375,
            false,
            false,
            "gender"
          ],
          [
            null,
            null,
            null,
            "__MASK__",
            "FEATURE",
            true,
            5870,
            [
              0
            ],
            [
              1
            ],
            [
              0.2081771721
            ],
            [
              1222
            ],
            [
              0.1648394371
            ],
            [
              0.4060388203
            ],
            0.0838499557,
            true,
            false,
            "gender"
          ]
        ],
        "foreign_keys": [],
        "labels": [],
        "types": [
          {
            "data_type": "ANY"
          },
          {
            "data_type": "ANY"
          },
          {
            "data_type": "ANY"
          },
          {
            "data_type": "STRING",
            "format": null
          },
          {
            "data_type": "STRING",
            "format": null
          },
          {
            "data_type": "BOOLEAN"
          },
          {
            "data_type": "NUMBER",
            "format": "INT64"
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "INT64"
            }
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "INT64"
            }
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "FLOAT64"
            }
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "INT64"
            }
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "FLOAT64"
            }
          },
          {
            "data_type": "ARRAY",
            "format": {
              "data_type": "NUMBER",
              "format": "FLOAT64"
            }
          },
          {
            "data_type": "NUMBER",
            "format": "FLOAT64"
          },
          {
            "data_type": "BOOLEAN"
          },
          {
            "data_type": "BOOLEAN"
          },
          {
            "data_type": "STRING",
            "format": null
          }
        ]
      },
      "views_version": {
        "major_version": 0,
        "minor_version": 5,
        "patch_version": 0,
        "build_version": "dev76"
      },
      "output_version": {
        "major_version": 1,
        "minor_version": 1,
        "patch_version": 1,
        "build_version": null
      }
    }
  ]
}
```

This is useful when the dataset has many fields and you only need to inspect a small subset.

## Output

The response follows the shared [Response structure](../response-structure) format.

The Dataset histogram view returns a single dataframe in `view_data`.

| Dataframe   | Description                                                                                                            |
| ----------- | ---------------------------------------------------------------------------------------------------------------------- |
| `view_data` | Histogram rows for dataset fields, including bin information, frequency values, target statistics, and field metadata. |

## Interpret the result

The Dataset histogram view is easiest to read by selecting a field first, then comparing the bins or categories for that field.

### Start with the field

Use `field` to identify the dataset field represented by each row.

Use `field_type` to distinguish features from targets. Feature rows describe input distributions. Target rows describe target distributions.

### Separate categorical and numeric fields

Use `is_categorical` to understand how to read the row.

For categorical fields, `token` identifies the category. For numeric fields, `bin_index`, `bin_low`, and `bin_high` describe the numeric bin.

### Review frequency

Use `frequency` to see the number of rows in the category or bin.

Use `frequency_fraction` to compare categories or bins on a normalized scale. This is usually the easiest way to spot imbalance across a field.

### Check infrequent or masked values

Use `is_infrequent` to identify rare categories.

Use `is_masked_token` to identify masked tokens. These rows are useful when reviewing whether sensitive, missing, rare, or protected values are being represented as expected.

### Inspect target statistics

Use the `target_*` fields to understand how target values behave within each category or bin.

For example, `target_mean` can show whether a category or numeric range is associated with higher or lower target values. `target_min`, `target_max`, `target_sum`, `target_var`, and `target_stddev` provide additional context.

## Options

The Dataset histogram view supports one view-specific option.

| Option   | Use                                                          |
| -------- | ------------------------------------------------------------ |
| `fields` | Restrict the histogram output to one or more dataset fields. |

### Fields

Use `fields` to request histogram rows for specific fields.

If `fields` is omitted, the view returns histogram rows for the default set of available dataset fields.

## Field reference

The Dataset histogram view returns a dataframe, so individual columns are not documented as standalone API schema properties.

### `view_data`

The `view_data` dataframe contains the histogram output.

| Field                | Description                                                          |
| -------------------- | -------------------------------------------------------------------- |
| `bin_index`          | Index of the numeric bin, when the row represents a numeric bin.     |
| `bin_low`            | Lower bound of the numeric bin, when available.                      |
| `bin_high`           | Upper bound of the numeric bin, when available.                      |
| `token`              | Category token, when the row represents a categorical value.         |
| `field_type`         | Type of field represented by the row, such as `FEATURE` or `TARGET`. |
| `is_categorical`     | Whether the field is categorical.                                    |
| `frequency`          | Number of dataset rows in the category or bin.                       |
| `target_min`         | Minimum target value for rows in the category or bin.                |
| `target_max`         | Maximum target value for rows in the category or bin.                |
| `target_mean`        | Mean target value for rows in the category or bin.                   |
| `target_sum`         | Sum of target values for rows in the category or bin.                |
| `target_var`         | Variance of target values for rows in the category or bin.           |
| `target_stddev`      | Standard deviation of target values for rows in the category or bin. |
| `frequency_fraction` | Fraction of dataset rows represented by the category or bin.         |
| `is_masked_token`    | Whether the row represents a masked token.                           |
| `is_infrequent`      | Whether the row represents an infrequent category or value.          |
| `field`              | Dataset field represented by the row.                                |