R is an open source programming language and software environment for statistical analysis and graphics. MicroStrategy can use R to do the predictive model estimations. By using R Integration Pack, MicroStrategy can get the inputs, pass them to R, get the computation results back from R, and then pass those to predictive metrics.
In MicroStrategy version 10, we need the following steps to integrate R:
Use the following commands to install R on Red Hat Enterprise Linux 6.6:
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum localinstall epel-release-6-8.noarch.rpm
yum install R
If there are dependency issues, you will find an error message similar to this:
--> Finished Dependency Resolution Error: Package: R-core-devel-3.1.1-3.el6.x86_64 (epel) Requires: lapack-devel Error: Package: R-core-devel-3.1.1-3.el6.x86_64 (epel) Requires: blas-devel >= 3.0
R installation failed because neither the EPEL nor the RHN repositories have all of the prerequisite packages available. To fix this, we need to enable the repository by changing the appropriate enabled = 0
line to enabled = 1
:
vim /etc/yum.repos.d/redhat.repo
[rhel-6-server-optional-rpms]
...
enabled = 1
Executing yum installs R again; the R installation now should work (source: Engineering Walden, https://bluehatrecord.wordpress.com). Check your R after installation. MicroStrategy may require the R 64-bit version as shown in the following screenshot:
First, we need to download R Integration Pack from https://rintegrationpack.codeplex.com/.
Then unpack the archive, and run setup.sh
in the terminal. Follow the instructions to finish the installation:
Now you need to upgrade existing projects; run Configuration Wizard in the terminal, and the following command:
/mstrcfgwiz
If you have problems, a good source to refer to is R Integration Pack User Guide, which is a PDF file you can download from https://rintegrationpack.codeplex.com/:
Let's build a simple neural network model, and export the model as a PMML file:
library(nnet)
Iris <- read.csv("https://raw.githubusercontent.com/uiuc-cse/data-fa14/gh-pages/data/iris.csv")
IrisNet <- nnet(species~., data=Iris, size=4)
str(IrisNet)
library(pmml)
pmml(IrisNet)
library(nnet)
will load the neural network package, and str(IrisNet)
will show the structure of the neural network:
library(pmml)
will load the PMML
package, and pmml(IrisNet)
will show the PMML code of the estimated neural network model. We can copy and save the PMML code as an XML file. MicroStrategy can import this neural network model from the XML file, or directly: