The feature schema
How a model declares its inputs and outputs, and how Kaimei uses that schema to validate, encode and report.
A model's features array declares its inputs. Kaimei uses it to validate rows, to encode categoricals and images into the numeric space the explainers work in, to decode them back for reports, and to fill in a baseline when a row omits a feature.
| Type | Values | Notes |
|---|---|---|
numeric | any number | Aliases: float, number, continuous. min and max bound perturbations and counterfactual searches. |
integer | whole numbers | Alias: int. Perturbed values are rounded. |
binary | true / false, 0 / 1 | Alias: boolean. |
categorical | one of categories | Aliases: category, enum, string. Unknown values are rejected on strict endpoints. |
image | height × width × channels nested lists | Channels last, pixels in [0, 1] unless value_range says otherwise. Flat lists of the same length are accepted. |
Optional fields on any feature: description, unit (shown in the dashboard and notebook cards), baseline (the value used when a row omits the feature, and the centre of perturbations), min, max, and for categoricals categories. Image features need height, width and channels, and may set value_range (for example [0, 255]) when callers send and the model reads 0 to 255 values; Kaimei holds pixels in [0, 1] internally and converts at the model boundary. Image features may also carry examples, labelled sample images that the dashboard offers as one-click inputs.
The outputs object describes what the model returns:
| Field | Applies to | Meaning |
|---|---|---|
labels | classification | Class names in output order. Binary models need exactly two; multiclass models must set them. |
positive_label | binary | The class whose probability is the model's score. Defaults to the second label. |
threshold | binary | Decision threshold on that probability. Default 0.5. |
name | all | What the output is called in reports (decision, demand_mw). |
unit | regression | Unit of the predicted value (MW, % / month). |
kind | all | probabilities (default), logits (a sigmoid or softmax is applied) or value. |
task is one of binary_classification, multiclass_classification or regression. For uploaded structures Kaimei infers the task, the features and the labels from the spec when you leave them out.
{
"name": "Credit risk v3",
"slug": "credit-risk-v3",
"task": "binary_classification",
"framework": "sklearn",
"features": [
{
"name": "income",
"type": "numeric",
"unit": "USD/yr",
"baseline": 65000,
"min": 0,
"description": "Annual gross income"
},
{
"name": "credit_score",
"type": "integer",
"baseline": 690,
"min": 300,
"max": 850
},
{
"name": "utilization",
"type": "numeric",
"baseline": 0.35,
"min": 0,
"max": 1.5
},
{
"name": "num_delinquencies",
"type": "integer",
"baseline": 0,
"min": 0,
"max": 20
},
{
"name": "home_ownership",
"type": "categorical",
"categories": ["rent", "mortgage", "own"],
"baseline": "mortgage"
},
{
"name": "photo",
"type": "image",
"height": 224,
"width": 224,
"channels": 3,
"value_range": [0, 255],
"description": "An image feature, for comparison"
}
],
"outputs": {
"labels": ["approve", "decline"],
"positive_label": "decline",
"threshold": 0.5,
"name": "decision"
}
}