\section{Regression\+Interpolation Class Reference}
\label{classmlpack_1_1cf_1_1RegressionInterpolation}\index{Regression\+Interpolation@{Regression\+Interpolation}}


Implementation of regression-\/based interpolation method.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Regression\+Interpolation} ()
\begin{DoxyCompactList}\small\item\em Empty Constructor. \end{DoxyCompactList}\item 
\textbf{ Regression\+Interpolation} (const arma\+::sp\+\_\+mat \&cleaned\+Data)
\begin{DoxyCompactList}\small\item\em Use cleaned\+Data to perform necessary preprocessing. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Vector\+Type , typename Decomposition\+Policy $>$ }\\void \textbf{ Get\+Weights} (Vector\+Type \&\&weights, const Decomposition\+Policy \&decomposition, const size\+\_\+t query\+User, const arma\+::\+Col$<$ size\+\_\+t $>$ \&neighbors, const arma\+::vec \&, const arma\+::sp\+\_\+mat \&cleaned\+Data)
\begin{DoxyCompactList}\small\item\em The regression-\/based interpolation problem can be solved by a linear system of equations. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Implementation of regression-\/based interpolation method. 

Predicting a user\textquotesingle{}s rating $ r_{iu} $ by it\textquotesingle{}s neighbors\textquotesingle{} ratings can be regarded as solving linear regression of $ r_{iu} $ on $ r_{iv} $, where v are u\textquotesingle{}s neighbors.

An example of how to use \doxyref{Regression\+Interpolation}{p.}{classmlpack_1_1cf_1_1RegressionInterpolation} 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,
    RegressionInterpolation>(10, recommendations);
\end{DoxyCode}


For more information, see the following paper.


\begin{DoxyCode}
@inproceedings\{bell2007improved,
 title=\{Improved neighborhood-based collaborative filtering\},
 author=\{Bell, Robert M and Koren, Yehuda\},
 booktitle=\{KDD cup and workshop at the 13th ACM SIGKDD international
     conference on knowledge discovery and data mining\},
 pages=\{7--14\},
 year=\{2007\},
 organization=\{Citeseer\}
\}
\end{DoxyCode}
 

Definition at line 56 of file regression\+\_\+interpolation.\+hpp.



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



Empty Constructor. 



Definition at line 62 of file regression\+\_\+interpolation.\+hpp.

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



Use cleaned\+Data to perform necessary preprocessing. 


\begin{DoxyParams}{Parameters}
{\em cleaned\+Data} & Sparse rating matrix. \\
\hline
\end{DoxyParams}


Definition at line 69 of file regression\+\_\+interpolation.\+hpp.



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



The regression-\/based interpolation problem can be solved by a linear system of equations. 

This method first calculates the coefficients and constant terms for the equations and then solve the equations. The solution of the linear system of equations is the resulting interpolation weights (the first parameter). 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_1RegressionInterpolation_ac1e5284cad449c49a0b5e026c5a795a7}. \\
\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 95 of file regression\+\_\+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{ regression\+\_\+interpolation.\+hpp}\end{DoxyCompactItemize}
