fos-r is a fos-core R implementation
There are pretty good machine learning training and scoring frameworks/libraries out there, but they don't provide the following benefits:
- Common API: fos provides a common abstraction for model attributes, model training and model scoring. Using a Weka based classifier will use have exactly the same API as using a R based classifier.
- Scoring & Training as a remote service: Training and scoring can be farmed to dedicated servers in the network enabling both vertical and horizontal scaling.
- Import and Export models: A model could be trained in a development box and imported seamlessly into a remote server
- Scalable and low latency scoring: Marshalling and Unmarshalling scoring requests/responses can be responsible for a significant amount of overhead. Along with the slow RMI based interface, fos also supports scoring using Kryo.
You need:
- Java SDK: Java 7
- Maven: Tested with maven 3.0.X
- fos-core
- R: Tested against R 2.15 on Linux (Tested on debian, centos, ubuntu)
- Access to maven central repo (or a local proxy)
After installing R you need to install R RServe library
To install Rserve open a command line, start R and type the following command:
install.packages("Rserve")
fos-r provides a built-in training module using randomForest. In order to use it you need to install the following R packages:
install.packages("randomForest")
install.packages("doMC")
install.packages("foreach")
install.packages("foreign")
install.packages("e1071")
install.packages("kernlab")
install.packages("XML")
install.packages("pmml")
After Rserve has been installed successfully, start a rserve daemon:
R --no-save --slave -e "library(Rserve);Rserve(args='--no-save --slave');"
After Java SDK and Maven have been installed run the following command
mvn clean install
This should compile fos-r, ran all the tests and install all modules into your local maven repo.
The default FOS-R package uses fos-weka. You need to set fos.factoryName
in fos.properties like this:
fos.factoryName=com.feedzai.fos.impl.r.RManagerFactory