/** * Instantiates a new instance. * * @param numAttributes the num attributes */ public InstanceImpl(int numAttributes) { this.instanceData = new DenseInstanceData(new double[numAttributes]); //JD this.weight = 1; }
/** * Checks if is missing sparse. * * @param indexAttribute the index attribute * @return true, if is missing sparse */ @Override public boolean isMissingSparse(int indexAttribute) { return isMissing(indexAttribute); }
/** * Num values. * * @return the int */ @Override public int numValues() { return numAttributes(); }
/** * Value sparse. * * @param indexAttribute the index attribute * @return the double */ @Override public double valueSparse(int indexAttribute) { return value(indexAttribute); }
@Override public double valueSparse(int indexAttribute) { return value(indexAttribute); }
/** * Instantiates a new instance. * * @param weight the weight * @param res the res */ public InstanceImpl(double weight, double[] res) { this.weight = weight; this.instanceData = new DenseInstanceData(res); }
/** * Checks if is missing. * * @param indexAttribute the index attribute * @return true, if is missing */ @Override public boolean isMissing(int indexAttribute) { return Double.isNaN(this.value(indexAttribute)); }
@Override public int numValues() { return numAttributes(); }
@Override public boolean isMissingSparse(int indexAttribute) { return isMissing(indexAttribute); }
public SingleLabelInstance(double weight, double[] res) { this.weight = weight; this.instanceData = new DenseInstanceData(res); //this.attributeValues = res; this.classData = new SingleClassInstanceData(); // this.classValue = Double.NaN; }
@Override public boolean isMissing(int indexAttribute) { return Double.isNaN(this.value(indexAttribute)); }
@Override public void insertAttributeAt(int index) { if ((index< 0) || (index > numAttributes())) { throw new IllegalArgumentException("Can't insert attribute: index out " + "of range"); } double[] newValues = new double[attributeValues.length + 1]; System.arraycopy(attributeValues , 0, newValues, 0, index); newValues[index] = Double.NaN; //Missing Value System.arraycopy(attributeValues , index, newValues, index + 1, attributeValues .length - index); attributeValues = newValues; }
@Override public InstanceData copy() { return new DenseInstanceData(this.attributeValues.clone()); }
public SingleLabelInstance(int numAttributes) { this.instanceData = new DenseInstanceData(new double[numAttributes]); // m_AttValues = new double[numAttributes]; /* * for (int i = 0; i < m_AttValues.length; i++) { m_AttValues[i] = * Utils.missingValue(); } */ this.weight = 1; this.classData = new SingleClassInstanceData(); this.instanceInformation = new InstancesHeader(); }