Exemple #1
0
 public Factory(RoleMappedData data, CursOpt opt = CursOpt.Features)
     : base(data, opt)
 {
 }
Exemple #2
0
 protected override FeatureFloatVectorCursor CreateCursorCore(IRowCursor input, RoleMappedData data, CursOpt opt, Action <CursOpt> signal)
 {
     return(new FeatureFloatVectorCursor(input, data, opt, signal));
 }
Exemple #3
0
 protected override StandardScalarCursor CreateCursorCore(IRowCursor input, RoleMappedData data, CursOpt opt, Action <CursOpt> signal)
 => new StandardScalarCursor(input, data, opt, signal);
Exemple #4
0
 public FeatureFloatVectorCursor(RoleMappedData data, CursOpt opt = CursOpt.Features,
                                 IRandom rand = null, params int[] extraCols)
     : this(CreateCursor(data, opt, rand, extraCols), data, opt)
 {
 }
Exemple #5
0
 public StandardScalarCursor(RoleMappedData data, CursOpt opt, IRandom rand = null, params int[] extraCols)
     : this(CreateCursor(data, opt, rand, extraCols), data, opt)
 {
 }
Exemple #6
0
 public Factory(RoleMappedData data, CursOpt opt)
     : base(data, opt)
 {
 }
Exemple #7
0
 private void SignalCore(CursOpt opt)
 {
     lock (_lock)
         _opts |= opt;
 }
Exemple #8
0
 public MultiClassLabelCursor(int classCount, RoleMappedData data, CursOpt opt = CursOpt.Label,
                              IRandom rand = null, params int[] extraCols)
     : this(classCount, CreateCursor(data, opt, rand, extraCols), data, opt)
 {
 }
Exemple #9
0
 /// <summary>
 /// Create a row cursor set for the RoleMappedData with the indicated standard columns active.
 /// This does not verify that the columns exist, but merely activates the ones that do exist.
 /// </summary>
 public static IRowCursor[] CreateRowCursorSet(this RoleMappedData data, out IRowCursorConsolidator consolidator,
                                               CursOpt opt, int n, IRandom rand, IEnumerable <int> extraCols = null)
 => data.Data.GetRowCursorSet(out consolidator, CreatePredicate(data, opt, extraCols), n, rand);
Exemple #10
0
 protected static IRowCursor CreateCursor(RoleMappedData data, CursOpt opt, IRandom rand, params int[] extraCols)
 {
     Contracts.AssertValue(data);
     Contracts.AssertValueOrNull(rand);
     return(data.CreateRowCursor(opt, rand, extraCols));
 }
Exemple #11
0
 /// <summary>
 /// Create a row cursor for the RoleMappedData with the indicated standard columns active.
 /// This does not verify that the columns exist, but merely activates the ones that do exist.
 /// </summary>
 public static IRowCursor CreateRowCursor(this RoleMappedData data, CursOpt opt, IRandom rand, IEnumerable <int> extraCols = null)
 => data.Data.GetRowCursor(CreatePredicate(data, opt, extraCols), rand);
Exemple #12
0
 protected override MultiClassLabelCursor CreateCursorCore(IRowCursor input, RoleMappedData data, CursOpt opt, Action <CursOpt> signal)
 {
     return(new MultiClassLabelCursor(_classCount, input, data, opt, signal));
 }
Exemple #13
0
        protected MultiClassLabelCursor(int classCount, IRowCursor input, RoleMappedData data, CursOpt opt, Action <CursOpt> signal = null)
            : base(input, data, opt, signal)
        {
            Contracts.Assert(classCount >= 0);
            _classCount = classCount;

            if ((opt & CursOpt.Label) != 0 && data.Schema.Label != null)
            {
                _get     = Row.GetLabelFloatGetter(data);
                _keepBad = (opt & CursOpt.AllowBadLabels) != 0;
            }
        }
Exemple #14
0
 public FloatLabelCursor(RoleMappedData data, CursOpt opt = CursOpt.Label,
                         IRandom rand = null, params int[] extraCols)
     : this(CreateCursor(data, opt, rand, extraCols), data, opt)
 {
 }
Exemple #15
0
 /// <summary>
 /// Called by both the <see cref="Create"/> and <see cref="CreateSet"/> factory methods. Implementors
 /// should instantiate the particular wrapping cursor.
 /// </summary>
 /// <param name="input">The row cursor we will wrap.</param>
 /// <param name="data">The data from which the row cursor was instantiated.</param>
 /// <param name="opt">The cursor options this row cursor was created with.</param>
 /// <param name="signal">The action that our wrapping cursor will call. Implementors of the cursor
 /// do not usually call it directly, but instead override
 /// <see cref="TrainingCursorBase.CursoringCompleteFlags"/>, whose return value is used to call
 /// this action.</param>
 /// <returns></returns>
 protected abstract TCurs CreateCursorCore(IRowCursor input, RoleMappedData data, CursOpt opt, Action <CursOpt> signal);
Exemple #16
0
        private static IEnumerable <Schema.Column> CreatePredicate(RoleMappedData data, CursOpt opt, IEnumerable <int> extraCols)
        {
            Contracts.AssertValue(data);
            Contracts.AssertValueOrNull(extraCols);

            var columns = extraCols == null?
                          Enumerable.Empty <Schema.Column>() :
                              data.Data.Schema.Where(c => extraCols.Contains(c.Index));

            if ((opt & CursOpt.Label) != 0 && data.Schema.Label.HasValue)
            {
                columns = columns.Append(data.Schema.Label.Value);
            }
            if ((opt & CursOpt.Features) != 0 && data.Schema.Feature.HasValue)
            {
                columns = columns.Append(data.Schema.Feature.Value);
            }
            if ((opt & CursOpt.Weight) != 0 && data.Schema.Weight.HasValue)
            {
                columns = columns.Append(data.Schema.Weight.Value);
            }
            if ((opt & CursOpt.Group) != 0 && data.Schema.Group.HasValue)
            {
                columns = columns.Append(data.Schema.Group.Value);
            }
            return(columns);
        }
 /// <summary>
 /// Create a row cursor set for the <see cref="RoleMappedData"/> with the indicated standard columns active.
 /// This does not verify that the columns exist, but merely activates the ones that do exist.
 /// </summary>
 public static RowCursor[] CreateRowCursorSet(this RoleMappedData data,
                                              CursOpt opt, int n, Random rand, IEnumerable <int> extraCols = null)
 => data.Data.GetRowCursorSet(CreatePredicate(data, opt, extraCols), n, rand);