예제 #1
0
        public async Task <IEnumerable <double> > FireAsync(IEnumerable <double> inputValues)
        {
            var outputs     = (await _perceptron.FireAsync(inputValues)).ToList();
            var oneHot      = Enumerable.Repeat(0d, outputs.Count()).ToList();
            var max         = outputs.Max();
            var avgMaxIndex = outputs.IndexOf(max);

            oneHot[avgMaxIndex] = 1d;
            return(oneHot);
        }
예제 #2
0
        public async Task OneHotPerceptronReturnsAvgMaxAs1()
        {
            var expected = new List <double> {
                0d, 1d, 0d
            };
            var results = new List <double> {
                1d, 3d, 2d
            }.AsEnumerable();

            _wrappedPerceptronMock.Setup(p => p.FireAsync(It.IsAny <IEnumerable <double> >())).Returns(() => Task.Run(() => results));
            var oneHot = await _perceptron.FireAsync(new List <double>());

            oneHot.Should().BeEquivalentTo(expected);
        }
 public async Task <IEnumerable <double> > FireAsync(IEnumerable <double> inputValues)
 {
     return(await _perceptron.FireAsync(inputValues));
 }