Haplo Prediction
predict haplogroups
|
00001 /* 00002 * This work is licensed under a Creative Commons 00003 * Attribution-Noncommercial-Share Alike 3.0 United States License. 00004 * 00005 * http://creativecommons.org/licenses/by-nc-sa/3.0/us/ 00006 * 00007 * You are free: 00008 * 00009 * to Share - to copy, distribute, display, and perform the work 00010 * to Remix - to make derivative works 00011 * 00012 * Under the following conditions: 00013 * 00014 * Attribution. You must attribute the work in the manner specified by the 00015 * author or licensor (but not in any way that suggests that they endorse you 00016 * or your use of the work). 00017 * 00018 * Noncommercial. You may not use this work for commercial purposes. 00019 * 00020 * Share Alike. If you alter, transform, or build upon this work, you may 00021 * distribute the resulting work only under the same or similar license to 00022 * this one. 00023 * 00024 * For any reuse or distribution, you must make clear to others the license 00025 * terms of this work. The best way to do this is by including this header. 00026 * 00027 * Any of the above conditions can be waived if you get permission from the 00028 * copyright holder. 00029 * 00030 * Apart from the remix rights granted under this license, nothing in this 00031 * license impairs or restricts the author's moral rights. 00032 */ 00033 00034 00046 #ifndef WEKA_H 00047 #define WEKA_H 00048 00049 00050 #include <config.h> 00051 00052 #include <stdlib.h> 00053 #include <inttypes.h> 00054 00055 #include <jwsc/base/error.h> 00056 #include <jwsc/vector/vector.h> 00057 #include <jwsc/matrix/matrix.h> 00058 00059 00061 Error* train_weka_j48_model 00062 ( 00063 const Vector_u32* labels, 00064 const Matrix_i32* markers, 00065 const char* labels_fname, 00066 const char* model_fname, 00067 const char* weka_jar_fname 00068 ); 00069 00070 00072 Error* train_weka_part_model 00073 ( 00074 const Vector_u32* labels, 00075 const Matrix_i32* markers, 00076 const char* labels_fname, 00077 const char* model_fname, 00078 const char* weka_jar_fname 00079 ); 00080 00081 00086 Error* predict_labels_with_weka_j48_model 00087 ( 00088 Vector_u32** labels_out, 00089 Vector_d** confs_out, 00090 const Matrix_i32* markers, 00091 const char* labels_fname, 00092 const char* model_fname, 00093 const char* weka_jar_fname 00094 ); 00095 00096 00101 Error* predict_labels_with_weka_part_model 00102 ( 00103 Vector_u32** labels_out, 00104 Vector_d** confs_out, 00105 const Matrix_i32* markers, 00106 const char* labels_fname, 00107 const char* model_fname, 00108 const char* weka_jar_fname 00109 ); 00110 00111 00113 typedef struct Weka_model_node 00114 { 00120 const struct Weka_model_node* parent; 00121 00127 uint32_t parent_label; 00128 00130 uint32_t num_groups; 00131 00137 struct Weka_model_node** subtrees; 00138 00140 Vector_u32* labels; 00141 00143 Vector_u32** altlabels; 00144 00146 char* labels_fname; 00147 00149 char* model_fname; 00150 } 00151 Weka_model_node; 00152 00153 00155 typedef Weka_model_node Weka_model_tree; 00156 00157 00159 Error* train_weka_j48_model_tree 00160 ( 00161 Weka_model_tree** tree_out, 00162 const Vector_u32* labels, 00163 const Matrix_i32* markers, 00164 const char* tree_xml_fname, 00165 const char* tree_dtd_fname, 00166 const char* model_dirname, 00167 const char* weka_jar_fname 00168 ); 00169 00170 00172 Error* train_weka_part_model_tree 00173 ( 00174 Weka_model_tree** tree_out, 00175 const Vector_u32* labels, 00176 const Matrix_i32* markers, 00177 const char* tree_xml_fname, 00178 const char* tree_dtd_fname, 00179 const char* model_dirname, 00180 const char* weka_jar_fname 00181 ); 00182 00183 00188 Error* predict_labels_with_weka_j48_model_tree 00189 ( 00190 Vector_u32** labels_out, 00191 Vector_d** confidence_out, 00192 const Matrix_i32* markers, 00193 const Weka_model_tree* tree, 00194 const char* weka_jar_fname 00195 ); 00196 00197 00202 Error* predict_labels_with_weka_part_model_tree 00203 ( 00204 Vector_u32** labels_out, 00205 Vector_d** confidence_out, 00206 const Matrix_i32* markers, 00207 const Weka_model_tree* tree, 00208 const char* weka_jar_fname 00209 ); 00210 00211 00213 Error* read_weka_model_tree 00214 ( 00215 Weka_model_tree** tree_out, 00216 const char* tree_xml_fname, 00217 const char* tree_dtd_fname, 00218 const char* model_dirname 00219 ); 00220 00221 00223 void free_weka_model_tree(Weka_model_tree* tree); 00224 00225 00226 #endif