|
SNAP Library 2.0, User Reference
2013-05-13 16:33:57
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Go to the source code of this file.
Functions | |
| void | GetMinMax (const TFltPrV &XYValV, double &Min, double &Max, const bool &ResetMinMax) |
| void | PlotGrad (const TFltPrV &EstLLV, const TFltPrV &TrueLLV, const TVec< TFltPrV > &GradVV, const TFltPrV &AcceptV, const TStr &OutFNm, const TStr &Desc) |
| void | PlotAutoCorrelation (const TFltV &ValV, const int &MaxK, const TStr &OutFNm, const TStr &Desc) |
| void | McMcGetAvgAvg (const TFltV &AvgJV, double &AvgAvg) |
| void | McMcGetAvgJ (const TVec< TFltV > &ChainLLV, TFltV &AvgJV) |
| void | PlotTrueAndEst (const TStr &OutFNm, const TStr &Desc, const TStr &YLabel, const TFltPrV &EstV, const TFltPrV &TrueV) |
| void McMcGetAvgAvg | ( | const TFltV & | AvgJV, |
| double & | AvgAvg | ||
| ) |
Definition at line 1876 of file kronecker.cpp.
| void McMcGetAvgJ | ( | const TVec< TFltV > & | ChainLLV, |
| TFltV & | AvgJV | ||
| ) |
| void PlotAutoCorrelation | ( | const TFltV & | ValV, |
| const int & | MaxK, | ||
| const TStr & | OutFNm, | ||
| const TStr & | Desc | ||
| ) |
Definition at line 1773 of file kronecker.cpp.
{
double Avg=0.0, Var=0.0;
for (int i = 0; i < ValV.Len(); i++) { Avg += ValV[i]; }
Avg /= (double) ValV.Len();
for (int i = 0; i < ValV.Len(); i++) { Var += TMath::Sqr(ValV[i]-Avg); }
TFltPrV ACorrV;
for (int k = 0; k < TMath::Mn(ValV.Len(), MaxK); k++) {
double corr = 0.0;
for (int i = 0; i < ValV.Len() - k; i++) {
corr += (ValV[i]-Avg)*(ValV[i+k]-Avg);
}
ACorrV.Add(TFltPr(k, corr/Var));
}
// plot grads
TGnuPlot GP("sAutoCorr-"+OutFNm, TStr::Fmt("AutoCorrelation (%d samples). %s", ValV.Len(), Desc.CStr()), true);
GP.AddPlot(ACorrV, gpwLines, "", "linewidth 1");
GP.SetXYLabel("Lag, k", "Autocorrelation, r_k");
GP.SavePng();
}
| void PlotGrad | ( | const TFltPrV & | EstLLV, |
| const TFltPrV & | TrueLLV, | ||
| const TVec< TFltPrV > & | GradVV, | ||
| const TFltPrV & | AcceptV, | ||
| const TStr & | OutFNm, | ||
| const TStr & | Desc | ||
| ) |
Definition at line 1740 of file kronecker.cpp.
{
double Min, Max, Min1, Max1;
// plot log-likelihood
{ TGnuPlot GP("sLL-"+OutFNm, TStr::Fmt("Log-likelihood (avg 1k samples). %s", Desc.CStr()), true);
GP.AddPlot(EstLLV, gpwLines, "Esimated LL", "linewidth 1");
if (! TrueLLV.Empty()) { GP.AddPlot(TrueLLV, gpwLines, "TRUE LL", "linewidth 1"); }
//GetMinMax(EstLLV, Min, Max, true); GetMinMax(TrueLLV, Min, Max, false);
//GP.SetYRange((int)floor(Min-1), (int)ceil(Max+1));
GP.SetXYLabel("Sample Index (time)", "Log-likelihood");
GP.SavePng(); }
// plot accept
{ TGnuPlot GP("sAcc-"+OutFNm, TStr::Fmt("Pct. accepted rnd moves (over 1k samples). %s", Desc.CStr()), true);
GP.AddPlot(AcceptV, gpwLines, "Pct accepted swaps", "linewidth 1");
GP.SetXYLabel("Sample Index (time)", "Pct accept permutation swaps");
GP.SavePng(); }
// plot grads
TGnuPlot GPAll("sGradAll-"+OutFNm, TStr::Fmt("Gradient (avg 1k samples). %s", Desc.CStr()), true);
GetMinMax(GradVV[0], Min1, Max1, true);
for (int g = 0; g < GradVV.Len(); g++) {
GPAll.AddPlot(GradVV[g], gpwLines, TStr::Fmt("param %d", g+1), "linewidth 1");
GetMinMax(GradVV[g], Min1, Max1, false);
TGnuPlot GP(TStr::Fmt("sGrad%02d-", g+1)+OutFNm, TStr::Fmt("Gradient (avg 1k samples). %s", Desc.CStr()), true);
GP.AddPlot(GradVV[g], gpwLines, TStr::Fmt("param id %d", g+1), "linewidth 1");
GetMinMax(GradVV[g], Min, Max, true);
GP.SetYRange((int)floor(Min-1), (int)ceil(Max+1));
GP.SetXYLabel("Sample Index (time)", "Gradient");
GP.SavePng();
}
GPAll.SetYRange((int)floor(Min1-1), (int)ceil(Max1+1));
GPAll.SetXYLabel("Sample Index (time)", "Gradient");
GPAll.SavePng();
}
| void PlotTrueAndEst | ( | const TStr & | OutFNm, |
| const TStr & | Desc, | ||
| const TStr & | YLabel, | ||
| const TFltPrV & | EstV, | ||
| const TFltPrV & | TrueV | ||
| ) |
Definition at line 2009 of file kronecker.cpp.