Esempio n. 1
0
        /// <summary>
        /// Create an estimator chain by appending an estimator to an estimator.
        /// </summary>
        public static EstimatorChain <TTrans> Append <TTrans>(
            this IEstimator <ITransformer> start, IEstimator <TTrans> estimator,
            TransformerScope scope = TransformerScope.Everything)
            where TTrans : class, ITransformer
        {
            Contracts.CheckValue(start, nameof(start));
            Contracts.CheckValue(estimator, nameof(estimator));

            return(new EstimatorChain <ITransformer>().Append(start).Append(estimator, scope));
        }
        public TransformerChain <ITransformer> GetModelFor(TransformerScope scopeFilter)
        {
            var xfs    = new List <ITransformer>();
            var scopes = new List <TransformerScope>();

            for (int i = 0; i < _transformers.Length; i++)
            {
                if ((_scopes[i] & scopeFilter) != TransformerScope.None)
                {
                    xfs.Add(_transformers[i]);
                    scopes.Add(_scopes[i]);
                }
            }
            return(new TransformerChain <ITransformer>(xfs.ToArray(), scopes.ToArray()));
        }
Esempio n. 3
0
        internal SweepableEstimator(TTran instance, TransformerScope scope = TransformerScope.Everything, string estimatorName = null, string[] inputs = null, string[] outputs = null)
            : base(estimatorName, inputs, outputs, null, scope)
        {
            this._instance = instance;

            if (estimatorName == null)
            {
                this.EstimatorName = instance.ToString().Split('.').Last();
            }
            else
            {
                this.EstimatorName = estimatorName;
            }

            this.InputColumns  = inputs;
            this.OutputColumns = outputs;
        }
 public TransformerChain <TNewLast> Append <TNewLast>(TNewLast transformer, TransformerScope scope = TransformerScope.Everything)
     where TNewLast : class, ITransformer
 {
     Contracts.CheckValue(transformer, nameof(transformer));
     return(new TransformerChain <TNewLast>(_transformers.AppendElement(transformer), _scopes.AppendElement(scope)));
 }
 public EstimatorChain <TNewTrans> Append <TNewTrans>(IEstimator <TNewTrans> estimator, TransformerScope scope = TransformerScope.Everything)
     where TNewTrans : class, ITransformer
 {
     Contracts.CheckValue(estimator, nameof(estimator));
     return(new EstimatorChain <TNewTrans>(_host, _estimators.AppendElement(estimator), _scopes.AppendElement(scope), _needCacheAfter.AppendElement(false)));
 }
Esempio n. 6
0
 public EstimatorChain <TNewTrans> Append <TNewTrans>(IEstimator <TNewTrans> estimator, TransformerScope scope = TransformerScope.Everything)
     where TNewTrans : class, ITransformer
 {
     Contracts.CheckValue(estimator, nameof(estimator));
     return(new EstimatorChain <TNewTrans>(_estimators.Append(estimator).ToArray(), _scopes.Append(scope).ToArray()));
 }
Esempio n. 7
0
 public static SweepableEstimator <TInstance> CreateUnSweepableNode <TInstance>(TInstance instance, TransformerScope scope = TransformerScope.Everything, string estimatorName = null)
     where TInstance : IEstimator <ITransformer>
 {
     return(new SweepableEstimator <TInstance>(instance, scope, estimatorName));
 }
Esempio n. 8
0
 public static SweepableEstimator <TNewTrain, TOption> CreateSweepableNode <TNewTrain, TOption>(Func <TOption, TNewTrain> estimatorFactory, SweepableOption <TOption> optionBuilder, TransformerScope scope = TransformerScope.Everything, string estimatorName = null)
     where TNewTrain : IEstimator <ITransformer>
     where TOption : class
 {
     return(new SweepableEstimator <TNewTrain, TOption>(estimatorFactory, optionBuilder, scope, estimatorName));
 }
Esempio n. 9
0
 public SweepableEstimatorBase(string estimatorName, string[] inputColumns, string[] outputColumns, IEnumerable <IValueGenerator> sweepableValueGenerators, TransformerScope scope = TransformerScope.Everything)
 {
     this.EstimatorName            = estimatorName;
     this.InputColumns             = inputColumns;
     this.OutputColumns            = outputColumns;
     this.SweepableValueGenerators = sweepableValueGenerators;
     this.Scope = scope;
 }
Esempio n. 10
0
 public static SweepableEstimator <TInstance> CreateSweepableEstimator <TInstance>(TInstance instance, TransformerScope scope = TransformerScope.Everything, string estimatorName = null, string[] inputs = null, string[] outputs = null)
     where TInstance : IEstimator <ITransformer>
 {
     return(new SweepableEstimator <TInstance>(instance, scope, estimatorName, inputs, outputs));
 }