latex

Multirow issues in Table in Latex/Overleaf


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.


Solution

  • There are a couple of syntax errors:

    Some other comments:

    \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}
    

    enter image description here