\section{Average\+Interpolation Class Reference}
\label{classmlpack_1_1cf_1_1AverageInterpolation}\index{Average\+Interpolation@{Average\+Interpolation}}


This class performs average interpolation to generate interpolation weights for neighborhood-\/based collaborative filtering.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Average\+Interpolation} ()
\item 
\textbf{ Average\+Interpolation} (const arma\+::sp\+\_\+mat \&)
\begin{DoxyCompactList}\small\item\em This constructor is needed for interface consistency. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Vector\+Type , typename Decomposition\+Policy $>$ }\\void \textbf{ Get\+Weights} (Vector\+Type \&\&weights, const Decomposition\+Policy \&, const size\+\_\+t, const arma\+::\+Col$<$ size\+\_\+t $>$ \&neighbors, const arma\+::vec \&, const arma\+::sp\+\_\+mat \&)
\begin{DoxyCompactList}\small\item\em Interoplation weights are identical and sum up to one. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
This class performs average interpolation to generate interpolation weights for neighborhood-\/based collaborative filtering. 

An example of how to use \doxyref{Average\+Interpolation}{p.}{classmlpack_1_1cf_1_1AverageInterpolation} in CF is shown below\+:


\begin{DoxyCode}
\textcolor{keyword}{extern} arma::mat data; \textcolor{comment}{// data is a (user, item, rating) table.}
\textcolor{comment}{// Users for whom recommendations are generated.}
\textcolor{keyword}{extern} arma::Col<size\_t> users;
arma::Mat<size\_t> recommendations; \textcolor{comment}{// Resulting recommendations.}

CFType<> cf(data);

\textcolor{comment}{// Generate 10 recommendations for all users.}
cf.template GetRecommendations<EuclideanSearch,
                               AverageInterpolation>(10, recommendations);
\end{DoxyCode}
 

Definition at line 39 of file average\+\_\+interpolation.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1cf_1_1AverageInterpolation_a0fc6829b9ccd30f4e79cb01389d5ef0c}} 
\index{mlpack\+::cf\+::\+Average\+Interpolation@{mlpack\+::cf\+::\+Average\+Interpolation}!Average\+Interpolation@{Average\+Interpolation}}
\index{Average\+Interpolation@{Average\+Interpolation}!mlpack\+::cf\+::\+Average\+Interpolation@{mlpack\+::cf\+::\+Average\+Interpolation}}
\subsubsection{Average\+Interpolation()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \textbf{ Average\+Interpolation} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Definition at line 43 of file average\+\_\+interpolation.\+hpp.

\mbox{\label{classmlpack_1_1cf_1_1AverageInterpolation_a48e88c343985e5407cd1e3f1a3d273d6}} 
\index{mlpack\+::cf\+::\+Average\+Interpolation@{mlpack\+::cf\+::\+Average\+Interpolation}!Average\+Interpolation@{Average\+Interpolation}}
\index{Average\+Interpolation@{Average\+Interpolation}!mlpack\+::cf\+::\+Average\+Interpolation@{mlpack\+::cf\+::\+Average\+Interpolation}}
\subsubsection{Average\+Interpolation()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \textbf{ Average\+Interpolation} (\begin{DoxyParamCaption}\item[{const arma\+::sp\+\_\+mat \&}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



This constructor is needed for interface consistency. 



Definition at line 48 of file average\+\_\+interpolation.\+hpp.



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1cf_1_1AverageInterpolation_ac92ff2a2cfcb48bda46221a1a31de9b3}} 
\index{mlpack\+::cf\+::\+Average\+Interpolation@{mlpack\+::cf\+::\+Average\+Interpolation}!Get\+Weights@{Get\+Weights}}
\index{Get\+Weights@{Get\+Weights}!mlpack\+::cf\+::\+Average\+Interpolation@{mlpack\+::cf\+::\+Average\+Interpolation}}
\subsubsection{Get\+Weights()}
{\footnotesize\ttfamily void Get\+Weights (\begin{DoxyParamCaption}\item[{Vector\+Type \&\&}]{weights,  }\item[{const Decomposition\+Policy \&}]{,  }\item[{const size\+\_\+t}]{,  }\item[{const arma\+::\+Col$<$ size\+\_\+t $>$ \&}]{neighbors,  }\item[{const arma\+::vec \&}]{,  }\item[{const arma\+::sp\+\_\+mat \&}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Interoplation weights are identical and sum up to one. 

After getting the weights, CF algorithm multiplies each neighbor\textquotesingle{}s rating by its corresponding weight and sums them to get predicted rating.


\begin{DoxyParams}{Parameters}
{\em weights} & Resulting interpolation weights. The size of weights should be set to the number of neighbors before calling \doxyref{Get\+Weights()}{p.}{classmlpack_1_1cf_1_1AverageInterpolation_ac92ff2a2cfcb48bda46221a1a31de9b3}. \\
\hline
{\em decomposition} & Decomposition object. \\
\hline
{\em query\+User} & Queried user. \\
\hline
{\em neighbors} & Neighbors of queried user. \\
\hline
{\em similarities} & Similarites between query user and neighbors. \\
\hline
{\em cleaned\+Data} & Sparse rating matrix. \\
\hline
\end{DoxyParams}


Definition at line 65 of file average\+\_\+interpolation.\+hpp.



References Log\+::\+Fatal.



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.\+0/src/mlpack/methods/cf/interpolation\+\_\+policies/\textbf{ average\+\_\+interpolation.\+hpp}\end{DoxyCompactItemize}
