1.15.1
User Documentation for Apache MADlib
elastic_net.sql_in File Reference

SQL functions for elastic net regularization. More...

Functions

void elastic_net_train (text tbl_source, text tbl_result, text col_dep_var, text col_ind_var, text regress_family, float8 alpha, float8 lambda_value, boolean standardize, text grouping_col, text optimizer, text optimizer_params, text excluded, integer max_iter, float8 tolerance)
 Interface for elastic net. More...
 
void elastic_net_train (text tbl_source, text tbl_result, text col_ind_var, text col_dep_var, text regress_family, float8 alpha, float8 lambda_value, boolean standardization, text grouping_columns, text optimizer, text optimizer_params, text excluded, integer max_iter)
 
void elastic_net_train (text tbl_source, text tbl_result, text col_ind_var, text col_dep_var, text regress_family, float8 alpha, float8 lambda_value, boolean standardization, text grouping_columns, text optimizer, text optimizer_params, text excluded)
 
void elastic_net_train (text tbl_source, text tbl_result, text col_ind_var, text col_dep_var, text regress_family, float8 alpha, float8 lambda_value, boolean standardization, text grouping_columns, text optimizer, text optimizer_params)
 
void elastic_net_train (text tbl_source, text tbl_result, text col_ind_var, text col_dep_var, text regress_family, float8 alpha, float8 lambda_value, boolean standardization, text grouping_columns, text optimizer)
 
void elastic_net_train (text tbl_source, text tbl_result, text col_ind_var, text col_dep_var, text regress_family, float8 alpha, float8 lambda_value, boolean standardization, text grouping_columns)
 
void elastic_net_train (text tbl_source, text tbl_result, text col_ind_var, text col_dep_var, text regress_family, float8 alpha, float8 lambda_value, boolean standardization)
 
void elastic_net_train (text tbl_source, text tbl_result, text col_ind_var, text col_dep_var, text regress_family, float8 alpha, float8 lambda_value)
 
text elastic_net_train ()
 Help function, to print out the supported families. More...
 
text elastic_net_train (text family_or_optimizer)
 Help function, to print out the supported optimizer for a family or print out the parameter list for an optimizer. More...
 
void elastic_net_predict (text tbl_model, text tbl_new_source, text col_id, text tbl_predict)
 Prediction and put the result in a table can be used together with General-CV. More...
 
float8 elastic_net_predict (text regress_family, float8[] coefficients, float8 intercept, float8[] ind_var)
 Prediction use learned coefficients for a given example. More...
 
float8 elastic_net_gaussian_predict (float8[] coefficients, float8 intercept, float8[] ind_var)
 Prediction for linear models use learned coefficients for a given example. More...
 
boolean elastic_net_binomial_predict (float8[] coefficients, float8 intercept, float8[] ind_var)
 Prediction for logistic models use learned coefficients for a given example. More...
 
float8 elastic_net_binomial_prob (float8[] coefficients, float8 intercept, float8[] ind_var)
 Compute the probability of belonging to the True class for a given observation. More...
 
float8 __elastic_net_binomial_loglikelihood (float8[] coefficients, float8 intercept, boolean dep_var, float8[] ind_var)
 
float8 [] __gaussian_igd_transition (float8[] state, float8[] ind_var, float8 dep_var, float8[] pre_state, float8 lambda, float8 alpha, integer dimension, float8 stepsize, integer total_rows, float8[] xmean, float8 ymean, float8 step_decay)
 
float8 [] __gaussian_igd_merge (float8[] state1, float8[] state2)
 
float8 [] __gaussian_igd_final (float8[] state)
 
aggregate float8 [] __gaussian_igd_step (float8[], float8, float8[], float8, float8, integer, float8, integer, float8[], float8, float8)
 
aggregate float8 [] __gaussian_igd_step_single_seg (float8[], float8, float8[], float8, float8, integer, float8, integer, float8[], float8, float8)
 
float8 __gaussian_igd_state_diff (float8[] state1, float8[] state2)
 
__elastic_net_result __gaussian_igd_result (float8[] in_state, float8[] feature_sq, float8 threshold, float8 tolerance)
 
float8 [] __gaussian_fista_transition (float8[] state, float8[] ind_var, float8 dep_var, float8[] pre_state, float8 lambda, float8 alpha, integer dimension, integer total_rows, float8 max_stepsize, float8 eta, integer use_active_set, integer is_active, integer random_stepsize)
 
float8 [] __gaussian_fista_merge (float8[] state1, float8[] state2)
 
float8 [] __gaussian_fista_final (float8[] state)
 
aggregate float8 [] __gaussian_fista_step (float8[], float8, float8[], float8, float8, integer, integer, float8, float8, integer, integer, integer)
 
float8 __gaussian_fista_state_diff (float8[] state1, float8[] state2)
 
__elastic_net_result __gaussian_fista_result (float8[] in_state)
 
float8 [] __binomial_igd_transition (float8[] state, float8[] ind_var, boolean dep_var, float8[] pre_state, float8 lambda, float8 alpha, integer dimension, float8 stepsize, integer total_rows, float8[] xmean, float8 ymean, float8 step_decay)
 
float8 [] __binomial_igd_merge (float8[] state1, float8[] state2)
 
float8 [] __binomial_igd_final (float8[] state)
 
aggregate float8 [] __binomial_igd_step (float8[], boolean, float8[], float8, float8, integer, float8, integer, float8[], float8, float8)
 
aggregate float8 [] __binomial_igd_step_single_seg (float8[], boolean, float8[], float8, float8, integer, float8, integer, float8[], float8, float8)
 
float8 __binomial_igd_state_diff (float8[] state1, float8[] state2)
 
__elastic_net_result __binomial_igd_result (float8[] in_state, float8[] feature_sq, float8 threshold, float8 tolerance)
 
float8 [] __binomial_fista_transition (float8[] state, float8[] ind_var, boolean dep_var, float8[] pre_state, float8 lambda, float8 alpha, integer dimension, integer total_rows, float8 max_stepsize, float8 eta, integer use_active_set, integer is_active, integer random_stepsize)
 
float8 [] __binomial_fista_merge (float8[] state1, float8[] state2)
 
float8 [] __binomial_fista_final (float8[] state)
 
aggregate float8 [] __binomial_fista_step (float8[], boolean, float8[], float8, float8, integer, integer, float8, float8, integer, integer, integer)
 
float8 __binomial_fista_state_diff (float8[] state1, float8[] state2)
 
__elastic_net_result __binomial_fista_result (float8[] in_state)
 

Detailed Description

Date
July 2012
See also
For a brief introduction to elastic net, see the module description Elastic Net Regularization.

Function Documentation

◆ __binomial_fista_final()

float8 [] __binomial_fista_final ( float8 []  state)

◆ __binomial_fista_merge()

float8 [] __binomial_fista_merge ( float8 []  state1,
float8 []  state2 
)

◆ __binomial_fista_result()

__elastic_net_result __binomial_fista_result ( float8 []  in_state)

◆ __binomial_fista_state_diff()

float8 __binomial_fista_state_diff ( float8 []  state1,
float8 []  state2 
)

◆ __binomial_fista_step()

aggregate float8 [] __binomial_fista_step ( float8  [],
boolean  ,
float8  [],
float8  ,
float8  ,
integer  ,
integer  ,
float8  ,
float8  ,
integer  ,
integer  ,
integer   
)

◆ __binomial_fista_transition()

float8 [] __binomial_fista_transition ( float8 []  state,
float8 []  ind_var,
boolean  dep_var,
float8 []  pre_state,
float8  lambda,
float8  alpha,
integer  dimension,
integer  total_rows,
float8  max_stepsize,
float8  eta,
integer  use_active_set,
integer  is_active,
integer  random_stepsize 
)

◆ __binomial_igd_final()

float8 [] __binomial_igd_final ( float8 []  state)

◆ __binomial_igd_merge()

float8 [] __binomial_igd_merge ( float8 []  state1,
float8 []  state2 
)

◆ __binomial_igd_result()

__elastic_net_result __binomial_igd_result ( float8 []  in_state,
float8 []  feature_sq,
float8  threshold,
float8  tolerance 
)

◆ __binomial_igd_state_diff()

float8 __binomial_igd_state_diff ( float8 []  state1,
float8 []  state2 
)

◆ __binomial_igd_step()

aggregate float8 [] __binomial_igd_step ( float8  [],
boolean  ,
float8  [],
float8  ,
float8  ,
integer  ,
float8  ,
integer  ,
float8  [],
float8  ,
float8   
)

◆ __binomial_igd_step_single_seg()

aggregate float8 [] __binomial_igd_step_single_seg ( float8  [],
boolean  ,
float8  [],
float8  ,
float8  ,
integer  ,
float8  ,
integer  ,
float8  [],
float8  ,
float8   
)

◆ __binomial_igd_transition()

float8 [] __binomial_igd_transition ( float8 []  state,
float8 []  ind_var,
boolean  dep_var,
float8 []  pre_state,
float8  lambda,
float8  alpha,
integer  dimension,
float8  stepsize,
integer  total_rows,
float8 []  xmean,
float8  ymean,
float8  step_decay 
)

◆ __elastic_net_binomial_loglikelihood()

float8 __elastic_net_binomial_loglikelihood ( float8 []  coefficients,
float8  intercept,
boolean  dep_var,
float8 []  ind_var 
)

◆ __gaussian_fista_final()

float8 [] __gaussian_fista_final ( float8 []  state)

◆ __gaussian_fista_merge()

float8 [] __gaussian_fista_merge ( float8 []  state1,
float8 []  state2 
)

◆ __gaussian_fista_result()

__elastic_net_result __gaussian_fista_result ( float8 []  in_state)

◆ __gaussian_fista_state_diff()

float8 __gaussian_fista_state_diff ( float8 []  state1,
float8 []  state2 
)

◆ __gaussian_fista_step()

aggregate float8 [] __gaussian_fista_step ( float8  [],
float8  ,
float8  [],
float8  ,
float8  ,
integer  ,
integer  ,
float8  ,
float8  ,
integer  ,
integer  ,
integer   
)

◆ __gaussian_fista_transition()

float8 [] __gaussian_fista_transition ( float8 []  state,
float8 []  ind_var,
float8  dep_var,
float8 []  pre_state,
float8  lambda,
float8  alpha,
integer  dimension,
integer  total_rows,
float8  max_stepsize,
float8  eta,
integer  use_active_set,
integer  is_active,
integer  random_stepsize 
)

◆ __gaussian_igd_final()

float8 [] __gaussian_igd_final ( float8 []  state)

◆ __gaussian_igd_merge()

float8 [] __gaussian_igd_merge ( float8 []  state1,
float8 []  state2 
)

◆ __gaussian_igd_result()

__elastic_net_result __gaussian_igd_result ( float8 []  in_state,
float8 []  feature_sq,
float8  threshold,
float8  tolerance 
)

◆ __gaussian_igd_state_diff()

float8 __gaussian_igd_state_diff ( float8 []  state1,
float8 []  state2 
)

◆ __gaussian_igd_step()

aggregate float8 [] __gaussian_igd_step ( float8  [],
float8  ,
float8  [],
float8  ,
float8  ,
integer  ,
float8  ,
integer  ,
float8  [],
float8  ,
float8   
)

◆ __gaussian_igd_step_single_seg()

aggregate float8 [] __gaussian_igd_step_single_seg ( float8  [],
float8  ,
float8  [],
float8  ,
float8  ,
integer  ,
float8  ,
integer  ,
float8  [],
float8  ,
float8   
)

◆ __gaussian_igd_transition()

float8 [] __gaussian_igd_transition ( float8 []  state,
float8 []  ind_var,
float8  dep_var,
float8 []  pre_state,
float8  lambda,
float8  alpha,
integer  dimension,
float8  stepsize,
integer  total_rows,
float8 []  xmean,
float8  ymean,
float8  step_decay 
)

◆ elastic_net_binomial_predict()

boolean elastic_net_binomial_predict ( float8 []  coefficients,
float8  intercept,
float8 []  ind_var 
)
Parameters
coefficientsLogistic fitting coefficients
interceptLogistic fitting intercept
ind_varFeatures (independent variables)

returns a boolean value

◆ elastic_net_binomial_prob()

float8 elastic_net_binomial_prob ( float8 []  coefficients,
float8  intercept,
float8 []  ind_var 
)
Parameters
coefficientsLogistic fitting coefficients
interceptLogistic fitting intercept
ind_varFeatures (independent variables)

returns a double value, which is the probability of this data point being True class

◆ elastic_net_gaussian_predict()

float8 elastic_net_gaussian_predict ( float8 []  coefficients,
float8  intercept,
float8 []  ind_var 
)
Parameters
coefficientsLinear fitting coefficients
interceptLinear fitting intercept
ind_varFeatures (independent variables)

returns a double value

◆ elastic_net_predict() [1/2]

void elastic_net_predict ( text  tbl_model,
text  tbl_new_source,
text  col_id,
text  tbl_predict 
)
Parameters
tbl_modelThe result from elastic_net_train
tbl_new_sourceData table
col_idUnique ID associated with each row
tbl_predictPrediction result

◆ elastic_net_predict() [2/2]

float8 elastic_net_predict ( text  regress_family,
float8 []  coefficients,
float8  intercept,
float8 []  ind_var 
)
Parameters
regress_familymodel family
coefficientsThe fitting coefficients
interceptThe fitting intercept
ind_varFeatures (independent variables)
Returns
float8

Note: Please use function elastic_net_gaussian_predict() or elastic_net_binomial_predict() instead if you could. This may be deprecated in the future, as users are confused between this function and the table function with the same name.

When regress_family is 'binomial' or 'logistic', this function returns 1 for True and 0 for False

◆ elastic_net_train() [1/10]

void elastic_net_train ( text  tbl_source,
text  tbl_result,
text  col_dep_var,
text  col_ind_var,
text  regress_family,
float8  alpha,
float8  lambda_value,
boolean  standardize,
text  grouping_col,
text  optimizer,
text  optimizer_params,
text  excluded,
integer  max_iter,
float8  tolerance 
)
Parameters
tbl_sourceName of data source table
tbl_resultName of the table to store the results
col_ind_varName of independent variable column, independent variable is an array
col_dep_varName of dependent variable column
regress_familyResponse type (gaussian or binomial)
alphaThe elastic net parameter, [0, 1]
lambda_valueThe regularization parameter
standardizeWhether to normalize the variables (default True)
grouping_colList of columns on which to apply grouping (currently only a placeholder)
optimizerThe optimization algorithm, 'fista' or 'igd'. Default is 'fista'
optimizer_paramsParameters of the above optimizer, the format is 'arg = value, ...'. Default is NULL
excludedWhich columns to exclude? Default is NULL (applicable only if col_ind_var is set as * or a column of array, column names as 'col1, col2, ...' if col_ind_var is '*'; element indices as '1,2,3, ...' if col_ind_var is a column of array)
max_iterMaximum number of iterations to run the algorithm (default value of 10000)
toleranceIteration stopping criteria. Default is 1e-6

◆ elastic_net_train() [2/10]

void elastic_net_train ( text  tbl_source,
text  tbl_result,
text  col_ind_var,
text  col_dep_var,
text  regress_family,
float8  alpha,
float8  lambda_value,
boolean  standardization,
text  grouping_columns,
text  optimizer,
text  optimizer_params,
text  excluded,
integer  max_iter 
)

◆ elastic_net_train() [3/10]

void elastic_net_train ( text  tbl_source,
text  tbl_result,
text  col_ind_var,
text  col_dep_var,
text  regress_family,
float8  alpha,
float8  lambda_value,
boolean  standardization,
text  grouping_columns,
text  optimizer,
text  optimizer_params,
text  excluded 
)

◆ elastic_net_train() [4/10]

void elastic_net_train ( text  tbl_source,
text  tbl_result,
text  col_ind_var,
text  col_dep_var,
text  regress_family,
float8  alpha,
float8  lambda_value,
boolean  standardization,
text  grouping_columns,
text  optimizer,
text  optimizer_params 
)

◆ elastic_net_train() [5/10]

void elastic_net_train ( text  tbl_source,
text  tbl_result,
text  col_ind_var,
text  col_dep_var,
text  regress_family,
float8  alpha,
float8  lambda_value,
boolean  standardization,
text  grouping_columns,
text  optimizer 
)

◆ elastic_net_train() [6/10]

void elastic_net_train ( text  tbl_source,
text  tbl_result,
text  col_ind_var,
text  col_dep_var,
text  regress_family,
float8  alpha,
float8  lambda_value,
boolean  standardization,
text  grouping_columns 
)

◆ elastic_net_train() [7/10]

void elastic_net_train ( text  tbl_source,
text  tbl_result,
text  col_ind_var,
text  col_dep_var,
text  regress_family,
float8  alpha,
float8  lambda_value,
boolean  standardization 
)

◆ elastic_net_train() [8/10]

void elastic_net_train ( text  tbl_source,
text  tbl_result,
text  col_ind_var,
text  col_dep_var,
text  regress_family,
float8  alpha,
float8  lambda_value 
)

◆ elastic_net_train() [9/10]

text elastic_net_train ( )

◆ elastic_net_train() [10/10]

text elastic_net_train ( text  family_or_optimizer)
Parameters
family_or_optimizerResponse type, 'gaussian' or 'binomial', or optimizer type