From 0dd4e05fc8babc1517de1d7981a99ad0a5241a5e Mon Sep 17 00:00:00 2001 From: Peter Carbonetto Date: Thu, 4 May 2017 14:43:12 -0500 Subject: Added new files shared by Xiang via email on May 4, 2017. --- src/logistic.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/logistic.h (limited to 'src/logistic.h') diff --git a/src/logistic.h b/src/logistic.h new file mode 100644 index 0000000..a68ee09 --- /dev/null +++ b/src/logistic.h @@ -0,0 +1,70 @@ +#ifndef LOGISTIC_H_ /* Include guard */ +#define LOGISTIC_H_ + +/* Mixed interface */ +void logistic_mixed_pred(gsl_vector *beta // Vector of parameters length = 1 + Sum_k(C_k - 1) + Kc + ,gsl_matrix_int *X //Matrix Nobs x K + ,gsl_vector_int *nlev // Vector with number categories + ,gsl_matrix *Xc // continuous covariates Matrix Nobs x Kc + ,gsl_vector *yhat //Vector of prob. predicted by the logistic + ); + +int logistic_mixed_fit(gsl_vector *beta // Vector of parameters length = 1 + Sum_k(C_k - 1) + Kc + ,gsl_matrix_int *X //Matrix Nobs x K + ,gsl_vector_int *nlev // Vector with number categories + ,gsl_matrix *Xc // continuous covariates Matrix Nobs x Kc + ,gsl_vector *y //Vector of prob. to predict + ,double lambdaL1 // Regularization L1 0.0 if not used + ,double lambdaL2); // Regularization L2 0.0 if not used + +double fLogit_mixed(gsl_vector *beta + ,gsl_matrix_int *X + ,gsl_vector_int *nlev + ,gsl_matrix *Xc // continuous covariates Matrix Nobs x Kc + ,gsl_vector *y + ,double lambdaL1 + ,double lambdaL2); + + +/* Categorical only interface */ +void logistic_cat_pred(gsl_vector *beta // Vector of parameters length = 1 + Sum_k(C_k - 1) + Kc + ,gsl_matrix_int *X //Matrix Nobs x K + ,gsl_vector_int *nlev // Vector with number categories + ,gsl_vector *yhat //Vector of prob. predicted by the logistic + ); + +int logistic_cat_fit(gsl_vector *beta // Vector of parameters length = 1 + Sum_k(C_k - 1) + Kc + ,gsl_matrix_int *X //Matrix Nobs x K + ,gsl_vector_int *nlev // Vector with number categories + ,gsl_vector *y //Vector of prob. to predict + ,double lambdaL1 // Regularization L1 0.0 if not used + ,double lambdaL2); // Regularization L2 0.0 if not used + +double fLogit_cat(gsl_vector *beta + ,gsl_matrix_int *X + ,gsl_vector_int *nlev + ,gsl_vector *y + ,double lambdaL1 + ,double lambdaL2); + + +/* Continuous only interface */ +void logistic_cont_pred(gsl_vector *beta // Vector of parameters length = 1 + Sum_k(C_k - 1) + Kc + ,gsl_matrix *Xc // continuous covariates Matrix Nobs x Kc + ,gsl_vector *yhat //Vector of prob. predicted by the logistic + ); + +int logistic_cont_fit(gsl_vector *beta // Vector of parameters length = 1 + Sum_k(C_k - 1) + Kc + ,gsl_matrix *Xc // continuous covariates Matrix Nobs x Kc + ,gsl_vector *y //Vector of prob. to predict + ,double lambdaL1 // Regularization L1 0.0 if not used + ,double lambdaL2); // Regularization L2 0.0 if not used + +double fLogit_cont(gsl_vector *beta + ,gsl_matrix *Xc // continuous covariates Matrix Nobs x Kc + ,gsl_vector *y + ,double lambdaL1 + ,double lambdaL2); + + +#endif // LOGISTIC_H_ -- cgit v1.2.3