Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

SimpleAssocRuleWriter.hpp

Go to the documentation of this file.
00001 #ifndef SimpleAssocRuleWriter_HPP
00002 #define SimpleAssocRuleWriter_HPP
00003 
00008 #include <iterator>
00009 #include "io/StreamRepr.hpp"  
00010 #include "io/codec/decoder/df/SimpleDFDecoder.hpp"  
00011 
00012 
00013 
00014 class SimpleAssocRuleWriter : public SimpleDFDecoder< BufferedNormalOutput<StreamRepr> >
00015 {
00016    protected:
00017       typedef SimpleDFDecoder< BufferedNormalOutput<StreamRepr> > PARENT;
00018    public:
00019       typedef PARENT::params_t params_t;
00020 
00021       SimpleAssocRuleWriter(const params_t* par) : 
00022          PARENT(par) {}
00023 
00024       template <typename ANTECIterator, typename CONSEQIterator> void 
00025       writeAssocRule(
00026          ANTECIterator antec_first, ANTECIterator antec_last, 
00027          CONSEQIterator conseq_first, CONSEQIterator conseq_last, 
00028          counter_t union_support, float confidence, float lift )
00029       {
00030          while( antec_first != antec_last)
00031          {
00032             PARENT::output_stream << PARENT::code_inverse[*antec_first] << ' ';
00033             ++antec_first;
00034          }
00035          PARENT::output_stream<<"-> ";
00036          while( conseq_first != conseq_last)
00037          {
00038             PARENT::output_stream << PARENT::code_inverse[*conseq_first] << ' ';
00039             ++conseq_first;
00040          }
00041          PARENT::output_stream<<'(' << union_support <<' '<< confidence << ' '<<lift<<")\n";
00042       }
00043 };
00044 
00045 #endif
00046 

Generated on Sun Sep 17 17:50:39 2006 for FIM environment by  doxygen 1.4.4