public Instances(String st, List<Attribute> v, int capacity) { this.instanceInformation = new InstanceInformation(st, v); this.instances = new ArrayList<>(); }
public Attribute classAttribute() { return this.attribute(this.classIndex()); }
/** * Class attribute. * * @return the attribute */ public Attribute classAttribute() { return this.instanceInformation.classAttribute(); }
public void setAttributes(Attribute[] v) { if (this.instanceInformation == null) { this.instanceInformation = new InstanceInformation(); } this.instanceInformation.setAttributes(v); }
/** * Instantiates a new arff loader. * * @param reader the reader * @param size the size * @param classAttribute the class attribute */ public ArffLoader(Reader reader, int size, int classAttribute) { // size is not used this(reader); if (classAttribute < 0) { this.instanceInformation.setClassIndex(this.instanceInformation.numAttributes() - 1); //System.out.print(this.instanceInformation.classIndex()); } else if (classAttribute > 0) { this.instanceInformation.setClassIndex(classAttribute - 1); } }
public Instance readInstanceDense() { Instance instance = new DenseInstance(this.instanceInformation.numAttributes() + 1); value = Double.valueOf(streamTokenizer.sval).doubleValue(); } else { value = this.instanceInformation.attribute(numAttribute).indexOfValue(streamTokenizer.sval);
/** * Class index. * * @return the int */ public int classIndex() { return this.instanceInformation.classIndex(); }
/** * Insert attribute at. * * @param attribute the attribute * @param position the position */ public void insertAttributeAt(Attribute attribute, int position) { if (this.instanceInformation == null) { this.instanceInformation = new InstanceInformation(); } this.instanceInformation.insertAttributeAt(attribute, position); for (int i = 0; i < numInstances(); i++) { instance(i).setDataset(null); instance(i).insertAttributeAt(i); instance(i).setDataset(this); } }
/** * Gets the relation name. * * @return the relation name */ public String getRelationName() { return this.instanceInformation.getRelationName(); }
/** * Sets the class index. * * @param classIndex the new class index */ public void setClassIndex(int classIndex) { this.instanceInformation.setClassIndex(classIndex); }
/** * Num attributes. * * @return the int */ public int numAttributes() { return this.instanceInformation.numAttributes(); }
/** * Attribute. * * @param w the w * @return the attribute */ public Attribute attribute(int w) { return this.instanceInformation.attribute(w); }
/** * Num classes. * * @return the int */ public int numClasses() { return this.instanceInformation.numClasses(); }
public void deleteAttributeAt(Integer integer) { this.instanceInformation.deleteAttributeAt(integer); }
public void insertAttributeAt(Attribute attribute, int i) { this.instanceInformation.insertAttributeAt(attribute, i); }
Instance instance = newDenseInstance(this.instanceInformation.numAttributes()); || streamTokenizer.ttype == 34)) { boolean isNumeric = this.instanceInformation.attribute(numAttribute).isNumeric(); double value; if ("?".equals(streamTokenizer.sval)) { value = Double.valueOf(streamTokenizer.sval).doubleValue(); } else { value = this.instanceInformation.attribute(numAttribute).indexOfValue(streamTokenizer.sval);
private void initStreamTokenizer(Reader reader) { BufferedReader br = new BufferedReader(reader); //Init streamTokenizer streamTokenizer = new StreamTokenizer(br); streamTokenizer.resetSyntax(); streamTokenizer.whitespaceChars(0, ' '); streamTokenizer.wordChars(' ' + 1, '\u00FF'); streamTokenizer.whitespaceChars(',', ','); streamTokenizer.commentChar('%'); streamTokenizer.quoteChar('"'); streamTokenizer.quoteChar('\''); streamTokenizer.ordinaryChar('{'); streamTokenizer.ordinaryChar('}'); streamTokenizer.eolIsSignificant(true); this.instanceInformation = this.getHeader(); if (classAttribute < 0) { this.instanceInformation.setClassIndex(this.instanceInformation.numAttributes() - 1); //System.out.print(this.instanceInformation.classIndex()); } else if (classAttribute > 0) { this.instanceInformation.setClassIndex(classAttribute - 1); } } }
public int classIndex() { return this.instanceInformation.classIndex(); }
public void setAttributes(Attribute[] v, int[] indexValues) { if (this.instanceInformation == null) { this.instanceInformation = new InstanceInformation(); } this.instanceInformation.setAttributes(v, indexValues); } public void setAttributes(List<Attribute> v, List<Integer> indexValues) {
public String getRelationName() { return this.instanceInformation.getRelationName(); }