本文整理了Java中weka.core.Instances.numDistinctValues()
方法的一些代码示例,展示了Instances.numDistinctValues()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instances.numDistinctValues()
方法的具体详情如下:
包路径:weka.core.Instances
类名称:Instances
方法名:numDistinctValues
[英]Returns the number of distinct values of a given attribute. The value 'missing' is not counted.
[中]返回给定属性的不同值的数目。值“缺失”不计算在内。
代码示例来源:origin: com.googlecode.obvious/obviousx-weka
@Override
public int numDistinctValues(Attribute att) {
return super.numDistinctValues(att);
}
代码示例来源:origin: com.googlecode.obvious/obviousx-weka
@Override
public int numDistinctValues(int arg0) {
return super.numDistinctValues(arg0);
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Returns the number of distinct values of a given attribute. The value
* 'missing' is not counted.
*
* @param att the attribute
* @return the number of distinct values of a given attribute
*/
public/* @pure@ */int numDistinctValues(/* @non_null@ */Attribute att) {
return numDistinctValues(att.index());
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Returns the number of distinct values of a given attribute. The value
* 'missing' is not counted.
*
* @param att the attribute
* @return the number of distinct values of a given attribute
*/
public/* @pure@ */int numDistinctValues(/* @non_null@ */Attribute att) {
return numDistinctValues(att.index());
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Compute the number of all possible conditions that could appear in a rule
* of a given data. For nominal attributes, it's the number of values that
* could appear; for numeric attributes, it's the number of values * 2, i.e.
* <= and >= are counted as different possible conditions.
*
* @param data the given data
* @return number of all conditions of the data
*/
public static double numAllConditions(Instances data) {
double total = 0;
Enumeration<Attribute> attEnum = data.enumerateAttributes();
while (attEnum.hasMoreElements()) {
Attribute att = attEnum.nextElement();
if (att.isNominal()) {
total += att.numValues();
} else {
total += 2.0 * data.numDistinctValues(att);
}
}
return total;
}
代码示例来源:origin: Waikato/wekaDeeplearning4j
/**
* Validate a data split of train and validation data
*
* @param trainData Training data
* @param valData Validation data
* @throws WekaException Invalid validation split
*/
protected void validateSplit(Instances trainData, Instances valData) throws WekaException {
if (earlyStopping.getValidationSetPercentage() < 10e-8) {
// Use no validation set at all
return;
}
int classIndex = trainData.classIndex();
int valDataNumDinstinctClassValues = valData.numDistinctValues(classIndex);
int trainDataNumDistinctClassValues = trainData.numDistinctValues(classIndex);
if (trainData.numClasses() > 1
&& valDataNumDinstinctClassValues != trainDataNumDistinctClassValues) {
throw new InvalidValidationPercentageException(
"The validation data did not contain the same classes as the training data. "
+ "You should increase the validation percentage in the EarlyStopping configuration.");
}
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Compute the number of all possible conditions that could appear in a rule
* of a given data. For nominal attributes, it's the number of values that
* could appear; for numeric attributes, it's the number of values * 2, i.e.
* <= and >= are counted as different possible conditions.
*
* @param data the given data
* @return number of all conditions of the data
*/
public static double numAllConditions(Instances data) {
double total = 0;
Enumeration<Attribute> attEnum = data.enumerateAttributes();
while (attEnum.hasMoreElements()) {
Attribute att = attEnum.nextElement();
if (att.isNominal()) {
total += att.numValues();
} else {
total += 2.0 * data.numDistinctValues(att);
}
}
return total;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
if (m_TrainInstances.numDistinctValues(i) <= 1) {
deleteCols.addElement(i);
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
if (m_trainInstances.numDistinctValues(i) <= 1) {
deleteCols.addElement(new Integer(i));
代码示例来源:origin: Waikato/weka-trunk
if (m_TrainInstances.numDistinctValues(i) <= 1) {
deleteCols.addElement(i);
代码示例来源:origin: Waikato/weka-trunk
if (m_trainInstances.numDistinctValues(i) <= 1) {
deleteCols.addElement(new Integer(i));
内容来源于网络,如有侵权,请联系作者删除!