00001 /* 00002 * Main authors: 00003 * Tias Guns <tias.guns@cs.kuleuven.be> 00004 * 00005 * Copyright: 00006 * Tias Guns, 2008 00007 * 00008 * Revision information: 00009 * $Id: pattset_concept_accuracy.cpp 217 2009-04-07 13:37:27Z tias $ 00010 * 00011 * This file is part of Cimcp, Correlated Itemset Mining using 00012 * Constraint Programming, and uses Gecode. 00013 * 00014 * Permission is hereby granted, free of charge, to any person obtaining 00015 * a copy of this software and associated documentation files (the 00016 * "Software"), to deal in the Software without restriction, including 00017 * without limitation the rights to use, copy, modify, merge, publish, 00018 * distribute, sublicense, and/or sell copies of the Software, and to 00019 * permit persons to whom the Software is furnished to do so, subject to 00020 * the following conditions: 00021 * 00022 * The above copyright notice and this permission notice shall be 00023 * included in all copies or substantial portions of the Software. 00024 * 00025 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00026 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00027 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00028 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00029 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00030 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00031 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00032 * 00033 */ 00034 00035 /// accuracy measure 00036 inline int monotone_function(int posTot, int pos, int negTot, int neg, int precision) { 00037 return ( (pos+negTot-neg)/(float)(posTot+negTot) )*precision; 00038 // equivalently: pos-neg 00039 } 00040 #include "cimcp_Fmonotone.cpp" // model using monotone function of boolean variables 00041 00042 int main(int argc, char* argv[]) { 00043 Options_fimcp opt(strpbrk(argv[0],"/\\")+1); 00044 opt.delta(0.50); 00045 opt.alpha(1); 00046 opt.description("This model finds discriminative patterns, using accuracy as measure"); 00047 opt.usage("-datafile example.txt\n\ 00048 -datafile example.txt\t itemset file where last item is the class: 0 or 1\n\ 00049 -alpha k\t (default 1) use branch-and-bound search for top-k itemsets\n\ 00050 -alpha 0\t to find all patternsets given tresholds:\n\ 00051 \t -delta 0.50\t minimal measure value (\% accuracy)"); 00052 opt.parse(argc, argv); 00053 00054 if (opt.alpha() == 0) { 00055 fprintf(stdout, "Running DF search for "); 00056 Script::run<Cimcp_Fmonotone,DFS,Options_fimcp>(opt); 00057 } else { 00058 fprintf(stdout, "Running BAB search for "); 00059 Script::run<Cimcp_Fmonotone,BAB,Options_fimcp>(opt); 00060 } 00061 return 0; 00062 } 00063 // avoid 'undefined reference' linking error 00064 void Fimcp_basic::run(const Options_fimcp&) {};
1.6.3