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
TLogRegPredict Class Reference

#include <agm.h>

Collaboration diagram for TLogRegPredict:

Public Member Functions

 TLogRegPredict (const TFltV &_bb)
 
 TLogRegPredict (TSIn &SIn)
 
void Save (TSOut &SOut) const
 
 UndefDefaultCopyAssign (TLogRegPredict)
 
double GetCfy (const TFltV &AttrV)
 
void GetTheta (TFltV &_Theta)
 
void GetCfy (const TVec< TFltV > &X, TFltV &OutV)
 
void PrintTheta ()
 

Static Public Member Functions

static PLogRegPredict Load (TSIn &SIn)
 
static void GetCfy (const TVec< TFltV > &X, TFltV &OutV, const TFltV &NewTheta)
 
static double GetCfy (const TFltV &AttrV, const TFltV &NewTheta)
 

Private Attributes

TCRef CRef
 
TFltV Theta
 

Friends

class TPt< TLogRegPredict >
 

Detailed Description

Definition at line 194 of file agm.h.

Constructor & Destructor Documentation

TLogRegPredict::TLogRegPredict ( const TFltV _bb)
inline

Definition at line 200 of file agm.h.

Referenced by Load().

200 : Theta(_bb) { };
TFltV Theta
Definition: agm.h:198

Here is the caller graph for this function:

TLogRegPredict::TLogRegPredict ( TSIn SIn)
inline

Definition at line 203 of file agm.h.

References TVec< TVal, TSizeTy >::Load().

203 { Theta.Load(SIn); };
void Load(TSIn &SIn)
Definition: ds.h:946
TFltV Theta
Definition: agm.h:198

Here is the call graph for this function:

Member Function Documentation

void TLogRegPredict::GetCfy ( const TVec< TFltV > &  X,
TFltV OutV,
const TFltV NewTheta 
)
static

Definition at line 933 of file agm.cpp.

References TVec< TVal, TSizeTy >::Gen(), and TVec< TVal, TSizeTy >::Len().

Referenced by TLogRegFit::Gradient(), TLogRegFit::Hessian(), and TLogRegFit::Likelihood().

933  {
934  OutV.Gen(X.Len());
935  for (int r = 0; r < X.Len(); r++) {
936  OutV[r] = GetCfy(X[r], NewTheta);
937  }
938 }
static void GetCfy(const TVec< TFltV > &X, TFltV &OutV, const TFltV &NewTheta)
Definition: agm.cpp:933
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:523

Here is the call graph for this function:

Here is the caller graph for this function:

double TLogRegPredict::GetCfy ( const TFltV AttrV,
const TFltV NewTheta 
)
static

Definition at line 922 of file agm.cpp.

References TVec< TVal, TSizeTy >::Last(), and TVec< TVal, TSizeTy >::Len().

922  {
923  int len = AttrV.Len();
924  double res = 0;
925  if (len < NewTheta.Len()) { res = NewTheta.Last(); } //if feature vector is shorter, add an intercept
926  for (int i = 0; i < len; i++) {
927  if (i < NewTheta.Len()) { res += AttrV[i] * NewTheta[i]; }
928  }
929  double mu = 1 / (1 + exp(-res));
930  return mu;
931 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:579

Here is the call graph for this function:

double TLogRegPredict::GetCfy ( const TFltV AttrV)
inline

Definition at line 212 of file agm.h.

References GetCfy().

Referenced by GetCfy().

212 { return GetCfy(AttrV, Theta); }
static void GetCfy(const TVec< TFltV > &X, TFltV &OutV, const TFltV &NewTheta)
Definition: agm.cpp:933
TFltV Theta
Definition: agm.h:198

Here is the call graph for this function:

Here is the caller graph for this function:

void TLogRegPredict::GetCfy ( const TVec< TFltV > &  X,
TFltV OutV 
)
inline

Definition at line 214 of file agm.h.

References GetCfy().

Referenced by GetCfy().

214 { GetCfy(X, OutV, Theta); }
static void GetCfy(const TVec< TFltV > &X, TFltV &OutV, const TFltV &NewTheta)
Definition: agm.cpp:933
TFltV Theta
Definition: agm.h:198

Here is the call graph for this function:

Here is the caller graph for this function:

void TLogRegPredict::GetTheta ( TFltV _Theta)
inline

Definition at line 213 of file agm.h.

References Theta.

213 { _Theta = Theta; }
TFltV Theta
Definition: agm.h:198
static PLogRegPredict TLogRegPredict::Load ( TSIn SIn)
inlinestatic

Definition at line 204 of file agm.h.

References TLogRegPredict().

204 { return new TLogRegPredict(SIn); };
TLogRegPredict(const TFltV &_bb)
Definition: agm.h:200

Here is the call graph for this function:

void TLogRegPredict::PrintTheta ( )
inline

Definition at line 215 of file agm.h.

References TVec< TVal, TSizeTy >::Len().

215 { for (int t = 0; t < Theta.Len(); t++) { printf("Theta[%d] = %f\n", t, Theta[t].Val); } }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:575
TFltV Theta
Definition: agm.h:198

Here is the call graph for this function:

void TLogRegPredict::Save ( TSOut SOut) const
inline

Definition at line 205 of file agm.h.

References TVec< TVal, TSizeTy >::Save().

205 { Theta.Save(SOut); };
void Save(TSOut &SOut) const
Definition: ds.h:954
TFltV Theta
Definition: agm.h:198

Here is the call graph for this function:

TLogRegPredict::UndefDefaultCopyAssign ( TLogRegPredict  )

Friends And Related Function Documentation

friend class TPt< TLogRegPredict >
friend

Definition at line 216 of file agm.h.

Member Data Documentation

TCRef TLogRegPredict::CRef
private

Definition at line 196 of file agm.h.

TFltV TLogRegPredict::Theta
private

Definition at line 198 of file agm.h.

Referenced by GetTheta().


The documentation for this class was generated from the following files: