Exemple #1
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));
            }
        }
Exemple #2
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));
            }
        }
Exemple #3
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));
            }
        }