\section{Gini\+Gain Class Reference}
\label{classmlpack_1_1tree_1_1GiniGain}\index{Gini\+Gain@{Gini\+Gain}}


The Gini gain, a measure of set purity usable as a fitness function (Fitness\+Function) for decision trees.  


\subsection*{Static Public Member Functions}
\begin{DoxyCompactItemize}
\item 
{\footnotesize template$<$bool Use\+Weights, typename Row\+Type , typename Weight\+Vec\+Type $>$ }\\static double \textbf{ Evaluate} (const Row\+Type \&labels, const size\+\_\+t num\+Classes, const Weight\+Vec\+Type \&weights)
\begin{DoxyCompactList}\small\item\em Evaluate the Gini impurity on the given set of 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 Gini impurity for the given number of classes. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
The Gini gain, a measure of set purity usable as a fitness function (Fitness\+Function) for decision trees. 

This is the exact same thing as the well-\/known Gini impurity, but negated---since the decision tree will be trying to maximize gain (and the Gini impurity would need to be minimized). 

Definition at line 27 of file gini\+\_\+gain.\+hpp.



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1tree_1_1GiniGain_a55301b1d670a7627f34d9a9e03b02cfb}} 
\index{mlpack\+::tree\+::\+Gini\+Gain@{mlpack\+::tree\+::\+Gini\+Gain}!Evaluate@{Evaluate}}
\index{Evaluate@{Evaluate}!mlpack\+::tree\+::\+Gini\+Gain@{mlpack\+::tree\+::\+Gini\+Gain}}
\subsubsection{Evaluate()}
{\footnotesize\ttfamily static double Evaluate (\begin{DoxyParamCaption}\item[{const Row\+Type \&}]{labels,  }\item[{const size\+\_\+t}]{num\+Classes,  }\item[{const Weight\+Vec\+Type \&}]{weights }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}, {\ttfamily [static]}}



Evaluate the Gini impurity on the given set of labels. 

Row\+Type should be an Armadillo vector that holds size\+\_\+t objects.

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} & Set of labels to evaluate Gini impurity on. \\
\hline
{\em num\+Classes} & Number of classes in the dataset. \\
\hline
{\em weights} & Weight of labels. \\
\hline
\end{DoxyParams}


Definition at line 62 of file gini\+\_\+gain.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1GiniGain_a67d1277fdaf085606937d4b523f615ba}} 
\index{mlpack\+::tree\+::\+Gini\+Gain@{mlpack\+::tree\+::\+Gini\+Gain}!Evaluate\+Ptr@{Evaluate\+Ptr}}
\index{Evaluate\+Ptr@{Evaluate\+Ptr}!mlpack\+::tree\+::\+Gini\+Gain@{mlpack\+::tree\+::\+Gini\+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 34 of file gini\+\_\+gain.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1GiniGain_a9d801bb1be5db5207213f846f224458f}} 
\index{mlpack\+::tree\+::\+Gini\+Gain@{mlpack\+::tree\+::\+Gini\+Gain}!Range@{Range}}
\index{Range@{Range}!mlpack\+::tree\+::\+Gini\+Gain@{mlpack\+::tree\+::\+Gini\+Gain}}
\subsubsection{Range()}
{\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 Gini impurity 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 203 of file gini\+\_\+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{ gini\+\_\+gain.\+hpp}\end{DoxyCompactItemize}
