Skip to content

Fuzzy-Logix/AdapteR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AdapteR README

Fuzzy Logix’s new R package AdapteR enables the R syntax to consume DB Lytix™ in-database analytics by generating SQL transparently, and replacing R matrix and data frame data structures with remote table objects.

What is AdapteR?

With Fuzzy Logix’ DB Lytix™, advanced analytics can realize dramatic improvements in performance by moving computation from client machines into data warehouses and clusters where big data lives. As important as performance and scalability is the way in which the end user interacts with the analytics, and the R language has become most pervasive in this area. R is remarkably expressive and flexible, allowing for fast prototyping and evaluation, enabling agile analytics. Fuzzy Logix’s new R package AdapteR enables the R syntax to consume DB Lytix™ in-database analytics by generating SQL transparently, and replacing R matrix and data frame data structures with remote table objects. AdapteR uses R’s class system and method override to seamlessly leverage in-database analytics, without requiring complicated R server installations or writing custom SQL. AdapteR can be used to build interactive analytics at scale with just a few lines of R code!

You can download the full manual here: AdapteR package manual.

Requirements

AdapteR needs DB Lytix™ suite to be installed on your Teradata Appliance, so it can use its fast C++ implementation of analytical functions. Find more information on http://www.fuzzylogix.com.

R

Installation of R on Windows:

  1. Download and install R(>=3.2.0) from https://cran.r-project.org/bin/windows/base/

Installation of R on Linux:

  1. Install R using Ubuntu:
    apt-get install r-base
        
  2. Install OS packages required to build R packages

    Ubuntu:

    apt-get -y build-dep libcurl4-gnutls-dev
    apt-get -y install libcurl4-gnutls-dev
    apt-get install libssl-dev
        

Work environments & recommendations

We recommend to

Installation and Update instructions

  1. Open R-Studio or an R terminal
  2. The recommended way to install (or update) the package is through github and the convenience function install_github function in the devtools package:
    ## 1. Install devtools package using "install.packages("devtools")"
    install.packages("devtools") ## Required for install_github
    
    ## 2. Load devtools using
    require(devtools)
    ## 3. Install AdapteR from github
    install_github("Fuzzy-Logix/AdapteR")
        

    This automatically installs dependencies.

  3. Load AdapteR using
    library(AdapteR)
        

Remove older Version, if you encounter any issues

remove.packages("AdapteR")

Connecting to the Data Warehouse

AdapteR does not depend on either JDBC or ODBC but uses either you provide at runtime. You can either use ODBC or JDBC to connect to the warehouse, see instructions below.

Use flConnect to connect to a database. Help on this can be found using

?flConnect

ODBC

install.packages("RODBC") ## Required for ODBC Connection.Need to setup odbc Source
library(RODBC)

Note: it is required that the Teradata ODBC option “Return Output Parameters As Result Set” is checked (set to true).

JDBC

Java JDK

  • Windows: Please make sure you install the 64 bit version of java when you use 64 bit R.
    1. (re-)install the jdk, and set the path variable in R
    Sys.setenv(JAVA_HOME="yourPathTojdk")
        

    (https://docs.oracle.com/cd/E19182-01/820-7851/inst_cli_jdk_javahome_t/)

  • Linux:
    1. install jdk and sources Ubuntu:
      sudo apt install default-jdk
              
    2. setup R for using your java installation
      sudo R CMD javareconf
              

RJDBC

In order to use jdbc with AdapteR, you need to install rJava

install.packages("rJava") ## Required for RJDBC
install.packages("RJDBC") ## Required for JDBC connection
library(RJDBC)            ## check if RJDBC can be loaded

JDBC connectors

Also, you need to download and use the jdbc connector jar files either in the java load path or provide them when calling flConnect the java development toolkit (jdbc).

AdapteR Demos and Training

The package includes some demos to get you started and to explain the most important concepts. To run the package demos, please copy and execute all scripts here in R. (Before running the demo in a fresh installation for the first time, also run the scripts in Optional packages, see below).

## Load devtools and Update AdapteR from github
require(devtools)
install_github("Fuzzy-Logix/AdapteR")


require(AdapteR)

To start a demo, first establish your connection info with ODBC (If you use JDBC, see below how to set your connection info with JDBC)

yourODBCSource <- "Gandalf" ## please make sure you use a 64 bit ODBC driver on a 64 bit R session
yourPlatform <- "TD"
connection <- flConnect(odbcSource = yourODBCSource,
                        database="FL_TRAIN",
                        platform=yourPlatform)

Run a demo:

demo("matrix.correlation",package="AdapteR")

This lists all available demos

demo(package="AdapteR")
Demos in package ‘AdapteR’:

Iris_kmeans             
LoanDefaultDemo         
TwitterBuzzDemo         
apply.statistical.functions
                        
connecting              
kmeans                  
matrix.algebra          
matrix.correlation      
string.functions

If you want to demonstrate what SQL queries are created during the demo:

options(debugSQL=TRUE)
demo("matrix.correlation",package="AdapteR")

Or set your connection info with JDBC

Before running, please fill in the required information in “”.
yourUser <- "" 
yourPassword <- ""
yourHost <- ""
yourPlatform <- "TD"

                ## set jdbc.jarsDir to add jdbc driver
                ## and security jars to classpath:
                ##    terajdbc4.jar tdgssconfig.jar
                ## CAVE: fully qualified PATH required
yourJarDir <- ""
connection <- flConnect(
                host     = yourHost,
                database = "FL_TRAIN",
                user = yourUser,
                passwd = yourPassword,
                jdbc.jarsDir = yourJarDir)

Optional packages

The following suggested packages provide functions that are used if AdapteR functions are called on data.frame, matrix or vectors (not remote representations). Install these packages for the demos:
install.packages("gplots")
install.packages("shiny")
install.packages("R.utils")
  

Functions in these packages provide the reference implementations for AdapteR functions:

install.packages("psych")
install.packages("SDMTools")
install.packages("MASS")
install.packages("psych")
install.packages("cluster")
install.packages("survival")
install.packages("mgcv")
install.packages("moments")
install.packages("stringdist")
install.packages("nortest")
install.packages("DescTools")
install.packages("RVAideMemoire")

These packages are required to run the test suite:

install.packages("devtools")
install.packages("roxygen2")
install.packages("testthat")
install.packages("optparse")

About

Advanced analytics package that enables R users to perform in-database analytics using Fuzzy Logix's flagship DB Lytix suite of functions on Teradata

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages