Matrixstil ändern

Matrixstil ändern

Ich habe die folgenden Matrizen mit dem entsprechenden Code. Das angehängte Bild zeigt die Ausgabe. Da ich dieses Bild in eine akademische Arbeit einfügen muss, dachte ich, dass mein tatsächlicher Entwurf stilistisch etwas zu weit geht, d. h. ich muss ihn „mathematischer“ aussehen lassen.

\documentclass{standalone}
%\usepackage[showframe]{geometry}
\usepackage{tikz}
\definecolor{gris}{RGB}{250,250,250}
\usepackage{lmodern}
\usetikzlibrary{matrix,
    positioning}
\tikzset{
    mymatrix/.style = {matrix of nodes,
        nodes in empty cells,
        nodes={minimum height=3ex, minimum width=1em,
            inner sep=0pt, outer sep=0pt, anchor=center,
            draw, very thin,scale=0.8,transform shape},
        column sep=0pt,
        row sep=0pt,
        inner sep=0.5\pgflinewidth, outer sep=1pt,
        draw, thick},
    empty node/.style = {draw,fill=gris},
    every label/.append style = {font=\large, text=teal}
}
\makeatletter
\def\tikz@lib@matrix@empty@cell{%
    \iftikz@lib@matrix@empty%
    \node[name=\tikzmatrixname-\the\pgfmatrixcurrentrow-\the\pgfmatrixcurrentcolumn,empty node]{};\fi}
\makeatother

\usepackage{bm}
\newcommand{\MatrixVariable}[1]{\bm{{#1}}}

\begin{document}

    \begin{tikzpicture}[node distance=0pt,scale=0.6,nodes={transform
        shape}]
    \matrix (m1) [mymatrix,
    label={[rotate=90, anchor=south,black]left: Movies},
    label={[black]below:$\MatrixVariable{{R}}$},
    label={[black]above:Users},
    nodes={fill=gray!30}]
    {
        1   &   & 3 &   &   & 5 &   &   & 5 &   & 4 &   \\
        &   & 5 & 4 &   &   & 4 &   &   & 2 & 1 & 3 \\
        2   & 4 &   & 1 & 2 &   & 3 &   & 4 & 3 & 5 &   \\
        & 2 & 4 &   & 5 &   &   & 4 &   &   & 2 &   \\
        &   & 4 & 3 & 4 & 2 &   &   &   &   & 2 & 5 \\
        1   &   & 3 &   & 3 &   &   & 2 &   &   & 4 &   \\
    };
    \node (approx) [right=of m1,scale=2] {$\approx$};
    \matrix (m2) [mymatrix=none, right=0.1em of approx,
    label={[rotate=90, anchor=south east,xshift=-0.7em,black]left: Movies},
    label={[black]below:$\MatrixVariable{{Q}}$},
    label={[black]above:$f$-factors},
    nodes={minimum width=2.2em,fill=white}]
    {
        0.1& -0.4  & -0.2 \\
        -0.5& 0.6 & 0.5 \\
        -0.2& 0.3 &0.5  \\
        1.1& 2.1 & 0.3 \\
        -0.7&2.1  & -2 \\
        -1& 0.7 & 0.3 \\
    };
    \node (times) [right=of m2,scale=2] {$\cdot$};
    \matrix (m3) [mymatrix=none, right=of times,
    label={[rotate=90, anchor=north,black]right: $f$-factors},
    label={[black]below:$\MatrixVariable{{P}^{T}}$},
    label={[black]above:Users},
    nodes={minimum width=2em,fill=white}]
    {
        1.1&-2  & 0.3 & 0.5 &-2  &  -0.5 & 0.8 & -0.4 & 0.3 & 1.4 & 2.4 &  -0.9\\
        -0.8& 0.7 & 0.5 & 1.4 &0.3  & -1 & 1.4 & 2.9 & 0.7 & - 1.2 & 1.3& 0.4\\
        2.1& -0.4 & 0.6 & 1.7 & 2.4 & 0.9 & -0.3 & 0.4 &  0.8 &   0.7 & -0.6&0.1 \\
    };
    \end{tikzpicture}

\end{document}

Bildbeschreibung hier eingeben

Das ist, was ich im Sinn habe:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
    \[
    \begin{pmatrix}
    x_{11}       & x_{12} & x_{13} & \dots & x_{1n} \\
    x_{21}       & x_{22} & x_{23} & \dots & x_{2n} \\
    \hdotsfor{5} \\
    x_{d1}       & x_{d2} & x_{d3} & \dots & x_{dn}
    \end{pmatrix}
    =
    \begin{pmatrix}
    x_{11} & x_{12} & x_{13} & \dots  & x_{1n} \\
    x_{21} & x_{22} & x_{23} & \dots  & x_{2n} \\
    \vdots & \vdots & \vdots & \ddots & \vdots \\
    x_{d1} & x_{d2} & x_{d3} & \dots  & x_{dn}
    \end{pmatrix}
    \]
\end{document}

Bildbeschreibung hier eingeben

Ich habe einige Probleme mit den Bezeichnungen „Filme“, „Benutzer“ und „Faktoren“. Können Sie mir dabei helfen?

PS: Darüber habe ich auch nachgedacht, aber es wäre toll, weitere K-Faktoren hinzuzufügen:

Bildbeschreibung hier eingeben

Antwort1

Verwenden arrayundrotatebox

Bildbeschreibung hier eingeben

MWE

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\begin{document}
\[\begin{array}{ccc}
 \text{Users} & &  \text{factors}\\
    \rotatebox[origin=c]{90}{\text{Movies}}
    \begin{pmatrix}
    x_{11}       & x_{12} & x_{13} & \dots & x_{1n} \\
    x_{21}       & x_{22} & x_{23} & \dots & x_{2n} \\
    \hdotsfor{5} \\
    x_{d1}       & x_{d2} & x_{d3} & \dots & x_{dn}
    \end{pmatrix}
    &=&
    \rotatebox[origin=c]{90}{\text{Movies}}
    \begin{pmatrix}
    x_{11} & x_{12} & x_{13} & \dots  & x_{1n} \\
    x_{21} & x_{22} & x_{23} & \dots  & x_{2n} \\
    \vdots & \vdots & \vdots & \ddots & \vdots \\
    x_{d1} & x_{d2} & x_{d3} & \dots  & x_{dn}
    \end{pmatrix}
\end{array}\]
\end{document}

Antwort2

Vielleicht hat Ihnen gefallen:

Bildbeschreibung hier eingeben

\documentclass{article}
\usepackage{amsmath}
\begin{document}
    \[
    \underbrace{\!
    \begin{pmatrix}
    x_{11} & x_{12} & \dots  & x_{1n} \\
    x_{21} & x_{22} & \dots  & x_{2n} \\
    \vdots & \vdots & \ddots & \vdots \\
    x_{d1} & x_{d2} & \dots  & x_{dn}
    \end{pmatrix}\!
    }_{\mathbf{R}_{\text{Movies}\times \text{Users}}}
    \approx
    \underbrace{\!
    \begin{pmatrix}
    y_{11} & y_{12} & \dots  & y_{1n} \\
    y_{21} & y_{22} & \dots  & y_{2n} \\
    \vdots & \vdots & \ddots & \vdots \\
    y_{d1} & y_{d2} & \dots  & y_{dn}
    \end{pmatrix}\!
    }_{\mathbf{Q}_{\text{Movies}\times f\text{-factors}}}
    \cdot
    \underbrace{
    \begin{pmatrix}\!
    z_{11} & z_{12} & \dots  & z_{1n} \\
    z_{21} & z_{22} & \dots  & z_{2n} \\
    \vdots & \vdots & \ddots & \vdots \\
    z_{d1} & z_{d2} & \dots  & z_{dn}
    \end{pmatrix}\!
    }_{\mathbf{P}^T_{f\text{-factors}\times\text{Users}}}
    \]
\end{document}

verwandte Informationen