cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Importing Rds R model to Power BI - gam model

Hi,

 

 

I'm trying to pass parameters of Gam model using this method.

 

https://towardsdatascience.com/how-to-predict-values-from-a-custom-r-model-in-power-bi-3364f83b0015

 

Unfortunettaly I am gettign read error on unserialize function

 

from_byte_string = function(x) {
xcharvec = strsplit(x, " ")[[1]]
xhex = as.hexmode(xcharvec)
xraw = as.raw(xhex)
unserialize(xraw)

 

}

#project_folder <- "Z:/Datasets/NSA/EBITDA_adimensional/"
#finalfit <- readRDS(paste0(project_folder, "mtcars-model.rds"))

finalfit.str <- as.character( dataset[dataset$model_id == 1, "model_str"] )
finalfit <- from_byte_string(finalfit.str)

v <- c( wt=dataset$weight, qsec=dataset$qsec, am=as.factor(dataset$am) )

pred <- round( predict(finalfit, newdata = as.data.frame(t(v))), digits = 2 )

plot.new()
text(0.5, 0.5,
#labels = as.character(dataset$weight)
labels = as.character(pred[[1]])
,cex = 3.5
)
 
On IDE script is runnig properly.
 
Is there anyone who had tried it yet ? Can it be problem with library in Power BI ?
 
 
3 REPLIES 3
Highlighted
Community Support
Community Support

Re: Importing Rds R model to Power BI - gam model

@patipati 

 

That works for me. Try the latest version of Power BI Desktop and take a good look at Create Power BI visuals with R.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: Importing Rds R model to Power BI - gam model

I have March version, and R 3.5.3 and I'm still getting error with unserialize function:

 

unserialize(xraw): read error

Highlighted
Regular Visitor

Re: Importing Rds R model to Power BI - gam model

Where you able to solve this issue?

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Upcoming Events

Upcoming Events

Wondering what events you could join or have an event to promote yourself? Check out our Upcoming Events.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Top Solution Authors
Top Kudoed Authors