← All procedures

generators.shrinkTarget

This function gives the target of a dimension: the value of its range nearest to 0.

CLI
Package
@procedures/generators · README
Path
["generators","shrinkTarget"]
CLI
mark generators shrinkTarget --dimension <object>
As data
{"$proc":["generators","shrinkTarget"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/generators/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["generators","shrinkTarget"], { dimension: {} });
console.log(JSON.stringify(result));

From the command line

$ mark generators shrinkTarget --dimension <object>

As data, in a program

{
  "$proc": ["generators", "shrinkTarget"],
  "input": { "dimension": {} }
}

Input

FieldTypeRequiredDefaultDescription
dimensionobjectyes

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "dimension": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the dimension. It is a key of each point."
          },
          "min": {
            "type": "number",
            "description": "The smallest value."
          },
          "max": {
            "type": "number",
            "description": "The largest value. A uniform or log dimension that is not `integer` gets values below `max`."
          },
          "distribution": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "family": {
                    "type": "string",
                    "const": "beta"
                  },
                  "a": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "array",
                        "items": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "additionalItems": {},
                        "minItems": 2,
                        "maxItems": 2
                      }
                    ]
                  },
                  "b": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "array",
                        "items": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "additionalItems": {},
                        "minItems": 2,
                        "maxItems": 2
                      }
                    ]
                  }
                },
                "required": [
                  "family",
                  "a",
                  "b"
                ],
                "additionalProperties": {}
              },
              {
                "type": "object",
                "properties": {
                  "family": {
                    "type": "string",
                    "const": "lognormal"
                  },
                  "mu": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "array",
                        "items": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "additionalItems": {},
                        "minItems": 2,
                        "maxItems": 2
                      }
                    ]
                  },
                  "sigma": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "array",
                        "items": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "additionalItems": {},
                        "minItems": 2,
                        "maxItems": 2
                      }
                    ]
                  }
                },
                "required": [
                  "family",
                  "mu",
                  "sigma"
                ],
                "additionalProperties": {}
              },
              {
                "type": "object",
                "properties": {
                  "family": {
                    "type": "string",
                    "const": "mixture"
                  },
                  "parts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "weight": {
                          "type": "number"
                        },
                        "part": {
                          "$ref": "#/definitions/__schema0"
                        }
                      },
                      "required": [
                        "weight",
                        "part"
                      ],
                      "additionalProperties": {}
                    }
                  }
                },
                "required": [
                  "family",
                  "parts"
                ],
                "additionalProperties": {}
              },
              {
                "type": "object",
                "properties": {
                  "family": {
                    "type": "string",
                    "const": "pareto"
                  },
                  "scale": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "array",
                        "items": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "additionalItems": {},
                        "minItems": 2,
                        "maxItems": 2
                      }
                    ]
                  },
                  "shape": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "array",
                        "items": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "additionalItems": {},
                        "minItems": 2,
                        "maxItems": 2
                      }
                    ]
                  }
                },
                "required": [
                  "family",
                  "scale",
                  "shape"
                ],
                "additionalProperties": {}
              },
              {
                "type": "object",
                "properties": {
                  "family": {
                    "type": "string",
                    "const": "recorded"
                  },
                  "values": {
                    "type": "array",
                    "items": {
                      "type": "number"
                    }
                  }
                },
                "required": [
                  "family",
                  "values"
                ],
                "additionalProperties": {}
              },
              {
                "type": "object",
                "properties": {
                  "family": {
                    "type": "string",
                    "const": "zipf"
                  },
                  "n": {
                    "type": "number"
                  },
                  "exponent": {
                    "anyOf": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "array",
                        "items": [
                          {
                            "type": "number"
                          },
                          {
                            "type": "number"
                          }
                        ],
                        "additionalItems": {},
                        "minItems": 2,
                        "maxItems": 2
                      }
                    ]
                  }
                },
                "required": [
                  "family",
                  "n",
                  "exponent"
                ],
                "additionalProperties": {}
              }
            ],
            "description": "The distribution of the values, cut to the range. Without it, the values are uniform in the range."
          },
          "scale": {
            "type": "string",
            "enum": [
              "linear",
              "log"
            ],
            "description": "With `log`, the logarithm of the value is uniform. `min` must be above 0. A dimension with a distribution has no scale."
          },
          "integer": {
            "type": "boolean",
            "description": "With `true`, each value is an integer. `min` and `max` must be integers."
          }
        },
        "required": [
          "name",
          "min",
          "max"
        ],
        "additionalProperties": {}
      }
    },
    "required": [
      "dimension"
    ],
    "additionalProperties": false,
    "definitions": {
      "__schema0": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "family": {
                "type": "string",
                "const": "beta"
              },
              "a": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "array",
                    "items": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "additionalItems": {},
                    "minItems": 2,
                    "maxItems": 2
                  }
                ]
              },
              "b": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "array",
                    "items": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "additionalItems": {},
                    "minItems": 2,
                    "maxItems": 2
                  }
                ]
              }
            },
            "required": [
              "family",
              "a",
              "b"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "family": {
                "type": "string",
                "const": "lognormal"
              },
              "mu": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "array",
                    "items": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "additionalItems": {},
                    "minItems": 2,
                    "maxItems": 2
                  }
                ]
              },
              "sigma": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "array",
                    "items": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "additionalItems": {},
                    "minItems": 2,
                    "maxItems": 2
                  }
                ]
              }
            },
            "required": [
              "family",
              "mu",
              "sigma"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "family": {
                "type": "string",
                "const": "mixture"
              },
              "parts": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "weight": {
                      "type": "number"
                    },
                    "part": {
                      "allOf": [
                        {
                          "$ref": "#/definitions/__schema0"
                        }
                      ]
                    }
                  },
                  "required": [
                    "weight",
                    "part"
                  ],
                  "additionalProperties": {}
                }
              }
            },
            "required": [
              "family",
              "parts"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "family": {
                "type": "string",
                "const": "pareto"
              },
              "scale": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "array",
                    "items": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "additionalItems": {},
                    "minItems": 2,
                    "maxItems": 2
                  }
                ]
              },
              "shape": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "array",
                    "items": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "additionalItems": {},
                    "minItems": 2,
                    "maxItems": 2
                  }
                ]
              }
            },
            "required": [
              "family",
              "scale",
              "shape"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "family": {
                "type": "string",
                "const": "recorded"
              },
              "values": {
                "type": "array",
                "items": {
                  "type": "number"
                }
              }
            },
            "required": [
              "family",
              "values"
            ],
            "additionalProperties": {}
          },
          {
            "type": "object",
            "properties": {
              "family": {
                "type": "string",
                "const": "zipf"
              },
              "n": {
                "type": "number"
              },
              "exponent": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "array",
                    "items": [
                      {
                        "type": "number"
                      },
                      {
                        "type": "number"
                      }
                    ],
                    "additionalItems": {},
                    "minItems": 2,
                    "maxItems": 2
                  }
                ]
              }
            },
            "required": [
              "family",
              "n",
              "exponent"
            ],
            "additionalProperties": {}
          }
        ]
      }
    }
  },
  "output": {
    "type": "number"
  }
}