@Test public void sourceInstanceToTarget() { assertEquals(1,transformed1.valueOutputAttribute(0), EPS); assertEquals(3,transformed1.valueOutputAttribute(1), EPS); assertEquals(1.1,transformed1.valueInputAttribute(0), EPS); assertEquals(-2.3,transformed1.valueInputAttribute(1), EPS); assertEquals(2,transformed1.valueInputAttribute(2), EPS); assertEquals(3.3,transformed1.valueInputAttribute(3), EPS); assertEquals(0,transformed1.valueInputAttribute(4), EPS); assertEquals(1.2,transformed2.valueInputAttribute(0), EPS); assertEquals(-2.2,transformed2.valueInputAttribute(1), EPS); assertEquals(0,transformed2.valueInputAttribute(2), EPS); assertEquals(3.2,transformed2.valueInputAttribute(3), EPS); assertEquals(0,transformed2.valueInputAttribute(4), EPS); assertEquals(3,transformed2.valueOutputAttribute(0), EPS); assertEquals(2, transformed2.valueOutputAttribute(1), EPS); }
@Override public Instance sourceInstanceToTarget(Instance sourceInstance) { double [] attValues = new double[targetInstances.numAttributes()]; Instance newInstance=new InstanceImpl(sourceInstance.weight(),attValues); int numInputs=this.targetInstances.numInputAttributes(); for (int i=0; i<numInputs; i++){ newInstance.setValue(i, sourceInstance.valueInputAttribute(i)); } for (int i=0; i<this.targetOutputIndices.length; i++){ newInstance.setValue(numInputs+i, sourceInstance.valueOutputAttribute(targetOutputIndices[i])); } newInstance.setDataset(targetInstances); return newInstance; }
InstanceOutputAttributesSelector extends AbstractMOAObject implements InstanceTransformer { @Override public Instance sourceInstanceToTarget(Instance sourceInstance) { double [] attValues = new double[targetInstances.numAttributes()]; Instance newInstance=new InstanceImpl(sourceInstance.weight(),attValues); int numInputs=this.targetInstances.numInputAttributes(); for (int i=0; i<numInputs; i++){ newInstance.setValue(i, sourceInstance.valueInputAttribute(i)); } for (int i=0; i<this.targetOutputIndices.length; i++){ newInstance.setValue(numInputs+i, sourceInstance.valueOutputAttribute(targetOutputIndices[i])); } newInstance.setDataset(targetInstances); return newInstance; } }
InstanceOutputAttributesSelector extends AbstractMOAObject implements InstanceTransformer { @Override public Instance sourceInstanceToTarget(Instance sourceInstance) { double [] attValues = new double[targetInstances.numAttributes()]; Instance newInstance=new InstanceImpl(sourceInstance.weight(),attValues); int numInputs=this.targetInstances.numInputAttributes(); for (int i=0; i<numInputs; i++){ newInstance.setValue(i, sourceInstance.valueInputAttribute(i)); } for (int i=0; i<this.targetOutputIndices.length; i++){ newInstance.setValue(numInputs+i, sourceInstance.valueOutputAttribute(targetOutputIndices[i])); } newInstance.setDataset(targetInstances); return newInstance; } InstanceOutputAttributesSelector();  InstanceOutputAttributesSelector(InstancesHeader sourceInstances, int [] targetOutputIndices); }
InstanceOutputAttributesSelector extends AbstractMOAObject implements InstanceTransformer { @Override public Instance sourceInstanceToTarget(Instance sourceInstance) { double [] attValues = new double[targetInstances.numAttributes()]; Instance newInstance=new InstanceImpl(sourceInstance.weight(),attValues); int numInputs=this.targetInstances.numInputAttributes(); for (int i=0; i<numInputs; i++){ newInstance.setValue(i, sourceInstance.valueInputAttribute(i)); } for (int i=0; i<this.targetOutputIndices.length; i++){ newInstance.setValue(numInputs+i, sourceInstance.valueOutputAttribute(targetOutputIndices[i])); } newInstance.setDataset(targetInstances); return newInstance; } InstanceOutputAttributesSelector();  InstanceOutputAttributesSelector(InstancesHeader sourceInstances, int [] targetOutputIndices); @Override Instance sourceInstanceToTarget(Instance sourceInstance); @Override Prediction targetPredictionToSource(Prediction targetPrediction); @Override void getDescription(StringBuilder sb, int indent); }
InstanceOutputAttributesSelector extends AbstractMOAObject implements InstanceTransformer { @Override public Instance sourceInstanceToTarget(Instance sourceInstance) { double [] attValues = new double[targetInstances.numAttributes()]; Instance newInstance=new InstanceImpl(sourceInstance.weight(),attValues); int numInputs=this.targetInstances.numInputAttributes(); for (int i=0; i<numInputs; i++){ newInstance.setValue(i, sourceInstance.valueInputAttribute(i)); } for (int i=0; i<this.targetOutputIndices.length; i++){ newInstance.setValue(numInputs+i, sourceInstance.valueOutputAttribute(targetOutputIndices[i])); } newInstance.setDataset(targetInstances); return newInstance; } InstanceOutputAttributesSelector();  InstanceOutputAttributesSelector(InstancesHeader sourceInstances, int [] targetOutputIndices); @Override Instance sourceInstanceToTarget(Instance sourceInstance); @Override Prediction targetPredictionToSource(Prediction targetPrediction); @Override void getDescription(StringBuilder sb, int indent); public InstancesHeader targetInstances; public int [] targetOutputIndices; public int numSourceInstancesOutputs; }