1 回答
TA貢獻1775條經驗 獲得超8個贊
我建議KarhunenLoeveSVDAlgorithm在 OpenTURNS 中使用。它提供了 4 種隨機 SVD 算法的實現。約束是必須預先設置要計算的奇異值的數量。
為了啟用算法,我們必須KarhunenLoeveSVDAlgorithm-UseRandomSVD在ResourceMap. 然后KarhunenLoeveSVDAlgorithm-RandomSVDMaximumRank鍵設置要計算的奇異值的數量(默認情況下,它等于 1000)。
提供了兩種實現:
Nathan Halko、Per-Gunnar Martinsson、Joel A. Tropp。尋找具有隨機性的結構:構造近似矩陣分解的概率算法,
Nathan Halko、Per-Gunnar Martisson、Yoel Shkolnisky 和 Mark Tygert。一種用于大型數據集的主成分分析的算法。
這些算法可以用KarhunenLoeveSVDAlgorithm-RandomSVDVariant密鑰來選擇。
在以下示例中,我使用AbsoluteExponential協方差模型從高斯過程中模擬了一個大型過程樣本。
import openturns as ot
mesh = ot.IntervalMesher([10]*2).build(ot.Interval([-1.0]*2, [1.0]*2))
s = 0.01
model = ot.AbsoluteExponential([1.0]*2)
sampleSize = 100000
sample = ot.GaussianProcess(model, mesh).getSample(sampleSize)
然后使用隨機 SVD 算法:
ot.ResourceMap_SetAsBool('KarhunenLoeveSVDAlgorithm-UseRandomSVD', True)
algorithm = ot.KarhunenLoeveSVDAlgorithm(sample, s)
algorithm.run()
result = algorithm.getResult()
該result對象包含過程的 Karhunen-Loève 分解。這對應于具有規則網格(和相等權重)的 PCA。
添加回答
舉報
