Documentation ¶
Index ¶
- Constants
- func ModelCode() string
- type CreateFitErrResp
- type CreateFitReq
- type CreateFitResp
- type GetOperationResp
- type GetParamsResp
- type ModelCompileReq
- type ModelCompileResp
- type Stan
- func (s Stan) CompileModel(ctx context.Context, programCode string) (ModelCompileResp, error)
- func (s Stan) CreateFit(ctx context.Context, modelID string, req CreateFitReq) (string, error)
- func (s Stan) ExtractFromFitResult(ctx context.Context, res io.ReadCloser) dataframe.DataFrame
- func (s Stan) GetFitResult(ctx context.Context, modelID, fitID string) (io.ReadCloser, error)
- func (s Stan) GetOperationDetails(ctx context.Context, operationID string) (GetOperationResp, error)
- func (s Stan) StanParams(ctx context.Context, modelID string, data map[string]interface{}) ([]string, []string)
Constants ¶
View Source
const (
HmcNUTSFunction = "stan::services::sample::hmc_nuts_diag_e_adapt"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateFitErrResp ¶
type CreateFitReq ¶
type CreateFitReq struct { Chain int `json:"chain,omitempty"` Data map[string]interface{} `json:"data,omitempty"` Delta int `json:"delta,omitempty"` Function string `json:"function,omitempty"` Gamma int `json:"gamma,omitempty"` Init map[string]interface{} `json:"init,omitempty"` InitBuffer int `json:"init_buffer,omitempty"` InitRadius int `json:"init_radius,omitempty"` Kappa int `json:"kappa,omitempty"` MaxDepth int `json:"max_depth,omitempty"` NumSamples int `json:"num_samples,omitempty"` NumThin int `json:"num_thin,omitempty"` NumWarmup int `json:"num_warmup,omitempty"` RandomSeed int `json:"random_seed,omitempty"` Refresh int `json:"refresh,omitempty"` SaveWarmup bool `json:"save_warmup,omitempty"` Stepsize int `json:"stepsize,omitempty"` StepsizeJitter int `json:"stepsize_jitter,omitempty"` T0 int `json:"t0,omitempty"` TermBuffer int `json:"term_buffer,omitempty"` Window int `json:"window,omitempty"` }
type CreateFitResp ¶
type CreateFitResp struct {
Name string `json:"name"`
}
type GetOperationResp ¶
type GetOperationResp struct { Name string `json:"name"` Done bool `json:"done"` Metadata struct { Fit struct { Name string `json:"name"` } `json:"fit"` Progress string `json:"progress"` } `json:"metadata"` Result struct { Name string `json:"name"` } `json:"result"` }
GetOperationResp example json:
{ "name": "operations/cpyhg3rz", "done": true, "metadata": { "fit": { "name": "models/nld3pk7n/fits/cpyhg3rz" }, "progress": "Iteration: 22000 / 22000 [100%] (Sampling)" }, "result": { "name": "models/nld3pk7n/fits/cpyhg3rz" } }
type GetParamsResp ¶
type ModelCompileReq ¶
type ModelCompileReq struct {
ProgramCode string `json:"program_code"`
}
type ModelCompileResp ¶
type Stan ¶
type Stan struct {
// contains filtered or unexported fields
}
func (Stan) CompileModel ¶
CompileModel compiles the model Status Codes:
201 Created – Identifier for compiled Stan model and compiler output. 400 Bad Request – Error associated with compile request.
func (Stan) CreateFit ¶
CreateFit Post request /v1/models/{model_id}/fits to start a long-running fit operation
Status Codes:
201 Created – Identifier for completed Stan fit 400 Bad Request – Error associated with request. 404 Not Found – Fit not found.
func (Stan) ExtractFromFitResult ¶
func (Stan) GetFitResult ¶
GetFitResult GET /v1/models/{model_id}/fits/{fit_id}
Get results returned by a function. Result (draws, logger messages) from calling a function defined in stan::services.
Status Codes:
200 OK – Newline-delimited JSON-encoded messages from Stan. Includes draws. 404 Not Found – Fit not found.
func (Stan) GetOperationDetails ¶
func (s Stan) GetOperationDetails(ctx context.Context, operationID string) (GetOperationResp, error)
GetOperationDetails GET /v1/operations/{operation_id}
Return Operation details. Details about an Operation include whether the operation is done and information about the progress of sampling.
Status Codes:
200 OK – Operation name and metadata. 404 Not Found – Operation not found.
func (Stan) StanParams ¶
func (s Stan) StanParams(ctx context.Context, modelID string, data map[string]interface{}) ([]string, []string)
StanParams POST /v1/models/{model_id}/params to get parameter names and dimensions.
Status Codes:
200 OK – Parameters for Stan Model 400 Bad Request – Error associated with request. 404 Not Found – Model not found.
Click to show internal directories.
Click to hide internal directories.