Пример #1
0
        public void TestOneHotPreprocessorCreate()
        {
            Assert.Throws <ArgumentException>(() => new OneHotPreprocessor(sectionName: "section"));

            OneHotPreprocessor preprocessor = new OneHotPreprocessor("section", 1, 2, 3, 4);

            Assert.AreEqual(new[] { "section" }, preprocessor.ProcessedSectionNames);
        }
Пример #2
0
        public void TestOneHotPreprocessorExtract()
        {
            OneHotPreprocessor  preprocessor = new OneHotPreprocessor("test", minValue: 0, maxValue: 2);
            IComputationHandler handler      = new CpuFloat32Handler();

            Dictionary <string, INDArray> extracted = preprocessor.ExtractDirectFrom(GetNamedArrayTestData(), 2, handler);

            Assert.AreEqual(new float[] { 1, 0, 0, 0, 0, 1 }, extracted["test"].GetDataAs <float>().GetValuesArrayAs <float>(0, 6).ToArray());
        }