public DataPoint(Instance nextInstance, Integer timestamp) { super(nextInstance); this.setDataset(nextInstance.dataset()); this.timestamp = timestamp; measure_values = new HashMap<String, String>(); Attribute classLabel = dataset().classAttribute(); noiseLabel = classLabel.indexOfValue("noise"); // -1 returned if there is no noise }
public DataPoint(Instance nextInstance, Integer timestamp) { super(nextInstance); this.setDataset(nextInstance.dataset()); this.timestamp = timestamp; measure_values = new HashMap<String, String>(); Attribute classLabel = dataset().classAttribute(); noiseLabel = classLabel.indexOfValue("noise"); // -1 returned if there is no noise }
public DataPoint(Instance nextInstance, Integer timestamp) { super(nextInstance); this.setDataset(nextInstance.dataset()); this.timestamp = timestamp; measure_values = new HashMap<String, String>(); Attribute classLabel = dataset().classAttribute(); noiseLabel = classLabel.indexOfValue("noise"); // -1 returned if there is no noise }
result.append(m_headerInfo.classAttribute().value(c)).append("\t"). append(Double.toString(m_probOfClass[c])).append("\n"); result.append(m_headerInfo.classAttribute().value(c)).append("\t");
indexValues.add(j); v.add(instance.dataset().classAttribute()); indexValues.add(h);
indexValues.add(j); v.add(instance.dataset().classAttribute()); indexValues.add(H);
int noiseLabel; Attribute classLabel = points.get(0).dataset().classAttribute(); int lastLabelIndex = classLabel.numValues() - 1; if (classLabel.value(lastLabelIndex) == "noise") {
int noiseLabel; Attribute classLabel = points.get(0).dataset().classAttribute(); int lastLabelIndex = classLabel.numValues() - 1; if (classLabel.value(lastLabelIndex) == "noise") {
int noiseLabel; Attribute classLabel = points.get(0).dataset().classAttribute(); int lastLabelIndex = classLabel.numValues() - 1; if (classLabel.value(lastLabelIndex) == "noise") {
public void initHeader(Instances dataset) { int numLabels = this.numOldLabelsOption.getValue(); Attribute target = dataset.classAttribute(); List<String> possibleValues = new ArrayList<String>(); int n = target.numValues(); for (int i = 0; i < n; i++) { possibleValues.add(target.value(i)); } ArrayList<Attribute> attrs = new ArrayList<Attribute>(numLabels + dataset.numAttributes()); for (int i = 0; i < numLabels; i++) { attrs.add(new Attribute(target.name() + "_" + i, possibleValues)); } for (int i = 0; i < dataset.numAttributes(); i++) { Attribute attr = dataset.attribute(i); Attribute newAttribute = null; if (attr.isNominal() == true) { newAttribute = new Attribute(attr.name(), attr.getAttributeValues()); } if (attr.isNumeric() == true) { newAttribute = new Attribute(attr.name()); } if (newAttribute != null) { attrs.add(newAttribute); } } this.header = new Instances("extended_" + dataset.getRelationName(), attrs, 0); this.header.setClassIndex(numLabels + dataset.classIndex()); }
Instances randData = new Instances(chunk); randData.randomize(random); if (randData.classAttribute().isNominal()) { randData.stratify(numFolds);
classLabels = second.classAttribute(); } else { classLabels = first.classAttribute();
/** * Stratify. * * @param numFolds the num folds */ public void stratify(int numFolds) { if (classAttribute().isNominal()) { // sort by class int index = 1; while (index < numInstances()) { Instance instance1 = instance(index - 1); for (int j = index; j < numInstances(); j++) { Instance instance2 = instance(j); if ((instance1.classValue() == instance2.classValue()) || (instance1.classIsMissing() && instance2.classIsMissing())) { swap(index, j); index++; } } index++; } stratStep(numFolds); } }