SQL functions for multinomial logistic regression. More...
Functions | |
| float8 [] | __mlogregr_irls_step_transition (float8[] state, integer y, integer num_categories, integer ref_category, float8[] x, float8[] prev_state) |
| float8 [] | __mlogregr_irls_step_merge_states (float8[] state1, float8[] state2) |
| float8 [] | __mlogregr_irls_step_final (float8[] state) |
| aggregate float8 [] | __mlogregr_irls_step (integer y, integer numcategories, integer ref_category, float8[] x, float8[] previous_state) |
| float8 | __internal_mlogregr_irls_step_distance (float8[] state1, float8[] state2) |
| mlogregr_result | __internal_mlogregr_irls_result (float8[] state) |
| mlogregr_summary_result | __internal_mlogregr_summary_results (float8[] state) |
| void | mlogregr_train (varchar source_table, varchar output_table, varchar dependent_varname, varchar independent_varname, integer ref_category, varchar optimizer_params) |
| Compute multinomial logistic regression coefficients. More... | |
| void | mlogregr_train (varchar source_table, varchar output_table, varchar dependent_varname, varchar independent_varname, integer ref_category) |
| void | mlogregr_train (varchar source_table, varchar output_table, varchar dependent_varname, varchar independent_varname) |
| varchar | mlogregr_train (varchar message) |
| varchar | mlogregr_train () |
| integer | __compute_mlogregr (varchar source_table, varchar dependent_varname, varchar independent_varname, integer num_categories, integer max_iter, varchar optimizer, float8 precision, integer ref_category) |
| mlogregr_result | mlogregr (varchar source, varchar depvar, varchar indepvar, integer max_num_iterations=20, varchar optimizer="irls", float8 precision=0.0001, integer ref_category) |
| Compute logistic-regression coefficients and diagnostic statistics. More... | |
| mlogregr_result | mlogregr (varchar source, varchar depvar, varchar indepvar) |
| mlogregr_result | mlogregr (varchar source, varchar depvar, varchar indepvar, integer max_num_iterations) |
| mlogregr_result | mlogregr (varchar source, varchar depvar, varchar indepvar, integer max_num_iterations, varchar optimizer) |
| set< __mlogregr_cat_coef > | __mlogregr_format (float8[] coef, integer num_feature, integer num_category, integer ref_category) |
| float8 [] | __mlogregr_predict_prob (float8[] coef, integer ref_category, float8[] col_ind_var) |
| integer | __mlogregr_predict_response (float8[] coef, integer ref_category, float8[] col_ind_var) |
| void | mlogregr_predict (text model, text source, text id_col_name, text output, text pred_type) |
| void | mlogregr_predict (text model, text source, text id_col_name, text output) |
| text | mlogregr_predict (text message) |
| integer __compute_mlogregr | ( | varchar | source_table, |
| varchar | dependent_varname, | ||
| varchar | independent_varname, | ||
| integer | num_categories, | ||
| integer | max_iter, | ||
| varchar | optimizer, | ||
| float8 | precision, | ||
| integer | ref_category | ||
| ) |
| mlogregr_result __internal_mlogregr_irls_result | ( | float8 [] | state | ) |
| float8 __internal_mlogregr_irls_step_distance | ( | float8 [] | state1, |
| float8 [] | state2 | ||
| ) |
| mlogregr_summary_result __internal_mlogregr_summary_results | ( | float8 [] | state | ) |
| set<__mlogregr_cat_coef> __mlogregr_format | ( | float8 [] | coef, |
| integer | num_feature, | ||
| integer | num_category, | ||
| integer | ref_category | ||
| ) |
| aggregate float8 [] __mlogregr_irls_step | ( | integer | y, |
| integer | numcategories, | ||
| integer | ref_category, | ||
| float8 [] | x, | ||
| float8 [] | previous_state | ||
| ) |
| float8 [] __mlogregr_irls_step_final | ( | float8 [] | state | ) |
| float8 [] __mlogregr_irls_step_merge_states | ( | float8 [] | state1, |
| float8 [] | state2 | ||
| ) |
| float8 [] __mlogregr_irls_step_transition | ( | float8 [] | state, |
| integer | y, | ||
| integer | num_categories, | ||
| integer | ref_category, | ||
| float8 [] | x, | ||
| float8 [] | prev_state | ||
| ) |
| float8 [] __mlogregr_predict_prob | ( | float8 [] | coef, |
| integer | ref_category, | ||
| float8 [] | col_ind_var | ||
| ) |
| integer __mlogregr_predict_response | ( | float8 [] | coef, |
| integer | ref_category, | ||
| float8 [] | col_ind_var | ||
| ) |
| mlogregr_result mlogregr | ( | varchar | source, |
| varchar | depvar, | ||
| varchar | indepvar, | ||
| integer | max_num_iterations = 20, |
||
| varchar | optimizer = "irls", |
||
| float8 | precision = 0.0001, |
||
| integer | ref_category | ||
| ) |
To include an intercept in the model, set one coordinate in the independentVariables array to 1.
| source | Name of the source relation containing the training data |
| depvar | Name of the dependent column (of type INTEGER < numcategories) |
| indepvar | Name of the independent column (of type DOUBLE PRECISION[]) |
| max_num_iterations | The maximum number of iterations |
| optimizer | The optimizer to use ( 'irls'/'newton' for iteratively reweighted least squares) |
| precision | The difference between log-likelihood values in successive iterations that should indicate convergence. Note that a non-positive value here disables the convergence criterion, and execution will only stop after \ max_num_iterations iterations. |
| ref_category | The reference category specified by the user |
ref_category INTEGER - Reference categorycoef FLOAT8[] - Array of coefficients, 
log_likelihood FLOAT8 - Log-likelihood 
std_err FLOAT8[] - Array of standard errors, 
z_stats FLOAT8[] - Array of Wald z-statistics, 
p_values FLOAT8[] - Array of Wald p-values, 
odds_ratios FLOAT8[]: Array of odds ratios, 
condition_no FLOAT8 - The condition number of matrix
during the iteration immediately preceding convergence (i.e.,
is computed using the coefficients of the previous iteration)num_iterations INTEGER - The number of iterations before the algorithm terminated
and all diagnostic statistics:SELECT * FROM mlogregr('sourceName', 'dependentVariable',
'numCategories', 'independentVariables');
:SELECT (mlogregr('sourceName', 'dependentVariable',
'numCategories', 'independentVariables')).coef;
, the log-likelihood of determination
, and the array of p-values
: SELECT coef, log_likelihood, p_values
FROM mlogregr('sourceName', 'dependentVariable',
'numCategories', 'independentVariables');| mlogregr_result mlogregr | ( | varchar | source, |
| varchar | depvar, | ||
| varchar | indepvar | ||
| ) |
| mlogregr_result mlogregr | ( | varchar | source, |
| varchar | depvar, | ||
| varchar | indepvar, | ||
| integer | max_num_iterations | ||
| ) |
| mlogregr_result mlogregr | ( | varchar | source, |
| varchar | depvar, | ||
| varchar | indepvar, | ||
| integer | max_num_iterations, | ||
| varchar | optimizer | ||
| ) |
| void mlogregr_predict | ( | text | model, |
| text | source, | ||
| text | id_col_name, | ||
| text | output, | ||
| text | pred_type | ||
| ) |
| void mlogregr_predict | ( | text | model, |
| text | source, | ||
| text | id_col_name, | ||
| text | output | ||
| ) |
| text mlogregr_predict | ( | text | message | ) |
| void mlogregr_train | ( | varchar | source_table, |
| varchar | output_table, | ||
| varchar | dependent_varname, | ||
| varchar | independent_varname, | ||
| integer | ref_category, | ||
| varchar | optimizer_params | ||
| ) |
To include an intercept in the model, set one coordinate in the independentVariables array to 1.
| source_table | Name of the source relation containing the training data |
| output_table | Name of the output relation to contain the resulting model |
| dependent_varname | Name of the dependent column (of type INTEGER) |
| independent_varname | Name of the independent column (or an array expression) |
| ref_category | The reference category specified by the user |
| optimizer_params | Comma-separated list of parameters for the optimizer function |
ref_category INTEGER - Reference categorycoef FLOAT8[] - Array of coefficients, 
log_likelihood FLOAT8 - Log-likelihood 
std_err FLOAT8[] - Array of standard errors, 
z_stats FLOAT8[] - Array of Wald z-statistics, 
p_values FLOAT8[] - Array of Wald p-values, 
odds_ratios FLOAT8[]: Array of odds ratios, 
condition_no FLOAT8 - The condition number of matrix
during the iteration immediately preceding convergence (i.e.,
is computed using the coefficients of the previous iteration) An output table (named 'output_table'_summary) containing following columns:regression_type VARCHAR - The regression type run (in this case it will be 'mlogit')source_table VARCHAR - Source table containing the training dataoutput_table VARCHAR - Output table containing the trained modeldependent_varname VARCHAR - Name of the dependent column used for trainingindependent_varname VARCHAR - Name of the independent column used for training (or the ARRAY expression used for training)ref_category INTEGER - The reference category specified by the usernum_iterations INTEGER - The number of iterations before the algorithm terminatednum_rows_processed INTEGER - The number of rows from training data used for trainingnum_missing_rows_skipped INTEGER - The number of rows skipped during training
and all diagnostic statistics:SELECT mlogregr_train('sourceName', 'outputName',
'dependentVariable', 'independentVariables');
SELECT * from outputName;
:SELECT coef from outputName;
, the log-likelihood of determination
, and the array of p-values
: SELECT coef, log_likelihood, p_values FROM outputName;
| void mlogregr_train | ( | varchar | source_table, |
| varchar | output_table, | ||
| varchar | dependent_varname, | ||
| varchar | independent_varname, | ||
| integer | ref_category | ||
| ) |
| void mlogregr_train | ( | varchar | source_table, |
| varchar | output_table, | ||
| varchar | dependent_varname, | ||
| varchar | independent_varname | ||
| ) |
| varchar mlogregr_train | ( | varchar | message | ) |
| varchar mlogregr_train | ( | ) |