00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00031 #ifndef _NETWORK_LEGO_H
00032 #define _NETWORK_LEGO_H
00033
00034 #include "active-networks.h"
00035 #include "apriori.h"
00036 #include "dag.h"
00037
00038 class NetworkLego : public ActiveNetwork
00039 {
00040 private:
00041
00042 set< NetworkLego > _leaves;
00043
00044
00045
00046 map< string, MyNT > _conditionsContributeTo;
00047
00048 public:
00049 };
00050
00051 enum NLOperator { NL_INTERSECTION, NL_DIFFERENCE };
00052
00053 class SDAGNode : DAGNode< NetworkLego >
00054 {
00055 private:
00056 NLOperator _operator;
00057 public:
00058 };
00059
00060 class SDAG : public DAG< SDAGNode >
00061 {
00062 private:
00063
00064 public:
00065
00066 void addLeaf(const NetworkLego &lego);
00067
00068 void addLeaves(const vector< NetworkLego > &leaves);
00069
00070 void compute();
00071
00072 };
00073
00074
00075 class SetOfNetworkLegos: public SetOfActiveNetworks
00076 {
00077 private:
00078
00079
00080 AprioriWithComplement _aprioriAlgo;
00081
00082
00083
00084 SetOfActiveNetworks _leaves;
00085
00086
00087 SetOfActiveNetworks _legos;
00088
00089
00090 SetOfActiveNetworks _significantLegos;
00091
00092
00093 SetOfActiveNetworks _significantLegosLeaves;
00094
00095
00096 SetOfActiveNetworks _significantLegosRoots;
00097
00098
00099 ItemsetLattice _lattice;
00100
00101
00102 ItemsetLattice _closedLattice;
00103
00104
00105 ItemsetLattice _significantLattice;
00106
00107 ItemsetLattice _closedSignificantLattice;
00108
00109
00110 vector< vector < unsigned int > > _binaryMatrix;
00111
00112 set< unsigned int > _complementRows;
00113
00114 map< unsigned int, string > _binaryMatrixRowNames;
00115
00116 map< unsigned int, string > _binaryMatrixColumnNames;
00117
00118
00119 MyGraph _mapFromNetworkLegosToActiveNetworks;
00120
00121
00122 public:
00123 SetOfNetworkLegos()
00124 {}
00125 SetOfNetworkLegos(SetOfActiveNetworks &anetSet)
00126 : _leaves(anetSet)
00127 {}
00128
00129 virtual ~SetOfNetworkLegos()
00130 {}
00131
00138 virtual void compute(ostream &logStream, unsigned int minNumberConditions = 1,
00139 unsigned int minNumberInteractions = 1);
00140
00165 void computeMaximallySignificantItemsets(
00166 const vector< Itemset > &allSignificantItemsets,
00167 vector< Itemset > &maximallySignificantItemsets,
00168 vector< Itemset > &significantLatticeRoots,
00169 vector< Itemset > &significantLatticeLeaves);
00170
00185 virtual void compareNetworkLegosToActiveNetworks();
00186
00190 virtual void computeTrivialLegos(ostream &logStream);
00191
00192
00193 virtual void computeRecoverability(ostream &logStream);
00194
00196 virtual void computeSignificantLegos(ostream &logStream, unsigned int numRandomTrials = 100000,
00197 MyNT pvalueThreshold = 0.01);
00198
00200 virtual void computeStability(ostream &logStream);
00201
00203 virtual void getSignificantLegos(SetOfActiveNetworks &legos)
00204 {
00205 legos = _significantLegos;
00206 }
00207
00208
00209 #ifdef CTEMPLATE
00210
00211 virtual void layout();
00212 #endif
00213
00214
00215
00216
00220 void printBinaryMatrix(ostream &ostr, bool transposed = false) const;
00221
00223 void printClosedLattice(ostream &ostr) const
00224 {
00225 _closedSignificantLattice.print(ostr);
00226 }
00227
00229 void printLattice(ostream &ostr) const
00230 {
00231 _significantLattice.print(ostr);
00232 }
00233
00250 virtual void readMappingFromNetworkLegosToActiveNetworks(string nlsToRNsFile);
00251 };
00252
00253
00254
00255 #endif // _NETWORK_LEGO_H