- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2024 02:36 AM
Hi @AntonDBUser,
Please refer to these posts for R Shiny using Databricks Apps - https://docs.databricks.com/en/sparkr/shiny.html#id8, https://community.databricks.com/t5/machine-learning/host-r-shiny-app/m-p/22992
For R Models hosting, we recommend using Posit Connect.
-
Useful Resources
Parallelize R code using user-defined functions (UDFs) in sparklyr - Posit-
Install the necessary packages and set up your credentials, it remotely access Databricks cluster through R Studio
-
Use sparklyr to access your Databricks cluster in RStudio.With sparklyr, you can execute distributed R code within the Spark environment in Databricks cluster.
-
Train a machine learning model and run predictions using spark udf
-
Save the trained model as an R object
-
Upload the R object to Databricks, save it as a pin, or store it in another suitable location
-
Use the vetiver package to store the model as a pin and deploy it as a REST API on Posit Connect
-
-
Other blogs
While it is technically possible to serve R models without Posit Connect, it involves several complex adjustments.
Below are the steps and options available:
-
Create a MLflow Run and Log the R Model and get a MLflow URI:
-
Use the 'crate' flavor to log the R model within an experiment
-
Include a list of required package versions or an renv lockfile.
-
Add Additional Artifacts:
-
Create a `pyfunc` that wraps the R model
-
Copy the model artifacts into a new model.
-
Generate `conda.yml`.
-
Adjust the `conda_env.yaml` to include `r-base` to add R to the container image.
-
Detect the version of R.
-
Use `rpy2` to set up the predict method and pass parameters to it.
-
The `pyfunc` must use `rpy2` to load and invoke the R model.