本文整理汇总了Java中weka.core.Utils.sm方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.sm方法的具体用法?Java Utils.sm怎么用?Java Utils.sm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类weka.core.Utils
的用法示例。
在下文中一共展示了Utils.sm方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: chooseLastIndex
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Choose last index (ie. choose rule).
*/
public final int chooseLastIndex() {
int minIndex = 0;
double estimated, min = Double.MAX_VALUE;
if (!m_isLeaf) {
for (int i = 0; i < m_sons.length; i++) {
if (son(i) != null) {
if (Utils.grOrEq(localModel().distribution().perBag(i), m_minNumObj)) {
estimated = son(i).getSizeOfBranch();
if (Utils.sm(estimated, min)) {
min = estimated;
minIndex = i;
}
}
}
}
}
return minIndex;
}
示例2: chooseIndex
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Method for choosing a subset to expand.
*/
public final int chooseIndex() {
int minIndex = -1;
double estimated, min = Double.MAX_VALUE;
int i, j;
for (i = 0; i < m_sons.length; i++) {
if (son(i) == null) {
if (Utils.sm(localModel().distribution().perBag(i), m_minNumObj)) {
estimated = Double.MAX_VALUE;
} else {
estimated = 0;
for (j = 0; j < localModel().distribution().numClasses(); j++) {
estimated -= m_splitCrit.lnFunc(localModel().distribution()
.perClassPerBag(i, j));
}
estimated += m_splitCrit
.lnFunc(localModel().distribution().perBag(i));
estimated /= (localModel().distribution().perBag(i) * ContingencyTables.log2);
}
if (Utils.smOrEq(estimated, 0)) {
return i;
}
if (Utils.sm(estimated, min)) {
min = estimated;
minIndex = i;
}
}
}
return minIndex;
}
示例3: checkClassifier
import weka.core.Utils; //导入方法依赖的package包/类
/**
* Quick and dirty check whether the quadratic programming problem is solved.
*
* @throws Exception if checking fails
*/
protected void checkClassifier() throws Exception {
double sum = 0;
for (int i = 0; i < m_alpha.length; i++) {
if (m_alpha[i] > 0) {
sum += m_class[i] * m_alpha[i];
}
}
System.err.println("Sum of y(i) * alpha(i): " + sum);
for (int i = 0; i < m_alpha.length; i++) {
double output = SVMOutput(i, m_data.instance(i));
if (Utils.eq(m_alpha[i], 0)) {
if (Utils.sm(m_class[i] * output, 1)) {
System.err.println("KKT condition 1 violated: " + m_class[i] * output);
}
}
if (Utils.gr(m_alpha[i], 0) &&
Utils.sm(m_alpha[i], m_C * m_data.instance(i).weight())) {
if (!Utils.eq(m_class[i] * output, 1)) {
System.err.println("KKT condition 2 violated: " + m_class[i] * output);
}
}
if (Utils.eq(m_alpha[i], m_C * m_data.instance(i).weight())) {
if (Utils.gr(m_class[i] * output, 1)) {
System.err.println("KKT condition 3 violated: " + m_class[i] * output);
}
}
}
}