詹森不等式_注意詹森差距

詹森不等式

背景 (Background)

In Kaggle’s M5 Forecasting — Accuracy competition, the square root transformation ruined many of my team’s forecasts and led to a selective patching effort in the eleventh hour. Although it turned out well, we were reminded that “reconstitution bias” can plague predictions on the original scale, even with common transformations such as the square root.

在Kaggle的“ M5預測-準確性”競賽中 ,平方根轉換破壞了我團隊的許多預測,并在第11小時進行了選擇性修補工作。 盡管結果很好 ,但我們仍被提醒,“重構偏見”會困擾原始規模的預測,即使采用平方根之類的常見轉換也是如此。

平方根變換 (The square root transformation)

For Poisson data, the rationale of the square root is that it is a variance-stabilizing transformation; in theory, the square root of the values are distributed approximately normal with constant variance and a mean that is the square root of the original mean. It is an approximation, and as Wikipedia puts it, one in which the “convergence to normality (as [the original mean] increases) is far faster than the untransformed variable.

對于Poisson數據 ,平方根的基本原理是它是方差穩定的變換; 從理論上講,值的平方根近似分布,且具有恒定方差,且均值是原始均值的平方根。 正如Wikipedia所說 ,這是一種近似,其中“ 一化的收斂性(隨著(原始均值)的增加)比未轉換的變量快得多。

Imagine you decide to take square roots in a count data scenario, feeling good reassured that the convergence to normality is “fast.” You then model the mean of square-root transformed data and then get predictions on the square root scale. At some point, especially in a forecasting scenario, you’ll have to get back to the original scale. That probably entails squaring the model-estimated means. The M5 competition served as a reminder that this approach can and will break down.

想象一下,您決定在計數數據方案中求平方根,并確信向正態的收斂是“快速的”。 然后,您可以對平方根轉換后的數據的均值建模,然后獲得平方根尺度的預測。 在某些時候,尤其是在預測情況下,您必須回到原始比例。 這可能需要對模型估計的均方進行平方。 M5競賽提醒我們,這種方法可能并且將會失敗。

詹森差距 (The Jensen Gap)

Jensen’s Inequality states that for convex functions, the function evaluated at the expectation is less than or equal to the expectation of the function, i.e., g(E[Y]) ≤ E[g(Y)]. The inequality is flipped for concave functions.

Jensen不等式指出,對于凸函數,按期望評估的函數小于或等于該函數的期望,即g(E [Y])≤E [g(Y)]。 對于凹函數,不等式被翻轉。

Similarly, the Jensen Gap is defined as the difference E[g(Y)]-g(E[Y]), which is positive for convex functions g. (As an aside, notice that when g(x) is the square function, the Jensen Gap is the Variance of Y, which had better be non-negative!)

類似地, 詹森差距定義為差E [ g ( Y )]- g (E [ Y ]),對于凸函數g為正 (順便說一句, 請注意,當g ( x )是平方函數時,Jensen Gap Y的方差,最好是非負的!)

When considering g(x) as the square function and the square root of Y as the random variable, the Jensen Gap becomes E[Y]-E[sqrt(Y)]2. Since that quantity is positive, our reconstituted mean will be biased downward. To learn more about the magnitude of the gap, we turn to the Taylor expansion.

當將g ( x )作為平方函數并將Y的 平方根作為隨機變量時,Jensen Gap變為E [ Y ] -E [sqrt( Y )]2。 由于該數量為正,因此我們重構的均值將向下偏向。 要了解有關差距大小的更多信息,我們轉向泰勒展開。

泰勒展開至近似偏差 (Taylor expansion to approximate bias)

To the Mathematics StackExchange prompt “Expected Value of Square Root of Poisson Random Variable,” contributor Hernan Gonzalez explains the Taylor expansion of a random variable about its mean, as shown in the screenshot below.

在數學StackExchange提示“ 泊松隨機變量平方根的期望值 ”中, 貢獻者Hernan Gonzalez解釋了隨機變量的泰勒展開式及其均值,如下面的屏幕快照所示。

Image for post

Note that the expansion needs at least a few central moments of the original distribution. For the Poisson, the first three are just the mean parameter.

請注意,展開至少需要原始分布的幾個中心時刻。 對于泊松而言,前三個只是均值參數。

Ignoring that the mean estimator is also a random variable, we can run the expectation above through the inverse transformation, i.e., square it, to get an idea of the bias on the original scale for any Poisson mean value (the algebra isn’t here but it’s computed in line 34 of the demonstration code.) Similarly, with properties of the square root of the random variable, it’s straightforward to analyze g(x) = x ^2 in the same way. That opens up the possibility of bias correction, an interesting proposition, albeit one with assumptions and complexities of its own.

忽略均值估計器也是一個隨機變量,我們可以通過逆變換在上面運行期望值,即對它求平方,以了解任何泊松均值在原始比例上的偏差(代數不在此處但是,它是在演示代碼的第34行中計算出來的 。)類似地,由于具有隨機變量的平方根的屬性,因此以相同的方式分析g (x)= x ^ 2很簡單。 這開辟了偏差校正的可能性,這是一個有趣的主張,盡管它有其自身的假設和復雜性。

近似分解 (Approximation breakdown)

Near the end of his answer, Gonzalez mentions that the approximation “is only useful if” the mean of the original Poisson is quite a bit bigger than 1, clarifying in the comments that this is needed so that “the terms of the sum decrease quickly.” That follows from the mean being raised to negative powers after the original term.

岡薩雷斯在回答接近尾聲時提到,“ 僅當 ”原始泊松的均值比1大很多時,近似值“ 才有用 ”,并在注釋中闡明了這一點是必要的,以便“ 總和的項Swift減少”。 。 ”這是因為原任期之后,均值被提升為負數。

In the M5 competition, mean sales for many items were substantially below one, and thus using the square root transformation was a recipe for poor performance. To get an idea of how this plays out in an actual sample, the next section will investigate this phenomenon via simulation.

在M5競賽中,許多商品的平均銷售額都大大低于1,因此使用平方根變換是降低性能的良方。 為了了解這種情況在實際樣本中如何發揮作用,下一部分將通過仿真研究這種現象。

示范 (Demonstration)

In this section, we use the loess smoother to create models on both the original scale and the square root scale, and square the mean estimates of the latter. For simulated Poisson data with both a mean of 20 and a mean of 0.2, we plot the two sets of predictions and examine the bias. The code is under 50 lines and is available in Nousot’s Public Github repository.

在本節中,我們將使用黃土平滑器在原始比例和平方根比例上創建模型,并對后者的均值進行平方。 對于均值為20和均值為0.2的模擬Poisson數據,我們繪制了兩組預測并檢查了偏差。 該代碼少于50行,可在Nousot的Public Github存儲庫中找到 。

當平均值是20 (When the mean is 20)

Image for post

For the case where the mean of the Poisson random variable is 20, the retransformation bias is negative (as Jensen’s Inequality said it would be), but also relatively small. In the code, the first two terms of the Taylor expansion are computed and compared to the empirical bias on the square root scale. At -0.027 and -0.023, respectively, they are relatively close.

對于泊松隨機變量的平均值為20的情況,重變換偏差為負(就像詹森的不等式所說的那樣),但也相對較小。 在代碼中,計算出泰勒展開的前兩個項,并將其與平方根尺度上的經驗偏差進行比較。 它們分別為-0.027和-0.023,相對接近。

當平均值為0.20時 (When the mean is 0.20)

Image for post

For the case where the mean of the Poisson random variable is 0.20, the picture is much different. While Jensen’s Inequality always holds, the Jensen Gap is now large in a relative sense. Furthermore, the Taylor approximation has completely broken down, with the first two bias terms summing to 0.419 while the empirical bias is -.251 (still on the square root scale).

對于泊松隨機變量的平均值為0.20的情況,圖片有很大不同。 盡管詹森的不平等現象始終存在,但詹森差距現在相對來說還是很大的。 此外,泰勒近似已完全分解,前兩個偏差項的總和為0.419,而經驗偏差為-.251(仍在平方根刻度上)。

討論區 (Discussion)

David Warton’s 2018 paper “Why You Cannot Transform Your Way Out of Trouble for Small Counts” demonstrates the hopelessness of getting to the standard assumptions for small-mean count data. For the sparse time series in M5, there was nothing to gain and a lot to lose by taking the square root. At the very least, we should have treated those series differently. (Regarding our use of the Kalman Filter, Otto Seiskari’s advice to tune via cross-validation when the model is misspecified is especially compelling).

戴維·沃頓(David Warton)在2018年發表的論文“ 為什么小數位數無法擺脫麻煩 ”,這說明了達到小數位數數據的標準假設的絕望。 對于M5中稀疏的時間序列,通過求平方根沒有任何收益,也有很多損失。 至少,我們應該對這些系列進行不同的處理。 (關于我們對卡爾曼濾波器的使用,當模型指定不正確時, Otto Seiskari的建議通過交叉驗證進行調諧特別引人注目)。

Warton’s paper has some harsh words for users of transformations in general. I still believe that if a transformation brings you closer to the standard assumptions, where your code runs faster and you enjoy nicer properties, then it’s worth considering. But there needs to be an honest exploration of properties of the transformation in the context of the data, and this does not come for free.

一般而言,沃頓的論文對轉??換的使用者來說有些苛刻的話。 我仍然相信,如果 轉換使您更接近標準假設,即代碼運行速度更快并且享受更好的屬性,因此值得考慮。 但是需要在數據的上下文中誠實地探索轉換的屬性,而這并不是免費的。

Typically transformations (and their inverses) are either convex or concave, and thus Jensen’s Inequality will guarantee bias in the form of a Jensen Gap. If you’re wondering why you’ve never heard of it, it’s because it’s often written off as approximation error. According to Gao et al (2018),

通常,變換(及其逆變換)是凸的或凹的,因此Jensen的不等式將保證以Jensen Gap的形式出現偏差。 如果您想知道為什么從未聽說過它,那是因為它經常被記為近似誤差。 根據Gao等人(2018) ,

“Computing a hard-to-compute [expectation of a function] appears in theoretical estimates in a variety of scenarios from statistical mechanics to machine learning theory. A common approach to tackle this problem is to … show that the error, i.e., the Jensen gap, would be small enough for the application.”

從統計力學到機器學習理論,在各種情況下的理論估計中都出現了計算難以計算的[函數期望]。 解決此問題的常用方法是……表明誤差(即詹森間隙)對于應用程序而言足夠小。”

When using transformations, the work to understand the properties of inverse-transformation (in the context of the data) is worth it. It’s dangerous out there. Watch your step, and mind the Jensen Gap!

使用轉換時,了解逆轉換屬性(在數據上下文中)的工作是值得的。 那里很危險。 注意您的腳步,并注意詹森差距!

翻譯自: https://towardsdatascience.com/mind-the-jensen-gap-c54e0eb9e1b7

詹森不等式

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/388668.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/388668.shtml
英文地址,請注明出處:http://en.pswp.cn/news/388668.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【轉載】儒林外史人物——荀玫

寫在前面:本博客內容為轉載,原文URL:http://blog.sina.com.cn/s/blog_9132ac5b0101iukw.html 說完周進,本應順著說范進,但我覺得荀玫他們村的事情過于喜感,想先說荀玫。 荀玫簡直是儒林中的某類標桿人物&am…

WebM VP8 SDK Usage/關于WebM VP8 SDK的用法

WebM是Google提出的新的網絡視頻格式,本質上是個MKV的殼,封裝VPX中的VP8視頻流與Vorbis OGG音頻流。目前Firefox、Opera、Chrome都能直接打開WebM視頻文件而無需其他任何亂七八糟的插件。我個人倒是很喜歡WebM的OGG音頻,雖然在低比特率下不如…

數據分析師 需求分析師_是什么讓分析師出色?

數據分析師 需求分析師重點 (Top highlight)Before we dissect the nature of analytical excellence, let’s start with a quick summary of three common misconceptions about analytics from Part 1:在剖析卓越分析的本質之前,讓我們從第1部分中對分析的三種常…

JQuery發起ajax請求,并在頁面動態的添加元素

頁面html代碼&#xff1a; <li><div class"coll-tit"><span class"coll-icon"><iclass"sysfont coll-default"></i>全域旅游目的地</span></div><div class"coll-panel"><div c…

arcgis鏡像圖形工具,ArcGis圖形編輯

一、編輯工具條介紹二、草圖工具介紹Sketch Tool&#xff1a;使用草圖工具來創建點要素或是線或面要素的節點。雙擊或是F2鍵結束草圖狀態&#xff0c;轉化為要素。Intersection Tool&#xff1a;使用相交工具在兩個線要素相交(或延長相交)的地方創建一個節點。如圖&#xff1a;…

MAYA插件入門

我們知道&#xff0c; MAYA 是一個基于結點的插件式軟件架構&#xff0c;這種開放式的軟件架構是非常優秀的&#xff0c;它可以讓用戶非常方便地在其基礎上開發一些自已想要的插件&#xff0c;從而實現一些特殊的功能或效果。 在MAYA上開發自已的插件&#xff0c;你有3種選擇&a…

(原創) 如何使用C++/CLI讀/寫jpg檔? (.NET) (C++/CLI) (GDI+) (C/C++) (Image Processing)

Abstract因為Computer Vision的作業&#xff0c;之前都是用C# GDI寫&#xff0c;但這次的作業要做Grayscale Dilation&#xff0c;想用STL的Generic Algorithm寫&#xff0c;但C Standard Library并無法讀取jpg檔&#xff0c;用其它Library又比較麻煩&#xff0c;所以又回頭想…

貓眼電影評論_電影的人群意見和評論家的意見一樣好嗎?

貓眼電影評論Ryan Bellgardt’s 2018 movie, The Jurassic Games, tells the story of ten death row inmates who must compete for survival in a virtual reality game where they not only fight each other but must also fight dinosaurs which can kill them both in th…

128.Two Sum

題目&#xff1a; Given an array of integers, return indices of the two numbers such that they add up to a specific target. 給定一個整數數組&#xff0c;返回兩個數字的索引&#xff0c;使它們相加到特定目標。 You may assume that each input would have exactly on…

php獲取錯誤信息函數,關于php:如何獲取mail()函數的錯誤消息?

我一直在使用PHP mail()函數。如果郵件由于任何原因未發送&#xff0c;我想回顯錯誤消息。 我該怎么做&#xff1f;就像是$this_mail mail(exampleexample.com, My Subject, $message);if($this_mail) echo sent!;else echo error_message;謝謝&#xff01;當mail()返回false時…

關于夏季及雷雨天氣的MODEM、路由器使用注意事項

每年夏季是雷雨多發季節&#xff0c;容易出現家用電腦因而雷擊造成電腦硬件的損壞和通訊故障&#xff0c;為了避免這種情況的的發生&#xff0c;保護您的財產不受損失&#xff08;一般雷擊照成損壞的設備是沒得保修的&#xff09;&#xff0c;建議您繼續閱讀下面內容&#xff1…

創建Console應用程序,粘貼一下代碼,創建E://MyWebServerRoot//目錄,作為虛擬目錄,親自測試通過,

創建Console應用程序&#xff0c;粘貼一下代碼&#xff0c;創建E://MyWebServerRoot//目錄&#xff0c;作為虛擬目錄&#xff0c;親自測試通過&#xff0c; 有一個想法&#xff0c;調用ASP.DLL解析ASP&#xff0c;可是始終沒有找到資料&#xff0c;有待于研究&#xff0c;還有…

c#對文件的讀寫

最近需要對一個文件進行數量的分割&#xff0c;因為數據量龐大&#xff0c;所以就想到了通過寫程序來處理。將代碼貼出來以備以后使用。 //讀取文件的內容 放置于StringBuilder 中 StreamReader sr new StreamReader(path, Encoding.Default); String line; StringBuilder sb …

php表格tr,jQuery+ajax實現動態添加表格tr td功能示例

本文實例講述了jQueryajax實現動態添加表格tr td功能。分享給大家供大家參考&#xff0c;具體如下&#xff1a;功能&#xff1a;ajax獲取后臺返回數據給table動態添加tr/tdhtml部分&#xff1a;ajax部分&#xff1a;var year $(#year).val();//下拉框數據var province $(#prov…

maya的簡單使用

1、導出obj類型文件window - settings preferences - plug- in Manager objExport.mllfile - export selection就有OBJ選項了窗口-設置/首選項- 插件管理 objExport.mll文件-導出當前選擇2、合并元素在文件下面的下拉框&#xff0c;選擇多邊形。按住shift鍵&…

ai前沿公司_美術是AI的下一個前沿嗎?

ai前沿公司In 1950, Alan Turing developed the Turing Test as a test of a machine’s ability to display human-like intelligent behavior. In his prolific paper, he posed the following questions:1950年&#xff0c;阿蘭圖靈開發的圖靈測試作為一臺機器的顯示類似人類…

查看修改swap空間大小

查看swap 空間大小(總計)&#xff1a; # free -m 默認單位為k, -m 單位為M   total used free shared buffers cached  Mem: 377 180 197 0 19 110  -/ buffers/ca…

關于WKWebView高度的問題的解決

關于WKWebView高度的問題的解決 IOS端嵌入網頁的方式有兩種UIWebView和WKWebView。其中WKWebView的性能要高些;WKWebView的使用也相對簡單 WKWebView在加載完成后&#xff0c;在相應的代理里面獲取其內容高度&#xff0c;大多數網上的方法在獲取高度是會出現一定的問題&#xf…

測試nignx php請求并發數,nginx 優化(突破十萬并發)

一般來說nginx 配置文件中對優化比較有作用的為以下幾項&#xff1a;worker_processes 8;nginx 進程數&#xff0c;建議按照cpu 數目來指定&#xff0c;一般為它的倍數。worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;為每個進…