1.19.0
User Documentation for Apache MADlib
cross_validation.sql_in File Reference

SQL functions for cross validation. More...

Functions

void cross_validation_general (varchar modelling_func, varchar[] modelling_params, varchar[] modelling_params_type, varchar param_explored, varchar[] explore_values, varchar predict_func, varchar[] predict_params, varchar[] predict_params_type, varchar metric_func, varchar[] metric_params, varchar[] metric_params_type, varchar data_tbl, varchar data_id, boolean id_is_random, varchar validation_result, varchar[] data_cols, integer n_folds)
 
void cross_validation_general (varchar modelling_func, varchar[] modelling_params, varchar[] modelling_params_type, varchar param_explored, varchar[] explore_values, varchar predict_func, varchar[] predict_params, varchar[] predict_params_type, varchar metric_func, varchar[] metric_params, varchar[] metric_params_type, varchar data_tbl, varchar data_id, boolean id_is_random, varchar validation_result, varchar[] data_cols)
 
void cv_linregr_train (varchar tbl_source, varchar col_ind_var, varchar col_dep_var, varchar tbl_result)
 A wrapper for linear regression. 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. More...
 
void mse_error (varchar tbl_prediction, varchar tbl_actual, varchar id_actual, varchar values_actual, varchar tbl_error)
 
void misclassification_avg (varchar tbl_prediction, varchar tbl_actual, varchar id_actual, varchar values_actual, varchar tbl_error)
 
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.

Function Documentation

◆ cross_validation_general() [1/2]

void cross_validation_general ( varchar  modelling_func,
varchar []  modelling_params,
varchar []  modelling_params_type,
varchar  param_explored,
varchar []  explore_values,
varchar  predict_func,
varchar []  predict_params,
varchar []  predict_params_type,
varchar  metric_func,
varchar []  metric_params,
varchar []  metric_params_type,
varchar  data_tbl,
varchar  data_id,
boolean  id_is_random,
varchar  validation_result,
varchar []  data_cols,
integer  n_folds 
)

◆ cross_validation_general() [2/2]

void cross_validation_general ( varchar  modelling_func,
varchar []  modelling_params,
varchar []  modelling_params_type,
varchar  param_explored,
varchar []  explore_values,
varchar  predict_func,
varchar []  predict_params,
varchar []  predict_params_type,
varchar  metric_func,
varchar []  metric_params,
varchar []  metric_params_type,
varchar  data_tbl,
varchar  data_id,
boolean  id_is_random,
varchar  validation_result,
varchar []  data_cols 
)

◆ cv_linregr_predict()

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

◆ cv_linregr_train()

void cv_linregr_train ( varchar  tbl_source,
varchar  col_ind_var,
varchar  col_dep_var,
varchar  tbl_result 
)

◆ cv_logregr_accuracy()

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

◆ cv_logregr_predict()

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

◆ logregr_accuracy()

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

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

◆ misclassification_avg()

void misclassification_avg ( varchar  tbl_prediction,
varchar  tbl_actual,
varchar  id_actual,
varchar  values_actual,
varchar  tbl_error 
)

◆ mse_error()

void mse_error ( varchar  tbl_prediction,
varchar  tbl_actual,
varchar  id_actual,
varchar  values_actual,
varchar  tbl_error 
)