hanaml.Glm {hana.ml.r}R Documentation

Generalized Linear Model

Description

hanaml.Glm is a R wrapper for PAL Generalized Linear Model.

Usage

hanaml.Glm(conn.context, data, key=NULL, features=NULL,
          label=NULL, family=NULL, link=NULL,
          solver=NULL, handle.missing.fit=NULL,
          quasilikelihood=NULL, max.iter=NULL, tol=NULL,
          significance.level=NULL,
          output.fitted=NULL, alpha=NULL, lambda=NULL,
          num.lambda=NULL, lambda.min.ratio=NULL,
          categorical.variable=NULL, ordering=NULL)

Arguments

conn.context

ConnectionContext
The connection to the SAP HANA system.

data

DataFrame
DataFrame containing the data.

key

character
Name of the ID column of data.

features

list of character, optional
Names of the feature columns. If features is not provided, it defaults to all non-ID, no-label columns.

label

character
Name of the column in data that specifies the dependent variable.

family

character, optional
The kind of distribution the dependent variable outcomes are assumed to be drawn from. Must be one of the following:

  • gaussian

  • normal (synonym of 'gaussian')

  • poisson

  • binomial

  • gamma

  • inversegaussian

  • negativebinomial

  • ordinal (for ordinal regression)

Defaults to 'gaussian'.

link

character, optional
GLM link function. Determines the relationship between the linear predictor and the predicted response. Default and allowed values depend on family. 'inverse' is accepted as a synonym of reciprocal'.

  • gaussian(family), identity(default), identity, log, reciprocal (allowed)

  • poisson(family, log(default), identity, log(allowed)

  • binomial(family, logit(default), logit, probit, comploglog, log (allowed)

  • gamma(family, reciprocal(default), identity, reciprocal, log(allowed)

  • inversegaussian(family), inversesquare(default), inversesquare, identity, reciprocal, log(allowed)

  • negativebinomial(family), log(default), identity, log, sqrt(allowed)

  • ordinal(family), logit(default), logit, probit, comploglog(allowed)

solver

("irls","nr","cd"), optional
Optimization algorithm to use.

  • "irls" Iteratively re-weighted least squares.

  • "nr" Newton-Raphson.

  • "cd" Coordinate descent. (Picking coordinate descent activates elastic net regularization.)

Defaults to "irls", except when family is "ordinal". Ordinal regression requires (and defaults to) "nr", and Newton-Raphson is not supported for other values of family.

handle.missing.fit

("skip", "abort", "fill_zero"), optional
How to handle data rows with missing independent variable values during fitting.

  • "skip" Don't use those rows for fitting

  • "abort" Throw an error if missing independent variable values are found.

  • "fill_zero" Replace missing values with 0.

Defaults to "skip".

quasilikelihood

logical, optional
If TRUE, enables the use of quasi-likelihood to estimate overdispersion. Defaults to FALSE.

max.iter

integer, optional
Maximum number of optimization iterations. Defaults to 100 for IRLS and Newton-Raphson. Defaults to 100000 for coordinate descent.

tol

double, optional
Stopping condition for optimization. Defaults to 1e-8 for IRLS, 1e-6 for Newton-Raphson, and 1e-7 for coordinate descent.

significance.level

double, optional
Significance level for confidence intervals and prediction intervals.
Defaults to 0.05.

output.fitted

double, optional
If TRUE, create the 'fitted_' DataFrame of fitted response values for training data in fit.

alpha

integer
Elastic net mixing parameter. Only accepted when using coordinate descent. Should be between 0 and 1 inclusive. Defaults to 1.0.

lambda

integer
Coefficient for L1 and L2 regularization.
No default value.

num.lambda

integer
The number of lambda values. Only accepted when using coordinate descent. Defaults to 100.

lambda.min.ratio

double, optional
The smallest value of lambda, as a fraction of the maximum lambda, where lambda_max is the smallest value for which all coefficients are zero. Only accepted when using coordinate descent. Defaults to 0.01 when the number of observations is smaller than the number of covariates, and 0.0001 otherwise.

categorical.variable

character or list of characters, optional
integer columns specified in this list will be treated as categorical data. Other integer columns will be treated as continuous.

ordering

list of characters/integers, optional
Specifies the order of categories for ordinal regression. The default is numeric order for ints and alphabetical order for strings.

Format

R6Class object.

Value

A "Glm" object with the following attributes:

See Also

predict.Glm

Examples

## Not run: 
Input DataFrame for training:
> df$Collect()
  ID  X  Y
0   1  0 -1
1   2  0 -1
2   3  1  0
3   4  1  0
4   5  1  0
5   6  1  0
6   7  2  1
7   8  2  1
8   9  2  1

Fitting a GLM on that data:
>glm <- hanaml.Glm(cc, df, key="ID", label="Y", solver="irls",
                 family="poisson", link="log")


## End(Not run)

[Package hana.ml.r version 1.0.8 Index]