public FeatureVector toFeatureVector(int unitIndex,String featureString){
  String[] featureValues=featureString.split("\\s+");
  if (featureValues.length != numByteFeatures + numShortFeatures + numContinuousFeatures)   throw new IllegalArgumentException("Expected " + (numByteFeatures + numShortFeatures + numContinuousFeatures) + " features, got "+ featureValues.length);
  byte[] bytes=new byte[numByteFeatures];
  short[] shorts=new short[numShortFeatures];
  float[] floats=new float[numContinuousFeatures];
  for (int i=0; i < numByteFeatures; i++) {
    bytes[i]=Byte.parseByte(featureValues[i]);
  }
  for (int i=0; i < numShortFeatures; i++) {
    shorts[i]=Short.parseShort(featureValues[numByteFeatures + i]);
  }
  for (int i=0; i < numContinuousFeatures; i++) {
    floats[i]=Float.parseFloat(featureValues[numByteFeatures + numShortFeatures + i]);
  }
  return new FeatureVector(bytes,shorts,floats,unitIndex);
}

public FeatureVector toFeatureVector ( int unitIndex , String featureString ) { String [ ] featureValues = featureString . split ( "\\s+" ) ; if ( featureValues . length != numByteFeatures + numShortFeatures + numContinuousFeatures ) throw new IllegalArgumentException ( "Expected " + ( numByteFeatures + numShortFeatures + numContinuousFeatures ) + " features, got " + featureValues . length ) ; byte [ ] bytes = new byte [ numByteFeatures ] ; short [ ] shorts = new short [ numShortFeatures ] ; float [ ] floats = new float [ numContinuousFeatures ] ; for ( int i = 0 ; i < numByteFeatures ; i ++ ) { bytes [ i ] = Byte . parseByte ( featureValues [ i ] ) ; } for ( int i = 0 ; i < numShortFeatures ; i ++ ) { shorts [ i ] = Short . parseShort ( featureValues [ numByteFeatures + i ] ) ; } for ( int i = 0 ; i < numContinuousFeatures ; i ++ ) { floats [ i ] = Float . parseFloat ( featureValues [ numByteFeatures + numShortFeatures + i ] ) ; } return new FeatureVector ( bytes , shorts , floats , unitIndex ) ; }
create a feature vector consistent with this feature definition by reading the data from a string representation . in that string , the string values for each feature must be separated by white space . for example , this format is created by tofeaturestring ( featurevector ) .
