Haplo Prediction
predict haplogroups
|
Naive Bayes Gaussian mixture model classifier. More...
#include <config.h>
#include <stdlib.h>
#include <inttypes.h>
#include <jwsc/base/error.h>
#include <jwsc/vector/vector.h>
#include <jwsc/matrix/matrix.h>
#include <jwsc/matblock/matblock.h>
Go to the source code of this file.
Data Structures | |
struct | NB_gmm_model |
Naive Bayes Gaussian mixture model. More... | |
struct | NB_gmm_model_node |
Naive Bayes Gaussian mixture model tree node. More... | |
Typedefs | |
typedef struct NB_gmm_model_node | NB_gmm_model_node |
Naive Bayes Gaussian mixture model tree node. | |
typedef NB_gmm_model_node | NB_gmm_model_tree |
Naive Bayes Gaussian mixture model tree. | |
Functions | |
void | train_nb_gmm_model (NB_gmm_model **model_out, const Vector_u32 *labels, const Matrix_i32 *markers, const Vector_d *priors, uint32_t num_components) |
Trains a Naive Bayes Gaussian mixture model. | |
Error * | predict_label_with_nb_gmm_model (uint32_t *label_out, double *confidence_out, const Vector_i32 *markers, const NB_gmm_model *model, uint32_t order) |
Predicts the label for a marker sample using a Naive Bayes Gaussian mixture model. | |
Error * | predict_labels_with_nb_gmm_model (Vector_u32 **labels_out, Vector_d **confidence_out, const Matrix_i32 *markers, const NB_gmm_model *model) |
Predicts the labels for a set of marker samples using a Naive Bayes Gaussian mixture model. | |
Error * | read_nb_gmm_model (NB_gmm_model **model_out, const char *fname) |
Reads a Naive Bayes Gaussian mixture model. | |
Error * | write_nb_gmm_model (NB_gmm_model *model, const char *fname) |
Writes a Naive Bayes Gaussian mixture model. | |
void | free_nb_gmm_model (NB_gmm_model *model) |
Frees a Naive Bayes Gaussian mixture model. | |
Error * | train_nb_gmm_model_tree (NB_gmm_model_tree **tree_out, const Vector_u32 *labels, const Matrix_i32 *markers, const char *tree_xml_fname, const char *tree_dtd_fname) |
Trains a Naive Bayes Gaussian mixture model tree . | |
Error * | predict_labels_with_nb_gmm_model_tree (Vector_u32 **labels_out, Vector_d **confidence_out, const Matrix_i32 *markers, const NB_gmm_model_tree *tree, uint32_t order) |
Predicts the labels for a set of marker samples using a Naive Bayes Gaussian mixture model tree. | |
Error * | read_nb_gmm_model_tree (NB_gmm_model_tree **tree_out, const char *tree_xml_fname, const char *tree_dtd_fname, const char *model_dirname) |
Reads a Naive Bayes Gaussian mixture model tree from. | |
Error * | write_nb_gmm_model_tree (const NB_gmm_model_tree *tree, const char *model_dirname) |
Writes a Naive Bayes Gaussian mixture model tree. | |
void | free_nb_gmm_model_tree (NB_gmm_model_tree *tree) |
Frees a Naive Bayes Gaussian mixture model tree. |
Naive Bayes Gaussian mixture model classifier.
Definition in file nb_gmm.h.
typedef struct NB_gmm_model_node NB_gmm_model_node |
Naive Bayes Gaussian mixture model tree node.
typedef NB_gmm_model_node NB_gmm_model_tree |
void train_nb_gmm_model | ( | NB_gmm_model ** | model_out, |
const Vector_u32 * | labels, | ||
const Matrix_i32 * | markers, | ||
const Vector_d * | label_priors, | ||
uint32_t | num_components | ||
) |
Trains a Naive Bayes Gaussian mixture model.
model_out | Result parameter. If *model_out is NULL, a model is allocated; otherwise its space is re-used. |
labels | Labels for training, with ith element as corresponding to the ith sample in markers. |
markers | Markers for training, with ith row as a sample corresponding to the ith label in labels. |
label_priors | Priors for each of the labels. |
num_components | Number of mixture components. |
Error* predict_label_with_nb_gmm_model | ( | uint32_t * | label_out, |
double * | confidence_out, | ||
const Vector_i32 * | markers, | ||
const NB_gmm_model * | model, | ||
uint32_t | order | ||
) |
Predicts the label for a marker sample using a Naive Bayes Gaussian mixture model.
label_out | Result parameter. |
confidence_out | Result parameter. |
markers | Marker data to predict. |
model | Trained model to use for predicting. |
order | Indicates which of the The kth best prediction values to return. Starts with 0 representing the overall best, 1 the next best and so on. |
Error* predict_labels_with_nb_gmm_model | ( | Vector_u32 ** | labels_out, |
Vector_d ** | confidence_out, | ||
const Matrix_i32 * | markers, | ||
const NB_gmm_model * | model | ||
) |
Predicts the labels for a set of marker samples using a Naive Bayes Gaussian mixture model.
labels_out | Result parameter. If *labels_out is NULL, it is allocated; otherwise its space is re-used. |
confidence_out | Result parameter. If *confidence_out is NULL, it is allocated; otherwise its space is re-used. |
markers | Marker data to predict. Each row is a sample for prediction, corresponding to an element in the result parameters. |
model | Trained model to use for predicting. |
Error* read_nb_gmm_model | ( | NB_gmm_model ** | model_out, |
const char * | fname | ||
) |
Reads a Naive Bayes Gaussian mixture model.
model_out | Result parameter. If *model_out is NULL, a model is allocated; otherwise its space is re-used. |
fname | File to read the model from. |
Error* write_nb_gmm_model | ( | NB_gmm_model * | model, |
const char * | fname | ||
) |
void free_nb_gmm_model | ( | NB_gmm_model * | model | ) |
Error* train_nb_gmm_model_tree | ( | NB_gmm_model_tree ** | tree_out, |
const Vector_u32 * | labels, | ||
const Matrix_i32 * | markers, | ||
const char * | tree_xml_fname, | ||
const char * | tree_dtd_fname | ||
) |
Trains a Naive Bayes Gaussian mixture model tree .
tree_out | Result parameter. |
labels | Sample group labels. |
markers | Sample marker values. |
tree_xml_fname | XML file containing the model tree information. |
tree_dtd_fname | DTD file for validating the XML file, can be NULL. |
Error* predict_labels_with_nb_gmm_model_tree | ( | Vector_u32 ** | labels_out, |
Vector_d ** | confidence_out, | ||
const Matrix_i32 * | markers, | ||
const NB_gmm_model_tree * | tree, | ||
uint32_t | order | ||
) |
Predicts the labels for a set of marker samples using a Naive Bayes Gaussian mixture model tree.
labels_out | Result parameter. If *labels_out is NULL, it is allocated; otherwise its space is re-used. |
confidence_out | Result parameter. If *confidence_out is NULL, it is allocated; otherwise its space is re-used. |
markers | Marker data to predict. Each row is a sample for prediction, corresponding to an element in the result parameters. |
tree | Trained model tree to use for predicting. |
order | The kth order prediction value. Zero being the best prediction. |
Error* read_nb_gmm_model_tree | ( | NB_gmm_model_tree ** | tree_out, |
const char * | tree_xml_fname, | ||
const char * | tree_dtd_fname, | ||
const char * | model_dirname | ||
) |
Reads a Naive Bayes Gaussian mixture model tree from.
tree_out | Result parameter. |
tree_xml_fname | XML file containing the model tree information. |
tree_dtd_fname | DTD file for validating the XML file, can be NULL. |
model_dirname | Directory prefixing each model file in the tree. |
Error* write_nb_gmm_model_tree | ( | const NB_gmm_model_tree * | tree, |
const char * | model_dirname | ||
) |
void free_nb_gmm_model_tree | ( | NB_gmm_model_tree * | tree | ) |