Quantcast
Viewing all articles
Browse latest Browse all 2638

R-Component Save Option

Hello Everyone,

 

I am trying to generate some new R-Components for PA Expert Mode. If I try to use the feature of saving the model, I get always the error MODEL_PARAMS_CHECK_WARNING.

 

 

 

Image may be NSFW.
Clik here to view.
Error_Picture.png

 

 

I have tried some SAP examples and get the same error message for the following code

 

SLR<-function(InputDataFrame,IndepenentColumn,DependentColumn)

               {

               finalString<-paste(paste(DependentColumn,"~" ), IndepenentColumn);

               slr_model<-lm(finalString); # calling the "lm" function and storing the output model in "slr_model"

               result<-predict(slr_model, InputDataFrame);

               output<- cbind(InputDataFrame, result); # combining "InputDataFrame" and "result" to get the final table.

               plot(slr_model);

               # returnvalue - function must always return a list that contains results("out"), and model variable variable ("slrmodel"), if present.

               return (list(slrmodel = slr_model,out=output))

               }

 

SLRModelScoring<-function (MInputDataFrame, MIndependentColumn, Model)

               {

               predicted <-predict (Model, data.frame(MInputDataFrame [, MIndependentColumn]), level=0.95);

              

               return(list(modelresult=predicted))

               }

 

and also for this example:

 

cnrFunction <- function(dataFrame, IndependentColumns, dep)

               {

               library(rpart)

               formattedString <- paste(IndependentColumns, collapse = '+');

               finalString <- paste(paste(dep, "~" ), formattedString)

               cnr_model <- rpart(finalString, method="class");

               output <- predict(cnr_model, dataFrame, type=c("class"));

               out <- cbind(dataFrame, output);

               return(list(result = out, modelcnr=cnr_model));

               }

              

cnrFunctionmodel<-function(dataFrame, ind, modelcnr, type)

               {

               output <- predict(modelcnr,data.frame(dataFrame[,ind]),type=type);

               out <- cbind(dataFrame, output);

               return(list(result = out));

               }

 

Regarding this example I saw that a community member had a similar problem (http://scn.sap.com/thread/3881996). I made the suggested changes in the code as the following

 

cnrFunctionmodel<-function(dataFrame,modelcnr,type)

{

output<-predict(modelcnr,dataFrame,type=type);

out<- cbind(dataFrame, output); return (list(result=out));

}

 

But I still get the same error message. I don’t know what I am doing wrong or where the mistake might be.  For any help or suggestions I would be very thankful.

 

Best regards,


Viewing all articles
Browse latest Browse all 2638

Trending Articles