public SequentialDataTransform(IHost host, SequentialTransformerBase <TInput, TOutput, TState> parent, IDataView input, IRowMapper mapper)
     : base(parent.Host, input)
 {
     _parent    = parent;
     _transform = CreateLambdaTransform(_parent.Host, input, _parent.InputColumnName,
                                        _parent.OutputColumnName, InitFunction, _parent.WindowSize > 0, _parent.OutputColumnType);
     _mapper   = mapper;
     _bindings = new ColumnBindings(Schema.Create(input.Schema), _mapper.GetOutputColumns());
 }
Exemplo n.º 2
0
            public void InitState(SequentialTransformerBase <TInput, TOutput, TState> parentTransform, IHost host)
            {
                Contracts.CheckValue(host, nameof(host), "The host cannot be null.");
                host.CheckValue(parentTransform, nameof(parentTransform));

                Host            = host;
                ParentTransform = parentTransform;
                RowCounter      = 0;
                InitializeStateCore(true);
                PreviousPosition = -1;
            }
Exemplo n.º 3
0
            /// <summary>
            /// This method sets the window size and initializes the buffer only once.
            /// Since the class needs to implement a default constructor, this methods provides a mechanism to initialize the window size and buffer.
            /// </summary>
            /// <param name="windowSize">The size of the windowed buffer</param>
            /// <param name="initialWindowSize">The size of the windowed initial buffer used for training</param>
            /// <param name="parentTransform">The parent transform of this state object</param>
            /// <param name="host">The host</param>
            public void InitState(int windowSize, int initialWindowSize, SequentialTransformerBase <TInput, TOutput, TState> parentTransform,
                                  IHost host)
            {
                Contracts.CheckValue(host, nameof(host), "The host cannot be null.");
                host.CheckValue(parentTransform, nameof(parentTransform));
                host.CheckParam(windowSize >= 0, nameof(windowSize), "Must be non-negative.");
                host.CheckParam(initialWindowSize >= 0, nameof(initialWindowSize), "Must be non-negative.");

                Host                  = host;
                WindowSize            = windowSize;
                InitialWindowSize     = initialWindowSize;
                ParentTransform       = parentTransform;
                WindowedBuffer        = (WindowSize > 0) ? new FixedSizeQueue <TInput>(WindowSize) : new FixedSizeQueue <TInput>(1);
                InitialWindowedBuffer = (InitialWindowSize > 0) ? new FixedSizeQueue <TInput>(InitialWindowSize) : new FixedSizeQueue <TInput>(1);
                RowCounter            = 0;

                InitializeStateCore();
                PreviousPosition = -1;
            }