SNAP Library 6.0, Developer Reference
2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <mag.h>
Public Member Functions | |
TMAGFitBern () | |
TMAGFitBern (const PNGraph &G, const int &NAttrs) | |
TMAGFitBern (const PNGraph &G, const TStr &InitFNm) | |
void | Clr () |
void | SaveTxt (const TStr &FNm) |
const int | GetNodes () const |
const int | GetAttrs () const |
const TMAGParam< TMAGNodeBern > & | GetParams () const |
const TMAGNodeBern & | GetNodeAttr () const |
const TFltV & | GetMuV () const |
void | SetMuV (const TFltV &MuV) |
void | GetMtxV (TMAGAffMtxV &MtxV) const |
void | SetMtxV (const TMAGAffMtxV &MtxV) |
PNGraph | GetGraph () |
void | SetGraph (const PNGraph &GraphPt) |
void | SetDebug (const bool _Debug) |
void | SetAlgConf (const bool EStep=true, const bool MStep=true) |
void | Init (const TFltV &MuV, const TMAGAffMtxV &AffMtxV) |
void | RandomInit (const TFltV &MuV, const TMAGAffMtxV &AffMtxV, const int &Seed) |
const TFltVV & | GetPhiVV () const |
void | SetPhiVV (const TIntVV &AttrVV, const int KnownIds=0) |
void | SetPhiVV (const TFltVV &AttrVV, const int KnownIds=0) |
const double | GetInCoeff (const int &i, const int &j, const int &l, const int &A, const TMAGAffMtx &Theta) const |
const double | GetAvgInCoeff (const int &i, const int &AId, const int &A, const TMAGAffMtx &Theta) const |
const double | GetOutCoeff (const int &i, const int &j, const int &l, const int &A, const TMAGAffMtx &Theta) const |
const double | GetAvgOutCoeff (const int &i, const int &AId, const int &A, const TMAGAffMtx &Theta) const |
const double | GetProbPhi (const int &NId1, const int &NId2, const int &AId, const int &Attr1, const int &Attr2) const |
const double | GetProbMu (const int &NId1, const int &NId2, const int &AId, const int &Attr1, const int &Attr2, const bool Left=false, const bool Right=false) const |
const double | GetThetaLL (const int &NId1, const int &NId2, const int &AId) const |
const double | GetAvgThetaLL (const int &NId1, const int &NId2, const int &AId, const bool Left=false, const bool Right=false) const |
const double | GetSqThetaLL (const int &NId1, const int &NId2, const int &AId) const |
const double | GetAvgSqThetaLL (const int &NId1, const int &NId2, const int &AId, const bool Left=false, const bool Right=false) const |
const double | GetProdLinWeight (const int &NId1, const int &NId2) const |
const double | GetAvgProdLinWeight (const int &NId1, const int &NId2, const bool Left=false, const bool Right=false) const |
const double | GetProdSqWeight (const int &NId1, const int &NId2) const |
const double | GetAvgProdSqWeight (const int &NId1, const int &NId2, const bool Left=false, const bool Right=false) const |
const double | GetEstNoEdgeLL (const int &NId, const int &AId) const |
const double | GradPhiMI (const double &x, const int &NId, const int &AId, const double &Lambda, const double &DeltaQ, const TFltVV &CntVV) |
const double | ObjPhiMI (const double &x, const int &NId, const int &AId, const double &Lambda, const double &Q0, const double &Q1, const TFltVV &CntVV) |
const double | UpdatePhiMI (const double &Lambda, const int &NId, const int &AId, double &Phi) |
const double | UpdateApxPhiMI (const double &Lambda, const int &NId, const int &AId, double &Phi, TFltVV &ProdVV) |
const double | UpdatePhi (const int &NId, const int &AId, double &Phi) |
const double | UpdateMu (const int &AId) |
const void | PrepareUpdateAffMtx (TFltVV &ProdVV, TFltVV &SqVV) |
const void | PrepareUpdateApxAffMtx (TFltVV &ProdVV, TFltVV &SqVV) |
const double | UpdateAffMtx (const int &AId, const double &LrnRate, const double &MaxGrad, const double &Lambda, TFltVV &ProdVV, TFltVV &SqVV, TMAGAffMtx &NewMtx) |
const double | UpdateAffMtxV (const int &GradIter, const double &LrnRate, const double &MaxGrad, const double &Lambda, const int &NReal=0) |
const void | GradAffMtx (const int &AId, const TFltVV &ProdVV, const TFltVV &SqVV, const TMAGAffMtx &CurMtx, TFltV &GradV) |
const void | GradApxAffMtx (const int &AId, const TFltVV &ProdVV, const TFltVV &SqVV, const TMAGAffMtx &CurMtx, TFltV &GradV) |
double | DoEStepOneIter (const TFltV &TrueMuV, TFltVV &NewPhi, const double &Lambda) |
double | DoEStepApxOneIter (const TFltV &TrueMuV, TFltVV &NewPhi, const double &Lambda) |
double | DoEStep (const TFltV &TrueMuV, const int &NIter, double &LL, const double &Lambda) |
void | DoMStep (const int &GradIter, const double &LrnRate, const double &MaxGrad, const double &Lambda, const int &NReal=0) |
void | DoEMAlg (const int &NStep, const int &NEstep, const int &NMstep, const double &LrnRate, const double &MaxGrad, const double &Lambda, const double &ReInit, const int &NReal=0) |
void | CountAttr (TFltV &EstMuV) const |
void | SortAttrOrdering (const TFltV &TrueMuV, TIntV &IndexV) const |
const double | ComputeJointOneLL (const TIntVV &AttrVV) const |
const double | ComputeJointLL (int NSample) const |
const double | ComputeJointAdjLL (const TIntVV &AttrVV) const |
const double | ComputeApxLL () const |
const double | ComputeApxAdjLL () const |
void | MakeCCDF (const TFltPrV &RawV, TFltPrV &CcdfV) |
void | PlotProperties (const TStr &FNm) |
void | NormalizeAffMtxV (TMAGAffMtxV &MtxV, const bool UseMu=false) |
void | UnNormalizeAffMtxV (TMAGAffMtxV &MtxV, const bool UseMu=false) |
Static Public Member Functions | |
static const double | ComputeMI (const TIntVV &AttrV, const int AId1, const int AId2) |
static const double | ComputeMI (const TFltVV &AttrV, const int AId1, const int AId2) |
static const double | ComputeMI (const TIntVV &AttrV) |
static const double | ComputeMI (const TFltVV &AttrV) |
Private Member Functions | |
const bool | NextPermutation (TIntV &IndexV) const |
Private Attributes | |
TFltVV | PhiVV |
TBoolVV | KnownVV |
PNGraph | Graph |
TMAGParam< TMAGNodeBern > | Param |
bool | ESpeedUp |
bool | MSpeedUp |
bool | Debug |
TFltV | AvgPhiV |
TFltVV | AvgPhiPairVV |
TFlt | NormConst |
TVec< TFltV > | MuHisV |
TVec< TMAGAffMtxV > | MtxHisV |
TFltV | LLHisV |
|
inline |
|
inline |
Definition at line 360 of file mag.h.
References TVec< TVal, TSizeTy >::Gen(), TVVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetAttrs(), TNGraph::GetNodes(), and SetGraph().
|
inline |
Definition at line 372 of file mag.h.
References TVVec< TVal, TSizeTy >::Clr().
const double TMAGFitBern::ComputeApxAdjLL | ( | ) | const |
Definition at line 2046 of file mag.cpp.
References TMAGAffMtx::At(), TMAGParam< TNodeAttr >::GetAttrs(), TMAGAffMtx::GetLLMtx(), TMAGParam< TNodeAttr >::GetMtx(), TMAGNodeBern::GetMuV(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), GetProbPhi(), GetProdLinWeight(), Graph, TNGraph::IsEdge(), Param, PhiVV, and TVec< TVal, TSizeTy >::PutAll().
const double TMAGFitBern::ComputeApxLL | ( | ) | const |
Definition at line 2005 of file mag.cpp.
References TMAGParam< TNodeAttr >::GetAttrs(), TMAGAffMtx::GetLLMtx(), TMAGParam< TNodeAttr >::GetMtx(), TMAGNodeBern::GetMuV(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), GetProbPhi(), GetProdLinWeight(), Graph, TNGraph::IsEdge(), NormConst, Param, and PhiVV.
Referenced by DoEMAlg().
const double TMAGFitBern::ComputeJointAdjLL | ( | const TIntVV & | AttrVV | ) | const |
Definition at line 1942 of file mag.cpp.
References TVVec< TVal, TSizeTy >::At(), TMAGParam< TNodeAttr >::GetAttrs(), TMAGParam< TNodeAttr >::GetMtxV(), TMAGNodeBern::GetMuV(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), Graph, TNGraph::IsEdge(), TVec< TVal, TSizeTy >::Len(), and Param.
const double TMAGFitBern::ComputeJointLL | ( | int | NSample | ) | const |
Definition at line 1976 of file mag.cpp.
References TVVec< TVal, TSizeTy >::At(), TVVec< TVal, TSizeTy >::Clr(), ComputeJointOneLL(), TMAGParam< TNodeAttr >::GetAttrs(), TMAGParam< TNodeAttr >::GetNodes(), TRnd::GetUniDev(), Param, and PhiVV.
const double TMAGFitBern::ComputeJointOneLL | ( | const TIntVV & | AttrVV | ) | const |
Definition at line 1900 of file mag.cpp.
References TVVec< TVal, TSizeTy >::At(), TMAGParam< TNodeAttr >::GetAttrs(), TMAGParam< TNodeAttr >::GetMtxV(), TMAGNodeBern::GetMuV(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), Graph, TNGraph::IsEdge(), TVec< TVal, TSizeTy >::Len(), and Param.
Referenced by ComputeJointLL().
|
static |
Definition at line 2091 of file mag.cpp.
References TVVec< TVal, TSizeTy >::GetXDim(), TVec< TVal, TSizeTy >::PutAll(), and TVVec< TVal, TSizeTy >::PutAll().
Referenced by ComputeMI().
|
static |
Definition at line 2120 of file mag.cpp.
References TVVec< TVal, TSizeTy >::GetXDim(), TVec< TVal, TSizeTy >::PutAll(), and TVVec< TVal, TSizeTy >::PutAll().
|
static |
Definition at line 2154 of file mag.cpp.
References ComputeMI(), and TVVec< TVal, TSizeTy >::GetYDim().
|
static |
Definition at line 2168 of file mag.cpp.
References ComputeMI(), and TVVec< TVal, TSizeTy >::GetYDim().
void TMAGFitBern::CountAttr | ( | TFltV & | EstMuV | ) | const |
Definition at line 1814 of file mag.cpp.
References TVec< TVal, TSizeTy >::Gen(), TVVec< TVal, TSizeTy >::GetXDim(), TVVec< TVal, TSizeTy >::GetYDim(), PhiVV, and TVec< TVal, TSizeTy >::PutAll().
Referenced by SortAttrOrdering().
void TMAGFitBern::DoEMAlg | ( | const int & | NStep, |
const int & | NEstep, | ||
const int & | NMstep, | ||
const double & | LrnRate, | ||
const double & | MaxGrad, | ||
const double & | Lambda, | ||
const double & | ReInit, | ||
const int & | NReal = 0 |
||
) |
Definition at line 1630 of file mag.cpp.
References TVec< TVal, TSizeTy >::Add(), TVVec< TVal, TSizeTy >::At(), ComputeApxLL(), Debug, DoEStep(), DoMStep(), TVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetAttrs(), TMAGParam< TNodeAttr >::GetMtxV(), TMAGNodeBern::GetMuV(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), TRnd::GetUniDev(), KnownVV, LLHisV, MtxHisV, MuHisV, NormalizeAffMtxV(), NormConst, Param, PhiVV, TMAGParam< TNodeAttr >::SetMtxV(), and UnNormalizeAffMtxV().
double TMAGFitBern::DoEStep | ( | const TFltV & | TrueMuV, |
const int & | NIter, | ||
double & | LL, | ||
const double & | Lambda | ||
) |
Definition at line 1272 of file mag.cpp.
References TVVec< TVal, TSizeTy >::Clr(), DoEStepApxOneIter(), DoEStepOneIter(), ESpeedUp, TMAGParam< TNodeAttr >::GetAttrs(), TMAGParam< TNodeAttr >::GetNodes(), TExeTm::GetTmStr(), TVec< TVal, TSizeTy >::Last(), and Param.
Referenced by DoEMAlg().
double TMAGFitBern::DoEStepApxOneIter | ( | const TFltV & | TrueMuV, |
TFltVV & | NewPhi, | ||
const double & | Lambda | ||
) |
Definition at line 1134 of file mag.cpp.
References TVVec< TVal, TSizeTy >::At(), AvgPhiPairVV, AvgPhiV, TVec< TVal, TSizeTy >::Gen(), TVVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetAttrs(), GetAvgProdLinWeight(), GetAvgProdSqWeight(), GetAvgSqThetaLL(), GetAvgThetaLL(), TMAGParam< TNodeAttr >::GetNodes(), TRnd::GetUniDevInt(), KnownVV, Param, PhiVV, TVec< TVal, TSizeTy >::PutAll(), TVVec< TVal, TSizeTy >::PutAll(), and UpdateApxPhiMI().
Referenced by DoEStep().
double TMAGFitBern::DoEStepOneIter | ( | const TFltV & | TrueMuV, |
TFltVV & | NewPhi, | ||
const double & | Lambda | ||
) |
Definition at line 1056 of file mag.cpp.
References TVVec< TVal, TSizeTy >::At(), TVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetAttrs(), TMAGParam< TNodeAttr >::GetNodes(), TRnd::GetUniDevInt(), KnownVV, Param, PhiVV, TVec< TVal, TSizeTy >::PutAll(), TVec< TVal, TSizeTy >::Sort(), and UpdatePhiMI().
Referenced by DoEStep().
void TMAGFitBern::DoMStep | ( | const int & | GradIter, |
const double & | LrnRate, | ||
const double & | MaxGrad, | ||
const double & | Lambda, | ||
const int & | NReal = 0 |
||
) |
Definition at line 1608 of file mag.cpp.
References AvgPhiV, TVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetAttrs(), TExeTm::GetTmStr(), Param, TVec< TVal, TSizeTy >::PutAll(), UpdateAffMtxV(), and UpdateMu().
Referenced by DoEMAlg().
|
inline |
Definition at line 376 of file mag.h.
References TMAGParam< TNodeAttr >::GetAttrs().
const double TMAGFitBern::GetAvgInCoeff | ( | const int & | i, |
const int & | AId, | ||
const int & | A, | ||
const TMAGAffMtx & | Theta | ||
) | const |
Definition at line 558 of file mag.cpp.
References TMAGAffMtx::At(), AvgPhiV, TMAGParam< TNodeAttr >::GetNodes(), and Param.
Referenced by UpdateApxPhiMI().
const double TMAGFitBern::GetAvgOutCoeff | ( | const int & | i, |
const int & | AId, | ||
const int & | A, | ||
const TMAGAffMtx & | Theta | ||
) | const |
Definition at line 564 of file mag.cpp.
References TMAGAffMtx::At(), AvgPhiV, TMAGParam< TNodeAttr >::GetNodes(), and Param.
Referenced by UpdateApxPhiMI().
const double TMAGFitBern::GetAvgProdLinWeight | ( | const int & | NId1, |
const int & | NId2, | ||
const bool | Left = false , |
||
const bool | Right = false |
||
) | const |
Definition at line 642 of file mag.cpp.
References TMAGParam< TNodeAttr >::GetAttrs(), GetAvgThetaLL(), NormConst, and Param.
Referenced by DoEStepApxOneIter(), and PrepareUpdateApxAffMtx().
const double TMAGFitBern::GetAvgProdSqWeight | ( | const int & | NId1, |
const int & | NId2, | ||
const bool | Left = false , |
||
const bool | Right = false |
||
) | const |
Definition at line 664 of file mag.cpp.
References TMAGParam< TNodeAttr >::GetAttrs(), GetAvgSqThetaLL(), NormConst, and Param.
Referenced by DoEStepApxOneIter(), and PrepareUpdateApxAffMtx().
const double TMAGFitBern::GetAvgSqThetaLL | ( | const int & | NId1, |
const int & | NId2, | ||
const int & | AId, | ||
const bool | Left = false , |
||
const bool | Right = false |
||
) | const |
Definition at line 620 of file mag.cpp.
References TMAGAffMtx::At(), TMAGParam< TNodeAttr >::GetMtx(), GetProbMu(), and Param.
Referenced by DoEStepApxOneIter(), GetAvgProdSqWeight(), GradApxAffMtx(), and UpdateApxPhiMI().
const double TMAGFitBern::GetAvgThetaLL | ( | const int & | NId1, |
const int & | NId2, | ||
const int & | AId, | ||
const bool | Left = false , |
||
const bool | Right = false |
||
) | const |
Definition at line 598 of file mag.cpp.
References TMAGAffMtx::At(), TMAGParam< TNodeAttr >::GetMtx(), GetProbMu(), and Param.
Referenced by DoEStepApxOneIter(), GetAvgProdLinWeight(), GradApxAffMtx(), and UpdateApxPhiMI().
const double TMAGFitBern::GetEstNoEdgeLL | ( | const int & | NId, |
const int & | AId | ||
) | const |
Definition at line 746 of file mag.cpp.
References TMAGParam< TNodeAttr >::GetNodeAttr(), and Param.
|
inline |
const double TMAGFitBern::GetInCoeff | ( | const int & | i, |
const int & | j, | ||
const int & | l, | ||
const int & | A, | ||
const TMAGAffMtx & | Theta | ||
) | const |
Definition at line 550 of file mag.cpp.
References TMAGAffMtx::At(), TVVec< TVal, TSizeTy >::At(), and PhiVV.
Referenced by UpdateApxPhiMI(), UpdatePhi(), and UpdatePhiMI().
|
inline |
Definition at line 381 of file mag.h.
References TMAGParam< TNodeAttr >::GetMtxV().
|
inline |
Definition at line 379 of file mag.h.
References TMAGNodeBern::GetMuV(), and TMAGParam< TNodeAttr >::GetNodeAttr().
Referenced by NormalizeAffMtxV(), SaveTxt(), and UnNormalizeAffMtxV().
|
inline |
Definition at line 378 of file mag.h.
References TMAGParam< TNodeAttr >::GetNodeAttr().
|
inline |
Definition at line 375 of file mag.h.
References TMAGParam< TNodeAttr >::GetNodes().
const double TMAGFitBern::GetOutCoeff | ( | const int & | i, |
const int & | j, | ||
const int & | l, | ||
const int & | A, | ||
const TMAGAffMtx & | Theta | ||
) | const |
Definition at line 554 of file mag.cpp.
References TMAGAffMtx::At(), TVVec< TVal, TSizeTy >::At(), and PhiVV.
Referenced by UpdateApxPhiMI(), UpdatePhi(), and UpdatePhiMI().
|
inline |
|
inline |
const double TMAGFitBern::GetProbMu | ( | const int & | NId1, |
const int & | NId2, | ||
const int & | AId, | ||
const int & | Attr1, | ||
const int & | Attr2, | ||
const bool | Left = false , |
||
const bool | Right = false |
||
) | const |
Definition at line 576 of file mag.cpp.
References TVVec< TVal, TSizeTy >::At(), AvgPhiV, TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), Param, and PhiVV.
Referenced by GetAvgSqThetaLL(), GetAvgThetaLL(), and GradApxAffMtx().
const double TMAGFitBern::GetProbPhi | ( | const int & | NId1, |
const int & | NId2, | ||
const int & | AId, | ||
const int & | Attr1, | ||
const int & | Attr2 | ||
) | const |
Definition at line 570 of file mag.cpp.
References TVVec< TVal, TSizeTy >::At(), and PhiVV.
Referenced by ComputeApxAdjLL(), ComputeApxLL(), GetSqThetaLL(), GetThetaLL(), GradAffMtx(), and GradApxAffMtx().
const double TMAGFitBern::GetProdLinWeight | ( | const int & | NId1, |
const int & | NId2 | ||
) | const |
Definition at line 631 of file mag.cpp.
References TMAGParam< TNodeAttr >::GetAttrs(), GetThetaLL(), NormConst, and Param.
Referenced by ComputeApxAdjLL(), ComputeApxLL(), GradApxAffMtx(), PrepareUpdateAffMtx(), UpdateApxPhiMI(), UpdatePhi(), and UpdatePhiMI().
const double TMAGFitBern::GetProdSqWeight | ( | const int & | NId1, |
const int & | NId2 | ||
) | const |
Definition at line 653 of file mag.cpp.
References TMAGParam< TNodeAttr >::GetAttrs(), GetSqThetaLL(), NormConst, and Param.
Referenced by GradApxAffMtx(), PrepareUpdateAffMtx(), UpdateApxPhiMI(), UpdatePhi(), and UpdatePhiMI().
const double TMAGFitBern::GetSqThetaLL | ( | const int & | NId1, |
const int & | NId2, | ||
const int & | AId | ||
) | const |
Definition at line 609 of file mag.cpp.
References TMAGAffMtx::At(), TMAGParam< TNodeAttr >::GetMtx(), GetProbPhi(), and Param.
Referenced by GetProdSqWeight(), GradAffMtx(), GradApxAffMtx(), UpdateApxPhiMI(), UpdatePhi(), and UpdatePhiMI().
const double TMAGFitBern::GetThetaLL | ( | const int & | NId1, |
const int & | NId2, | ||
const int & | AId | ||
) | const |
Definition at line 587 of file mag.cpp.
References TMAGAffMtx::At(), TMAGParam< TNodeAttr >::GetMtx(), GetProbPhi(), and Param.
Referenced by GetProdLinWeight(), GradAffMtx(), GradApxAffMtx(), UpdateApxPhiMI(), UpdatePhi(), and UpdatePhiMI().
const void TMAGFitBern::GradAffMtx | ( | const int & | AId, |
const TFltVV & | ProdVV, | ||
const TFltVV & | SqVV, | ||
const TMAGAffMtx & | CurMtx, | ||
TFltV & | GradV | ||
) |
Definition at line 1320 of file mag.cpp.
References TMAGAffMtx::At(), TMAGParam< TNodeAttr >::GetNodes(), GetProbPhi(), GetSqThetaLL(), GetThetaLL(), Graph, TNGraph::IsEdge(), Param, and TVec< TVal, TSizeTy >::PutAll().
Referenced by UpdateAffMtx().
const void TMAGFitBern::GradApxAffMtx | ( | const int & | AId, |
const TFltVV & | ProdVV, | ||
const TFltVV & | SqVV, | ||
const TMAGAffMtx & | CurMtx, | ||
TFltV & | GradV | ||
) |
Definition at line 1346 of file mag.cpp.
References TVec< TVal, TSizeTy >::Add(), TMAGAffMtx::At(), TNGraph::BegEI(), TNGraph::EndEI(), TVec< TVal, TSizeTy >::Gen(), GetAvgSqThetaLL(), GetAvgThetaLL(), TMAGParam< TNodeAttr >::GetNodes(), GetProbMu(), GetProbPhi(), GetProdLinWeight(), GetProdSqWeight(), GetSqThetaLL(), GetThetaLL(), Graph, LogSumExp(), Param, and TVec< TVal, TSizeTy >::PutAll().
Referenced by UpdateAffMtx().
const double TMAGFitBern::GradPhiMI | ( | const double & | x, |
const int & | NId, | ||
const int & | AId, | ||
const double & | Lambda, | ||
const double & | DeltaQ, | ||
const TFltVV & | CntVV | ||
) |
Definition at line 703 of file mag.cpp.
References TVVec< TVal, TSizeTy >::GetYDim(), and PhiVV.
Referenced by UpdateApxPhiMI(), and UpdatePhiMI().
void TMAGFitBern::Init | ( | const TFltV & | MuV, |
const TMAGAffMtxV & | AffMtxV | ||
) |
Definition at line 452 of file mag.cpp.
References TVVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetAttrs(), TMAGParam< TNodeAttr >::GetNodes(), KnownVV, Param, PhiVV, TVVec< TVal, TSizeTy >::PutAll(), TMAGParam< TNodeAttr >::SetMtxV(), and TMAGParam< TNodeAttr >::SetNodeAttr().
Definition at line 1703 of file mag.cpp.
References TVec< TVal, TSizeTy >::Add(), TVec< TVal, TSizeTy >::Gen(), IAssert, and TVec< TVal, TSizeTy >::Len().
Referenced by PlotProperties().
|
private |
Definition at line 1867 of file mag.cpp.
References TVec< TVal, TSizeTy >::GetSubValV(), TVec< TVal, TSizeTy >::Len(), and TVec< TVal, TSizeTy >::Sort().
void TMAGFitBern::NormalizeAffMtxV | ( | TMAGAffMtxV & | MtxV, |
const bool | UseMu = false |
||
) |
Definition at line 1454 of file mag.cpp.
References AvgPhiV, TNGraph::GetEdges(), GetMuV(), TMAGParam< TNodeAttr >::GetNodes(), Graph, TVec< TVal, TSizeTy >::Len(), NormConst, and Param.
Referenced by DoEMAlg(), UnNormalizeAffMtxV(), and UpdateAffMtxV().
const double TMAGFitBern::ObjPhiMI | ( | const double & | x, |
const int & | NId, | ||
const int & | AId, | ||
const double & | Lambda, | ||
const double & | Q0, | ||
const double & | Q1, | ||
const TFltVV & | CntVV | ||
) |
Definition at line 722 of file mag.cpp.
References TVVec< TVal, TSizeTy >::GetYDim(), and PhiVV.
Referenced by UpdateApxPhiMI(), and UpdatePhiMI().
void TMAGFitBern::PlotProperties | ( | const TStr & | FNm | ) |
Definition at line 1727 of file mag.cpp.
References TGStatVec::Add(), TGnuPlot::AddCmd(), TGnuPlot::AddPlot(), TGStatVec::At(), TSnap::DelZeroDegNodes(), TMAGParam< TNodeAttr >::GenMAG(), TMAGParam< TNodeAttr >::GetAttrs(), TNGraph::GetEdges(), TMAGParam< TNodeAttr >::GetMtxV(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), gpsLog10XY, gpwLines, Graph, gsdClustCf, gsdHops, gsdInDeg, gsdOutDeg, gsdSngVal, gsdSngVec, gsdTriadPart, gsdWcc, TGStatVec::Len(), MakeCCDF(), Param, PhiVV, TGnuPlot::SaveEps(), TMAGParam< TNodeAttr >::SetMtxV(), TMAGParam< TNodeAttr >::SetNodeAttr(), TGnuPlot::SetScale(), TGnuPlot::SetXYLabel(), TGnuPlot::ShowGrid(), and tmuNodes.
Definition at line 1532 of file mag.cpp.
References TVVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetNodes(), GetProdLinWeight(), GetProdSqWeight(), and Param.
Referenced by UpdateAffMtxV().
Definition at line 1545 of file mag.cpp.
References TVVec< TVal, TSizeTy >::Gen(), GetAvgProdLinWeight(), GetAvgProdSqWeight(), TMAGParam< TNodeAttr >::GetNodes(), and Param.
Referenced by UpdateAffMtxV().
void TMAGFitBern::RandomInit | ( | const TFltV & | MuV, |
const TMAGAffMtxV & | AffMtxV, | ||
const int & | Seed | ||
) |
Definition at line 510 of file mag.cpp.
References TVVec< TVal, TSizeTy >::At(), TVVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetAttrs(), TMAGParam< TNodeAttr >::GetNodes(), TRnd::GetUniDev(), KnownVV, Param, PhiVV, TVec< TVal, TSizeTy >::PutAll(), TVVec< TVal, TSizeTy >::PutAll(), TRnd::PutSeed(), TMAGNodeBern::Rnd, TMAGParam< TNodeAttr >::SetMtxV(), and TMAGParam< TNodeAttr >::SetNodeAttr().
void TMAGFitBern::SaveTxt | ( | const TStr & | FNm | ) |
Definition at line 423 of file mag.cpp.
References TMAGParam< TNodeAttr >::GetAttrs(), TStr::GetCStr(), TMAGParam< TNodeAttr >::GetMtxV(), GetMuV(), TMAGParam< TNodeAttr >::GetNodes(), Param, and PhiVV.
|
inline |
void TMAGFitBern::SetGraph | ( | const PNGraph & | GraphPt | ) |
Definition at line 385 of file mag.cpp.
References TNGraph::GetNIdV(), TNGraph::GetNodes(), TSnap::GetSubGraph(), Graph, IAssert, and TNGraph::IsNode().
Referenced by TMAGFitBern().
|
inline |
Definition at line 382 of file mag.h.
References TMAGParam< TNodeAttr >::SetMtxV().
|
inline |
Definition at line 380 of file mag.h.
References TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGNodeBern::SetMuV(), and TMAGParam< TNodeAttr >::SetNodeAttr().
void TMAGFitBern::SetPhiVV | ( | const TIntVV & | AttrVV, |
const int | KnownIds = 0 |
||
) |
Definition at line 399 of file mag.cpp.
References TVVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetAttrs(), TMAGParam< TNodeAttr >::GetNodes(), KnownVV, Param, PhiVV, and TVVec< TVal, TSizeTy >::PutY().
|
inline |
Definition at line 394 of file mag.h.
References TVVec< TVal, TSizeTy >::Gen(), TVVec< TVal, TSizeTy >::GetXDim(), TVVec< TVal, TSizeTy >::GetYDim(), TVVec< TVal, TSizeTy >::PutAll(), and TVVec< TVal, TSizeTy >::PutY().
Definition at line 1828 of file mag.cpp.
References CountAttr(), TVec< TVal, TSizeTy >::Gen(), TVec< TVal, TSizeTy >::Len(), and TVec< TVal, TSizeTy >::Swap().
void TMAGFitBern::UnNormalizeAffMtxV | ( | TMAGAffMtxV & | MtxV, |
const bool | UseMu = false |
||
) |
Definition at line 1492 of file mag.cpp.
References TNGraph::GetEdges(), GetMuV(), TMAGParam< TNodeAttr >::GetNodes(), Graph, TVec< TVal, TSizeTy >::Len(), NormalizeAffMtxV(), NormConst, Param, and TVec< TVal, TSizeTy >::Sort().
Referenced by DoEMAlg().
const double TMAGFitBern::UpdateAffMtx | ( | const int & | AId, |
const double & | LrnRate, | ||
const double & | MaxGrad, | ||
const double & | Lambda, | ||
TFltVV & | ProdVV, | ||
TFltVV & | SqVV, | ||
TMAGAffMtx & | NewMtx | ||
) |
Definition at line 1418 of file mag.cpp.
References TMAGAffMtx::At(), TMAGParam< TNodeAttr >::GetMtx(), TMAGAffMtx::GetMtxStr(), GradAffMtx(), GradApxAffMtx(), MSpeedUp, and Param.
Referenced by UpdateAffMtxV().
const double TMAGFitBern::UpdateAffMtxV | ( | const int & | GradIter, |
const double & | LrnRate, | ||
const double & | MaxGrad, | ||
const double & | Lambda, | ||
const int & | NReal = 0 |
||
) |
Definition at line 1558 of file mag.cpp.
References TVVec< TVal, TSizeTy >::Clr(), TMAGParam< TNodeAttr >::GetAttrs(), TMAGParam< TNodeAttr >::GetMtxV(), TMAGNodeBern::GetMuV(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), MSpeedUp, NormalizeAffMtxV(), Param, PrepareUpdateAffMtx(), PrepareUpdateApxAffMtx(), TMAGParam< TNodeAttr >::SetMtxV(), and UpdateAffMtx().
Referenced by DoMStep().
const double TMAGFitBern::UpdateApxPhiMI | ( | const double & | Lambda, |
const int & | NId, | ||
const int & | AId, | ||
double & | Phi, | ||
TFltVV & | ProdVV | ||
) |
Definition at line 930 of file mag.cpp.
References TVec< TVal, TSizeTy >::Add(), TMAGAffMtx::At(), TVVec< TVal, TSizeTy >::At(), AvgPhiPairVV, TVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetAttrs(), GetAvgInCoeff(), GetAvgOutCoeff(), GetAvgSqThetaLL(), GetAvgThetaLL(), GetInCoeff(), TNGraph::TNodeI::GetInDeg(), TNGraph::TNodeI::GetInNId(), TMAGAffMtx::GetLLMtx(), TMAGParam< TNodeAttr >::GetMtx(), TMAGNodeBern::GetMu(), TNGraph::GetNI(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), GetOutCoeff(), TNGraph::TNodeI::GetOutDeg(), TNGraph::TNodeI::GetOutNId(), GetProdLinWeight(), GetProdSqWeight(), TVVec< TVal, TSizeTy >::GetRow(), GetSqThetaLL(), GetThetaLL(), GradPhiMI(), Graph, IAssert, TMAGAffMtx::Len(), TVec< TVal, TSizeTy >::Len(), LogSumExp(), MaxExp, ObjPhiMI(), Param, PhiVV, and TVVec< TVal, TSizeTy >::PutAll().
Referenced by DoEStepApxOneIter().
const double TMAGFitBern::UpdateMu | ( | const int & | AId | ) |
Definition at line 1299 of file mag.cpp.
References TVVec< TVal, TSizeTy >::At(), AvgPhiV, TMAGNodeBern::GetMu(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), Param, PhiVV, TMAGNodeBern::SetMu(), and TMAGParam< TNodeAttr >::SetNodeAttr().
Referenced by DoMStep().
const double TMAGFitBern::UpdatePhi | ( | const int & | NId, |
const int & | AId, | ||
double & | Phi | ||
) |
Definition at line 756 of file mag.cpp.
References TVec< TVal, TSizeTy >::Add(), TMAGAffMtx::At(), TVVec< TVal, TSizeTy >::At(), TVec< TVal, TSizeTy >::Gen(), GetInCoeff(), TMAGAffMtx::GetLLMtx(), TMAGParam< TNodeAttr >::GetMtx(), TMAGNodeBern::GetMu(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), GetOutCoeff(), GetProdLinWeight(), GetProdSqWeight(), GetSqThetaLL(), GetThetaLL(), Graph, TNGraph::IsEdge(), TMAGAffMtx::Len(), LogSumExp(), MaxExp, Param, and PhiVV.
const double TMAGFitBern::UpdatePhiMI | ( | const double & | Lambda, |
const int & | NId, | ||
const int & | AId, | ||
double & | Phi | ||
) |
Definition at line 826 of file mag.cpp.
References TVec< TVal, TSizeTy >::Add(), TMAGAffMtx::At(), TVVec< TVal, TSizeTy >::At(), TVec< TVal, TSizeTy >::Gen(), TMAGParam< TNodeAttr >::GetAttrs(), GetInCoeff(), TMAGAffMtx::GetLLMtx(), TMAGParam< TNodeAttr >::GetMtx(), TMAGNodeBern::GetMu(), TMAGParam< TNodeAttr >::GetNodeAttr(), TMAGParam< TNodeAttr >::GetNodes(), GetOutCoeff(), GetProdLinWeight(), GetProdSqWeight(), GetSqThetaLL(), GetThetaLL(), GradPhiMI(), Graph, IAssert, TNGraph::IsEdge(), TMAGAffMtx::Len(), LogSumExp(), MaxExp, ObjPhiMI(), Param, PhiVV, and TVVec< TVal, TSizeTy >::PutAll().
Referenced by DoEStepOneIter().
|
private |
Definition at line 349 of file mag.h.
Referenced by DoEStepApxOneIter(), and UpdateApxPhiMI().
|
private |
Definition at line 348 of file mag.h.
Referenced by DoEStepApxOneIter(), DoMStep(), GetAvgInCoeff(), GetAvgOutCoeff(), GetProbMu(), NormalizeAffMtxV(), and UpdateMu().
|
private |
Definition at line 345 of file mag.h.
Referenced by ComputeApxAdjLL(), ComputeApxLL(), ComputeJointAdjLL(), ComputeJointOneLL(), GetGraph(), GradAffMtx(), GradApxAffMtx(), NormalizeAffMtxV(), PlotProperties(), SetGraph(), UnNormalizeAffMtxV(), UpdateApxPhiMI(), UpdatePhi(), and UpdatePhiMI().
|
private |
Definition at line 344 of file mag.h.
Referenced by DoEMAlg(), DoEStepApxOneIter(), DoEStepOneIter(), Init(), RandomInit(), and SetPhiVV().
|
private |
Definition at line 347 of file mag.h.
Referenced by UpdateAffMtx(), and UpdateAffMtxV().
|
private |
|
private |
Definition at line 350 of file mag.h.
Referenced by ComputeApxLL(), DoEMAlg(), GetAvgProdLinWeight(), GetAvgProdSqWeight(), GetProdLinWeight(), GetProdSqWeight(), NormalizeAffMtxV(), and UnNormalizeAffMtxV().
|
private |
Definition at line 346 of file mag.h.
Referenced by ComputeApxAdjLL(), ComputeApxLL(), ComputeJointAdjLL(), ComputeJointLL(), ComputeJointOneLL(), DoEMAlg(), DoEStep(), DoEStepApxOneIter(), DoEStepOneIter(), DoMStep(), GetAvgInCoeff(), GetAvgOutCoeff(), GetAvgProdLinWeight(), GetAvgProdSqWeight(), GetAvgSqThetaLL(), GetAvgThetaLL(), GetEstNoEdgeLL(), GetParams(), GetProbMu(), GetProdLinWeight(), GetProdSqWeight(), GetSqThetaLL(), GetThetaLL(), GradAffMtx(), GradApxAffMtx(), Init(), NormalizeAffMtxV(), PlotProperties(), PrepareUpdateAffMtx(), PrepareUpdateApxAffMtx(), RandomInit(), SaveTxt(), SetPhiVV(), UnNormalizeAffMtxV(), UpdateAffMtx(), UpdateAffMtxV(), UpdateApxPhiMI(), UpdateMu(), UpdatePhi(), and UpdatePhiMI().
|
private |
Definition at line 343 of file mag.h.
Referenced by ComputeApxAdjLL(), ComputeApxLL(), ComputeJointLL(), CountAttr(), DoEMAlg(), DoEStepApxOneIter(), DoEStepOneIter(), GetInCoeff(), GetOutCoeff(), GetPhiVV(), GetProbMu(), GetProbPhi(), GradPhiMI(), Init(), ObjPhiMI(), PlotProperties(), RandomInit(), SaveTxt(), SetPhiVV(), UpdateApxPhiMI(), UpdateMu(), UpdatePhi(), and UpdatePhiMI().