httpstan.schemas
¶
Module Contents¶
Classes¶
Long-running operation. |
|
Error. |
|
Schema for request to build a Stan program. |
|
Base schema class with which to define custom schemas. |
|
Data for a Stan model. |
|
Schema for request to start sampling. |
|
Base schema class with which to define custom schemas. |
|
Base schema class with which to define custom schemas. |
|
Schema for single parameter. |
|
Messages from callback writers and loggers in |
|
Schema for log_prob request. |
|
Schema for log_prob_grad request. |
|
Schema for write_array request. |
|
Schema for transform_inits request. |
- class httpstan.schemas.Operation(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Long-running operation.
Modeled on operations.proto, linked in https://cloud.google.com/apis/design/standard_methods
- name¶
- metadata¶
- done¶
- result¶
- class httpstan.schemas.Status(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Error.
Modeled on
google.rpc.Status
. See https://cloud.google.com/apis/design/errors- code¶
- status¶
- message¶
- details¶
- class httpstan.schemas.CreateModelRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Schema for request to build a Stan program.
- program_code¶
- class httpstan.schemas.Model(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Base schema class with which to define custom schemas.
Example usage:
import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}
- Parameters
only – Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters.
exclude – Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both only and exclude, it is not used. Nested fields can be represented with dot delimiters.
many – Should be set to True if
obj
is a collection so that the object will be serialized to a list.context – Optional context passed to
fields.Method
andfields.Function
fields.load_only – Fields to skip during serialization (write-only fields)
dump_only – Fields to skip during deserialization (read-only fields)
partial – Whether to ignore missing fields and not require any fields declared. Propagates down to
Nested
fields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields.unknown – Whether to exclude, include, or raise an error for unknown fields in the data. Use EXCLUDE, INCLUDE or RAISE.
Changed in version 3.0.0: prefix parameter removed.
Changed in version 2.0.0: __validators__, __preprocessors__, and __data_handlers__ are removed in favor of marshmallow.decorators.validates_schema, marshmallow.decorators.pre_load and marshmallow.decorators.post_dump. __accessor__ and __error_handler__ are deprecated. Implement the handle_error and get_attribute methods instead.
- name¶
- compiler_output¶
- stanc_warnings¶
- class httpstan.schemas.Data(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Data for a Stan model.
- class httpstan.schemas.CreateFitRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Schema for request to start sampling.
Only two algorithms are supported:
hmc_nuts_diag_e_adapt
andfixed_param
.Sampler parameters can be found in
httpstan/stan_services.cpp
.- function¶
- data¶
- init¶
- random_seed¶
- chain¶
- init_radius¶
- num_warmup¶
- num_samples¶
- num_thin¶
- save_warmup¶
- refresh¶
- stepsize¶
- stepsize_jitter¶
- max_depth¶
- delta¶
- gamma¶
- kappa¶
- t0¶
- init_buffer¶
- term_buffer¶
- window¶
- class httpstan.schemas.Fit(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Base schema class with which to define custom schemas.
Example usage:
import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}
- Parameters
only – Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters.
exclude – Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both only and exclude, it is not used. Nested fields can be represented with dot delimiters.
many – Should be set to True if
obj
is a collection so that the object will be serialized to a list.context – Optional context passed to
fields.Method
andfields.Function
fields.load_only – Fields to skip during serialization (write-only fields)
dump_only – Fields to skip during deserialization (read-only fields)
partial – Whether to ignore missing fields and not require any fields declared. Propagates down to
Nested
fields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields.unknown – Whether to exclude, include, or raise an error for unknown fields in the data. Use EXCLUDE, INCLUDE or RAISE.
Changed in version 3.0.0: prefix parameter removed.
Changed in version 2.0.0: __validators__, __preprocessors__, and __data_handlers__ are removed in favor of marshmallow.decorators.validates_schema, marshmallow.decorators.pre_load and marshmallow.decorators.post_dump. __accessor__ and __error_handler__ are deprecated. Implement the handle_error and get_attribute methods instead.
- name¶
- class httpstan.schemas.ShowParamsRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Base schema class with which to define custom schemas.
Example usage:
import datetime as dt from dataclasses import dataclass from marshmallow import Schema, fields @dataclass class Album: title: str release_date: dt.date class AlbumSchema(Schema): title = fields.Str() release_date = fields.Date() album = Album("Beggars Banquet", dt.date(1968, 12, 6)) schema = AlbumSchema() data = schema.dump(album) data # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}
- Parameters
only – Whitelist of the declared fields to select when instantiating the Schema. If None, all fields are used. Nested fields can be represented with dot delimiters.
exclude – Blacklist of the declared fields to exclude when instantiating the Schema. If a field appears in both only and exclude, it is not used. Nested fields can be represented with dot delimiters.
many – Should be set to True if
obj
is a collection so that the object will be serialized to a list.context – Optional context passed to
fields.Method
andfields.Function
fields.load_only – Fields to skip during serialization (write-only fields)
dump_only – Fields to skip during deserialization (read-only fields)
partial – Whether to ignore missing fields and not require any fields declared. Propagates down to
Nested
fields as well. If its value is an iterable, only missing fields listed in that iterable will be ignored. Use dot delimiters to specify nested fields.unknown – Whether to exclude, include, or raise an error for unknown fields in the data. Use EXCLUDE, INCLUDE or RAISE.
Changed in version 3.0.0: prefix parameter removed.
Changed in version 2.0.0: __validators__, __preprocessors__, and __data_handlers__ are removed in favor of marshmallow.decorators.validates_schema, marshmallow.decorators.pre_load and marshmallow.decorators.post_dump. __accessor__ and __error_handler__ are deprecated. Implement the handle_error and get_attribute methods instead.
- data¶
- class httpstan.schemas.Parameter(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Schema for single parameter.
- name¶
- dims¶
- constrained_names¶
- class httpstan.schemas.WriterMessage(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Messages from callback writers and loggers in
stan::callbacks
.NOTE: You SHOULD NOT use this schema. This schema exists for testing and for documentation. It SHOULD NOT be used to process a large number of JSON messages. Doing so will slow down any program.
This schema is intended for messages emitted by C++ classes which inherit from
stan/callbacks/writer.hpp
, andstan/callbacks/logger.hpp
.
In particular, the schema matches a JSON-based “version” of the CSV-focused
stan/callbacks/stream_writer.hpp
andstan/callbacks/stream_logger.hpp
.This version is found “inside” the httpstan-specific
httpstan/socket_writer.hpp
andhttpstan/socket_logger.hpp
.WriterMessage is a data format for all messages written by the callback writers defined in
stan::callbacks
. These writers are used by the functions defined instan::services
. For example,stan::services::sample::hmc_nuts_diag_e
uses one logger and three writers:logger
Logger for informational and error messagesinit_writer
Writer callback for unconstrained initssample_writer
Writer for drawsdiagnostic_writer
Writer for diagnostic information
WriterMessage is a format which is flexible enough to accommodate these different uses while still providing a predictable structure.
A WriterMessage has a field
topic
which provides information about what the WriterMessage concerns or what produced it. For example, the topic associated with a WriterMessage written by sample_writer in the function issample
.The “content” of a message is stored in the field
values
. This is either a list or a mapping.- version¶
- topic¶
- values¶
- class httpstan.schemas.ShowLogProbRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Schema for log_prob request.
- data¶
- unconstrained_parameters¶
- adjust_transform¶
- class httpstan.schemas.ShowLogProbGradRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Schema for log_prob_grad request.
- data¶
- unconstrained_parameters¶
- adjust_transform¶
- class httpstan.schemas.ShowWriteArrayRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Schema for write_array request.
- data¶
- unconstrained_parameters¶
- include_tparams¶
- include_gqs¶
- class httpstan.schemas.ShowTransformInitsRequest(*, only: types.StrSequenceOrSet | None = None, exclude: marshmallow.types.StrSequenceOrSet = (), many: bool = False, context: dict | None = None, load_only: marshmallow.types.StrSequenceOrSet = (), dump_only: marshmallow.types.StrSequenceOrSet = (), partial: bool | types.StrSequenceOrSet = False, unknown: str | None = None)[source]¶
Bases:
marshmallow.Schema
Schema for transform_inits request.
- data¶
- constrained_parameters¶