コード例 #1
0
        internal DataLoaderEstimator(IHostEnvironment env, IDataLoaderEstimator <TIn, TDataLoader> estimator, StaticSchemaShape shape)
            : base(env, shape)
        {
            Env.AssertValue(estimator);

            AsDynamic = estimator;
            Shape.Check(Env, AsDynamic.GetOutputSchema());
        }
コード例 #2
0
        /// <summary>
        /// Create a new composite loader estimator, by appending another estimator to the end of this data loader estimator.
        /// </summary>
        public static CompositeLoaderEstimator <TSource, TTrans> Append <TSource, TTrans>(
            this IDataLoaderEstimator <TSource, IDataLoader <TSource> > start, IEstimator <TTrans> estimator)
            where TTrans : class, ITransformer
        {
            Contracts.CheckValue(start, nameof(start));
            Contracts.CheckValue(estimator, nameof(estimator));

            return(new CompositeLoaderEstimator <TSource, ITransformer>(start).Append(estimator));
        }
コード例 #3
0
        public CompositeLoaderEstimator(IDataLoaderEstimator <TSource, IDataLoader <TSource> > start, EstimatorChain <TLastTransformer> estimatorChain = null)
        {
            Contracts.CheckValue(start, nameof(start));
            Contracts.CheckValueOrNull(estimatorChain);

            _start          = start;
            _estimatorChain = estimatorChain ?? new EstimatorChain <TLastTransformer>();

            // REVIEW: enforce that estimator chain can read the loader's schema.
            // Right now it throws.
            // GetOutputSchema();
        }
コード例 #4
0
        public static DataLoaderEstimator <TIn, T, TLoader> AssertStatic <TIn, [IsShape] T, TLoader>(
            this IDataLoaderEstimator <TIn, TLoader> loaderEstimator, IHostEnvironment env,
            Func <SchemaAssertionContext, T> outputDecl)
            where TLoader : class, IDataLoader <TIn>
        {
            Contracts.CheckValue(env, nameof(env));
            env.CheckValue(loaderEstimator, nameof(loaderEstimator));
            env.CheckValue(outputDecl, nameof(outputDecl));

            var schema = StaticSchemaShape.Make <T>(outputDecl.Method.ReturnParameter);

            return(new DataLoaderEstimator <TIn, T, TLoader>(env, loaderEstimator, schema));
        }