本文整理了Java中weka.core.Instances.allInstanceWeightsIdentical()
方法的一些代码示例,展示了Instances.allInstanceWeightsIdentical()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instances.allInstanceWeightsIdentical()
方法的具体详情如下:
包路径:weka.core.Instances
类名称:Instances
方法名:allInstanceWeightsIdentical
[英]Returns true if all instance weights are the same and false otherwise. Returns true if there are no instances.
[中]如果所有实例权重相同,则返回true;否则返回false。如果没有实例,则返回true。
代码示例来源:origin: net.sf.meka/meka
/**
* Build the classifier on the filtered data.
*
* @param data the training data
* @throws Exception if the classifier could not be built successfully
*/
public void buildClassifier(Instances data) throws Exception {
if (m_Classifier == null) {
throw new Exception("No base classifier has been set!");
}
getCapabilities().testWithFail(data);
Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
data = setUp(data, r);
if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
data = data.resampleWithWeights(r); // The filter may have assigned weights.
}
if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
data = resampleAttributes(data, false, r);
}
if (m_Classifier instanceof Randomizable) {
((Randomizable)m_Classifier).setSeed(r.nextInt());
}
m_Classifier.buildClassifier(data);
}
代码示例来源:origin: Waikato/meka
/**
* Build the classifier on the filtered data.
*
* @param data the training data
* @throws Exception if the classifier could not be built successfully
*/
public void buildClassifier(Instances data) throws Exception {
if (m_Classifier == null) {
throw new Exception("No base classifier has been set!");
}
getCapabilities().testWithFail(data);
Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
data = setUp(data, r);
if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
data = data.resampleWithWeights(r); // The filter may have assigned weights.
}
if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
data = resampleAttributes(data, false, r);
}
if (m_Classifier instanceof Randomizable) {
((Randomizable)m_Classifier).setSeed(r.nextInt());
}
m_Classifier.buildClassifier(data);
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
/**
* Build the classifier on the filtered data.
*
* @param data the training data
* @throws Exception if the classifier could not be built successfully
*/
public void buildClassifier(Instances data) throws Exception {
if (m_Classifier == null) {
throw new Exception("No base classifier has been set!");
}
getCapabilities().testWithFail(data);
Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
data = setUp(data, r);
if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
data = data.resampleWithWeights(r); // The filter may have assigned weights.
}
if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
data = resampleAttributes(data, false, r);
}
// can classifier handle the data?
getClassifier().getCapabilities().testWithFail(data);
if (m_Classifier instanceof Randomizable) {
((Randomizable)m_Classifier).setSeed(r.nextInt());
}
m_Classifier.buildClassifier(data);
}
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
data = setUp(data, r);
if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
代码示例来源:origin: Waikato/weka-trunk
/**
* Build the classifier on the filtered data.
*
* @param data the training data
* @throws Exception if the classifier could not be built successfully
*/
public void buildClassifier(Instances data) throws Exception {
if (m_Classifier == null) {
throw new Exception("No base classifier has been set!");
}
getCapabilities().testWithFail(data);
Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
data = setUp(data, r);
if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
data = data.resampleWithWeights(r); // The filter may have assigned weights.
}
if (!data.allAttributeWeightsIdentical() && !(m_Classifier instanceof WeightedAttributesHandler)) {
data = resampleAttributes(data, false, r);
}
// can classifier handle the data?
getClassifier().getCapabilities().testWithFail(data);
if (m_Classifier instanceof Randomizable) {
((Randomizable)m_Classifier).setSeed(r.nextInt());
}
m_Classifier.buildClassifier(data);
}
代码示例来源:origin: Waikato/weka-trunk
Random r = (data.numInstances() > 0) ? data.getRandomNumberGenerator(getSeed()) : new Random(getSeed());
data = setUp(data, r);
if (!data.allInstanceWeightsIdentical() && !(m_Classifier instanceof WeightedInstancesHandler)) {
代码示例来源:origin: Waikato/weka-trunk
m_ReorderFiltered = null;
if (data.allInstanceWeightsIdentical() || (m_Filter instanceof WeightedInstancesHandler)) {
data = new Instances(data);
} else {
代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable
m_ReorderFiltered = null;
if (data.allInstanceWeightsIdentical() || (m_Filter instanceof WeightedInstancesHandler)) {
data = new Instances(data);
} else {
内容来源于网络,如有侵权,请联系作者删除!