Example #1
0
        public static SabotenCache PrefetchAll(this SabotenCache dataSample, TanukiTransformers tanukiTransformers)
        {
            for (int featureIndex = 0; featureIndex < dataSample.Data.Count(); featureIndex++)
            {
                dataSample = dataSample.Prefetch(featureIndex, tanukiTransformers);
            }

            return(dataSample);
        }
Example #2
0
        public static SabotenCache Prefetch(this SabotenCache dataSample, int featureIndex, TanukiTransformers tanukiTransformers)
        {
            if (dataSample.CacheHit(featureIndex))
            {
                return(dataSample);
            }
            else
            {
                Tuple <Range, Converter <IEnumerable <double>, IEnumerable <double> > > dataTransformer = tanukiTransformers.DataTransformer(featureIndex);
                IEnumerable <double> transformedData = dataTransformer.Item2(dataSample.Data);

                return(dataSample.LoadCache(dataTransformer.Item1, transformedData));
            }
        }
Example #3
0
        public static IEnumerable <SabotenCache> Prefetch(this IEnumerable <SabotenCache> dataSamples, int featureIndex, TanukiTransformers tanukiTransformers)
        {
            Tuple <Range, Converter <IEnumerable <double>, IEnumerable <double> > > dataTransformer = tanukiTransformers.DataTransformer(featureIndex);

            foreach (SabotenCache dataSample in dataSamples)
            {
                yield return(dataSample.Prefetch(featureIndex, dataTransformer));
            }
        }
Example #4
0
        public static IEnumerable <SabotenCache> PrefetchAll(this IEnumerable <SabotenCache> dataSamples, TanukiTransformers tanukiTransformers)
        {
            ImmutableList <Tuple <Range, Converter <IEnumerable <double>, IEnumerable <double> > > > dataTransformers = ImmutableList <Tuple <Range, Converter <IEnumerable <double>, IEnumerable <double> > > > .Empty;

            for (int featureIndex = 0; featureIndex < tanukiTransformers.TotalOutputSamples; featureIndex++)
            {
                dataTransformers = dataTransformers.Add(tanukiTransformers.DataTransformer(featureIndex));
            }

            foreach (SabotenCache dataSample in dataSamples)
            {
                yield return(dataSample.PrefetchAll(dataTransformers));
            }
        }