Here is my Latex Code:
\documentclass[a4paper,oneside,11pt]{report}
\documentclass{standalone}
\usepackage{standalone}
\usepackage{multirow}
\usepackage{multicol}
\begin{document}
\begin{table}[h!]
\begin{center}
\caption{Algorithm Performance Evaluation Utilizing Different Features with 10-fold CV}
\label{tab:table2}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{2}{|cc|}{} & \multicolumn{3}{c|}{\textbf{Feature Sets}}\\
\hline
\textbf{Classifiers } & \textbf{Evaluation Metrics} & \textbf{TF-IDF} & \textbf{Unigram + Bigram} & \textbf{Bag of words}\\
\hline
& Accuracy & 0.540 & 0.672 & 0.528\\ \cline{2-5}
\multirow{Na\"{\i}ve Bayes} & Precision & 0.755 & 0.750 & 0.747\\ \cline{2-5}
& Recall & 0.188 & 0.565 & 0.157\\ \cline{2-5}
& F1 score & 0.300 & 0.644 & 0.258\\
\hline
& Accuracy & 0.687 & 0.728 & 0.686\\ \cline{2-5}
\multirow{SVM} & Precision & 0.692 & 0.769 & 0.719\\ \cline{2-5}
& Recall & 0.732 & 0.694 & 0.665\\ \cline{2-5}
& F1 score & 0.711 & 0.729 & 0.690\\
\hline
& Accuracy & 0.689 & 0.684 & 0.686\\ \cline{2-5}
\multirow{Random Forest} & Precision & 0.728 & 0.747 & 0.737\\ \cline{2-5}
& Recall & 0.655 & 0.609 & 0.629\\ \cline{2-5}
& F1 score & 0.689 & 0.669 & 0.678\\
\hline
& Accuracy & 0.646 & 0.660 & 0.654\\ \cline{2-5}
\multirow{Decision Tree} & Precision & 0.675 & 0.700 & 0.686\\ \cline{2-5}
& Recall & 0.635 & 0.622 & 0.635\\ \cline{2-5}
& F1 score & 0.654 & 0.659 & 0.659\\
\hline
& Accuracy & 0.639 & 0.644 & 0.645\\ \cline{2-5}
\multirow{Adaboost} & Precision & 0.641 & 0.664 & 0.664\\ \cline{2-5}
& Recall & 0.741 & 0.658 & 0.661\\ \cline{2-5}
& F1 score & 0.683 & 0.661 & 0.662\\
\hline
& Accuracy & 0.684 & 0.686 & 0.681\\ \cline{2-5}
\multirow{Gradient Boosting} & Precision & 0.696 & 0.702 & 0.706\\ \cline{2-5}
& Recall & 0.718 & 0.690 & 0.679\\ \cline{2-5}
& F1 score & 0.706 & 0.698 & 0.688\\
\hline
\end{tabular}\\
\end{center}
\end{table}
\end{document}
The Output is showing perfectly but why overleaf is showing this error
Undefined control sequence.
The code lines are highlighted with red color. I don't understand why this is happening, is there any required package missing? I'm new using latex.
There are a couple of syntax errors:
you can only have one document class.
\multicolumn
produces a single cell, you can only use one alignment specifier in the argument, instead of |cc|
it should be |c|
the syntax for \multirow
is \multirow[⟨vpos⟩]{⟨nrows⟩}[⟨bigstruts⟩]{⟨width⟩}[⟨vmove⟩]{⟨text⟩}
. At the very minimum, you need to specify all the mandatory arguments, so e.g. \multirow{4}{*}{some text here}
if you want the cell to span 4 rows. Put this in the first of the cells you want to merge, not in the middle one.
Some other comments:
you don't need the multicolumn
package for tables. The purpose of the package is to set the document in multiple columns
instead of the center
environment you should rather use \centering
to avoid the additional vertical space
your table is significantly too wide for your page geometry.
\documentclass[a4paper,oneside,11pt]{report}
%\documentclass{standalone}
\usepackage{standalone}
\usepackage{multirow}
\usepackage{multicol}
\begin{document}
\begin{table}[h!]
% \begin{center}
\centering
\caption{Algorithm Performance Evaluation Utilizing Different Features with 10-fold CV}
\label{tab:table2}
\begin{tabular}{|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{} & \multicolumn{3}{c|}{\textbf{Feature Sets}}\\
\hline
\textbf{Classifiers } & \textbf{Evaluation Metrics} & \textbf{TF-IDF} & \textbf{Unigram + Bigram} & \textbf{Bag of words}\\
\hline
\multirow{4}{*}{Na\"{\i}ve Bayes} & Accuracy & 0.540 & 0.672 & 0.528\\ \cline{2-5}
& Precision & 0.755 & 0.750 & 0.747\\ \cline{2-5}
& Recall & 0.188 & 0.565 & 0.157\\ \cline{2-5}
& F1 score & 0.300 & 0.644 & 0.258\\
\hline
\end{tabular}%\\
% \end{center}
\end{table}
\end{document}