File size: 2,979 Bytes
88b8e22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
\documentclass[border=0.2cm]{standalone}

% Bar chart drawing library 
\usepackage{pgfplots} 
\pgfplotsset{compat=1.18}

% Define custom colors
\definecolor{testcolor}{RGB}{250, 164, 58}  % Orange for test

\begin{document}

% RMSE Graph
\begin{tikzpicture}
\begin{axis} [
    xbar = .05cm,
    bar width = 12pt, % Keep the original bar width
    xmin = 0, 
    xmax = 35, 
    at={(0cm,0)},
    enlarge y limits = {abs = .8},
    enlarge x limits = {value = .25, upper},
    title={Mean Squared Error Statistics},
    ytick={0,1,2},
    yticklabels={Decision Tree, Random Forest, XGBoost},
    xlabel={Mean Squared Error (MSE)},
    xmajorgrids, % Add gridlines on x-axis
    grid style={dashed, gray!30},
    legend style={at={(1.05,0.5)},
    anchor=west, legend columns=1}, % Adjusted for single line
    legend cell align={left},
]

% Train MSE values (colored in cyan)
\addplot[fill=cyan] coordinates {(35.32,0) (28.60,1) (21.78,2)}; 

% Test MSE values (colored in orange)
\addplot[fill=testcolor] coordinates {(36.69,0) (31.74,1) (28.70,2)}; 

\addlegendentry{Train} % Single legend entry for Train
\addlegendentry{Test}  % Single legend entry for Test

% Add annotations for MSE (Train)
\node at (axis cs:35.32,0) [yshift=-0.25cm, xshift=0.5cm] {35.32};
\node at (axis cs:28.60,1) [yshift=-0.25cm, xshift=0.5cm] {28.60};
\node at (axis cs:21.78,2) [yshift=-0.25cm, xshift=0.5cm] {21.78};

% Add annotations for MSE (Test)
\node at (axis cs:36.69,0) [yshift=0.25cm, xshift=0.5cm] {36.69};
\node at (axis cs:31.74,1) [yshift=0.25cm, xshift=0.5cm] {31.74};
\node at (axis cs:28.70,2) [yshift=0.25cm, xshift=0.5cm] {28.70};


\end{axis}

\begin{axis} [
    xbar = .05cm,
    bar width = 12pt, % Keep the original bar width
    xmin = 0, 
    xmax = 6, 
    at={(9cm,0)},
    title={Root Mean Squared Error Statistics},
    enlarge y limits = {abs = .8},
    enlarge x limits = {value = .25, upper},
    yticklabels=\empty,
    xlabel={Root Mean Squared Error (RMSE)},
    xmajorgrids, % Add gridlines on x-axis
    grid style={dashed, gray!30},
    legend style={at={(1.05,0.5)},
    anchor=west, legend columns=1}, % Adjusted for single line
    legend cell align={left},
]

% Train RMSE values (colored in light blue)
\addplot[fill=cyan] coordinates {(5.66,0) (5.11,1) (4.40,2)}; % Decision Tree, Random Forest, XGBoost

% Test RMSE values (colored in orange)
\addplot[fill=testcolor] coordinates {(5.76,0) (5.36,1) (5.04,2)}; % Decision Tree, Random Forest, XGBoost

% Add annotations for RMSE (Train)
\node at (axis cs:5.66,0) [yshift=-0.25cm, xshift=0.5cm] {5.66};
\node at (axis cs:5.31,1) [yshift=-0.25cm, xshift=0.5cm] {5.11};
\node at (axis cs:5.04,2) [yshift=-0.25cm, xshift=0.5cm] {4.40};

% Add annotations for RMSE (Test)
\node at (axis cs:5.66,0) [yshift=0.25cm, xshift=0.5cm] {5.76};
\node at (axis cs:5.31,1) [yshift=0.25cm, xshift=0.5cm] {5.36};
\node at (axis cs:5.04,2) [yshift=0.25cm, xshift=0.5cm] {5.04};

\end{axis}

\end{tikzpicture}

\end{document}