execute R

deadestiani
deadestiani New Altair Community Member
edited November 5 in Community Q&A
i have scripst C5.0 in r, how make execute in rapid miner ?


dataseratus <- read.csv("C:/Desktop/dataseratus.csv")

View(dataseratus)
str(dataseratus)

table(dataseratus$Prediksi)
table(dataseratus$Global_intensity)
table(dataseratus$Voltage)
table(dataseratus$Global_re_aktiv)
table(dataseratus$Global_aktiv)


dataseratus$Prediksi<-as.factor(dataseratus$Prediksi)

summary(dataseratus$Global_re_aktiv)
summary(dataseratus$Voltage)
summary(dataseratus$Global_aktiv)
summary(dataseratus$Global_intensity)



set.seed(1000)
dataseratus_train <-dataseratus[2:9000,]
dataseratus_test <-dataseratus[9001:10002,]
prop.table(table(dataseratus_train$Prediksi))
prop.table(table(dataseratus_test$Prediksi))

View(dataseratus_train)
View(dataseratus_test)

library(C50)

dataseratus_model <- C5.0(dataseratus_train[1:5],dataseratus_train$Prediksi)

dataseratus_model
dataseratus_model$tree
plot(dataseratus_model)
summary(dataseratus_model)
dataseratus_pred<-predict(dataseratus_model,dataseratus_test)
library (gmodels)
CrossTable(dataseratus_test$Prediksi,dataseratus_pred,prop.chisq=FALSE,Prop.r=FALSE,dnn=c('actual prediksi','predicted prediksi'))


Tagged:

Answers

  • rfuentealba
    rfuentealba New Altair Community Member

    There is an extension named "R Scripting Extension", you can find it in the RapidMiner Marketplace if in the menu you go to Extensions > Marketplace.

    You must configure your R interpreter to execute R code inside RapidMiner. For this, go to Settings > Preferences and beneath the "R Scripting" tab, you should give your installation of R. RapidMiner requires a package to handle datasets, but I don't know of anyone.

    Finally, you can find "R Scripting" on the operators window, drag it and input your code where it's applicable.

    All the best,

    Rodrigo.
  • varunm1
    varunm1 New Altair Community Member
    edited November 2019
    Adding to @rfuentealba comment, you can check the sample R script usage in R in the below link for better understanding and defining necessary functions in rapidminer R operator

    https://docs.rapidminer.com/latest/studio/operators/utility/scripting/execute_r.html
  • deadestiani
    deadestiani New Altair Community Member
    but apply model R parsing fieled 
  • deadestiani
    deadestiani New Altair Community Member

  • Pavithra_Rao
    Pavithra_Rao New Altair Community Member
    hI @deadestiani

    Could you please share process XML so we can look into the process flow and what exactly is causing this error. Thank you.

    Cheers,
    Pavithra
  • rfuentealba
    rfuentealba New Altair Community Member
    Hello @deadestiani,

    I have two comments here that might help you solving your problem.
    1. You don't have an R-CRAN repository configured in your $HOME/.Rprofile file. You should never install packages inside your scripts (unless you create an R script to replicate your package setup), but if you do, you may want to configure one by adding the following line to your .Rprofile file instead of specifying the repo as an argument to install.packages():
      <code><span>http://cran.us.r-project.org</span>")))
      options(repos=structure(c(CRAN="
    2. You should never use "install.packages" inside a script. Better launch R and install packages from there before using those with RapidMiner. Otherwise, whenever you execute a RapidMiner process, you will have delays because R will connect to the Web Server, check that the latest version is already installed, install if it isn't...
    3. Don't underestimate the power of learning a little about the R console. You aren't required to become an expert in terminals and stuff, but installing and updating packages globally is a must.
    That's all I got for today, let's see if something goes sideways tomorrow.

    All the best,

    Rodrigo.