本文整理汇总了Java中hex.gram.Gram.Cholesky类的典型用法代码示例。如果您正苦于以下问题:Java Cholesky类的具体用法?Java Cholesky怎么用?Java Cholesky使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cholesky类属于hex.gram.Gram包,在下文中一共展示了Cholesky类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: regularizedCholesky
import hex.gram.Gram.Cholesky; //导入依赖的package包/类
public Cholesky regularizedCholesky(Gram gram, int max_attempts) {
int attempts = 0;
double addedL2 = 0; // TODO: Should I report this to the user?
Cholesky chol = gram.cholesky(null);
while (!chol.isSPD() && attempts < max_attempts) {
if (addedL2 == 0) addedL2 = 1e-5;
else addedL2 *= 10;
++attempts;
gram.addDiag(addedL2); // try to add L2 penalty to make the Gram SPD
Log.info("Added L2 regularization = " + addedL2 + " to diagonal of Gram matrix");
gram.cholesky(chol);
}
if (!chol.isSPD())
throw new Gram.NonSPDMatrixException();
return chol;
}