minimalization of cos-distance

204 Views Asked by At

About single perceptron problem Dim $X_n = \{w_1x_1, w_2x_2, w_3x_3, w_4x_4,......, w_nx_n\}$ as vector ($X_n$)supervised learning data

$\{x_1, x_2, x_3, x_4,......x_n\} $ are input values of analasing data.

$\{w_1, w_2, w_3, w_4,......w_n\} $are weight of $X$ we have a vector $Y_n\{y_1, y_2, y_3, y_4........y_n\}$ that is to be compared.

we will compare them by $cos\theta$-distance

$cos\theta = X_nY_n^T/|X||Y|$

the fomula above is Loss function.

if data $X_n$ is correct $cos\theta$ will be increaced, if not $cos \theta$ will decreace; how to adjust weight $\{w_1, w_2. w_3, ......w_n\}$

1

There are 1 best solutions below

0
On

Let $X = \begin{bmatrix}x_1 \\ x_2 \\ \vdots \\ x_n\end{bmatrix}$ be a $n$-dimensional vector. Let the weights $W$ also be an unknown vector, defined similarily.

Let $M = IX = \begin{bmatrix}x_1&&&\\&x_2&&\\&&\ddots&\\&&&x_n\end{bmatrix}$ be a diagonal matrix.

By adjusting the weights, you are transforming $X$ to some other vector. This is equivalent to a linear transformation, or a matrix-vector multiplication of $MW$.

To maximize the resulting cosine similarity between $MW$ and $Y$, just make sure $MW$ points in the same direction as $Y$, such that $MW = \alpha Y$, where $\alpha \in \mathbb{R^+}$.

If any diagonal elements in $M$ are zero, delete the entire row corresponding to that element. Cosine similarity is not affected. As a result, we have an invertible diagonal matrix $M$. The inverse of a diagonal matrix is the reciprocal of each diagonal element.

And we solved for the weights, $W = \alpha M^{-1} \cdot Y$. There are infinite solutions to $W$, and the set of solutions forms a line.