protected Instance newDenseInstance(int numberAttributes) { Instance inst = new DenseInstance(numberAttributes); //inst.setInstanceInformation(this.instanceInformation); return inst; }
public void learnObject(double[] features){ DenseInstance inst = new DenseInstance(features.length); for(int i=0; i<features.length; i++){ inst.setValue(i, features[i]); } trainOnInstance(inst); }
@Override protected Instance newDenseInstance(int numAttributes) { // numAttributes is this.instanceInformation.numAttributes() this.range.setUpper(numAttributes); return new DenseInstance(numAttributes); }
public void train(DataSet trainingSet) { // TODO fix not working builder! // ClusTree private variables are not updated but are mandatory for the algorithm to function. // if (UseBulkLoadingOption.isSet()) { // // Use BulkLoading // EMTopDownTreeBuilder builder = new EMTopDownTreeBuilder(); // try { // this.root = builder.buildTree(trainingSet); // } catch (Exception e) { // e.printStackTrace(); // } // } else { //Use traditional initialization for (DataObject o : trainingSet.getDataObjectArray()){ DenseInstance inst = new DenseInstance(o.getFeatures().length); for(int i=0; i<o.getFeatures().length; i++){ inst.setValue(i, o.getFeatures()[i]); } trainOnInstance(inst); } // } }
return new DenseInstance(1.0, res);
return new DenseInstance(1.0, res);
return new DenseInstance(1.0, res);
"Next Instance has an wrong cardinality!"); this.lastInstanceRead = new InstanceExample(new DenseInstance(1, value)); this.lastInstanceRead.getData().setDataset(this.dataset); this.hitEndOfFile = false;
public Instance readInstanceDense() { Instance instance = new DenseInstance(this.instanceInformation.numAttributes() + 1);
private Instance readDenseInstanceSparse() { Instance instance = new DenseInstance(this.instanceInformation.numAttributes() + 1);
value[i] = Double.valueOf(token.nextToken()); this.lastInstanceRead = new InstanceExample(new DenseInstance(1, value)); this.lastInstanceRead.getData().setDataset(this.dataset); this.numInstancesRead = 0;
@Override public InstanceExample nextInstance() { Centroid centroid = this.centroids[MiscUtils.chooseRandomIndexBasedOnWeights(this.centroidWeights, this.instanceRandom)]; int numAtts = this.numAttsOption.getValue(); double[] attVals = new double[numAtts + 1]; for (int i = 0; i < numAtts; i++) { attVals[i] = (this.instanceRandom.nextDouble() * 2.0) - 1.0; } double magnitude = 0.0; for (int i = 0; i < numAtts; i++) { magnitude += attVals[i] * attVals[i]; } magnitude = Math.sqrt(magnitude); double desiredMag = this.instanceRandom.nextGaussian() * centroid.stdDev; double scale = desiredMag / magnitude; for (int i = 0; i < numAtts; i++) { attVals[i] = centroid.centre[i] + attVals[i] * scale; } Instance inst = new DenseInstance(1.0, attVals); inst.setDataset(getHeader()); inst.setClassValue(centroid.classLabel); return new InstanceExample(inst); }
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; }
determineClass(color, price, payment, amount, delivery); instnc = new DenseInstance(streamHeader.numAttributes());
for(int c = 0; c < kernels.size(); c++){ for(int m = 0; m < kernels.get(c).microClusters.size(); m++){ Instance inst = new DenseInstance(1, sample); if(kernels.get(c).microClusters.get(m).getInclusionProbability(inst) > 0){ incluster = true;
for(int c = 0; c < kernels.size(); c++){ for(int m = 0; m < kernels.get(c).microClusters.size(); m++){ Instance inst = new DenseInstance(1, sample); if(kernels.get(c).microClusters.get(m).getInclusionProbability(inst) > 0){ incluster = true;
for(int c = 0; c < kernels.size(); c++){ for(int m = 0; m < kernels.get(c).microClusters.size(); m++){ Instance inst = new DenseInstance(1, sample); if(kernels.get(c).microClusters.get(m).getInclusionProbability(inst) > 0){ incluster = true;
@Override public InstanceExample nextInstance() { InstancesHeader header = getHeader(); Instance inst = new DenseInstance(header.numAttributes()); inst.setDataset(header); int waveform = this.instanceRandom.nextInt(NUM_CLASSES);
@Override public InstanceExample nextInstance() { InstancesHeader header = getHeader(); Instance inst = new DenseInstance(header.numAttributes()); inst.setDataset(header); int waveform = this.instanceRandom.nextInt(NUM_CLASSES);