Rmarkdown 引用@bibtexkey
在 tablenotes 环境中使用时引用失败。有没有办法来解决这个问题?
表格中即将出现的 MWE 中的两个引文的 Bibtex 来源
@Article{Lundberg2017,
author = {Scott Lundberg and Su-In Lee},
title = {A Unified Approach to Interpreting Model Predictions},
abstract = {Understanding why a model makes a certain prediction can be as crucial as the prediction's accuracy in many applications. However, the highest accuracy for large modern datasets is often achieved by complex models that even experts struggle to interpret, such as ensemble or deep learning models, creating a tension between accuracy and interpretability. In response, various methods have recently been proposed to help users interpret the predictions of complex models, but it is often unclear how these methods are related and when one method is preferable over another. To address this problem, we present a unified framework for interpreting predictions, SHAP (SHapley Additive exPlanations). SHAP assigns each feature an importance value for a particular prediction. Its novel components include: (1) the identification of a new class of additive feature importance measures, and (2) theoretical results showing there is a unique solution in this class with a set of desirable properties. The new class unifies six existing methods, notable because several recent methods in the class lack the proposed desirable properties. Based on insights from this unification, we present new methods that show improved computational performance and/or better consistency with human intuition than previous approaches.},
date = {2017-05-22},
eprint = {1705.07874v2},
eprintclass = {cs.AI},
eprinttype = {arXiv},
file = {:http\://arxiv.org/pdf/1705.07874v2:PDF},
keywords = {cs.AI, cs.LG, stat.ML},
}
@Article{Amoukou2021,
author = {Salim I. Amoukou and Nicolas J-B. Brunel and Tangi Salaün},
title = {Accurate Shapley Values for explaining tree-based models},
abstract = {Although Shapley Values (SV) are widely used in explainable AI, they can be poorly understood and estimated, implying that their analysis may lead to spurious inferences and explanations. As a starting point, we remind an invariance principle for SV and derive the correct approach for computing the SV of categorical variables that are particularly sensitive to the encoding used. In the case of tree-based models, we introduce two estimators of Shapley Values that exploit the tree structure efficiently and are more accurate than state-of-the-art methods. Simulations and comparisons are performed with state-of-the-art algorithms and show the practical gain of our approach. Finally, we discuss the ability of SV to provide reliable local explanations. We also provide a Python package that computes our estimators at https://github.com/salimamoukou/acv00.},
date = {2021-06-07},
eprint = {2106.03820v2},
eprintclass = {stat.ML},
eprinttype = {arXiv},
file = {:http\://arxiv.org/pdf/2106.03820v2:PDF},
journaltitle = {AISTATS 2022},
keywords = {stat.ML, cs.LG},
}
表格的 MWE 及其表注中值得关注的引用:
\newcommand{\hlfancy}[2]{\sethlcolor{#1}\hl{#2}}
\begin{table}[!htbp]
\centering
\scriptsize
\captionsetup{labelsep=newline, justification=centering}
\begin{threeparttable}
\caption{\textit{SHAP Value calculation with bias }}
\begin{tabular}{*{5}{l}}
\toprule
& & \multicolumn{1}{c}{\makecell{\textbf{ Tree 1 }}}& & \\
\midrule
\multicolumn{1}{c}{\makecell{Feature \\ subset $(S)$}}& \multicolumn{1}{c}{\makecell{$f_x(S)$}} & \multicolumn{1}{c}{\makecell{$f_{x}(S \cup\{X_1\})$}} & \multicolumn{1}{c}{\makecell{$f_{x}(S \cup\{X_1\}$\\$ - f_x(S))$ }} & \multicolumn{1}{c}{\makecell{ $|S| !(M-|S|-1) !$}} \\
\midrule
\textit{$\emptyset$} &
\multicolumn{1}{c}{\makecell{$100$}} &
\multicolumn{1}{c}{\makecell{$\dfrac{100}{500} * 100 + \dfrac{400}{500} * 200 $\\$= 180$}} &
\multicolumn{1}{c}{\makecell{$80$}} &
\multicolumn{1}{c}{\makecell{$0.5$}}
\\
\midrule
\textit{\{$X_2$\}} &
\multicolumn{1}{c}{\makecell{\hlfancy{yellow}{$\dfrac{500}{1000}$}$ * 100+ $\hlfancy{yellow}{$\dfrac{500}{1000}$}$ * 200 $\\$= 150$}} &
\multicolumn{1}{c}{\makecell{$200$}} &
\multicolumn{1}{c}{\makecell{$50$}} &
\multicolumn{1}{c}{\makecell{$0.5$}}
\\
\midrule
\midrule
&&& \multicolumn{1}{c}{\makecell{SHAP value of $X_1$}} & \multicolumn{1}{c}{\makecell{$90$}} \\
\cmidrule{4-5}
\multicolumn{1}{c}{\makecell{Feature \\ subset $(S)$}}& \multicolumn{1}{c}{\makecell{$f_x(S)$}} & \multicolumn{1}{c}{\makecell{$f_{x}(S \cup\{X_2\})$}} & \multicolumn{1}{c}{\makecell{$f_{x}(S \cup\{X_2\} $\\$ - f_x(S))$ }} & \multicolumn{1}{c}{\makecell{ $|S| !(M-|S|-1) !$}} \\
\midrule
\textit{$\emptyset$} &
\multicolumn{1}{c}{\makecell{$100$}} &
\multicolumn{1}{c}{\makecell{\hlfancy{yellow}{$\dfrac{500}{1000}$}$ * 100 + $\hlfancy{yellow}{$\dfrac{500}{1000}$}$ * 200 $\\$= 150$}} &
\multicolumn{1}{c}{\makecell{$50$}} &
\multicolumn{1}{c}{\makecell{$0.5$}}
\\
\midrule
\textit{\{$X_1$\}} &
\multicolumn{1}{c}{\makecell{$\dfrac{100}{500} * 100 + \dfrac{400}{500} * 200 $\\$= 180$}} &
\multicolumn{1}{c}{\makecell{$200$}} &
\multicolumn{1}{c}{\makecell{$20$}} &
\multicolumn{1}{c}{\makecell{$0.5$}}
\\
\midrule
\midrule
&&& \multicolumn{1}{c}{\makecell{SHAP value of $X_2$}} & \multicolumn{1}{c}{\makecell{$35$}} \\
\cmidrule{4-5}
& & \multicolumn{1}{c}{\makecell{\textbf{ Tree 2 }}}& & \\
\midrule
\multicolumn{1}{c}{\makecell{Feature \\ subset $(S)$}}& \multicolumn{1}{c}{\makecell{$f_x(S)$}} & \multicolumn{1}{c}{\makecell{$f_{x}(S \cup\{X_1\})$}} & \multicolumn{1}{c}{\makecell{$f_{x}(S \cup\{X_1\} $\\$ - f_x(S))$}} & \multicolumn{1}{c}{\makecell{ $|S| !(M-|S|-1) !$}} \\
\midrule
\textit{$\emptyset$} &
\multicolumn{1}{c}{\makecell{$100$}} &
\multicolumn{1}{c}{\makecell{\hlfancy{yellow}{$\dfrac{500}{1000}$}$ * 100 + $\hlfancy{yellow}{$\dfrac{500}{1000}$}$ * 200 $\\$= 150$}} &
\multicolumn{1}{c}{\makecell{$50$}} &
\multicolumn{1}{c}{\makecell{$0.5$}}
\\
\midrule
\textit{\{$X_2$\}} &
\multicolumn{1}{c}{\makecell{$\dfrac{100}{500} * 100 + \dfrac{400}{500} * 200 $\\$= 180$}} &
\multicolumn{1}{c}{\makecell{$200$}} &
\multicolumn{1}{c}{\makecell{$20$}} &
\multicolumn{1}{c}{\makecell{$0.5$}}
\\
\midrule
\midrule
&&& \multicolumn{1}{c}{\makecell{SHAP value of $X_1$}} & \multicolumn{1}{c}{\makecell{$35$}} \\
\cmidrule{4-5}
\multicolumn{1}{c}{\makecell{Feature \\ subset $(S)$}}& \multicolumn{1}{c}{\makecell{$f_x(S)$}} & \multicolumn{1}{c}{\makecell{$f_{x}(S \cup\{X_2\})$}} & \multicolumn{1}{c}{\makecell{$f_{x}(S \cup\{X_2\} $\\$ - f_x(S))$}} &
\multicolumn{1}{c}{\makecell{ $|S| !(M-|S|-1) !$}} \\
\midrule
\textit{$\emptyset$} &
\multicolumn{1}{c}{\makecell{$100$}} &
\multicolumn{1}{c}{\makecell{$\dfrac{100}{500} * 100 + \dfrac{400}{500} * 200 $\\$ = 180$}} &
\multicolumn{1}{c}{\makecell{$80$}} &
\multicolumn{1}{c}{\makecell{$0.5$}}
\\
\midrule
\textit{\{$X_1$\}} &
\multicolumn{1}{c}{\makecell{\hlfancy{yellow}{$\dfrac{500}{1000}$}$ * 100 + $\hlfancy{yellow}{$\dfrac{500}{1000}$}$ * 200 $\\$= 150$}} &
\multicolumn{1}{c}{\makecell{$200$}} &
\multicolumn{1}{c}{\makecell{$50$}} &
\multicolumn{1}{c}{\makecell{$0.5$}}
\\
\midrule
\midrule
&&& \multicolumn{1}{c}{\makecell{SHAP value of $X_2$}} &
\multicolumn{1}{c}{\makecell{$90$}} \\
\cmidrule{4-5}
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]
\small
\item \textit{Note.} SHAP values were calculated using equation 2 of @Lundberg2017. In case of $|S|=\emptyset$ the author considered $0! = 1$. Highlighted parts of the calculation are weights which cause the bias of the SHAP values, argued by @Amoukou2021.
\end{tablenotes}
\label{tab:SHAP_bias}
\end{threeparttable}
\end{table}
答案1
Rmarkdown 语法可以包括原始 LaTeX 命令和 LaTeX 环境,但在 LaTeX 命令和 LaTeX 环境内不能包括 rmarkdown 语法。
您不应该使用 @bibtexkey
内部 Latex 代码,而应该使用等效的 LaTeX 命令(这可能会根据文档设置而改变,在纯 markdown 文本之间设置keep_tex: yes
和使用@bibtexkey
,以查看在您的情况下如何准确导出)。