yat  0.20.3pre
Public Member Functions | List of all members
theplu::yat::classifier::Perceptron Class Reference

A Single-layer Perceptron. More...

#include <yat/classifier/Perceptron.h>

Public Member Functions

const utility::Matrixcovariance (void) const
 
double oddsratio (size_t i) const
 
double oddsratio_lower_CI (size_t i, double alpha=0.05) const
 
double oddsratio_upper_CI (size_t i, double alpha=0.05) const
 
double p_value (size_t i) const
 
double predict (const utility::VectorBase &x) const
 
void train (const utility::MatrixBase &x, const Target &target)
 train the model More...
 
const utility::Vectorweight (void) const
 

Detailed Description

A Single-layer Perceptron.

Data are modeled as $ \mu = \frac{1}{1 + \exp(-wx)} $

Since
New in yat 0.16

Member Function Documentation

◆ covariance()

const utility::Matrix& theplu::yat::classifier::Perceptron::covariance ( void  ) const

Estimated covariance of weight vector.

Covariance is estimated as $ \left(X'SX\right)^{-1} $ where $ S $ is a diagnoal matrix with $ S_{ii} = \mu_i (1-\mu_i) $ where $ \mu_i $ is the expected value of sample i.

◆ oddsratio()

double theplu::yat::classifier::Perceptron::oddsratio ( size_t  i) const

The odds ratio is defined as $ \textrm{OR} = \exp(w_i) $

◆ oddsratio_lower_CI()

double theplu::yat::classifier::Perceptron::oddsratio_lower_CI ( size_t  i,
double  alpha = 0.05 
) const

The lower end of the confidence interval of estimation of oddsratio i with confidence 1 - alpha. The true value is estimated to be within confidence interval with probability 1 - alpha.

◆ oddsratio_upper_CI()

double theplu::yat::classifier::Perceptron::oddsratio_upper_CI ( size_t  i,
double  alpha = 0.05 
) const

The lower end of the confidence interval of estimation of oddsratio i with confidence 1 - alpha. The true value is estimated to be within confidence interval with probability 1 - alpha.

◆ p_value()

double theplu::yat::classifier::Perceptron::p_value ( size_t  i) const
Returns
p-value that for null hypothesis that ith weight is zero

◆ predict()

double theplu::yat::classifier::Perceptron::predict ( const utility::VectorBase x) const
Returns
$ \frac{1}{1 + \exp(-wx)} $

◆ train()

void theplu::yat::classifier::Perceptron::train ( const utility::MatrixBase x,
const Target target 
)

train the model

Model parameters, $w$, are calculated such that the log-likelihood, $ \log \mathcal{L} = \sum y_i \log \left(\mu_i\right) + (1-y_i) \log \left(1 - \mu_i\right) $, is maximized.

Parameters
xeach row corresponds to a data point and each column a feature.
targetdescribes the class label for each data point. Data that has binary set are trained to output 1.

◆ weight()

const utility::Vector& theplu::yat::classifier::Perceptron::weight ( void  ) const
Returns
trained weight vector, $w$.

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

Generated on Sat Feb 18 2023 03:31:44 for yat by  doxygen 1.8.14