本文整理匯總了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);
}
}
}
}