本文整理了Java中weka.core.Utils.missingValue()
方法的一些代码示例,展示了Utils.missingValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.missingValue()
方法的具体详情如下:
包路径:weka.core.Utils
类名称:Utils
方法名:missingValue
[英]Returns the value used to code a missing value. Note that equality tests on this value will always return false, so use isMissingValue(double val) for testing..
[中]返回用于编码缺失值的值。请注意,对该值的相等性测试将始终返回false,因此使用isMissingValue(double val)进行测试。。
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Constructor of an instance that sets weight to one, all values to be
* missing, and the reference to the dataset to null. (ie. the instance
* doesn't have access to information about the attribute types)
*
* @param numAttributes the size of the instance
*/
// @ requires numAttributes > 0; // Or maybe == 0 is okay too?
// @ ensures m_Dataset == null;
public DenseInstance(int numAttributes) {
m_AttValues = new double[numAttributes];
for (int i = 0; i < m_AttValues.length; i++) {
m_AttValues[i] = Utils.missingValue();
}
m_Weight = 1;
m_Dataset = null;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Constructor of an instance that sets weight to one, all values to be
* missing, and the reference to the dataset to null. (ie. the instance
* doesn't have access to information about the attribute types)
*
* @param numAttributes the size of the instance
*/
public SparseInstance(int numAttributes) {
m_AttValues = new double[numAttributes];
m_NumAttributes = numAttributes;
m_Indices = new int[numAttributes];
for (int i = 0; i < m_AttValues.length; i++) {
m_AttValues[i] = Utils.missingValue();
m_Indices[i] = i;
}
m_Weight = 1;
m_Dataset = null;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Constructor of an instance that sets weight to one, all values to be
* missing, and the reference to the dataset to null. (ie. the instance
* doesn't have access to information about the attribute types)
*
* @param numAttributes the size of the instance
*/
// @ requires numAttributes > 0; // Or maybe == 0 is okay too?
// @ ensures m_Dataset == null;
public DenseInstance(int numAttributes) {
m_AttValues = new double[numAttributes];
for (int i = 0; i < m_AttValues.length; i++) {
m_AttValues[i] = Utils.missingValue();
}
m_Weight = 1;
m_Dataset = null;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/distributedWekaBase
/**
* Get the count for a given label
*
* @param label the label to get the count for
* @return the count or missing value if the label is unknown
*/
public double getCount(String label) {
NominalStats.Count c = m_counts.get(label);
if (c == null) {
return Utils.missingValue();
}
return c.m_count;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Inserts an attribute at the given position (0 to numAttributes()) and sets
* its value to be missing.
*
* @param position the attribute's position
*/
@Override
protected void forceInsertAttributeAt(int position) {
double[] newValues = new double[m_AttValues.length + 1];
System.arraycopy(m_AttValues, 0, newValues, 0, position);
newValues[position] = Utils.missingValue();
System.arraycopy(m_AttValues, position, newValues, position + 1,
m_AttValues.length - position);
m_AttValues = newValues;
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Inserts an attribute at the given position (0 to numAttributes()) and sets
* its value to be missing.
*
* @param position the attribute's position
*/
@Override
protected void forceInsertAttributeAt(int position) {
double[] newValues = new double[m_AttValues.length + 1];
System.arraycopy(m_AttValues, 0, newValues, 0, position);
newValues[position] = Utils.missingValue();
System.arraycopy(m_AttValues, position, newValues, position + 1,
m_AttValues.length - position);
m_AttValues = newValues;
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Sets a specific value to be "missing". Performs a deep copy of the vector
* of attribute values before the value is set to be missing.
*
* @param attIndex the attribute's index
*/
@Override
public final void setMissing(int attIndex) {
setValue(attIndex, Utils.missingValue());
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Sets a specific value to be "missing". Performs a deep copy of the vector
* of attribute values before the value is set to be missing.
*
* @param attIndex the attribute's index
*/
@Override
public final void setMissing(int attIndex) {
setValue(attIndex, Utils.missingValue());
}
代码示例来源:origin: nz.ac.waikato.cms.weka/simpleEducationalLearningSchemes
/**
* Classifies a given instance.
*
* @param inst the instance to be classified
* @return the classification
*/
public double classifyInstance(Instance inst) {
int result = m_rules.resultRules(inst);
if (result == -1) {
return Utils.missingValue();
} else {
return (double)result;
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/distributedWekaBase
/**
* Constructs a new NumericStats
*
* @param attributeName the name of the attribute that these statistics are
* for
*/
public NumericStats(String attributeName) {
super(attributeName);
m_stats[ArffSummaryNumericMetric.MIN.ordinal()] = Utils.missingValue();
m_stats[ArffSummaryNumericMetric.MAX.ordinal()] = Utils.missingValue();
m_stats[ArffSummaryNumericMetric.FIRSTQUARTILE.ordinal()] =
Utils.missingValue();
m_stats[ArffSummaryNumericMetric.MEDIAN.ordinal()] = Utils.missingValue();
m_stats[ArffSummaryNumericMetric.THIRDQUARTILE.ordinal()] =
Utils.missingValue();
}
代码示例来源:origin: Waikato/weka-trunk
/**
* Get the value of the attribute as a number or Utils.missingValue() if the
* attribute is not numeric.
*
* @return the value of the attribute as a number
*/
public double getNumericValue() {
if (getResolvedType().toLowerCase().startsWith("numeric")) {
return Double.parseDouble(getResolvedValue());
}
return Utils.missingValue(); // not a numeric attribute
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Get the value of the attribute as a number or Utils.missingValue() if the
* attribute is not numeric.
*
* @return the value of the attribute as a number
*/
public double getNumericValue() {
if (getResolvedType().toLowerCase().startsWith("numeric")) {
return Double.parseDouble(getResolvedValue());
}
return Utils.missingValue(); // not a numeric attribute
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Evaluate on the basis of the no true child strategy.
*
* @param classAtt the class attribute.
* @param preds an array to hold the predicted probabilities.
* @throws Exception if something goes wrong.
*/
protected void doNoTrueChild(Attribute classAtt, double[] preds)
throws Exception {
if (TreeModel.this.m_noTrueChildStrategy == NoTrueChildStrategy.RETURNNULLPREDICTION) {
for (int i = 0; i < classAtt.numValues(); i++) {
preds[i] = Utils.missingValue();
}
} else {
// return the predictions at this node
doLeaf(classAtt, preds);
}
}
代码示例来源:origin: Waikato/weka-trunk
@Override
public double evaluate() {
if (isMissing()) {
missingAccessed = true;
return Utils.missingValue();
}
return instance.value(getIndex());
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
@Override
public double evaluate() {
if (isMissing()) {
missingAccessed = true;
return Utils.missingValue();
}
return instance.value(getIndex());
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/distributedWekaBase
/**
* Update with a new value
*
* @param value the string value to update with
* @param weight the weight for the update
*/
public void update(String value, double weight) {
if (DistributedJobConfig.isEmpty(value)) {
m_missingCount += weight;
m_stringLengthStats.update(Utils.missingValue(), weight, false, false);
m_wordStats.update(Utils.missingValue(), weight, false, false);
} else {
m_stringLengthStats.update(value.length(), weight, false, false);
m_tokenizer.tokenize(value);
m_wordStats.update(m_tokenizer.countTokens(), weight, false, false);
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Returns the area under precision-recall curve (AUPRC) for those predictions
* that have been collected in the evaluateClassifier(Classifier, Instances)
* method. Returns Utils.missingValue() if the area is not available.
*
* @param classIndex the index of the class to consider as "positive"
* @return the area under the precision-recall curve or not a number
*/
public double areaUnderPRC(int classIndex) {
// Check if any predictions have been collected
if (m_Predictions == null) {
return Utils.missingValue();
} else {
ThresholdCurve tc = new ThresholdCurve();
Instances result = tc.getCurve(m_Predictions, classIndex);
return ThresholdCurve.getPRCArea(result);
}
}
代码示例来源:origin: nz.ac.waikato.cms.weka/distributedWekaBase
@Override
public double valueFromAttribute(Attribute att) {
if (THIRDQUARTILE.ordinal() > att.numValues() - 1) {
return Utils.missingValue();
}
String value = att.value(THIRDQUARTILE.ordinal());
return toValue(value, toString());
}
代码示例来源:origin: nz.ac.waikato.cms.weka/distributedWekaBase
@Override
public double valueFromAttribute(Attribute att) {
if (FIRSTQUARTILE.ordinal() > att.numValues() - 1) {
return Utils.missingValue();
}
String value = att.value(FIRSTQUARTILE.ordinal());
return toValue(value, toString());
}
代码示例来源:origin: nz.ac.waikato.cms.weka/distributedWekaBase
@Override
public double valueFromAttribute(Attribute att) {
if (MEDIAN.ordinal() > att.numValues() - 1) {
return Utils.missingValue();
}
String value = att.value(MEDIAN.ordinal());
return toValue(value, toString());
}
内容来源于网络,如有侵权,请联系作者删除!