| Title: | R Bindings Over the Functional Kernel |
|---|---|
| Description: | Provides thin R bindings for the Innovate functional kernel. The package constructs versioned JSON request envelopes, invokes the shared Python bridge, and converts kernel responses into R-native objects. |
| Authors: | Dylan Mordaunt [aut, cre] |
| Maintainer: | Dylan Mordaunt <[email protected]> |
| License: | Apache License (>= 2) |
| Version: | 0.5.0 |
| Built: | 2026-05-17 06:26:48 UTC |
| Source: | https://github.com/edithatogo/innovate |
Thin R bindings for the Innovate functional kernel. The package exposes request builders, bridge dispatch helpers, response conversion, and diagnostics helpers without duplicating model logic in R.
The package is organized around the shared Innovate kernel schema. The exported helpers build request lists, call the Python-backed kernel bridge, and convert JSON responses into R-native arrays, data frames, lists, and conditions.
Use kernel_discover_models() to inspect available model metadata
when the bridge runtime is available. Use kernel_request() plus
one of the operation helpers for fit_model, predict_model,
simulate_model, summarize_model, or diagnose_model
requests.
Examples in the reference manual avoid launching the bridge so they remain deterministic in offline and CRAN-style checks.
kernel_schema_version,
kernel_request,
kernel_call,
kernel_response_to_r,
kernel_discover_models,
kernel_fit_model,
kernel_predict_model,
kernel_simulate_model,
kernel_summarize_model,
kernel_diagnose_model,
kernel_extract_diagnostics
kernel_schema_version() request <- kernel_request( operation = "summarize_model", model_key = "logistic", payload = list(inputs = list(time = c(0, 1), observed = c(0.2, 0.5))) ) names(request)kernel_schema_version() request <- kernel_request( operation = "summarize_model", model_key = "logistic", payload = list(inputs = list(time = c(0, 1), observed = c(0.2, 0.5))) ) names(request)
Construct Innovate kernel requests, invoke the shared Python kernel bridge, and convert kernel responses into ordinary R objects.
kernel_schema_version() kernel_request(operation, model_key = NULL, payload = list(), metadata = list(), schema_version = KERNEL_SCHEMA_VERSION) kernel_call(request) kernel_response_to_r(response) kernel_discover_models() kernel_fit_model(request) kernel_predict_model(request) kernel_simulate_model(request) kernel_summarize_model(request) kernel_diagnose_model(request) kernel_extract_diagnostics(result)kernel_schema_version() kernel_request(operation, model_key = NULL, payload = list(), metadata = list(), schema_version = KERNEL_SCHEMA_VERSION) kernel_call(request) kernel_response_to_r(response) kernel_discover_models() kernel_fit_model(request) kernel_predict_model(request) kernel_simulate_model(request) kernel_summarize_model(request) kernel_diagnose_model(request) kernel_extract_diagnostics(result)
operation |
A non-empty scalar character kernel operation name, such as
|
model_key |
A scalar character model key. Required for all operations
except |
payload |
A named list containing the operation-specific request payload. |
metadata |
A named list containing optional request metadata. |
schema_version |
A scalar character kernel schema version. Defaults to the package's active schema version. |
request |
A kernel request list, normally created by
|
response |
A decoded kernel response list, normally returned by
|
result |
A converted kernel result object returned by
|
The R package is intentionally a thin adapter over the stable Innovate functional kernel contract. It does not reimplement model semantics. Execution is delegated to the shared Python kernel bridge, while this package handles request construction, process dispatch, error conversion, and response conversion.
kernel_call() writes a temporary JSON request, invokes the bridge script,
and reads the JSON response. By default it uses uv run python when
uv is available, otherwise it falls back to python3. Set the
INNOVATE_PYTHON_COMMAND environment variable to override the launcher.
If the kernel response contains an error payload, kernel_response_to_r()
signals an innovate_kernel_error condition. The condition object contains
the original kernel error payload in its error field and the full
response in its response field.
kernel_schema_version() returns a scalar character schema version.
kernel_request() returns a request list with
schema_version, operation, model_key, payload, and
metadata fields.
kernel_call() returns a decoded response list from the Python
bridge.
kernel_response_to_r() and the operation helpers return converted
R objects. Kernel arrays become arrays, table-shaped payloads become data
frames, discovery payloads become data frames, and nested payloads remain named
lists.
kernel_extract_diagnostics() returns a diagnostics list when the
result exposes one.
kernel_schema_version() request <- kernel_request( operation = "predict_model", model_key = "logistic", payload = list( state = list( model_key = "logistic", parameters = list(L = 1, k = 0.5, x0 = 2) ), inputs = list(time = c(0, 1, 2)) ) ) request$operation request$model_key response <- list( schema_version = "1.0", operation = "predict_model", result = list(shape = list(3L), dtype = "float64", values = list(0.1, 0.2, 0.4)), error = NULL, metadata = list() ) values <- kernel_response_to_r(response) values attr(values, "kernel_operation") summary_result <- list( diagnostics = list( support_level = "supported", provenance = "deterministic" ) ) kernel_extract_diagnostics(summary_result)kernel_schema_version() request <- kernel_request( operation = "predict_model", model_key = "logistic", payload = list( state = list( model_key = "logistic", parameters = list(L = 1, k = 0.5, x0 = 2) ), inputs = list(time = c(0, 1, 2)) ) ) request$operation request$model_key response <- list( schema_version = "1.0", operation = "predict_model", result = list(shape = list(3L), dtype = "float64", values = list(0.1, 0.2, 0.4)), error = NULL, metadata = list() ) values <- kernel_response_to_r(response) values attr(values, "kernel_operation") summary_result <- list( diagnostics = list( support_level = "supported", provenance = "deterministic" ) ) kernel_extract_diagnostics(summary_result)