Skip to content
R random forest model hosted on opencpu
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
data
inst
man
.Rbuildignore
.gitignore
DESCRIPTION
NAMESPACE
README.md
modelApartmentsRF.Rproj

README.md

random_forest_Apartments

R random forest model hosted on opencpu

Steps for hosting on opencpu

https://www.opencpu.org/api.html

Hosted app

! repository name

https://analyticsplussoftwaresolutions.ocpu.io/random_forest_Apartments/info

How to predict

library(rjson)
library(DALEX)

model_url <- "https://analyticsplussoftwaresolutions.ocpu.io/random_forest_Apartments/R/pred/json"

custom_pred <- function(model_url, data){
  x <- toJSON(unname(split(data, 1:nrow(data))))
  (tmp <- httr::POST(model_url, body = list(input = x)))
  result <- rawToChar(tmp$content)
  fromJSON(result)
}

custom_pred(model_url, apartments[1,])


# explainer
explainer <- explain(model = model_url, predict_function = custom_pred, 
                     data = apartmentsTest[,-1], 
                     y = apartmentsTest$m2.price)
mp <- model_performance(explainer)
plot(mp)
You can’t perform that action at this time.