예제 #1
0
        public override void Save(ModelSaveContext ctx)
        {
            Host.CheckValue(ctx, nameof(ctx));
            ctx.CheckAtModel();
            ctx.SetVersionInfo(GetVersionInfo());

            // <prefix handled in static Create method>
            // <base>
            // Exes

            SaveBase(ctx);
            Host.Assert(_exes.Length == Infos.Length);
            for (int iinfo = 0; iinfo < Infos.Length; iinfo++)
            {
                _exes[iinfo].Save(ctx);
            }

            TextModelHelper.SaveAll(Host, ctx, Infos.Length, _keyValues);
        }
예제 #2
0
        public override void Save(ModelSaveContext ctx)
        {
            Host.CheckValue(ctx, nameof(ctx));
            ctx.CheckAtModel();
            ctx.SetVersionInfo(GetVersionInfo());

            // *** Binary format ***
            // int: sizeof(Float)
            // bindings
            // for each added column
            //   ColInfoEx

            ctx.Writer.Write(sizeof(Float));
            _bindings.Save(ctx);
            for (int iinfo = 0; iinfo < _exes.Length; iinfo++)
            {
                _exes[iinfo].Save(ctx);
            }
            TextModelHelper.SaveAll(Host, ctx, _exes.Length, _slotNames);
        }
예제 #3
0
        private HashTransform(IHost host, ModelLoadContext ctx, IDataView input)
            : base(host, ctx, input, TestType)
        {
            Host.AssertValue(ctx);

            // *** Binary format ***
            // <base>
            // Exes

            Host.AssertNonEmpty(Infos);
            _exes = new ColInfoEx[Infos.Length];
            for (int iinfo = 0; iinfo < Infos.Length; iinfo++)
            {
                _exes[iinfo] = new ColInfoEx(ctx);
            }

            _types = InitColumnTypes();

            TextModelHelper.LoadAll(Host, ctx, Infos.Length, out _keyValues, out _kvTypes);
            SetMetadata();
        }
예제 #4
0
        private NgramHashTransform(IHost host, ModelLoadContext ctx, IDataView input)
            : base(host, input)
        {
            Host.AssertValue(ctx);

            // *** Binary format ***
            // int: sizeof(Float)
            // bindings
            // for each added column
            //   ColInfoEx

            int cbFloat = ctx.Reader.ReadInt32();

            Host.CheckDecode(cbFloat == sizeof(Float));
            _bindings = new Bindings(ctx, Source.Schema, this);
            _exes     = new ColInfoEx[_bindings.Infos.Length];

            for (int iinfo = 0; iinfo < _bindings.Infos.Length; iinfo++)
            {
                _exes[iinfo] = new ColInfoEx(ctx);
            }
            InitColumnTypes();
            TextModelHelper.LoadAll(Host, ctx, _exes.Length, out _slotNames, out _slotNamesTypes);
        }