m_outputFormat.attribute(indexOffset).addRelation( relationalHeader); m_outputFormat.attribute(indexOffset).addRelation( input.relationalValue(i)); contained.put(indexOffset, new double[] { newIndex });
child = subList.get(0); data = createInstances(header.attribute(index).relation(), child); values[index] = header.attribute(index).addRelation(data); break;
child = subList.get(0); data = createInstances(header.attribute(index).relation(), child); values[index] = header.attribute(index).addRelation(data); break;
result = data.classAttribute().addRelation(getRelationalClassFormat()); } else { TestInstances dataset = new TestInstances(); rel.setClassIndex(-1); rel.deleteAttributeAt(clsIndex); result = data.classAttribute().addRelation(rel);
result = data.attribute(index).addRelation(rel); break;
result = data.classAttribute().addRelation(getRelationalClassFormat()); } else { TestInstances dataset = new TestInstances(); rel.setClassIndex(-1); rel.deleteAttributeAt(clsIndex); result = data.classAttribute().addRelation(rel);
result = data.attribute(index).addRelation(rel); break;
.attribute(i).relation(), 0); Instances data = arff.getData(); instance[i] = m_Data.attribute(i).addRelation(data); } catch (Exception e) { throw new IOException(e.toString() + " of line " + getLineNo());
bagData.setClassIndex(-1); bagData.deleteAttributeAt(bagData.numAttributes() - 1); double val = m_Data.attribute(1).addRelation(bagData); m_Data.instance(i).setValue(1, val);
int value = output.attribute(1).addRelation(bagInsts); newBag.setValue(0, bagIndex); if (input.classIndex() >= 0) {
/** * Scale the given exemplar so that the returned exemplar has the value of 0 * to 1 for each dimension * * @param before the given exemplar * @return the resultant exemplar after scaling * @throws Exception if given exampler cannot be scaled properly */ private Instance scale(Instance before) throws Exception { Instances afterInsts = before.relationalValue(1).stringFreeStructure(); Instance after = new DenseInstance(before.numAttributes()); after.setDataset(m_Attributes); for (int i = 0; i < before.relationalValue(1).numInstances(); i++) { Instance datum = before.relationalValue(1).instance(i); Instance inst = (Instance) datum.copy(); for (int j = 0; j < m_Dimension; j++) { if (before.relationalValue(1).attribute(j).isNumeric()) { inst.setValue(j, (datum.value(j) - m_MinArray[j]) / (m_MaxArray[j] - m_MinArray[j])); } } afterInsts.add(inst); } int attValue = after.attribute(1).addRelation(afterInsts); after.setValue(0, before.value(0)); after.setValue(1, attValue); after.setValue(2, before.value(2)); return after; }
private Instance makeOutputInstance(Instances output, Instance source) { double[] newVals = new double[output.numAttributes()]; for (int i = 0; i < newVals.length; i++) { newVals[i] = Utils.missingValue(); } for (int i = 0; i < source.numAttributes(); i++) { if (!source.isMissing(i)) { Attribute s = source.attribute(i); int outputIndex = output.attribute(s.name()).index(); if (s.isNumeric()) { newVals[outputIndex] = source.value(s); } else if (s.isString()) { String sVal = source.stringValue(s); newVals[outputIndex] = output.attribute(outputIndex).addStringValue( sVal); } else if (s.isRelationValued()) { Instances rVal = source.relationalValue(s); newVals[outputIndex] = output.attribute(outputIndex) .addRelation(rVal); } else if (s.isNominal()) { String nomVal = source.stringValue(s); newVals[outputIndex] = output.attribute(outputIndex).indexOfValue( nomVal); } } } Instance newInst = new DenseInstance(source.weight(), newVals); newInst.setDataset(output); return newInst; }
private Instance makeOutputInstance(Instances output, Instance source) { double[] newVals = new double[output.numAttributes()]; for (int i = 0; i < newVals.length; i++) { newVals[i] = Utils.missingValue(); } for (int i = 0; i < source.numAttributes(); i++) { if (!source.isMissing(i)) { Attribute s = source.attribute(i); int outputIndex = output.attribute(s.name()).index(); if (s.isNumeric()) { newVals[outputIndex] = source.value(s); } else if (s.isString()) { String sVal = source.stringValue(s); newVals[outputIndex] = output.attribute(outputIndex).addStringValue( sVal); } else if (s.isRelationValued()) { Instances rVal = source.relationalValue(s); newVals[outputIndex] = output.attribute(outputIndex) .addRelation(rVal); } else if (s.isNominal()) { String nomVal = source.stringValue(s); newVals[outputIndex] = output.attribute(outputIndex).indexOfValue( nomVal); } } } Instance newInst = new DenseInstance(source.weight(), newVals); newInst.setDataset(output); return newInst; }
after.setValue(1, after.attribute(1).addRelation(insts)); after.setValue(2, before.value(2));
Instances rVal = source.relationalValue(s); newVals[outputIndex] = output.attribute(outputIndex).addRelation(rVal); } else if (s.isNominal()) { String nomVal = source.stringValue(s);
Instances rVal = source.relationalValue(s); newVals[outputIndex] = output.attribute(outputIndex).addRelation(rVal); } else if (s.isNominal()) { String nomVal = source.stringValue(s);
.getAttributeIndices()[i])); if (!instance.isMissing(instIndex)) { int valIndex = dest.addRelation(src.relation((int) instance .value(instIndex))); instance.setValue(instIndex, valIndex);
.getAttributeIndices()[i])); if (!instance.isMissing(instIndex)) { int valIndex = dest.addRelation(src.relation((int) instance .value(instIndex))); instance.setValue(instIndex, valIndex);
relationValue = noises.attribute(1).addRelation(noises_relationInsts); noises.setValue(0, before.value(0)); noises.setValue(1, relationValue); noises.setValue(2, before.classValue()); relationValue = after.attribute(1).addRelation(after_relationInsts); after.setValue(0, before.value(0)); after.setValue(1, relationValue);
rp.setPercentage(rand.nextDouble()*100); final Instances rel2 = Filter.useFilter(rel, rp); final int i = generated.attribute(0).addRelation(rel2); datum.setValue(0, i);