發表文章

理解 GBM 相關的關隘

圖片
下列就是為何針對殘差 使用   CART  方法的原因: ------------------------------------------------------------------------------------------------- 一個函數對函數的求導不好理解,而且通常都無法通過上述公式直接求解 到梯度函數gi。為此,採取一個近似的方法,把函數F i−1 理解成在所有樣本上的離散的函數值,即:                                        [ F i−1 (x1), F i−1  (x2) ,..., F i−1  (xN)] 不難理解,這是一個 N 維矢量,然後計算 這是一個函數對矢量的求導,得到的也是一個梯度矢量。注意,這裏求導時的變量還是函數F,不是樣本x k 。 嚴格來説 ĝi(xk) for k = 1,2, ... , N 只是描述了gi在某些個別點上的值,並不足以表達gi,但我們可以通過函數擬合的方法從ĝi(xk) for k = 1,2, ... , N 構造gi,這樣我們就通過近似的方法得到了函數對函數的梯度求導。 ------------------------------------------------------------------------------------------ 

反向傳播 = 梯度下降 + 鏈式法則

圖片

Resample - 改變時間序列的顆粒度

Python 的 pandas 套件內提供一個 resample 函式在處理這種事情,你可先參考: https://machinelearningmastery.com/resample-interpolate-time-series-data-python/ 知道它大概做什麼。然後你會發現,resample 的第一個參數有點陌生,它用來表示目標顆粒度的轉換 ( the offset string or object representing target conversion): 這些顆粒度的表示法如下: Alias Description B business day frequency C custom business day frequency D calendar day frequency W weekly frequency M month end frequency SM semi-month end frequency (15th and end of month) BM business month end frequency CBM custom business month end frequency MS month start frequency SMS semi-month start frequency (1st and 15th) BMS business month start frequency CBMS custom business month start frequency Q quarter end frequency BQ business quarter end frequency QS quarter start frequency BQS business quarter start frequency A, Y year end frequency BA, BY business year end frequency AS, YS year start frequency BAS, BYS business year start frequency BH business hour frequency H hourly frequency T, m...

Time Series Features

圖片
Features :  Time domain: 均值,方差,標準差,最大值,最小值,過零點個數,最大值與最小值之差,眾數 frequency domain: 直流分量,圖形的均值、方差、標準差、斜度、峭度,幅度的均值、方差、標準差、斜度、峭度 R 1. Spectral entropy of a time series Computes feature of a time series based on tiled (non-overlapping) windows. 2. lumpiness is the variance of the variances 3. stability is the variance of the means Computes feature of a time series based on sliding (overlapping) windows 4. max_level_shift finds the largest mean shift between two consecutive windows. 5. max_var_shift finds the largest var shift between two consecutive windows 6. max_kl_shift finds the largest shift in Kulback-Leibler divergence between two consecutive windows 7. Number of crossing points: the number of times a time series crosses the median 8. Number of flat spots: Number of flat spots in a time series(rel) 9. Hurst coefficent: Computes the Hurst coefficient indicating the level of fractional differencing of a time series 10. Autocorrelation-based features: Compu...