@Test public void testParse() { assertArrayEquals(new float[] {2.0f,3.0f}, DataUtils.readFeatureVector("2,3")); assertArrayEquals(new float[] {2.0f,-3.0f}, DataUtils.readFeatureVector("2, -3")); assertArrayEquals(new float[] {0.4f}, DataUtils.readFeatureVector("0.4")); assertArrayEquals(new float[] {0.0f,-2.1f,0.0f,3.0f,0.0f}, DataUtils.readFeatureVector("0,-2.1,0,3,0")); }
public static float[] readFeatureVector(CharSequence featureVectorString) { String[] elementTokens = COMMA.split(featureVectorString); int features = elementTokens.length; float[] elements = new float[features]; for (int i = 0; i < features; i++) { elements[i] = LangUtils.parseFloat(elementTokens[i]); } return elements; }
DataUtils { public static float[] readFeatureVector(CharSequence featureVectorString) { String[] elementTokens = COMMA.split(featureVectorString); int features = elementTokens.length; float[] elements = new float[features]; for (int i = 0; i < features; i++) { elements[i] = LangUtils.parseFloat(elementTokens[i]); } return elements; } }
DataUtils { public static float[] readFeatureVector(CharSequence featureVectorString) { String[] elementTokens = COMMA.split(featureVectorString); int features = elementTokens.length; float[] elements = new float[features]; for (int i = 0; i < features; i++) { elements[i] = LangUtils.parseFloat(elementTokens[i]); } return elements; } private  DataUtils(); }
DataUtils { public static float[] readFeatureVector(CharSequence featureVectorString) { String[] elementTokens = COMMA.split(featureVectorString); int features = elementTokens.length; float[] elements = new float[features]; for (int i = 0; i < features; i++) { elements[i] = LangUtils.parseFloat(elementTokens[i]); } return elements; } private  DataUtils(); static float[] readFeatureVector(CharSequence featureVectorString); }
DataUtils { public static float[] readFeatureVector(CharSequence featureVectorString) { String[] elementTokens = COMMA.split(featureVectorString); int features = elementTokens.length; float[] elements = new float[features]; for (int i = 0; i < features; i++) { elements[i] = LangUtils.parseFloat(elementTokens[i]); } return elements; } private  DataUtils(); static float[] readFeatureVector(CharSequence featureVectorString);  }