\documentclass[varwidth=598pt]{standalone}

\usepackage{booktabs} % professional-quality tables
\usepackage{multirow} % multi-row cells in tables
\usepackage{colortbl} % color for tables (\cellcolor, \rowcolor)
\usepackage[table]{xcolor} % enhanced colors for tables
\usepackage{array} % more flexible column formats (often used)
\usepackage{tabularx} % for tables with auto-stretch columns (if used)
\usepackage{graphicx} % for images in tables or figure/table floats
\usepackage{amssymb} % math symbols
\usepackage{amsmath} % math environments
\usepackage{soul} % highlighting (used for colored text/cells)
\usepackage[normalem]{ulem} % underlining, strikethroughs
\usepackage[T1]{fontenc} % font encoding
\usepackage[utf8]{inputenc}% input encoding (legacy, fine for pdflatex)
\usepackage{microtype} % better text appearance
\usepackage{hyperref} % hyperlinks
\usepackage{textcomp} % for extra symbols
\usepackage{enumitem} % for compact lists (if used in table notes)
\usepackage{adjustbox}
\usepackage{tabu}
\usepackage{pifont} % http://ctan.org/pkg/pifont
\usepackage{bbding} % \XSolidBrush
\usepackage{makecell}

\begingroup
\makeatletter
\renewcommand{\fnum@table}{}%
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\centering #2\par
\vskip\belowcaptionskip
}
\makeatother

\begin{document}
\begin{table}
\centering
\begin{adjustbox}{max width=\textwidth}
\begin{tabular}{l | r| r | r | rr|rrrrr|rrr|rrrrrrrrrr|rrrrrr }
\toprule
& \bf \textit{O*} & \bf O & \multicolumn{1}{|c|}{\textbf{D}}
& \multicolumn{2}{|c|}{\textbf{Gender}} & \multicolumn{5}{|c|}{\textbf{Ethnicity}} & \multicolumn{3}{|c}{\textbf{SOr}} & \multicolumn{10}{|c}{\textbf{Gender+Ethnicity}} & \multicolumn{6}{|c}{\textbf{Gender+SOr}} \\

& & & & \bf \rotatebox{90}{M} &\bf \rotatebox{90}{F} &\bf \rotatebox{90}{W} &\bf \rotatebox{90}{A-A} &\bf \rotatebox{90}{B} &\bf \rotatebox{90}{H} &\bf \rotatebox{90}{As} &\bf \rotatebox{90}{Hetero} &\bf \rotatebox{90}{Bi} &\bf \rotatebox{90}{Homo} & \bf \rotatebox{90}{M+W} &\bf \rotatebox{90}{M+A-A} &\bf \rotatebox{90}{M+B} &\bf\rotatebox{90}{M+H} &\bf \rotatebox{90}{M+As} &\bf \rotatebox{90}{F+W} &\bf\rotatebox{90}{F+A-A} &\bf \rotatebox{90}{F+B} &\bf \rotatebox{90}{F+H} &\bf \rotatebox{90}{F+As} &\bf \rotatebox{90}{M+Hetero} & \bf \rotatebox{90}{M+Bi} & \bf \rotatebox{90}{M+Homo} &\bf \rotatebox{90}{F+Hetero} & \bf \rotatebox{90}{F+Bi} &\bf \rotatebox{90}{F+Homo}\\

\midrule
1
& \textit{\textbf{40}} & \textbf{39} & \textbf{40} & \textbf{40} & \textbf{40} & \textbf{40} & \textbf{38} & \textbf{39} & \textbf{39} & \textbf{36} & \textbf{38} & \textbf{38} & \textbf{37} & \textbf{39} & \textbf{37} & \textbf{41} & \textbf{40} & \textbf{40} & \textbf{40} & \textbf{36} & \textbf{40} & \textbf{41} & \textbf{40} & \textbf{41} & \textbf{41} & \textbf{36} & \textbf{41} & \textbf{40} & \textbf{36} \\

2
& \textit{28.9} &26 &25 &29 &27 &27 &26 &26 &27 &27 &28 &27 &26 &27 &27 &27 &26 &25 &27 &27 &27 &26 &24 &27 &27 &28 &25 &26 &25 \\

\bottomrule
\end{tabular}
\end{adjustbox}
\caption{Table 8: Accuracy (in percentages) of the biomedical and generic models on our demographically enhanced datasets. \textit{M}=male; \textit{F}=female; \textit{W}=White; \textit{B}=Black; \textit{A-A}=African-American; \textit{H}=Hispanic; \textit{As}=Asian; \textit{SOr}=sexual orientation; O*=original test dataset; O=the original, unmodified 100 questions; D=No demographic information; 1=Generic; 2=Biomedical. \label{accuracy_table_generic1}}
\end{table}
\end{document}