Haplo Prediction
predict haplogroups
Data Structures | Typedefs | Functions
weka.h File Reference

Weka J48 and PART classifiers. 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>

Go to the source code of this file.

Data Structures

struct  Weka_model_node
 Weka model tree node. More...

Typedefs

typedef struct Weka_model_node Weka_model_node
 Weka model tree node.
typedef Weka_model_node Weka_model_tree
 Weka model tree.

Functions

Errortrain_weka_j48_model (const Vector_u32 *labels, const Matrix_i32 *markers, const char *labels_fname, const char *model_fname, const char *weka_jar_fname)
 Trains a Weka J48 model and writes it to a file.
Errortrain_weka_part_model (const Vector_u32 *labels, const Matrix_i32 *markers, const char *labels_fname, const char *model_fname, const char *weka_jar_fname)
 Trains a Weka PART model and writes it to a file.
Errorpredict_labels_with_weka_j48_model (Vector_u32 **labels_out, Vector_d **confs_out, const Matrix_i32 *markers, const char *labels_fname, const char *model_fname, const char *weka_jar_fname)
 Predicts the labels for a set of marker samples using Weka's J48 classifier.
Errorpredict_labels_with_weka_part_model (Vector_u32 **labels_out, Vector_d **confs_out, const Matrix_i32 *markers, const char *labels_fname, const char *model_fname, const char *weka_jar_fname)
 Predicts the labels for a set of marker samples using Weka's PART classifier.
Errortrain_weka_j48_model_tree (Weka_model_tree **tree_out, const Vector_u32 *labels, const Matrix_i32 *markers, const char *tree_xml_fname, const char *tree_dtd_fname, const char *model_dirname, const char *weka_jar_fname)
 Trains a Weka J48 model tree .
Errortrain_weka_part_model_tree (Weka_model_tree **tree_out, const Vector_u32 *labels, const Matrix_i32 *markers, const char *tree_xml_fname, const char *tree_dtd_fname, const char *model_dirname, const char *weka_jar_fname)
 Trains a Weka PART model tree .
Errorpredict_labels_with_weka_j48_model_tree (Vector_u32 **labels_out, Vector_d **confidence_out, const Matrix_i32 *markers, const Weka_model_tree *tree, const char *weka_jar_fname)
 Predicts the labels for a set of marker samples using a Weka J48 model tree.
Errorpredict_labels_with_weka_part_model_tree (Vector_u32 **labels_out, Vector_d **confidence_out, const Matrix_i32 *markers, const Weka_model_tree *tree, const char *weka_jar_fname)
 Predicts the labels for a set of marker samples using a Weka PART model tree.
Errorread_weka_model_tree (Weka_model_tree **tree_out, const char *tree_xml_fname, const char *tree_dtd_fname, const char *model_dirname)
 Reads a Weka model tree.
void free_weka_model_tree (Weka_model_tree *tree)
 Frees a Weka model tree.

Detailed Description

Weka J48 and PART classifiers.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

Definition in file weka.h.


Typedef Documentation

Weka model tree node.

Weka model tree.

Definition at line 155 of file weka.h.


Function Documentation

Error* train_weka_j48_model ( const Vector_u32 labels,
const Matrix_i32 markers,
const char *  labels_fname,
const char *  model_fname,
const char *  weka_jar_fname 
)

Trains a Weka J48 model and writes it to a file.

Parameters:
labelsLabels for training, with ith element as corresponding to the ith sample in markers.
markersMarkers for training, with ith row as a sample corresponding to the ith label in labels.
labels_fnameFile name containing labels for groups in the model.
model_fnameFile name containing the model.
weka_jar_fnameWeka java archive file.
Returns:
On success, NULL is returned; otherwise an error is returned.

Definition at line 141 of file weka.c.

Error* train_weka_part_model ( const Vector_u32 labels,
const Matrix_i32 markers,
const char *  labels_fname,
const char *  model_fname,
const char *  weka_jar_fname 
)

Trains a Weka PART model and writes it to a file.

Parameters:
labelsLabels for training, with ith element as corresponding to the ith sample in markers.
markersMarkers for training, with ith row as a sample corresponding to the ith label in labels.
labels_fnameFile name containing labels for groups in the model.
model_fnameFile name containing the model.
weka_jar_fnameWeka java archive file.
Returns:
On success, NULL is returned; otherwise an error is returned.

Definition at line 232 of file weka.c.

Error* predict_labels_with_weka_j48_model ( Vector_u32 **  labels_out,
Vector_d **  confs_out,
const Matrix_i32 markers,
const char *  labels_fname,
const char *  model_fname,
const char *  weka_jar_fname 
)

Predicts the labels for a set of marker samples using Weka's J48 classifier.

Parameters:
labels_outResult parameter.
confs_outResult parameter.
markersMarker data to predict.
labels_fnameFile name containing labels used by the model.
model_fnameFile name containing the model.
weka_jar_fnameWeka java archive file.
Returns:
On success, NULL is returned; otherwise an error is returned.

Definition at line 323 of file weka.c.

Error* predict_labels_with_weka_part_model ( Vector_u32 **  labels_out,
Vector_d **  confs_out,
const Matrix_i32 markers,
const char *  labels_fname,
const char *  model_fname,
const char *  weka_jar_fname 
)

Predicts the labels for a set of marker samples using Weka's PART classifier.

Parameters:
labels_outResult parameter.
confs_outResult parameter.
markersMarker data to predict.
labels_fnameFile name containing labels used by the model.
model_fnameFile name containing the model.
weka_jar_fnameWeka java archive file.
Returns:
On success, NULL is returned; otherwise an error is returned.

Definition at line 487 of file weka.c.

Error* train_weka_j48_model_tree ( Weka_model_tree **  tree_out,
const Vector_u32 labels,
const Matrix_i32 markers,
const char *  tree_xml_fname,
const char *  tree_dtd_fname,
const char *  model_dirname,
const char *  weka_jar_fname 
)

Trains a Weka J48 model tree .

Parameters:
tree_outResult parameter.
labelsSample group labels.
markersSample marker values.
tree_xml_fnameXML file containing the model tree information.
tree_dtd_fnameDTD file for validating the XML file, can be NULL.
model_dirnameModel directory location.
weka_jar_fnameWeka java archive file.

Definition at line 1000 of file weka.c.

Error* train_weka_part_model_tree ( Weka_model_tree **  tree_out,
const Vector_u32 labels,
const Matrix_i32 markers,
const char *  tree_xml_fname,
const char *  tree_dtd_fname,
const char *  model_dirname,
const char *  weka_jar_fname 
)

Trains a Weka PART model tree .

Parameters:
tree_outResult parameter.
labelsSample group labels.
markersSample marker values.
tree_xml_fnameXML file containing the model tree information.
tree_dtd_fnameDTD file for validating the XML file, can be NULL.
model_dirnameModel directory location.
weka_jar_fnameWeka java archive file.

Definition at line 1061 of file weka.c.

Error* predict_labels_with_weka_j48_model_tree ( Vector_u32 **  labels_out,
Vector_d **  confs_out,
const Matrix_i32 markers,
const Weka_model_tree tree,
const char *  weka_jar_fname 
)

Predicts the labels for a set of marker samples using a Weka J48 model tree.

Parameters:
labels_outResult parameter. If *labels_out is NULL, it is allocated; otherwise its space is re-used.
confs_outResult parameter. If *confs_out is NULL, it is allocated; otherwise its space is re-used.
markersMarker data to predict. Each row is a sample for prediction, corresponding to an element in the result parameters.
treeTrained model tree to use for predicting.
weka_jar_fnameWeka java archive file.
Returns:
On success, NULL is returned; otherwise an error is returned, but the result parameters are not freed.

Definition at line 1315 of file weka.c.

Error* predict_labels_with_weka_part_model_tree ( Vector_u32 **  labels_out,
Vector_d **  confs_out,
const Matrix_i32 markers,
const Weka_model_tree tree,
const char *  weka_jar_fname 
)

Predicts the labels for a set of marker samples using a Weka PART model tree.

Parameters:
labels_outResult parameter. If *labels_out is NULL, it is allocated; otherwise its space is re-used.
confs_outResult parameter. If *confs_out is NULL, it is allocated; otherwise its space is re-used.
markersMarker data to predict. Each row is a sample for prediction, corresponding to an element in the result parameters.
treeTrained model tree to use for predicting.
weka_jar_fnameWeka java archive file.
Returns:
On success, NULL is returned; otherwise an error is returned, but the result parameters are not freed.

Definition at line 1352 of file weka.c.

Error* read_weka_model_tree ( Weka_model_tree **  tree_out,
const char *  tree_xml_fname,
const char *  tree_dtd_fname,
const char *  model_dirname 
)

Reads a Weka model tree.

Parameters:
tree_outResult parameter.
tree_xml_fnameXML file containing the model tree information.
tree_dtd_fnameDTD file for validating the XML file, can be NULL.
model_dirnameModel directory location.

Definition at line 1381 of file weka.c.

void free_weka_model_tree ( Weka_model_tree tree)

Frees a Weka model tree.

Parameters:
treeModel tree to free.

Definition at line 1423 of file weka.c.