【问题标题】:MATLAB: build confidence regionMATLAB:建立置信区域
【发布时间】:2019-01-04 16:11:28
【问题描述】:

我正在尝试在 MATLAB 中以补丁方式执行图像异常检测。 对于图像中的每个补丁,我提取了一个6x1 特征向量g,其中每个分量都是一个指标。

我必须使用由下面的 sn-p 定义的置信区域cr(我无法发布图像),建立在正常补丁的所有特征向量上,并将其用于测试新补丁。

<a href="https://www.codecogs.com/eqnedit.php?latex=\dpi{100}&space;\mathcal{R}_{\gamma}=\lbrace\phi\in\mathbb{R}^6:&space;\sqrt{(\phi&space;-&space;\overline{\bf{g}})'\Sigma^{-1}(\phi-\overline{\bf{g}})}\leq\gamma\rbrace&space;\\\\&space;\text{where&space;$\overline{\bf{g}},$\Sigma$&space;are&space;the&space;average&space;and&space;the&space;sample&space;covariance&space;of&space;g}" target="_blank"><img src="https://latex.codecogs.com/gif.latex?\dpi{100}&space;\mathcal{R}_{\gamma}=\lbrace\phi\in\mathbb{R}^6:&space;\sqrt{(\phi&space;-&space;\overline{\bf{g}})'\Sigma^{-1}(\phi-\overline{\bf{g}})}\leq\gamma\rbrace&space;\\\\&space;\text{where&space;$\overline{\bf{g}},$\Sigma$&space;are&space;the&space;average&space;and&space;the&space;sample&space;covariance&space;of&space;g}" title="\mathcal{R}_{\gamma}=\lbrace\phi\in\mathbb{R}^6: \sqrt{(\phi - \overline{\bf{g}})'\Sigma^{-1}(\phi-\overline{\bf{g}})}\leq\gamma\rbrace \\\\ \text{where $\overline{\bf{g}},$\Sigma$ are the average and the sample covariance of g}" /></a>

非正式地,我想检查测试特征向量是否落在置信区域内,因此将补丁标记为normal,否则标记为anomalous

我很难理解如何使用 MATLAB 在 R6 中构建置信区域。我尝试过使用bootci,但是这样做cr 变成了2x6x6 矩阵,我不明白第三维的含义。任何帮助或建议表示赞赏! 谢谢。

【问题讨论】:

    标签: matlab multidimensional-array statistics confidence-interval data-fitting


    【解决方案1】:

    如果您只想对 6 维向量 φ 进行分类,只需在您的 sn-p 中应用公式即可。假设 sigmaInv 是样本协方差的倒数,并且 φ 和 g_bar 是列向量,即 size(phi) = size(g_bar) = (6,1) 那么

    s = (phi-g_bar)'*sigmaInv*(phi-g_bar) % note the ' after the first () = transpose
    

    是一个标量,sqrt(s) <= gamma 表示正常,相反表示异常。 (取平方根假设样本协方差是正定的)。 如果phig_bar 是行向量,那么公式应该在第二个括号后有转置:

    s = (phi-g_bar)*sigmaInv*(phi-g_bar)' %  apostrophe now after second ()
    

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-02
      • 1970-01-01
      • 2022-01-10
      相关资源
      最近更新 更多