public void TestDenseFeature() { var builder = new FeatureCTFBuilder(); builder.AddDenseFeature("by_sequence", new float[] { 1, 2, 3, 4, 5, 6, 7 }, 3); builder.AddDenseFeature("by_array_of_array", new float[][] { new float[] { 1, 2 }, new float[] { 3, 4, 5 }, new float[] { 6, 7, 8, 9 } }); builder.AddDenseFeature("step_by_step"); builder.AddDenseSample(new float[] { 10, 20, 30 }); builder.AddDenseSample(new float[] { 40, 50, 60 }); var writer = new StringWriter(); builder.Write(writer); var s = writer.ToString(); var expected = "0\t|by_sequence 1 2 3\t|by_array_of_array 1 2\t|step_by_step 10 20 30\r\n" + "1\t|by_sequence 4 5 6\t|by_array_of_array 3 4 5\t|step_by_step 40 50 60\r\n" + "2\t|by_sequence 7\t|by_array_of_array 6 7 8 9"; Assert.AreEqual(expected, s); }
public void TestComment() { var builder = new FeatureCTFBuilder(); builder.AddComment(new string[] { "hello", "world", "!" }); builder.AddDenseFeature("dense", new float[] { 1, 2, 3 }, 1); var writer = new StringWriter(); builder.Write(writer); var s = writer.ToString(); var expected = "0\t|# hello\t|dense 1\r\n" + "1\t|# world\t|dense 2\r\n" + "2\t|# !\t|dense 3"; Assert.AreEqual(expected, s); }