\section{Randomized\+S\+V\+D\+Policy Class Reference}
\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy}\index{Randomized\+S\+V\+D\+Policy@{Randomized\+S\+V\+D\+Policy}}


Implementation of the Randomized S\+VD policy to act as a wrapper when accessing Randomized S\+VD from within \doxyref{C\+F\+Type}{p.}{classmlpack_1_1cf_1_1CFType}.  


\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Randomized\+S\+V\+D\+Policy} (const size\+\_\+t iterated\+Power=0, const size\+\_\+t max\+Iterations=2)
\begin{DoxyCompactList}\small\item\em Use randomized S\+VD method to perform collaborative filtering. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Mat\+Type $>$ }\\void \textbf{ Apply} (const Mat\+Type \&, const arma\+::sp\+\_\+mat \&cleaned\+Data, const size\+\_\+t rank, const size\+\_\+t max\+Iterations, const double, const bool)
\begin{DoxyCompactList}\small\item\em Apply Collaborative Filtering to the provided data set using the randomized S\+VD. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Neighbor\+Search\+Policy $>$ }\\void \textbf{ Get\+Neighborhood} (const arma\+::\+Col$<$ size\+\_\+t $>$ \&users, const size\+\_\+t num\+Users\+For\+Similarity, arma\+::\+Mat$<$ size\+\_\+t $>$ \&neighborhood, arma\+::mat \&similarities) const
\begin{DoxyCompactList}\small\item\em Get the neighborhood and corresponding similarities for a set of users. \end{DoxyCompactList}\item 
double \textbf{ Get\+Rating} (const size\+\_\+t user, const size\+\_\+t item) const
\begin{DoxyCompactList}\small\item\em Return predicted rating given user ID and item ID. \end{DoxyCompactList}\item 
void \textbf{ Get\+Rating\+Of\+User} (const size\+\_\+t user, arma\+::vec \&rating) const
\begin{DoxyCompactList}\small\item\em Get predicted ratings for a user. \end{DoxyCompactList}\item 
const arma\+::mat \& \textbf{ H} () const
\begin{DoxyCompactList}\small\item\em Get the User Matrix. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Iterated\+Power} () const
\begin{DoxyCompactList}\small\item\em Get the size of the normalized power iterations. \end{DoxyCompactList}\item 
size\+\_\+t \& \textbf{ Iterated\+Power} ()
\begin{DoxyCompactList}\small\item\em Modify the size of the normalized power iterations. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Max\+Iterations} () const
\begin{DoxyCompactList}\small\item\em Get the number of iterations. \end{DoxyCompactList}\item 
size\+\_\+t \& \textbf{ Max\+Iterations} ()
\begin{DoxyCompactList}\small\item\em Modify the number of iterations. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Archive $>$ }\\void \textbf{ serialize} (Archive \&ar, const unsigned int)
\begin{DoxyCompactList}\small\item\em Serialization. \end{DoxyCompactList}\item 
const arma\+::mat \& \textbf{ W} () const
\begin{DoxyCompactList}\small\item\em Get the Item Matrix. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Implementation of the Randomized S\+VD policy to act as a wrapper when accessing Randomized S\+VD from within \doxyref{C\+F\+Type}{p.}{classmlpack_1_1cf_1_1CFType}. 

An example of how to use \doxyref{Randomized\+S\+V\+D\+Policy}{p.}{classmlpack_1_1cf_1_1RandomizedSVDPolicy} 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<RandomizedSVDPolicy> cf(data);

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

Definition at line 41 of file randomized\+\_\+svd\+\_\+method.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_a9d45e67639db6115370f474dd71acff4}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!Randomized\+S\+V\+D\+Policy@{Randomized\+S\+V\+D\+Policy}}
\index{Randomized\+S\+V\+D\+Policy@{Randomized\+S\+V\+D\+Policy}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{Randomized\+S\+V\+D\+Policy()}
{\footnotesize\ttfamily \textbf{ Randomized\+S\+V\+D\+Policy} (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{iterated\+Power = {\ttfamily 0},  }\item[{const size\+\_\+t}]{max\+Iterations = {\ttfamily 2} }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Use randomized S\+VD method to perform collaborative filtering. 


\begin{DoxyParams}{Parameters}
{\em iterated\+Power} & Size of the normalized power iterations (Default\+: rank + 2). \\
\hline
{\em max\+Iterations} & Number of iterations for the power method (Default\+: 2). \\
\hline
\end{DoxyParams}


Definition at line 52 of file randomized\+\_\+svd\+\_\+method.\+hpp.



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_ac34ecde0993c0456c23849a40b743931}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!Apply@{Apply}}
\index{Apply@{Apply}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{Apply()}
{\footnotesize\ttfamily void Apply (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{,  }\item[{const arma\+::sp\+\_\+mat \&}]{cleaned\+Data,  }\item[{const size\+\_\+t}]{rank,  }\item[{const size\+\_\+t}]{max\+Iterations,  }\item[{const double}]{,  }\item[{const bool}]{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Apply Collaborative Filtering to the provided data set using the randomized S\+VD. 


\begin{DoxyParams}{Parameters}
{\em $\ast$} & (data) Data matrix\+: dense matrix (coordinate lists) or sparse matrix(cleaned). \\
\hline
{\em cleaned\+Data} & item user table in form of sparse matrix. \\
\hline
{\em rank} & Rank parameter for matrix factorization. \\
\hline
{\em max\+Iterations} & Maximum number of iterations. \\
\hline
{\em $\ast$} & (min\+Residue) Residue required to terminate. \\
\hline
{\em $\ast$} & (mit) Whether to terminate only when max\+Iterations is reached. \\
\hline
\end{DoxyParams}


Definition at line 73 of file randomized\+\_\+svd\+\_\+method.\+hpp.



References Randomized\+S\+V\+D\+::\+Apply().

\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_a35bca7a6e09f4fb35b9945a9368711e4}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!Get\+Neighborhood@{Get\+Neighborhood}}
\index{Get\+Neighborhood@{Get\+Neighborhood}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{Get\+Neighborhood()}
{\footnotesize\ttfamily void Get\+Neighborhood (\begin{DoxyParamCaption}\item[{const arma\+::\+Col$<$ size\+\_\+t $>$ \&}]{users,  }\item[{const size\+\_\+t}]{num\+Users\+For\+Similarity,  }\item[{arma\+::\+Mat$<$ size\+\_\+t $>$ \&}]{neighborhood,  }\item[{arma\+::mat \&}]{similarities }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the neighborhood and corresponding similarities for a set of users. 


\begin{DoxyTemplParams}{Template Parameters}
{\em Neighbor\+Search\+Policy} & The policy to perform neighbor search.\\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em users} & Users whose neighborhood is to be computed. \\
\hline
{\em num\+Users\+For\+Similarity} & The number of neighbors returned for each user. \\
\hline
{\em neighborhood} & Neighbors represented by user I\+Ds. \\
\hline
{\em similarities} & Similarity between each user and each of its neighbors. \\
\hline
\end{DoxyParams}


Definition at line 129 of file randomized\+\_\+svd\+\_\+method.\+hpp.

\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_a0c3e16d73c8b25b8934cbc36ac161619}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!Get\+Rating@{Get\+Rating}}
\index{Get\+Rating@{Get\+Rating}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{Get\+Rating()}
{\footnotesize\ttfamily double Get\+Rating (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{user,  }\item[{const size\+\_\+t}]{item }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Return predicted rating given user ID and item ID. 


\begin{DoxyParams}{Parameters}
{\em user} & User ID. \\
\hline
{\em item} & Item ID. \\
\hline
\end{DoxyParams}


Definition at line 99 of file randomized\+\_\+svd\+\_\+method.\+hpp.

\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_ae5dc3895f0294bf054cb2ea58084a426}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!Get\+Rating\+Of\+User@{Get\+Rating\+Of\+User}}
\index{Get\+Rating\+Of\+User@{Get\+Rating\+Of\+User}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{Get\+Rating\+Of\+User()}
{\footnotesize\ttfamily void Get\+Rating\+Of\+User (\begin{DoxyParamCaption}\item[{const size\+\_\+t}]{user,  }\item[{arma\+::vec \&}]{rating }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get predicted ratings for a user. 


\begin{DoxyParams}{Parameters}
{\em user} & User ID. \\
\hline
{\em rating} & Resulting rating vector. \\
\hline
\end{DoxyParams}


Definition at line 111 of file randomized\+\_\+svd\+\_\+method.\+hpp.

\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_a71e6a6119b9efde17f4112c6d82d9233}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!H@{H}}
\index{H@{H}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{H()}
{\footnotesize\ttfamily const arma\+::mat\& H (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the User Matrix. 



Definition at line 158 of file randomized\+\_\+svd\+\_\+method.\+hpp.

\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_aa8e59edf3732bcceec0a214f9d049488}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!Iterated\+Power@{Iterated\+Power}}
\index{Iterated\+Power@{Iterated\+Power}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{Iterated\+Power()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily size\+\_\+t Iterated\+Power (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the size of the normalized power iterations. 



Definition at line 161 of file randomized\+\_\+svd\+\_\+method.\+hpp.

\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_aa06eded3fc0ec2f6bae88acc0395da57}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!Iterated\+Power@{Iterated\+Power}}
\index{Iterated\+Power@{Iterated\+Power}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{Iterated\+Power()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily size\+\_\+t\& Iterated\+Power (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the size of the normalized power iterations. 



Definition at line 163 of file randomized\+\_\+svd\+\_\+method.\+hpp.

\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_a420770944a5b0c7a852c4ec372c4a2d1}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!Max\+Iterations@{Max\+Iterations}}
\index{Max\+Iterations@{Max\+Iterations}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{Max\+Iterations()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily size\+\_\+t Max\+Iterations (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the number of iterations. 



Definition at line 166 of file randomized\+\_\+svd\+\_\+method.\+hpp.

\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_acda675ab4ab86b95c92bc33bc391a61b}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!Max\+Iterations@{Max\+Iterations}}
\index{Max\+Iterations@{Max\+Iterations}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{Max\+Iterations()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily size\+\_\+t\& Max\+Iterations (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the number of iterations. 



Definition at line 168 of file randomized\+\_\+svd\+\_\+method.\+hpp.

\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_af0dd9205158ccf7bcfcd8ff81f79c927}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!serialize@{serialize}}
\index{serialize@{serialize}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{serialize()}
{\footnotesize\ttfamily void serialize (\begin{DoxyParamCaption}\item[{Archive \&}]{ar,  }\item[{const unsigned}]{int }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Serialization. 



Definition at line 174 of file randomized\+\_\+svd\+\_\+method.\+hpp.

\mbox{\label{classmlpack_1_1cf_1_1RandomizedSVDPolicy_a0f733dde66e23287758de984b5151e36}} 
\index{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}!W@{W}}
\index{W@{W}!mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy@{mlpack\+::cf\+::\+Randomized\+S\+V\+D\+Policy}}
\subsubsection{W()}
{\footnotesize\ttfamily const arma\+::mat\& W (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the Item Matrix. 



Definition at line 156 of file randomized\+\_\+svd\+\_\+method.\+hpp.



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/var/www/mlpack.\+ratml.\+org/mlpack.\+org/\+\_\+src/mlpack-\/git/src/mlpack/methods/cf/decomposition\+\_\+policies/\textbf{ randomized\+\_\+svd\+\_\+method.\+hpp}\end{DoxyCompactItemize}
