SNAP Library 3.0, User Reference  2016-07-20 17:56:49
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TLogRegPredict Class Reference

#include <agm.h>

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.

200 : Theta(_bb) { };
TFltV Theta
Definition: agm.h:198
TLogRegPredict::TLogRegPredict ( TSIn SIn)
inline

Definition at line 203 of file agm.h.

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

Member Function Documentation

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

Definition at line 933 of file agm.cpp.

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:547
void Gen(const TSizeTy &_Vals)
Constructs a vector (an array) of _Vals elements.
Definition: ds.h:495
double TLogRegPredict::GetCfy ( const TFltV AttrV,
const TFltV NewTheta 
)
static

Definition at line 922 of file agm.cpp.

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:547
const TVal & Last() const
Returns a reference to the last element of the vector.
Definition: ds.h:551
double TLogRegPredict::GetCfy ( const TFltV AttrV)
inline

Definition at line 212 of file agm.h.

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
void TLogRegPredict::GetCfy ( const TVec< TFltV > &  X,
TFltV OutV 
)
inline

Definition at line 214 of file agm.h.

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
void TLogRegPredict::GetTheta ( TFltV _Theta)
inline

Definition at line 213 of file agm.h.

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

Definition at line 204 of file agm.h.

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

Definition at line 215 of file agm.h.

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:547
TFltV Theta
Definition: agm.h:198
void TLogRegPredict::Save ( TSOut SOut) const
inline

Definition at line 205 of file agm.h.

205 { Theta.Save(SOut); };
void Save(TSOut &SOut) const
Definition: ds.h:903
TFltV Theta
Definition: agm.h:198
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.


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