SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWLogisticLevenbergMarquardt Class Reference

Calculates model parameter estimates from logistic regression data using the Levenberg-Marquardt method. More...

#include <rw/analytics/loglevbg.h>

Inheritance diagram for RWLogisticLevenbergMarquardt:
RWRegressionCalc< double, bool >

Public Member Functions

 RWLogisticLevenbergMarquardt ()
 
 RWLogisticLevenbergMarquardt (const RWLogisticLevenbergMarquardt &rhs)
 
virtual void addObsToBaseCalc (const RWAddObservations< double, bool > &dataChange)
 
virtual void addPredToBaseCalc (const RWAddPredictors< double, bool > &dataChange)
 
virtual void calc (const RWGenMat< double > &predictors, const RWMathVec< bool > &observations)
 
virtual RWRegressionCalc< double, bool > * clone (void) const
 
virtual bool fail (void) const
 
virtual RWCString name (void) const
 
RWLogisticLevenbergMarquardtoperator= (const RWLogisticLevenbergMarquardt &)
 
virtual RWMathVec< double > parameters (void) const
 
virtual void removeObsFromBaseCalc (const RWRemoveObservations< double, bool > &dataChange)
 
virtual void removePredFromBaseCalc (const RWRemovePredictors< double, bool > &dataChange)
 
virtual void setBaseCalc (const RWGenMat< double > &r, const RWMathVec< bool > &o)
 
- Public Member Functions inherited from RWRegressionCalc< double, bool >
 RWRegressionCalc ()
 

Detailed Description

Class RWLogisticLevenbergMarquardt calculates model parameter estimates from logistic regression data using the Levenberg-Marquardt method, described in the Business Analysis Module User's Guide.

Synopsis
#include <rw/analytics/loglevbg.h>
Calculates model parameter estimates from logistic regression data using the Levenberg-Marquardt meth...
Definition loglevbg.h:74
Example
#include <rw/analytics/loglevbg.h>
#include <iostream>
int main() {
RWGenMat<double> predData = "5x2 [1 234 2 431 3
333 4 654 5 788]";
obsData[0] = obsData[3] = obsData[4] = true;
obsData[1] = obsData[2] = false;
mlCalc.calc(predData, obsData);
if (!mlCalc.fail()) {
std::cout << "Parameters:" << mlCalc.parameters() << std::endl;
} else {
std::cout << "Calculation failed" << std::endl;
}
return 0;
}
A templatized general matrix class.
Definition genmat.h:741
virtual bool fail(void) const
Definition loglevbg.h:196
virtual void calc(const RWGenMat< double > &predictors, const RWMathVec< bool > &observations)
virtual RWMathVec< double > parameters(void) const
A templatized vector class.
Definition mathvec.h:667
@ rwUninitialized
Definition defs.h:105

Constructor & Destructor Documentation

◆ RWLogisticLevenbergMarquardt() [1/2]

RWLogisticLevenbergMarquardt::RWLogisticLevenbergMarquardt ( )
inline

Constructs an empty RWLogisticLevenbergMarquardt object.

◆ RWLogisticLevenbergMarquardt() [2/2]

RWLogisticLevenbergMarquardt::RWLogisticLevenbergMarquardt ( const RWLogisticLevenbergMarquardt & rhs)
inline

Copy constructor.

Member Function Documentation

◆ addObsToBaseCalc()

virtual void RWLogisticLevenbergMarquardt::addObsToBaseCalc ( const RWAddObservations< double, bool > & dataChange)
inlinevirtual

Recalculates the regression model using an additional set of predictor-observation data pairs. This method offers the option of using results from the base calculation to calculate the coefficients for the larger data set. Consequently, this method can be called only when a base calculation has been set using setBaseCalc(). The input variable provides the additional data.

Reimplemented from RWRegressionCalc< double, bool >.

◆ addPredToBaseCalc()

virtual void RWLogisticLevenbergMarquardt::addPredToBaseCalc ( const RWAddPredictors< double, bool > & dataChange)
virtual

Expands the regression model to include new predictor variables. This method offers the option of using results from the base calculation to calculate the coefficients for the larger predictor set. Consequently, this method can be called only when a base calculation has been set using setBaseCalc(). The input variable contains the data for the added predictor variables.

Reimplemented from RWRegressionCalc< double, bool >.

◆ calc()

virtual void RWLogisticLevenbergMarquardt::calc ( const RWGenMat< double > & predictors,
const RWMathVec< bool > & observations )
virtual

Calculates the parameters for the regression model. Invoking this method does not affect the state of any existing base calculation.

Implements RWRegressionCalc< double, bool >.

◆ clone()

virtual RWRegressionCalc< double, bool > * RWLogisticLevenbergMarquardt::clone ( void ) const
inlinevirtual

Allocates and creates a clone, or exact copy, of the current instance, and returns a pointer to the copy. Caller is responsible for deleting the returned object.

Implements RWRegressionCalc< double, bool >.

◆ fail()

virtual bool RWLogisticLevenbergMarquardt::fail ( void ) const
inlinevirtual

Returns true if the calculation failed.

Implements RWRegressionCalc< double, bool >.

◆ name()

virtual RWCString RWLogisticLevenbergMarquardt::name ( void ) const
inlinevirtual

Returns the name of the calculation method.

Implements RWRegressionCalc< double, bool >.

◆ operator=()

RWLogisticLevenbergMarquardt & RWLogisticLevenbergMarquardt::operator= ( const RWLogisticLevenbergMarquardt & )

Assignment operator.

◆ parameters()

virtual RWMathVec< double > RWLogisticLevenbergMarquardt::parameters ( void ) const
virtual

Returns the parameters from the last calculation performed. If the calculation failed, and this method is called, an exception of type RWInternalErr is thrown.

Implements RWRegressionCalc< double, bool >.

◆ removeObsFromBaseCalc()

virtual void RWLogisticLevenbergMarquardt::removeObsFromBaseCalc ( const RWRemoveObservations< double, bool > & dataChange)
inlinevirtual

Modifies the regression model by removing a set of contiguous predictor-observation data pairs, and recalculating the parameters. This method offers the option of using results from the base calculation to calculate the coefficients for the smaller data set. Consequently, this method can be called only when a base calculation has been set using setBaseCalc(). The input variable indicates the indices of the rows to be removed from the regression matrix and from the observation vector used in the base calculation.

Reimplemented from RWRegressionCalc< double, bool >.

◆ removePredFromBaseCalc()

virtual void RWLogisticLevenbergMarquardt::removePredFromBaseCalc ( const RWRemovePredictors< double, bool > & dataChange)
virtual

Shrinks the regression model to exclude previously used predictor variables. This method offers the option of using results from the base calculation to calculate the coefficients for the smaller predictor set. Consequently, this method can be called only when a base calculation has been set using setBaseCalc(). The input variable indicates the indices of the columns to be removed from the regression matrix used in the base calculation.

Reimplemented from RWRegressionCalc< double, bool >.

◆ setBaseCalc()

virtual void RWLogisticLevenbergMarquardt::setBaseCalc ( const RWGenMat< double > & r,
const RWMathVec< bool > & o )
virtual

Calculates the coefficients for the input regression data and sets the base calculation to this calculation.

Reimplemented from RWRegressionCalc< double, bool >.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.