private void writeBinaryTo(DataOutput out,List<Integer> featuresToDrop) throws IOException {
  int droppedByteFeatures=0;
  int droppedShortFeatures=0;
  int droppedContinuousFeatures=0;
  for (  int f : featuresToDrop) {
    if (f < numByteFeatures) {
      droppedByteFeatures++;
    }
 else     if (f < numByteFeatures + numShortFeatures) {
      droppedShortFeatures++;
    }
 else     if (f < numByteFeatures + numShortFeatures + numContinuousFeatures) {
      droppedContinuousFeatures++;
    }
  }
  out.writeInt(numByteFeatures - droppedByteFeatures);
  for (int i=0; i < numByteFeatures; i++) {
    if (featuresToDrop.contains(i)) {
      continue;
    }
    if (featureWeights != null) {
      out.writeFloat(featureWeights[i]);
    }
 else {
      out.writeFloat(0);
    }
    out.writeUTF(getFeatureName(i));
    int numValues=getNumberOfValues(i);
    byte numValuesEncoded=(byte)numValues;
    out.writeByte(numValuesEncoded);
    for (int b=0; b < numValues; b++) {
      String value=getFeatureValueAsString(i,b);
      out.writeUTF(value);
    }
  }
  out.writeInt(numShortFeatures - droppedShortFeatures);
  for (int i=numByteFeatures; i < numByteFeatures + numShortFeatures; i++) {
    if (featuresToDrop.contains(i)) {
      continue;
    }
    if (featureWeights != null) {
      out.writeFloat(featureWeights[i]);
    }
 else {
      out.writeFloat(0);
    }
    out.writeUTF(getFeatureName(i));
    short numValues=(short)getNumberOfValues(i);
    out.writeShort(numValues);
    for (short b=0; b < numValues; b++) {
      String value=getFeatureValueAsString(i,b);
      out.writeUTF(value);
    }
  }
  out.writeInt(numContinuousFeatures - droppedContinuousFeatures);
  for (int i=numByteFeatures + numShortFeatures; i < numByteFeatures + numShortFeatures + numContinuousFeatures; i++) {
    if (featuresToDrop.contains(i)) {
      continue;
    }
    if (featureWeights != null) {
      out.writeFloat(featureWeights[i]);
      out.writeUTF(floatWeightFuncts[i - numByteFeatures - numShortFeatures]);
    }
 else {
      out.writeFloat(0);
      out.writeUTF("");
    }
    out.writeUTF(getFeatureName(i));
  }
}

private void writeBinaryTo ( DataOutput out , List < Integer > featuresToDrop ) throws IOException { int droppedByteFeatures = 0 ; int droppedShortFeatures = 0 ; int droppedContinuousFeatures = 0 ; for ( int f : featuresToDrop ) { if ( f < numByteFeatures ) { droppedByteFeatures ++ ; } else if ( f < numByteFeatures + numShortFeatures ) { droppedShortFeatures ++ ; } else if ( f < numByteFeatures + numShortFeatures + numContinuousFeatures ) { droppedContinuousFeatures ++ ; } } out . writeInt ( numByteFeatures - droppedByteFeatures ) ; for ( int i = 0 ; i < numByteFeatures ; i ++ ) { if ( featuresToDrop . contains ( i ) ) { continue ; } if ( featureWeights != null ) { out . writeFloat ( featureWeights [ i ] ) ; } else { out . writeFloat ( 0 ) ; } out . writeUTF ( getFeatureName ( i ) ) ; int numValues = getNumberOfValues ( i ) ; byte numValuesEncoded = ( byte ) numValues ; out . writeByte ( numValuesEncoded ) ; for ( int b = 0 ; b < numValues ; b ++ ) { String value = getFeatureValueAsString ( i , b ) ; out . writeUTF ( value ) ; } } out . writeInt ( numShortFeatures - droppedShortFeatures ) ; for ( int i = numByteFeatures ; i < numByteFeatures + numShortFeatures ; i ++ ) { if ( featuresToDrop . contains ( i ) ) { continue ; } if ( featureWeights != null ) { out . writeFloat ( featureWeights [ i ] ) ; } else { out . writeFloat ( 0 ) ; } out . writeUTF ( getFeatureName ( i ) ) ; short numValues = ( short ) getNumberOfValues ( i ) ; out . writeShort ( numValues ) ; for ( short b = 0 ; b < numValues ; b ++ ) { String value = getFeatureValueAsString ( i , b ) ; out . writeUTF ( value ) ; } } out . writeInt ( numContinuousFeatures - droppedContinuousFeatures ) ; for ( int i = numByteFeatures + numShortFeatures ; i < numByteFeatures + numShortFeatures + numContinuousFeatures ; i ++ ) { if ( featuresToDrop . contains ( i ) ) { continue ; } if ( featureWeights != null ) { out . writeFloat ( featureWeights [ i ] ) ; out . writeUTF ( floatWeightFuncts [ i - numByteFeatures - numShortFeatures ] ) ; } else { out . writeFloat ( 0 ) ; out . writeUTF ( "" ) ; } out . writeUTF ( getFeatureName ( i ) ) ; } }
write this feature definition in binary format to the given output , dropping featurestodrop
