User Documentation
 All Files Functions Groups
cross_validation.sql_in File Reference

SQL functions for cross validation. More...

Go to the source code of this file.

Functions

void cv_linregr_train (varchar tbl_source, varchar col_ind_var, varchar col_dep_var, varchar tbl_result)
 Simple interface of cross-validation, which has no limitation on lock number. More...
 
void cv_linregr_predict (varchar tbl_model, varchar tbl_newdata, varchar col_ind_var, varchar col_id, varchar tbl_predict)
 A wrapper for linear regression prediction.
 
boolean logregr_predict (float8[] coef, float8[] col_ind)
 A prediction function for logistic regression. More...
 
void cv_logregr_predict (varchar tbl_model, varchar tbl_newdata, varchar col_ind_var, varchar col_id, varchar tbl_predict)
 A prediction function for logistic regression The result is stored in the table of tbl_predict. More...
 
integer logregr_accuracy (float8[] coef, float8[] col_ind, boolean col_dep)
 Metric function for logistic regression. More...
 
void cv_logregr_accuracy (varchar tbl_predict, varchar tbl_source, varchar col_id, varchar col_dep_var, varchar tbl_accuracy)
 Metric function for logistic regression. More...
 

Detailed Description

Date
January 2011
See Also
For a brief introduction to the usage of cross validation, see the module description Cross Validation.

Definition in file cross_validation.sql_in.

Function Documentation

void cv_linregr_train ( varchar  tbl_source,
varchar  col_ind_var,
varchar  col_dep_var,
varchar  tbl_result 
)
Parameters
module_nameModule to be cross validated
func_argsArguments of modelling function of the module, including the table name of data
param_to_tryThe name of the paramter that CV runs through
param_valuesThe values of the parameter that CV will try
data_idName of the unique ID associated with each row. Provide NULL if there is no such column in the data table
id_is_randomWhether the provided ID is randomly assigned to each row
validation_resultTable name to store the output of CV function, see the Output for format. It will be automatically created by CV function
fold_numHow many fold cross-validation Print the help message for a given module's cross-validation. Print the supported module names for cross_validation A wrapper for linear regression

Definition at line 366 of file cross_validation.sql_in.

void cv_logregr_accuracy ( varchar  tbl_predict,
varchar  tbl_source,
varchar  col_id,
varchar  col_dep_var,
varchar  tbl_accuracy 
)

It computes the percentage of correct predictions. The result is stored in the table of tbl_accuracy

Definition at line 481 of file cross_validation.sql_in.

void cv_logregr_predict ( varchar  tbl_model,
varchar  tbl_newdata,
varchar  col_ind_var,
varchar  col_id,
varchar  tbl_predict 
)

This function can be used together with cross-validation

Definition at line 447 of file cross_validation.sql_in.

integer logregr_accuracy ( float8[]  coef,
float8[]  col_ind,
boolean  col_dep 
)
Parameters
coefLogistic fitting coefficients. Note: MADlib logregr_train function does not produce a seperate intercept term as elastic_net_train function.
col_indIndependent variable, an array
col_depDependent variable

returns 1 if the prediction is the same as col_dep, otherwise 0

Definition at line 467 of file cross_validation.sql_in.

boolean logregr_predict ( float8[]  coef,
float8[]  col_ind 
)
Parameters
coefCoefficients. Note: MADlib logregr_train function does not produce a seperate intercept term as elastic_net_train function.
col_indIndependent variable, which must be an array

Definition at line 434 of file cross_validation.sql_in.