Mleap Calculating Confidence and feature score - mleap

I was able to successfully serialize a pyspark generated RandomForestModel as Mleap bundle and run it using mleap-runtime.
I want to get the confidence score and score for each feature. Is there a way to achieve that without using any spark dependencies?

Related

what tests to use to validate a dynamic factor model obtained using nowcasting package in r

I used the nowcast function from R package to use dynamic factor model to nowcast GDP using the extracted factors. I Have tried multiple combination of the initial variables and finally obtained this model which all variables in it seems significant and teh ales obtained for my variable of interest is acceptable.
enter image description here
But I can't find any reference about what tests on residuals that I need to do in order to validate this model.
I am really struggling and have been stuck in this for a month, I need to submit my graduation project this weekend and I really need this model to work. so any help will be very much appreciated. Thank you.
Update 1:
This is teh acf plot n residuals suggested by the same package nowcasting, I think my model passes that test and therefore I can use it. right?
enter image description here

Using {gtsummary} to display confidence intervals for survey.design object?

{gtsummary} has the tbl_svysummary() function for producing summary statistics tables from survey.design objects created by the {survey} package. The {gtsummary} website provides an example of how to add confidence intervals for tbl_summary(), by defining custom functions for calculating CIs which are then passed to the statistics = argument in tbl_summary().
However, the documentation for tbl_svysummary() noted that "Unlike tbl_summary(), it is not possible to pass a custom function." I'm using a survey.design object since I'm applying weighting to my data, but I really like the output of {gtsummary}, so it would be great if I could find a way to add confidence intervals as I need to show these for reporting.
Any suggestions on how to achieve this, or is it not possible?
I am sorry to report that it is currently not possible. The way one would go about it using the add_stat() function (example here How to generate effect size [90%CI] in the summary table using R package “gtsummary”?). But that function has not yet been generalized to work with tbl_svysummary() objects.
I had never considered generalizing it until now, so thank you very much for your question. I opened a GitHub Issue to track implementation progress. You can subscribe to the issue to be notified when it is complete.
https://github.com/ddsjoberg/gtsummary/issues/688
Happy Programming!

How to run a dynamic linear regression in R?

I am new to using R as I usually use Stata. I want to estimate a state space model on some time series data with time varying coefficients. From what I have gathered this is not possible to do in Stata.
I have downloaded the dlm package in R and I am trying to run the dlmModReg command to regress my dependent variable on a single explanatory variable. I would like to allow the intercept and beta coefficient to vary over time.
If anyone could show me an example of the code I want to run I think that would be enough for me to work out how to do this. The examples I have found online are vague or use terminology that I am not familiar with as a new R user. Any help or comments are greatly appreciated.

Tableau Correlation using R

I am currently trying to do a Spearman's Rank Correlation in Tableau using the new R capability. I was able to get the correct code in R, but having trouble putting it in a form for Tableau to understand.
My data is grouped by code. So it is a Group Correlation. My code in R:
library (plyr)
ddply(mydata,"Code",summarise, corr=cor(Survey.1,Survey.2, method="spearman"))
How do I use the Script_Real in Tableau to give me that correlation?
For those wanting to understand the coding. I have figured it out!
Script_Real("cor(.arg1,.arg2, method='spearman')",SUM([x]), Sum([y])).
Note: You need to have ID:1,2,3,4,5,6,7 near your data in order for it to run the test. Then click the pill and compute using that ID code.
One step you need is to configure the connection to R.
See the help menu ->Settings and Performance > Manage R Connection
If you are using Tableau server, that will need to know the connection path to RServe as well. See the online help.

Deploy R statistical models in WSO2?

A newbie question on WSO2 and 'R'....
I have a customer where they are looking to build some statistical models using 'R'. These models are mostly associated with customer scoring, i.e. sucking in a table of customer data with behavioural attributes as columns, and spitting out a 'score' for each customer.
Two questions on this:
Can 'R' models by deployed like rules in a service model?
Could you deploy R models into a WSO2 middleware, and if so, how and where?
TIA
Note: I'm not familiar with wso2 but I'm with R.
The answer to your question very much depends on what type of models you would like to deploy. The easiest ones are models such as linear/logistic regression followed by decision trees.
The reason they are easy is because for linear & logistic regression you get a nice formula you can plug-in to any programming interface. An example prediction formula might be like the following:
customer_predicted_life_time_value =
17.25+2.365*num_of_products_held-16.12*time_at_address+25.36*monthly_income.
Similarly, decision trees can be easily exported as a bunch of if-then-else rules (there at least a couple of packages in R which will translate the R decision tree model into rules).
You could technically be able to deploy randomForest too in the form of rules but that will be cumbersome if you want to implenent using rules.

Resources