Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new instance from the input partition
        /// </summary>
        /// <param name="x">A <see cref="Span{T}"/> representing the input samples partition</param>
        /// <param name="y">A <see cref="Span{T}"/> representing the output samples partition</param>
        /// <param name="inputs">The number of input features</param>
        /// <param name="outputs">The number of output features</param>
        public static SamplesBatch From(Span <float> x, Span <float> y, int inputs, int outputs)
        {
            int samples = x.Length / inputs;

            if (y.Length / outputs != samples)
            {
                throw new ArgumentException("The size of the input and output datasets isn't valid");
            }
            return(new SamplesBatch(x.AsMatrix(samples, inputs), y.AsMatrix(samples, outputs)));
        }