本文整理了Java中weka.core.Utils.sm()
方法的一些代码示例,展示了Utils.sm()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.sm()
方法的具体详情如下:
包路径:weka.core.Utils
类名称:Utils
方法名:sm
[英]Tests if a is smaller than b.
[中]测试a是否小于b。
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Returns the log-odds for a given probabilitiy.
*
* @param prob the probabilitiy
*
* @return the log-odds after the probability has been mapped to [Utils.SMALL,
* 1-Utils.SMALL]
*/
public static/* @pure@ */double probToLogOdds(double prob) {
if (gr(prob, 1) || (sm(prob, 0))) {
throw new IllegalArgumentException("probToLogOdds: probability must "
+ "be in [0,1] " + prob);
}
double p = SMALL + (1.0 - 2 * SMALL) * prob;
return Math.log(p / (1 - p));
}
代码示例来源:origin: nz.ac.waikato.cms.weka/conjunctiveRule
if (Utils.sm(worthValue[z], 1.0)) {
valueDelta = (worthValue[z] - worthValue[z - 1]) / worthValue[z];
} else {
if (Utils.sm(worthValue[z], 1.0)) {
valueDelta = (worthValue[z - 1] - worthValue[z]) / worthValue[z];
} else {
double valueDelta;
if (m_ClassAttribute.isNominal()) {
if (Utils.sm(worthValue[0], 1.0)) {
valueDelta = (worthValue[0] - defAccu) / worthValue[0];
} else {
if (Utils.sm(worthValue[0], 1.0)) {
valueDelta = (defAccu - worthValue[0]) / worthValue[0];
} else {
代码示例来源:origin: Waikato/weka-trunk
/**
* Returns the log-odds for a given probabilitiy.
*
* @param prob the probabilitiy
*
* @return the log-odds after the probability has been mapped to [Utils.SMALL,
* 1-Utils.SMALL]
*/
public static/* @pure@ */double probToLogOdds(double prob) {
if (gr(prob, 1) || (sm(prob, 0))) {
throw new IllegalArgumentException("probToLogOdds: probability must "
+ "be in [0,1] " + prob);
}
double p = SMALL + (1.0 - 2 * SMALL) * prob;
return Math.log(p / (1 - p));
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
if (Utils.sm(localModel().distribution().perBag(i), m_minNumObj)) {
estimated = Double.MAX_VALUE;
} else {
return i;
if (Utils.sm(estimated, min)) {
min = estimated;
minIndex = i;
代码示例来源:origin: Waikato/weka-trunk
if (Utils.gr(ctotal[col], 0)) {
expect = (ctotal[col] * rtotal[row]) / n;
if (Utils.sm(expect, smallfreq)) {
if (Utils.sm(expect, 1)) {
return false;
} else {
代码示例来源:origin: Waikato/weka-trunk
if (Utils.sm(localModel().distribution().perBag(i), m_minNumObj)) {
estimated = Double.MAX_VALUE;
} else {
return i;
if (Utils.sm(estimated, min)) {
min = estimated;
minIndex = i;
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
if (Utils.gr(ctotal[col], 0)) {
expect = (ctotal[col] * rtotal[row]) / n;
if (Utils.sm(expect, smallfreq)) {
if (Utils.sm(expect, 1)) {
return false;
} else {
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
if (Utils.sm(firstMiss, 2 * minSplit)) {
return;
代码示例来源:origin: com.github.fracpete/multisearch-weka-package
/**
* returns the closest index for the given value in the dimension.
*
* @param value the value to get the index for
* @return the closest index in the dimension
*/
public int getLocation(Object value) {
int result;
double distance;
double currDistance;
int i;
result = 0;
// determine x
distance = m_Step;
for (i = 0; i < width(); i++) {
currDistance = StrictMath.abs(((Double) value) - ((Double) getValue(i)));
if (Utils.sm(currDistance, distance)) {
distance = currDistance;
result = i;
}
}
return result;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
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);
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);
代码示例来源:origin: Waikato/weka-trunk
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);
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);
代码示例来源:origin: nz.ac.waikato.cms.weka/multiInstanceLearning
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]
&& 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]
代码示例来源:origin: com.github.fracpete/multisearch-weka-package
if (Utils.sm((Double) getValue(i), (Double) obj.getValue(i))) {
return -1;
} else if (Utils.gr((Double) getValue(i), (Double) obj.getValue(i))) {
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* 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;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* 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;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
while (Utils.sm(MSE, oldMSE)){
代码示例来源:origin: Waikato/weka-trunk
while (Utils.sm(MSE, oldMSE)){
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
Instance instance = enu.nextElement();
currentWeight = currentRule.weight(instance);
if (Utils.sm(currentWeight, 1)) {
instance.setWeight(instance.weight() * (1 - currentWeight));
newGrowData.add(instance);
Instance instance = enu.nextElement();
currentWeight = currentRule.weight(instance);
if (Utils.sm(currentWeight, 1)) {
instance.setWeight(instance.weight() * (1 - currentWeight));
newPruneData.add(instance);
代码示例来源:origin: Waikato/weka-trunk
Instance instance = enu.nextElement();
currentWeight = currentRule.weight(instance);
if (Utils.sm(currentWeight, 1)) {
instance.setWeight(instance.weight() * (1 - currentWeight));
newGrowData.add(instance);
Instance instance = enu.nextElement();
currentWeight = currentRule.weight(instance);
if (Utils.sm(currentWeight, 1)) {
instance.setWeight(instance.weight() * (1 - currentWeight));
newPruneData.add(instance);
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
if (Utils.sm(checkDistribution.total(), 2 * m_minNoObj)
|| Utils.eq(checkDistribution.total(),
checkDistribution.perClass(checkDistribution.maxClass()))) {
Attribute attribute = enu.nextElement();
if ((attribute.isNumeric())
|| (Utils.sm(attribute.numValues(), (0.3 * m_allData.numInstances())))) {
multiVal = false;
break;
|| (multiVal || Utils.sm(data.attribute(i).numValues(),
(0.3 * m_allData.numInstances())))) {
averageInfoGain = averageInfoGain + currentModel[i].infoGain();
内容来源于网络,如有侵权,请联系作者删除!