AdaBoostDecisionTree class.
More...
#include <LArAdaBoostDecisionTree.h>
lar_content::AdaBoostDecisionTree::AdaBoostDecisionTree |
( |
| ) |
|
Constructor.
Definition at line 18 of file LArAdaBoostDecisionTree.cc.
StrongClassifier * m_pStrongClassifier
Strong adaptive boost tree classifier.
Copy constructor.
- Parameters
-
Definition at line 24 of file LArAdaBoostDecisionTree.cc.
StrongClassifier * m_pStrongClassifier
Strong adaptive boost tree classifier.
lar_content::AdaBoostDecisionTree::~AdaBoostDecisionTree |
( |
| ) |
|
Destructor.
Definition at line 41 of file LArAdaBoostDecisionTree.cc.
StrongClassifier * m_pStrongClassifier
Strong adaptive boost tree classifier.
Calculate the classification score for a set of input features, based on the trained model.
- Parameters
-
features | the input features |
- Returns
- the classification score
Implements lar_content::MvaInterface.
Definition at line 126 of file LArAdaBoostDecisionTree.cc.
double CalculateScore(const LArMvaHelper::MvaFeatureVector &features) const
Calculate score for input features using strong classifier.
Calculate the classification probability for a set of input features, based on the trained model.
- Parameters
-
features | the input features |
- Returns
- the classification probability
Implements lar_content::MvaInterface.
Definition at line 133 of file LArAdaBoostDecisionTree.cc.
double CalculateScore(const LArMvaHelper::MvaFeatureVector &features) const
Calculate score for input features using strong classifier.
Calculate score for input features using strong classifier.
- Parameters
-
features | the input features |
- Returns
- score
Definition at line 142 of file LArAdaBoostDecisionTree.cc.
146 std::cout <<
"AdaBoostDecisionTree: Attempting to use an uninitialized bdt" <<
std::endl;
147 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
155 catch (StatusCodeException &statusCodeException)
157 if (STATUS_CODE_NOT_FOUND == statusCodeException.GetStatusCode())
159 std::cout <<
"AdaBoostDecisionTree: Caught exception thrown when trying to cut on an unknown variable." <<
std::endl;
161 else if (STATUS_CODE_INVALID_PARAMETER == statusCodeException.GetStatusCode())
163 std::cout <<
"AdaBoostDecisionTree: Caught exception thrown when classifier weights sum to zero indicating defunct classifier." 166 else if (STATUS_CODE_OUT_OF_RANGE == statusCodeException.GetStatusCode())
168 std::cout <<
"AdaBoostDecisionTree: Caught exception thrown when heirarchy in decision tree is incomplete." <<
std::endl;
172 std::cout <<
"AdaBoostDecisionTree: Unexpected exception thrown." <<
std::endl;
175 throw statusCodeException;
double Predict(const LArMvaHelper::MvaFeatureVector &features) const
Predict signal or background based on trained data.
StrongClassifier * m_pStrongClassifier
Strong adaptive boost tree classifier.
QTextStream & endl(QTextStream &s)
Classify the set of input features based on the trained model.
- Parameters
-
features | the input features |
- Returns
- the classification
Implements lar_content::MvaInterface.
Definition at line 119 of file LArAdaBoostDecisionTree.cc.
double CalculateScore(const LArMvaHelper::MvaFeatureVector &features) const
Calculate score for input features using strong classifier.
StatusCode lar_content::AdaBoostDecisionTree::Initialize |
( |
const std::string & |
parameterLocation, |
|
|
const std::string & |
bdtName |
|
) |
| |
Initialize the bdt model.
- Parameters
-
parameterLocation | the location of the model |
bdtName | the name of the model |
- Returns
- success
Definition at line 48 of file LArAdaBoostDecisionTree.cc.
52 std::cout <<
"AdaBoostDecisionTree: AdaBoostDecisionTree was already initialized" <<
std::endl;
53 return STATUS_CODE_ALREADY_INITIALIZED;
56 TiXmlDocument xmlDocument(bdtXmlFileName);
58 if (!xmlDocument.LoadFile())
60 std::cout <<
"AdaBoostDecisionTree::Initialize - Invalid xml file." <<
std::endl;
61 return STATUS_CODE_INVALID_PARAMETER;
64 const TiXmlHandle xmlDocumentHandle(&xmlDocument);
65 TiXmlNode *pContainerXmlNode(TiXmlHandle(xmlDocumentHandle).FirstChildElement().Element());
67 while (pContainerXmlNode)
69 if (pContainerXmlNode->ValueStr() !=
"AdaBoostDecisionTree")
70 return STATUS_CODE_FAILURE;
72 const TiXmlHandle currentHandle(pContainerXmlNode);
75 PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(currentHandle,
"Name", currentName));
77 if (currentName.empty() || (currentName.size() > 1000))
79 std::cout <<
"AdaBoostDecisionTree::Initialize - Implausible AdaBoostDecisionTree name extracted from xml." <<
std::endl;
80 return STATUS_CODE_INVALID_PARAMETER;
83 if (currentName == bdtName)
86 pContainerXmlNode = pContainerXmlNode->NextSibling();
89 if (!pContainerXmlNode)
91 std::cout <<
"AdaBoostDecisionTree: Could not find an AdaBoostDecisionTree of name " << bdtName <<
std::endl;
92 return STATUS_CODE_NOT_FOUND;
95 const TiXmlHandle xmlHandle(pContainerXmlNode);
101 catch (StatusCodeException &statusCodeException)
105 if (STATUS_CODE_INVALID_PARAMETER == statusCodeException.GetStatusCode())
106 std::cout <<
"AdaBoostDecisionTree: Initialization failure, unknown component in xml file." <<
std::endl;
108 if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
109 std::cout <<
"AdaBoostDecisionTree: Node definition does not contain expected leaf or branch variables." <<
std::endl;
111 return statusCodeException.GetStatusCode();
114 return STATUS_CODE_SUCCESS;
StrongClassifier * m_pStrongClassifier
Strong adaptive boost tree classifier.
QTextStream & endl(QTextStream &s)
Assignment operator.
- Parameters
-
Definition at line 31 of file LArAdaBoostDecisionTree.cc.
StrongClassifier * m_pStrongClassifier
Strong adaptive boost tree classifier.
The documentation for this class was generated from the following files: