\section{Information\+Gain Class Reference}
\label{classmlpack_1_1tree_1_1InformationGain}\index{Information\+Gain@{Information\+Gain}}


The standard information gain criterion, used for calculating gain in decision trees.  


\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
static double \textbf{ Evaluate} (const arma\+::\+Mat$<$ size\+\_\+t $>$ \&counts)
\begin{DoxyCompactList}\small\item\em Given the sufficient statistics of a proposed split, calculate the information gain if that split was to be used. \end{DoxyCompactList}\item 
{\footnotesize template$<$bool Use\+Weights$>$ }\\static double \textbf{ Evaluate} (const arma\+::\+Row$<$ size\+\_\+t $>$ \&labels, const size\+\_\+t num\+Classes, const arma\+::\+Row$<$ double $>$ \&weights)
\begin{DoxyCompactList}\small\item\em Given a set of labels, calculate the information gain of those labels. \end{DoxyCompactList}\item 
{\footnotesize template$<$bool Use\+Weights, typename Count\+Type $>$ }\\static double \textbf{ Evaluate\+Ptr} (const Count\+Type $\ast$counts, const size\+\_\+t count\+Length, const Count\+Type total\+Count)
\begin{DoxyCompactList}\small\item\em Evaluate the Gini impurity given a vector of class weight counts. \end{DoxyCompactList}\item 
static double \textbf{ Range} (const size\+\_\+t num\+Classes)
\begin{DoxyCompactList}\small\item\em Return the range of the information gain for the given number of classes. \end{DoxyCompactList}\item 
static double \textbf{ Range} (const size\+\_\+t num\+Classes)
\begin{DoxyCompactList}\small\item\em Return the range of the information gain for the given number of classes. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
The standard information gain criterion, used for calculating gain in decision trees. 

Definition at line 25 of file information\+\_\+gain.\+hpp.



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1tree_1_1InformationGain_a578c636308efbd492ea30e62f05f4d63}} 
\index{mlpack\+::tree\+::\+Information\+Gain@{mlpack\+::tree\+::\+Information\+Gain}!Evaluate@{Evaluate}}
\index{Evaluate@{Evaluate}!mlpack\+::tree\+::\+Information\+Gain@{mlpack\+::tree\+::\+Information\+Gain}}
\subsubsection{Evaluate()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily static double Evaluate (\begin{DoxyParamCaption}\item[{const arma\+::\+Mat$<$ size\+\_\+t $>$ \&}]{counts }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Given the sufficient statistics of a proposed split, calculate the information gain if that split was to be used. 

The \textquotesingle{}counts\textquotesingle{} matrix should contain the number of points in each class in each column, so the size of \textquotesingle{}counts\textquotesingle{} is children x classes, where \textquotesingle{}children\textquotesingle{} is the number of child nodes in the proposed split.


\begin{DoxyParams}{Parameters}
{\em counts} & Matrix of sufficient statistics. \\
\hline
\end{DoxyParams}


Definition at line 31 of file information\+\_\+gain.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1InformationGain_a82f0cda1eb3b481f5fec6142e07b8053}} 
\index{mlpack\+::tree\+::\+Information\+Gain@{mlpack\+::tree\+::\+Information\+Gain}!Evaluate@{Evaluate}}
\index{Evaluate@{Evaluate}!mlpack\+::tree\+::\+Information\+Gain@{mlpack\+::tree\+::\+Information\+Gain}}
\subsubsection{Evaluate()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily static double Evaluate (\begin{DoxyParamCaption}\item[{const arma\+::\+Row$<$ size\+\_\+t $>$ \&}]{labels,  }\item[{const size\+\_\+t}]{num\+Classes,  }\item[{const arma\+::\+Row$<$ double $>$ \&}]{weights }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Given a set of labels, calculate the information gain of those labels. 

Note that it is possible that due to floating-\/point representation issues, it is possible that the gain returned can be very slightly greater than 0! Thus, if you are checking for a perfect fit, be sure to use \textquotesingle{}gain $>$= 0.\+0\textquotesingle{} not \textquotesingle{}gain == 0.\+0\textquotesingle{}.


\begin{DoxyParams}{Parameters}
{\em labels} & Labels of the dataset. \\
\hline
{\em num\+Classes} & Number of classes in the dataset. \\
\hline
\end{DoxyParams}


Definition at line 59 of file information\+\_\+gain.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1InformationGain_a67d1277fdaf085606937d4b523f615ba}} 
\index{mlpack\+::tree\+::\+Information\+Gain@{mlpack\+::tree\+::\+Information\+Gain}!Evaluate\+Ptr@{Evaluate\+Ptr}}
\index{Evaluate\+Ptr@{Evaluate\+Ptr}!mlpack\+::tree\+::\+Information\+Gain@{mlpack\+::tree\+::\+Information\+Gain}}
\subsubsection{Evaluate\+Ptr()}
{\footnotesize\ttfamily static double Evaluate\+Ptr (\begin{DoxyParamCaption}\item[{const Count\+Type $\ast$}]{counts,  }\item[{const size\+\_\+t}]{count\+Length,  }\item[{const Count\+Type}]{total\+Count }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Evaluate the Gini impurity given a vector of class weight counts. 



Definition at line 32 of file information\+\_\+gain.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1InformationGain_a9d801bb1be5db5207213f846f224458f}} 
\index{mlpack\+::tree\+::\+Information\+Gain@{mlpack\+::tree\+::\+Information\+Gain}!Range@{Range}}
\index{Range@{Range}!mlpack\+::tree\+::\+Information\+Gain@{mlpack\+::tree\+::\+Information\+Gain}}
\subsubsection{Range()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily static double Range (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{num\+Classes }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Return the range of the information gain for the given number of classes. 

(That is, the difference between the maximum possible value and the minimum possible value.) 

Definition at line 84 of file information\+\_\+gain.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1InformationGain_a9d801bb1be5db5207213f846f224458f}} 
\index{mlpack\+::tree\+::\+Information\+Gain@{mlpack\+::tree\+::\+Information\+Gain}!Range@{Range}}
\index{Range@{Range}!mlpack\+::tree\+::\+Information\+Gain@{mlpack\+::tree\+::\+Information\+Gain}}
\subsubsection{Range()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily static double Range (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{num\+Classes }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Return the range of the information gain for the given number of classes. 

(That is, the difference between the maximum possible value and the minimum possible value.)


\begin{DoxyParams}{Parameters}
{\em num\+Classes} & Number of classes in the dataset. \\
\hline
\end{DoxyParams}


Definition at line 202 of file information\+\_\+gain.\+hpp.



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/var/www/mlpack.\+ratml.\+org/mlpack.\+org/\+\_\+src/mlpack-\/3.\+3.\+1/src/mlpack/methods/decision\+\_\+tree/\textbf{ information\+\_\+gain.\+hpp}\end{DoxyCompactItemize}
