@Test public void testReintegrateModifiedDataSet() throws Exception{ Remove remove = new Remove(); remove.setAttributeIndicesArray(new int[]{NUM_FEATURES + NUM_LABELS - 1}); remove.setInputFormat(mlData.getDataSet()); Instances modifiedDataSet = Filter.useFilter(mlData.getDataSet(), remove); MultiLabelInstances newMLData = mlData.reintegrateModifiedDataSet(modifiedDataSet); Assert.assertEquals(NUM_LABELS - 1, newMLData.getNumLabels()); }
public MultiLabelInstances reintegrateModifiedDataSet(Instances modifiedDataSet) throws InvalidDataFormatException { if (modifiedDataSet == null) { throw new IllegalArgumentException("The modified data set is null."); } LabelsMetaDataImpl newMetaData = (LabelsMetaDataImpl) labelsMetaData.clone(); Set<String> origLabelNames = labelsMetaData.getLabelNames(); for (String labelName : origLabelNames) { if (modifiedDataSet.attribute(labelName) == null) { newMetaData.removeLabelNode(labelName); } } return new MultiLabelInstances(modifiedDataSet, newMetaData); }
MultiLabelInstances implements Serializable { public MultiLabelInstances reintegrateModifiedDataSet(Instances modifiedDataSet) throws InvalidDataFormatException { if (modifiedDataSet == null) { throw new IllegalArgumentException("The modified data set is null."); } LabelsMetaDataImpl newMetaData = (LabelsMetaDataImpl) labelsMetaData.clone(); Set<String> origLabelNames = labelsMetaData.getLabelNames(); for (String labelName : origLabelNames) { if (modifiedDataSet.attribute(labelName) == null) { newMetaData.removeLabelNode(labelName); } } return new MultiLabelInstances(modifiedDataSet, newMetaData); } }
MultiLabelInstances implements Serializable { public MultiLabelInstances reintegrateModifiedDataSet(Instances modifiedDataSet) throws InvalidDataFormatException { if (modifiedDataSet == null) { throw new IllegalArgumentException("The modified data set is null."); } LabelsMetaDataImpl newMetaData = (LabelsMetaDataImpl) labelsMetaData.clone(); Set<String> origLabelNames = labelsMetaData.getLabelNames(); for (String labelName : origLabelNames) { if (modifiedDataSet.attribute(labelName) == null) { newMetaData.removeLabelNode(labelName); } } return new MultiLabelInstances(modifiedDataSet, newMetaData); } MultiLabelInstances(String arffFilePath, int numLabelAttributes);  MultiLabelInstances(InputStream arffDataStream, int numLabelAttributes);  MultiLabelInstances(InputStream arffDataStream, int numLabelAttributes,
            boolean labelsFirst);  MultiLabelInstances(Instances data, String xmlLabelsDefFilePath);  MultiLabelInstances(String arffFilePath, String xmlLabelsDefFilePath);  MultiLabelInstances(String arffFilePath, String xmlLabelsDefFilePath, boolean incremental);  MultiLabelInstances(InputStream arffDataStream, InputStream xmlLabelsDefStream);  MultiLabelInstances(Instances dataSet, LabelsMetaData labelsMetaData); }
MultiLabelInstances implements Serializable { public MultiLabelInstances reintegrateModifiedDataSet(Instances modifiedDataSet) throws InvalidDataFormatException { if (modifiedDataSet == null) { throw new IllegalArgumentException("The modified data set is null."); } LabelsMetaDataImpl newMetaData = (LabelsMetaDataImpl) labelsMetaData.clone(); Set<String> origLabelNames = labelsMetaData.getLabelNames(); for (String labelName : origLabelNames) { if (modifiedDataSet.attribute(labelName) == null) { newMetaData.removeLabelNode(labelName); } } return new MultiLabelInstances(modifiedDataSet, newMetaData); } MultiLabelInstances(String arffFilePath, int numLabelAttributes);  MultiLabelInstances(InputStream arffDataStream, int numLabelAttributes);  MultiLabelInstances(InputStream arffDataStream, int numLabelAttributes,
            boolean labelsFirst);  MultiLabelInstances(Instances data, String xmlLabelsDefFilePath);  MultiLabelInstances(String arffFilePath, String xmlLabelsDefFilePath);  MultiLabelInstances(String arffFilePath, String xmlLabelsDefFilePath, boolean incremental);  MultiLabelInstances(InputStream arffDataStream, InputStream xmlLabelsDefStream);  MultiLabelInstances(Instances dataSet, LabelsMetaData labelsMetaData); int getNumLabels(); int getNumInstances(); double getCardinality(); int[] getLabelIndices(); String[] getLabelNames(); Map<String, Integer> getLabelsOrder(); Set<Attribute> getLabelAttributes(); int[] getFeatureIndices(); Set<Attribute> getFeatureAttributes(); LabelsMetaData getLabelsMetaData(); Instances getDataSet(); MultiLabelInstances reintegrateModifiedDataSet(Instances modifiedDataSet); @Override MultiLabelInstances clone(); HashMap<String, Integer> getLabelDepth(); int getDepth(String labelName); int[] getLabelDepthIndices(); boolean hasMissingLabels(Instance instance); Instance getNextInstance(); double[] getImbalanceRatios(); double[] getImbalanceRatio(int arrayLabelIndex[]); }
MultiLabelInstances implements Serializable { public MultiLabelInstances reintegrateModifiedDataSet(Instances modifiedDataSet) throws InvalidDataFormatException { if (modifiedDataSet == null) { throw new IllegalArgumentException("The modified data set is null."); } LabelsMetaDataImpl newMetaData = (LabelsMetaDataImpl) labelsMetaData.clone(); Set<String> origLabelNames = labelsMetaData.getLabelNames(); for (String labelName : origLabelNames) { if (modifiedDataSet.attribute(labelName) == null) { newMetaData.removeLabelNode(labelName); } } return new MultiLabelInstances(modifiedDataSet, newMetaData); } MultiLabelInstances(String arffFilePath, int numLabelAttributes);  MultiLabelInstances(InputStream arffDataStream, int numLabelAttributes);  MultiLabelInstances(InputStream arffDataStream, int numLabelAttributes,
            boolean labelsFirst);  MultiLabelInstances(Instances data, String xmlLabelsDefFilePath);  MultiLabelInstances(String arffFilePath, String xmlLabelsDefFilePath);  MultiLabelInstances(String arffFilePath, String xmlLabelsDefFilePath, boolean incremental);  MultiLabelInstances(InputStream arffDataStream, InputStream xmlLabelsDefStream);  MultiLabelInstances(Instances dataSet, LabelsMetaData labelsMetaData); int getNumLabels(); int getNumInstances(); double getCardinality(); int[] getLabelIndices(); String[] getLabelNames(); Map<String, Integer> getLabelsOrder(); Set<Attribute> getLabelAttributes(); int[] getFeatureIndices(); Set<Attribute> getFeatureAttributes(); LabelsMetaData getLabelsMetaData(); Instances getDataSet(); MultiLabelInstances reintegrateModifiedDataSet(Instances modifiedDataSet); @Override MultiLabelInstances clone(); HashMap<String, Integer> getLabelDepth(); int getDepth(String labelName); int[] getLabelDepthIndices(); boolean hasMissingLabels(Instance instance); Instance getNextInstance(); double[] getImbalanceRatios(); double[] getImbalanceRatio(int arrayLabelIndex[]);  }