Generates PFA Documents from R Code and Optionally Runs Them
Converts R syntax into PFA and provides tools for assembling a PFA document within R. Tests validity and runtime behavior of PFA by offloading PFA and data to Titus (through rPython). Facilitates conversion of common R model output to PFA using aurelius.* libraries. Aurelius is part of Hadrian and is on Github at https://github.com/opendatagroup/hadrian.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
library("aurelius")
# build a model
lm_model <- lm(mpg ~ hp, data = mtcars)
# convert the lm object to a list of lists PFA representation
lm_model_as_pfa <- pfa(lm_model)
# save as plain-text JSON
write_pfa(lm_model_as_pfa, file = "my-model.pfa")
# read the model back in
read_pfa(file("my-model.pfa"))
## End(Not run)
|
$input
$input$type
[1] "record"
$input$fields
$input$fields[[1]]
$input$fields[[1]]$name
[1] "hp"
$input$fields[[1]]$type
[1] "double"
$input$name
[1] "Input"
$output
[1] "double"
$action
$action[[1]]
$action[[1]]$let
$action[[1]]$let$glm_input
$action[[1]]$let$glm_input$type
$action[[1]]$let$glm_input$type$type
[1] "array"
$action[[1]]$let$glm_input$type$items
[1] "double"
$action[[1]]$let$glm_input$new
$action[[1]]$let$glm_input$new[[1]]
[1] "input.hp"
$action[[2]]
$action[[2]]$let
$action[[2]]$let$pred
$action[[2]]$let$pred$model.reg.linear
$action[[2]]$let$pred$model.reg.linear[[1]]
[1] "glm_input"
$action[[2]]$let$pred$model.reg.linear[[2]]
$action[[2]]$let$pred$model.reg.linear[[2]]$cell
[1] "glm_model"
$action[[3]]
[1] "pred"
$cells
$cells$glm_model
$cells$glm_model$type
$cells$glm_model$type$type
[1] "record"
$cells$glm_model$type$fields
$cells$glm_model$type$fields[[1]]
$cells$glm_model$type$fields[[1]]$name
[1] "const"
$cells$glm_model$type$fields[[1]]$type
[1] "double"
$cells$glm_model$type$fields[[2]]
$cells$glm_model$type$fields[[2]]$name
[1] "coeff"
$cells$glm_model$type$fields[[2]]$type
$cells$glm_model$type$fields[[2]]$type$type
[1] "array"
$cells$glm_model$type$fields[[2]]$type$items
[1] "double"
$cells$glm_model$type$name
[1] "gaussianRegression"
$cells$glm_model$init
$cells$glm_model$init$const
[1] 30.09886
$cells$glm_model$init$coeff
$cells$glm_model$init$coeff[[1]]
[1] -0.06822828
$cells$glm_model$source
[1] "embedded"
$cells$glm_model$shared
[1] FALSE
$cells$glm_model$rollback
[1] FALSE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.