weka.core.Instances.mergeInstances()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中weka.core.Instances.mergeInstances()方法的一些代码示例,展示了Instances.mergeInstances()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instances.mergeInstances()方法的具体详情如下:
包路径:weka.core.Instances
类名称:Instances
方法名:mergeInstances

Instances.mergeInstances介绍

[英]Merges two sets of Instances together. The resulting set will have all the attributes of the first set plus all the attributes of the second set. The number of instances in both sets must be the same.
[中]将两组实例合并在一起。结果集将具有第一个集的所有属性加上第二个集的所有属性。两个集合中的实例数必须相同。

代码示例

代码示例来源:origin: Waikato/meka

@Override
public Instances transformLabels(Instances D) throws Exception{
Instances features = this.extractPart(D, false);
Instances labels = this.extractPart(D, true);
BooleanMatrixDecomposition bmd =
    BooleanMatrixDecomposition.BEST_CONFIGURED(this.threshold);
Tuple<Instances, Instances> res = bmd.decompose(labels, this.size);

this.compressedMatrix = res._1;
this.uppermatrix = res._2;

Instances result= Instances.mergeInstances(compressedMatrix,
            features);
result.setClassIndex(this.getSize());
return result;
}

代码示例来源:origin: net.sf.meka/meka

@Override
public Instances transformLabels(Instances D) throws Exception{
Instances features = this.extractPart(D, false);
Instances labels = this.extractPart(D, true);
BooleanMatrixDecomposition bmd =
    BooleanMatrixDecomposition.BEST_CONFIGURED(this.threshold);
Tuple<Instances, Instances> res = bmd.decompose(labels, this.size);

this.compressedMatrix = res._1;
this.uppermatrix = res._2;

Instances result= Instances.mergeInstances(compressedMatrix,
            features);
result.setClassIndex(this.getSize());
return result;
}

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

DataSource source2 = new DataSource(args[2]);
i = Instances
 .mergeInstances(source1.getDataSet(), source2.getDataSet());
System.out.println(i);

代码示例来源:origin: Waikato/weka-trunk

DataSource source2 = new DataSource(args[2]);
i = Instances
 .mergeInstances(source1.getDataSet(), source2.getDataSet());
System.out.println(i);

代码示例来源:origin: Waikato/meka

/**
 * Transforms the instance in the prediction process before given to the internal multi-label
 * or multi-target classifier. The instance is passed having the original set of labels, these
 * must be replaced with the transformed labels (attributes) so that the internla classifier
 * can predict them.
 *
 * @param x The instance to transform. Consists of features and labels.
 * @return The transformed instance. Consists of features and transformed labels.
 */
@Override
public Instance transformInstance(Instance x) throws Exception{
Instances tmpInst = new Instances(x.dataset());
tmpInst.delete();
tmpInst.add(x);
Instances features = this.extractPart(tmpInst, false);
Instances labels = new Instances(this.m_PatternInstances);
labels.add(new DenseInstance(labels.numAttributes()));
Instances result = Instances.mergeInstances(labels, features);
result.setClassIndex(labels.numAttributes());
return result.instance(0);
}

代码示例来源:origin: net.sf.meka/meka

/**
 * Transforms the instance in the prediction process before given to the internal multi-label
 * or multi-target classifier. The instance is passed having the original set of labels, these
 * must be replaced with the transformed labels (attributes) so that the internla classifier
 * can predict them.
 *
 * @param x The instance to transform. Consists of features and labels.
 * @return The transformed instance. Consists of features and transformed labels.
 */
@Override
public Instance transformInstance(Instance x) throws Exception{
Instances tmpInst = new Instances(x.dataset());
tmpInst.delete();
tmpInst.add(x);
Instances features = this.extractPart(tmpInst, false);
Instances labels = new Instances(this.m_PatternInstances);
labels.add(new DenseInstance(labels.numAttributes()));
Instances result = Instances.mergeInstances(labels, features);
result.setClassIndex(labels.numAttributes());
return result.instance(0);
}

代码示例来源:origin: Waikato/meka

@Override
public Instance transformInstance(Instance x) throws Exception{
Instances tmpInst = new Instances(x.dataset());
tmpInst.delete();
tmpInst.add(x);

Instances features = this.extractPart(tmpInst, false);
Instances pseudoLabels = new Instances(this.compressedMatrix);
Instance tmpin = pseudoLabels.instance(0);
pseudoLabels.delete();
pseudoLabels.add(tmpin);
for ( int i = 0; i< pseudoLabels.classIndex(); i++) {
  pseudoLabels.instance(0).setMissing(i);
}
Instances newDataSet = Instances.mergeInstances(pseudoLabels, features);
newDataSet.setClassIndex(this.size);

return newDataSet.instance(0);
}

代码示例来源:origin: net.sf.meka/meka

@Override
public Instance transformInstance(Instance x) throws Exception{
Instances tmpInst = new Instances(x.dataset());
tmpInst.delete();
tmpInst.add(x);

Instances features = this.extractPart(tmpInst, false);
Instances pseudoLabels = new Instances(this.compressedMatrix);
Instance tmpin = pseudoLabels.instance(0);
pseudoLabels.delete();
pseudoLabels.add(tmpin);
for ( int i = 0; i< pseudoLabels.classIndex(); i++) {
  pseudoLabels.instance(0).setMissing(i);
}
Instances newDataSet = Instances.mergeInstances(pseudoLabels, features);
newDataSet.setClassIndex(this.size);

return newDataSet.instance(0);
}

代码示例来源:origin: Waikato/meka

@Override
public Instance transformInstance(Instance x) throws Exception{

Instances tmpInst = new Instances(x.dataset());
tmpInst.delete();
tmpInst.add(x);

Instances features = this.extractPart(tmpInst, false);
Instances pseudoLabels = new Instances(this.compressedTemplateInst);
Instance tmpin = pseudoLabels.instance(0);
pseudoLabels.delete();

pseudoLabels.add(tmpin);
for ( int i = 0; i< pseudoLabels.classIndex(); i++) {
  pseudoLabels.instance(0).setMissing(i);
}
Instances newDataSet = Instances.mergeInstances(pseudoLabels, features);
newDataSet.setClassIndex(pseudoLabels.numAttributes());

return newDataSet.instance(0);
}

代码示例来源:origin: net.sf.meka/meka

@Override
public Instance transformInstance(Instance x) throws Exception{

Instances tmpInst = new Instances(x.dataset());
tmpInst.delete();
tmpInst.add(x);

Instances features = this.extractPart(tmpInst, false);
Instances pseudoLabels = new Instances(this.compressedTemplateInst);
Instance tmpin = pseudoLabels.instance(0);
pseudoLabels.delete();

pseudoLabels.add(tmpin);
for ( int i = 0; i< pseudoLabels.classIndex(); i++) {
  pseudoLabels.instance(0).setMissing(i);
}
Instances newDataSet = Instances.mergeInstances(pseudoLabels, features);
newDataSet.setClassIndex(pseudoLabels.numAttributes());

return newDataSet.instance(0);
}

代码示例来源:origin: net.sf.meka/meka

Instances.mergeInstances(MatrixUtils.matrixToInstances(compressed, m_PatternInstances),
       features);

代码示例来源:origin: Waikato/meka

Instances.mergeInstances(MatrixUtils.matrixToInstances(compressed, m_PatternInstances),
       features);

代码示例来源:origin: Waikato/meka

Instances result = Instances.mergeInstances(compressedLabels,features);

代码示例来源:origin: net.sf.meka/meka

Instances result = Instances.mergeInstances(compressedLabels,features);

代码示例来源:origin: nz.ac.waikato.cms.weka/multiInstanceLearning

newData = Instances.mergeInstances(mini_data, max_data); // merge minima

相关文章

Instances类方法