여러 2차원 회귀를 시각화하는 전략은 무엇입니까?

여러 2차원 회귀를 시각화하는 전략은 무엇입니까?

제목보다 내용에서 내 질문을 더 명확하게 설명할 수 있기를 바랍니다. 특정 pgfplots 기술보다 시각화 전략에 관한 것일 수 있습니다. 문제는 2차원 입력의 회귀에 관한 것이지만 1차원 입력부터 시작하겠습니다.

내 실험에서 입력 x를 변경하고 출력 y를 관찰한다고 가정해 보겠습니다. 실험을 세 번 반복합니다. 플롯에는 결과가 표시됩니다(코드는 끝에 나열되어 있음).

1차원 입력의 다중 회귀

이제 내 실험에 두 개의 입력 x와 y와 출력 z가 있다고 가정합니다. 한 실험의 관찰 결과는 다음과 같이 그려질 수 있습니다.

2차원 입력의 회귀

그러나 반복 실험(예: 4~5회)의 경우 이러한 모든 결과가 포함된 3D 플롯은 다소 혼란스럽습니다. 평균 및 편차 도표는 더 좋아 보이지만 확실히 정보가 손실되었습니다. 다음은 실험이 두 번 반복되는 경우(두 세트의 관찰)의 예입니다. 플롯은 다음과 같습니다.

2차원 입력의 다중 회귀

이 사례(다중 xyz)를 더 잘 시각화할 수 있는 전략이 있나요? "더 좋다"는 것은 각각의 개별 실험이 명확하게 제시되고 여러 실험이 함께 제시되어 쉽게 비교할 수 있다는 의미일 것입니다.

참고로 이는 플롯을 생성하는 pgfplots 코드입니다.

다중 xyz 플롯:

\begin{tikzpicture}[scale=0.8]
\begin{axis}
  [scale only axis, width=0.35\textwidth,
  xlabel=x, ylabel=y, zlabel=z, title=Two dimensional input,]
  \addplot3[surf,mesh/rows=5] coordinates { 
    (0,0,0) (1,0,0) (2,0,0) (3,0,0) 
    (0,1,0.1) (1,1,0.3) (2,1,0.3) (3,1,0.4) 
    (0,2,0.15) (1,2,0.5) (2,2,0.5) (3,2,0.5) 
    (0,3,0.65) (1,3,0.60) (2,3,0.65) (3,3,0.45) 
    (0,4,0.8) (1,4,0.75) (2,4,0.85) (3,4,0.65) 
  }; 
 \addplot3[surf,mesh/rows=5] coordinates { 
    (0,0,0.1) (1,0,0.1) (2,0,0) (3,0,0) 
    (0,1,0.3) (1,1,0.2) (2,1,0.2) (3,1,0.4) 
    (0,2,0.15) (1,2,0.6) (2,2,0.5) (3,2,0.5) 
    (0,3,0.55) (1,3,0.7) (2,3,0.65) (3,3,0.45) 
    (0,4,0.6) (1,4,0.85) (2,4,0.65) (3,4,0.35) 
  }; 
\end{axis} 
\end{tikzpicture}
\begin{tikzpicture}[scale=0.8]
\begin{axis}[scale only axis, width=0.3\textwidth,
  xlabel=x, ylabel=y, zlabel=z, title=Mean and Deviation,]
  \addplot3[surf,mesh/rows=5,
    error bars/z dir=both, error bars/z fixed=0.1,] coordinates { 
    (0,0,0.05) (1,0,0.05) (2,0,0) (3,0,0) 
    (0,1,0.2) (1,1,0.25) (2,1,0.25) (3,1,0.4) 
    (0,2,0.15) (1,2,0.55) (2,2,0.5) (3,2,0.5) 
    (0,3,0.65) (1,3,0.65) (2,3,0.65) (3,3,0.45) 
    (0,4,0.7) (1,4,0.80) (2,4,0.75) (3,4,0.5) 
  }; 
\end{axis} 
\end{tikzpicture}

단일 xyz 플롯:

\begin{tikzpicture}[scale=0.8]
\begin{axis}
  [scale only axis, width=0.35\textwidth,
  xlabel=x, ylabel=y, zlabel=z, title=Two dimensional input,]
  \addplot3[surf,mesh/rows=5] coordinates { 
    (0,0,0) (1,0,0) (2,0,0) (3,0,0) 
    (0,1,0.1) (1,1,0.3) (2,1,0.3) (3,1,0.4) 
    (0,2,0.15) (1,2,0.5) (2,2,0.5) (3,2,0.5) 
    (0,3,0.65) (1,3,0.60) (2,3,0.65) (3,3,0.45) 
    (0,4,0.8) (1,4,0.75) (2,4,0.85) (3,4,0.65) 
  }; 
\end{axis} 
\end{tikzpicture}
\hfill
\begin{tikzpicture}[scale=0.8]
\begin{axis}[view={0}{90}, scale only axis, width=0.3\textwidth,
  xlabel=x, ylabel=y, zlabel=z, title=Top view of two dimensional input, ]
  \addplot3[surf,mesh/rows=5] coordinates { 
    (0,0,0) (1,0,0) (2,0,0) (3,0,0) 
    (0,1,0.1) (1,1,0.3) (2,1,0.3) (3,1,0.4) 
    (0,2,0.15) (1,2,0.5) (2,2,0.5) (3,2,0.5) 
    (0,3,0.65) (1,3,0.60) (2,3,0.65) (3,3,0.45) 
    (0,4,0.8) (1,4,0.75) (2,4,0.85) (3,4,0.65) 
  }; 
\end{axis} 
\end{tikzpicture}

다중 xy 플롯:

\begin{tikzpicture}
\begin{axis}
  [scale only axis, width=0.3\textwidth,
  xlabel=x, ylabel=y, title=One dimensional input]
  \addplot coordinates{(0, 0.6) (0.1, 0.25) (0.2, 0.1) (0.3, 0.06) (0.4, 0.02) (0.5, 0.01)};
  \addplot coordinates{(0, 0.7) (0.1, 0.1) (0.2, 0.125) (0.3, 0.08) (0.4, 0.016) (0.5, 0.02)};
  \addplot coordinates{(0, 0.5) (0.1, 0.15) (0.2, 0.15) (0.3, 0.10) (0.4, 0.012) (0.5, 0.03)};
  \legend{exp1, exp2, exp3}
\end{axis}
\end{tikzpicture}
\hfill
\begin{tikzpicture}
\begin{axis}
  [scale only axis, width=0.3\textwidth,
  xlabel=x, ylabel=y, title=Mean and Deviation]
  \addplot[ error bars/.cd, y dir=both, y explicit, ]
    coordinates{(0, 0.6)  +- (0, 0.1) 
                    (0.1, 0.1)  +- (0, 0.1)
                    (0.2, 0.125) +- (0, 0.025)
                    (0.3, 0.08) +- (0, 0.08) 
                    (0.4, 0.016) +- (0, 0.04)
                  (0.5, 0.02) +- (0, 0.02)};
\end{axis}
\end{tikzpicture}

하지만,

답변1

이 사진을 얻으려면..

여기에 이미지 설명을 입력하세요

...다음 명령을 시도해 보세요.

pdflatex example.tex; asy  -twosided *.asy; pdflatex example.tex

...이 예제를 컴파일합니다.

\documentclass[]{article}
\usepackage[]{asymptote}
\begin{document}
Two Dimensional Input

\vspace{3cm}
\begin{asy}
settings.render=4;
import three;
import graph3;
currentlight=White;
currentprojection=orthographic(3,-5,1,center=true);
size(5cm);
size3(5cm,5cm,5cm, IgnoreAspect);

render render=render(compression=Low,merge=true);
triple[][] t1 = 
{
 {(0,0,0), (1,0,0), (2,0,0), (3,0,0) }, 
 {(0,1,0.1), (1,1,0.3), (2,1,0.3), (3,1,0.4)}, 
 {(0,2,0.15), (1,2,0.5), (2,2,0.5), (3,2,0.5)},
 {(0,3,0.65), (1,3,0.60), (2,3,0.65), (3,3,0.45)},
 {(0,4,0.8), (1,4,0.75), (2,4,0.85), (3,4,0.65)}
};
triple[][] t2 = 
{
   {(0,0,0.1), (1,0,0.1), (2,0,0), (3,0,0)},
   {(0,1,0.3), (1,1,0.2), (2,1,0.2), (3,1,0.4)},
   {(0,2,0.15), (1,2,0.6), (2,2,0.5), (3,2,0.5)},
   {(0,3,0.55), (1,3,0.7), (2,3,0.65), (3,3,0.45)},
   {(0,4,0.6),(1,4,0.85),(2,4,0.65),(3,4,0.35)}
};

draw(surface(t1), blue+opacity(0.9));
draw(surface(t2), red+opacity(0.6));

xaxis3("$x$",Bounds,InTicks);
yaxis3("$y$",Bounds,InTicks);
zaxis3("$z$",Bounds,InTicks);

\end{asy}
\end{document}

분명히 pdflatex, 점근선 패키지 및 점근선이 시스템에 설치되어 있어야 합니다. 운이 좋으면 최신 버전의 Acrobat Reader를 사용하여 PDF를 열면 PDF에 대화형 3D 개체가 표시됩니다.

오늘날에도 나는 pgfplots로 이 작업을 수행할 수 있더라도(단순히 할 수는 없음) 매우 혼란스럽다는 Jake의 의견에 동의합니다.

답변2

pgfplots(이 아닌 ) 순수하게 사용하는 또 다른 유사한 솔루션은 표면에 옵션을 asymptote추가하는 것입니다 . opacity=0.5다음과 같이:

 \addplot3[surf,mesh/rows=5, opacity=0.5] coordinates { ...

불투명도 트릭

아직 완벽하지는 않지만 적어도 이미지는 물리적이며(고스트 표면이 상호 침투함) 불가능한 3D 개체를 생성하여 뇌를 손상시키지 않습니다. 이 트릭은 값이 0.5인 경우에만 작동합니다(즉, 표면이 다른 표면을 더 많이 덮지 않음). 그렇지 않으면 뇌가 이상하다고 생각하는 방식으로 표면이 겹치기 시작합니다.

오류 막대( )를 사용하여 동일한 트릭을 사용하여 opacity다음 효과를 얻을 수도 있습니다.

오류 막대가 있는 불투명도

다음은 마지막 그림의 전체 코드입니다.

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[scale=0.8]
\begin{axis}
  [scale only axis, width=0.35\textwidth,
  xlabel=x, ylabel=y, zlabel=z, title=Two dimensional input,]
  \addplot3[surf,mesh/rows=5,opacity=0.5] coordinates { 
    (0,0,0) (1,0,0) (2,0,0) (3,0,0) 
    (0,1,0.1) (1,1,0.3) (2,1,0.3) (3,1,0.4) 
    (0,2,0.15) (1,2,0.5) (2,2,0.5) (3,2,0.5) 
    (0,3,0.65) (1,3,0.60) (2,3,0.65) (3,3,0.45) 
    (0,4,0.8) (1,4,0.75) (2,4,0.85) (3,4,0.65) 
  }; 
 \addplot3[surf,mesh/rows=5, opacity=0.5] coordinates { 
    (0,0,0.1) (1,0,0.1) (2,0,0) (3,0,0) 
    (0,1,0.3) (1,1,0.2) (2,1,0.2) (3,1,0.4) 
    (0,2,0.15) (1,2,0.6) (2,2,0.5) (3,2,0.5) 
    (0,3,0.55) (1,3,0.7) (2,3,0.65) (3,3,0.45) 
    (0,4,0.6) (1,4,0.85) (2,4,0.65) (3,4,0.35) 
  }; 
  \addplot3[mesh/rows=5,
    error bars/z dir=both, error bars/z fixed=0.1, opacity=0.3, draw=none] coordinates { 
    (0,0,0.05) (1,0,0.05) (2,0,0) (3,0,0) 
    (0,1,0.2) (1,1,0.25) (2,1,0.25) (3,1,0.4) 
    (0,2,0.15) (1,2,0.55) (2,2,0.5) (3,2,0.5) 
    (0,3,0.65) (1,3,0.65) (2,3,0.65) (3,3,0.45) 
    (0,4,0.7) (1,4,0.80) (2,4,0.75) (3,4,0.5) 
  };
\end{axis} 
\end{tikzpicture}
\end{document}

관련 정보