/** * Gets the dataset. * * @return the dataset */ public Instances getDataset() { return firstInstance.dataset(); }
/** * Gets the dataset. * * @return the dataset */ public Instances getDataset() { return firstInstance.dataset(); }
public Instances getDataset() { return firstInstance.dataset(); }
public Instances getDataset() { return firstInstance.dataset(); }
public Instances getDataset() { if (firstInstance == null) { initStreamSource(sourceStream); } return firstInstance.dataset(); }
public Instances getDataset() { if (firstInstance == null) { initStreamSource(sourceStream); } return firstInstance.dataset(); }
public DenPoint(Instance nextInstance, Long timestamp) { super(nextInstance); this.setDataset(nextInstance.dataset()); } }
protected void VerboseToConsole(Instance inst) { if(VerbosityOption.getValue()>=5){ System.out.println(); System.out.println("I) Dataset: "+inst.dataset().getRelationName()); if(!this.unorderedRulesOption.isSet()){ System.out.println("I) Method Ordered"); }else{ System.out.println("I) Method Unordered"); } } }
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 }
@Override public double[] getVotesForInstance(Instance inst) { if (this.treeRoot != null) { FoundNode foundNode = this.treeRoot.filterInstanceToLeaf(inst, null, -1); Node leafNode = foundNode.node; if (leafNode == null) { leafNode = foundNode.parent; } return leafNode.getClassVotes(inst, this); } else { int numClasses = inst.dataset().numClasses(); return new double[numClasses]; } }
/** * Creates a new leaf <code>CNode</code> instance. * * @param numAttributes the number of attributes in the data * @param leafInstance the instance to store at this leaf */ public CNode(int numAttributes, Instance leafInstance) { this(numAttributes); if (m_clusterInstances == null) { //System.out.println(leafInstance.numAttributes()+"-"+leafInstance.value(0)+"-"+leafInstance.value(1)+"-"+leafInstance.value(2)); //System.out.println(leafInstance.numAttributes()+"-"+leafInstance.attribute(0).type()+"-"+leafInstance.attribute(1).type()+"-"+leafInstance.attribute(2).type()); m_clusterInstances = new Instances(leafInstance.dataset(), 1); } m_clusterInstances.add(leafInstance); updateStats(leafInstance, false); }
public Clustering(List<? extends Instance> points){ HashMap<Integer, Integer> labelMap = classValues(points); int dim = points.get(0).dataset().numAttributes()-1; Attribute classLabel = points.get(0).dataset().classAttribute(); int lastLabelIndex = classLabel.numValues() - 1; if (classLabel.value(lastLabelIndex) == "noise") {
public Instance extendWithOldLabels(Instance instance) { if (this.header == null) { initHeader(instance.dataset()); this.baseLearner.setModelContext(new InstancesHeader(this.header)); } int numLabels = this.oldLabels.length; if (numLabels == 0) { return instance; } double[] x = instance.toDoubleArray(); double[] x2 = Arrays.copyOfRange(this.oldLabels, 0, numLabels + x.length); System.arraycopy(x, 0, x2, numLabels, x.length); Instance extendedInstance = new DenseInstance(instance.weight(), x2); extendedInstance.setDataset(this.header); //System.out.println( extendedInstance); return extendedInstance; }
indexValues.add(j); v.add(instance.dataset().classAttribute()); indexValues.add(H);
@Override public void trainOnInstanceImpl(Instance inst) { if (inst.classValue() > C) { C = (int) inst.classValue(); } if (this.window == null) { this.window = new Instances(inst.dataset()); } for (int i = 0; i < this.window.size(); i++) { if (this.classifierRandom.nextDouble() > this.prob) { this.window.delete(i); } } this.window.add(inst); }
@Override public void trainOnInstanceImpl(Instance inst) { if (inst.classValue() > C) C = (int)inst.classValue(); if (this.window == null) { this.window = new Instances(inst.dataset()); } if (this.limitOption.getValue() <= this.window.numInstances()) { this.window.delete(0); } this.window.add(inst); }
@Override public void addResult(Example<Instance> example, double[] prediction) { Instance inst = example.getData(); double weight = inst.weight(); if (weight > 0.0) { if (TotalweightObserved == 0) { reset(inst.dataset().numClasses()); } this.TotalweightObserved += weight; this.weightObserved.add(weight); if (prediction.length > 0) { this.squareError.add((inst.classValue() - prediction[0]) * (inst.classValue() - prediction[0])); this.averageError.add(Math.abs(inst.classValue() - prediction[0])); } //System.out.println(inst.classValue()+", "+prediction[0]); } }
@Override public Example<Instance> nextInstance() { Example<Instance> original = originalStream.nextInstance(); // copies the original values double values[] = new double[this.newHeader.numAttributes()]; int ix = 0; for(int i = 0; i < original.getData().dataset().numAttributes(); i++){ if(original.getData().dataset().classIndex() != i) { values[ix] = original.getData().value(i); ix++; } } // appends the new values while(ix < values.length - 1){ Attribute att = this.newHeader.attribute(ix); if(att.isNumeric()) values[ix] = this.random.nextDouble(); else values[ix] = this.random.nextInt(numValuesCategoricalFeatureOption.getValue()); ix++; } //copies the class value if(original.getData().classIndex() != -1) { values[values.length - 1] = original.getData().classValue(); } // instantiates and returns the actual instance Instance instnc = new DenseInstance(1.0, values); instnc.setDataset(this.newHeader); return new InstanceExample(instnc); }