WUT_Computer_Science/Programming/EARIN/project/preliminary/sections/01-algorithm-description-and-examples.tex
Krzysztof kuhy Rudnicki ffa5dad02a Split 19 over-cap LaTeX reports, proving each PDF is unchanged
The 250-line cap applies to prose too, and the reports were the worst
offenders -- ENUME's projectA.tex alone was 1,876 lines. Each is now a
preamble plus one \input{} per section, which is how a long LaTeX document is
normally organised; not one byte of prose was rewritten.

"The PDF is unchanged" is checked by a script rather than by eye, because
hashing the PDF cannot work: pdflatex stamps a /CreationDate and an /ID into
every build, so two runs of the SAME source already differ. tex_fingerprint.sh
compares what a reader sees instead -- page count plus a hash of the extracted
text -- and it is stable across rebuilds of untouched sources, which is the
property that makes it usable as a gate.

It earned its keep immediately. Both ECOTE reports quote an example LaTeX
document inside an lstlisting block, so \end{document} appears in the middle
of the file; splitting on the FIRST one stranded everything after it. Same
page count, different text, caught automatically. EOPSY lab3 exposed a second
bug: a \section{} title that runs onto the next line.

Result: 19 .tex over the cap -> 1. The survivor,
ELAC/.../03-building-nfa-...tex, is 418 lines of consecutive tikz figures
with no subsection to split on and needs a hand-placed boundary.

Verified: 29 splits across two passes (section, then subsection for the
pieces still over), every one reporting `unchanged` from
scripts/tex_fingerprint.sh --check.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172dj34FDpao6wsix8ZuCzE
2026-08-28 19:47:12 +02:00

70 lines
6.6 KiB
TeX
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

\section{Algorithm description and examples}
We will be using the collaborative filtering approach to develop our model. \\
Collaborative filtering is a popular method for making personalized recommendations based on the preferences of other users with similar tastes. In this approach, the recommendation system analyzes a large data-set of user-item ratings to identify patterns and similarities between users and anime's, and uses this information to make recommendations to new users.
We will represent users and anime's data-sets as embedding vectors. Embeddings provide a way to transform high-dimensional data into a lower-dimensional space while preserving relevant relationships.
We have decided to use and test multiple metrics such as
\begin{itemize}
\item Cosine similarity
\item Mahalanobis Distance
\item Euclidean Distance
\end{itemize}
together with K-nearest neighbors algorithm. \\
\subsection{Embedding users and anime}
In order to embed users and anime we must choose which features of the user/anime are the most important for our model \\
For the user we are restricted to what database offers, database pretty much only offers us what ratings the user gave to an anime, we will compare the performance of our algorithm when:
\begin{itemize}
\item Given ratings of the user for all anime that they gave rating to (no matter the watching status)
\item Given ratings of the user for all anime that they have \emph{completed}
\end{itemize}
For anime we will use data:
\begin{itemize}
\item User score
\item Popularity (this includes popularity itself, number of members and favourites)
\item Controversy (Whether the anime gets a lot of 1s and 10s or just 6s)
\end{itemize}
We have decided to use two different methods to combine data and compare the results \\
First method is dot product which gives a single number after multiplying two vectors \\
The second is concatenation which returns a new vector combining first and second vector \\
As an input for all our metrics (like cosine similarity) we will use vectors of anime and users
\subsection{Metrics}
%\emph{Cosine similarity} is a metric used to compute the similarity between two users based on their ratings or preferences for anime. In our case, we will use cosine similarity to compute the similarity between each pair of users in our data-set based on their anime ratings. This will result in a similarity matrix, where each entry (i,j) represents the cosine similarity between users i and j.
\paragraph{Cosine similarity} is a measure used to calculate the similarity between two vectors representing items or users. It evaluates the cosine of the angle between the two vectors, indicating their directional similarity. In our use case, cosine similarity can help identify items or users with similar preferences or characteristics by comparing their embedding vectors. Higher cosine similarity values (closer to 1) indicate a stronger similarity between the vectors, suggesting that the items or users are more likely to have similar features or preferences.
\paragraph{Mahalanobis distance} is a metric that takes into account the correlations between variables when measuring the distance between two vectors. In our recommendation system, we can leverage Mahalanobis distance to quantify the dissimilarity between the embedding vectors of items or users. By considering the correlations within the embedding dimensions, Mahalanobis distance provides a more accurate measure of dissimilarity. It helps identify items or users that are dissimilar based on their characteristics or preferences, accounting for the relationships between different features.
\paragraph{Euclidean distance} is a widely used metric to calculate the straight-line distance between two points in a multi-dimensional space. In our use case, we can apply Euclidean distance to measure the dissimilarity between the embedding vectors of items or users. By comparing the corresponding dimensions of the vectors and calculating the square root of the sum of squared differences, Euclidean distance provides a simple and intuitive measure of dissimilarity. It helps identify items or users that are relatively far apart in terms of their characteristics or preferences, based on the geometric distance in the embedding space.
%\subsubsection{Cosine similarity input}
%TUTAJ MA BYĆ INNY TEKST A NIE KNN
\paragraph{KNN} is a machine learning algorithm that we will use to find the K most similar users to a target user in the similarity matrix. The K most similar users will be our nearest neighbors, and we will use their ratings to generate recommendations for the target user. The number of nearest neighbors (K) that we choose will depend on the performance of our recommendation system on the validation set. We will experiment with different values of K and different weighting schemes for the ratings of the nearest neighbors to optimize the performance of our recommendation system. \\
%\paragraph{Euclidean distance} measures distance between two points in a straight line. It is used to measure similarity between points. Points that are closer to each other are considered to be similar. We can use it for finding nearest neighbors and clusters.
%\paragraph{Mahalonobis distance} again measures distance between two points but this time it takes into consideration how different elements of data-set relate to each other. This should be an advantage over Euclidean distance which assumes that all inputs are independent of each other.
\subsection{Data used for recommendation}
In addition to users and their rating for anime, we will also use measures of:
\begin{itemize}
\item Controversy - Anime with lots of ’1’ and ’10 might have the exact same rating as anime with mostly ’6’ but it is much more
controversial (hit or miss) and it can be a good recommendation even though its rating might seem low
\item Combined data about popularity - Number of favorites, number of members which are in the group for fans of a given anime and overall popularity on the site
\item Ranked - How good the anime is in comparison with other anime's on the site
\end{itemize}
%Collaborative filtering is a technique that recommends items based on the preferences of similar users or items. \\
%In our case, we will use the item-based collaborative filtering approach where we will recommend anime's based on their similarity to the input anime. \\
%Our model will use the cosine similarity metric to measure the similarity between anime's. \\
%We will also use a neighborhood-based approach to find the most similar anime's. \\
%Specifically, we will use the K-nearest neighbors (KNN) algorithm to identify the most similar anime's to the input anime.