Built-In Data Types
Data types are the structural and typed nodes in a json2vec schema. Branch names shared contexts for child fields, usually repeated collections such as transactions or sessions. Tensorfields are typed leaves that read values, encode them into tensors, hide values during training, and decode targets when requested.
Use constructor names from the package root in Python. Serialized schemas use the lower-case type value.
The individual data type pages cover built-in data types.
Every leaf tensorfield follows the same high-level lifecycle:
query -> validate raw values -> tensorize content/state -> embed visible values
-> optionally decode trainable targets -> write public prediction payload
Choose A Data Type
| Source value | Recommended type | Use a different type when |
|---|---|---|
| Continuous scalar | Number |
Numeric value is an ID, code, or class label. |
| Boolean | Boolean |
The source has more than two labels; use Category. |
| One bounded label | Category |
The value is a massive or unstable identifier; keep it as metadata or use Entity for local repeated equality. |
| Zero or more labels | Set |
Labels have attributes or order; use Branch. |
| Repeated objects | Branch |
Repetition is only an upstream storage artifact; preprocess or flatten. |
| Timestamp/calendar value | DateParts |
Elapsed time or recency matters; derive a Number. |
| Local repeated identity | Entity |
The ID is intentionally a small, stable, globally learned label; use Category. |
| Precomputed dense vector | Vector |
json2vec should compute embeddings from strings; use Text. |
| Free-form text | Text |
The string is a bounded label; use Category or Set. |
Same raw value can need different types:
"12345"is aNumberonly if distance and magnitude matter."12345"is aCategoryif it is a bounded code or label."12345"is anEntityif only repeated equality inside the current repeated context matters.["red", "sale"]is aSetif the labels are unordered.[{"name": "red"}, {"name": "sale"}]is aBranchif each item has fields.
Prediction Support
| Type | Public Model.predict(...) content |
State probabilities | Notes |
|---|---|---|---|
Number |
Yes, scalar value | Yes | Metrics are reported in original value scale. |
Boolean |
Yes, value plus true probability | Yes | Vocabulary-free binary decoding. |
Category |
Yes, best label plus optional top-k candidates | Yes | Unknown bucket is internal only. |
Set |
Yes, per-label probabilities or thresholded labels | Yes | threshold can reduce API response size. |
Vector |
Yes, reconstructed vector | Yes | Non-valued predictions return zero-vector content. |
DateParts |
No | No public payload | Trains losses and accuracies only. |
Entity |
No | No public payload | Observation-local identity representation. |
Text |
No | No public payload | Reconstructs frozen encoder embeddings, not text. |
Branch |
No direct payload | No | Child fields may emit predictions. |
Any node configured with embed=True can also emit an embedding payload from Model.predict(...). See Learning Modes & Embeddings.
No public content payload does not mean the field is ignored. DateParts, Entity, and Text can still be visible inputs, train reconstruction losses, and emit embeddings when configured with embed=True.
Value State
Tensorfields track value state separately from value content:
valued: the source value exists and was encoded.null: the source value exists asNone.padded: the configured branch shape has a slot with no source value.masked: training or prediction intentionally hid the value.
[
{"tags": ["vip"]},
{"tags": []},
{"tags": null},
{}
]For Set("tags"), ["vip"] and [] are both valued content. null is a null field state. A missing repeated slot inside a Branch is padded. If a leaf is configured with nullable=False, encoding raises when the extracted input contains an explicit null for that leaf.
This separation matters most for numeric content. A sentinel such as 0, -1, or 999999 can collide with real values and distort normalization. NaN can say “not a number”, but it cannot distinguish null source data, padded branch slots, and training-time masks. The model predicts state separately, then content is meaningful when the field is valued.