示例#1
0
 public BinaryCategoryEncoding(FieldEncodingOptions options) : base(options, FieldDataEncoding.BinaryIntId)
 {
     Limit           = 20;
     EmptyFieldExtra = new FieldExtra
     {
         Key   = EncodeKey(9),
         Value = "none"
     };
 }
示例#2
0
 public FieldEncoding(FieldEncodingOptions options, FieldDataEncoding encoding)
 {
     this.Encoding = encoding;
     _options      = options;
     _integration  = _options.Integration;
     //var collection = MongoHelper.GetCollection(_integration.Collection);
     _targetFields = _integration.Fields.Where(x => x.DataEncoding == encoding).ToList();
     _fieldDict    = new Dictionary <string, ConcurrentDictionary <string, FieldExtra> >();
     foreach (var fld in TargetFields)
     {
         if (fld.Extras == null)
         {
             var dict1 = new ConcurrentDictionary <string, FieldExtra>();
             _fieldDict.Add(fld.Name, dict1);
             continue;
         }
         var dict = new ConcurrentDictionary <string, FieldExtra>(fld.Extras.Extra.ToDictionary(x => x.Value));
         _fieldDict[fld.Name] = dict;
     }
 }
示例#3
0
            public static FieldEncoding Create(IIntegration integration, FieldDataEncoding fldDataEncoding)
            {
                //TODO: Replace this with attributes.
                var ops = new FieldEncodingOptions {
                    Integration = integration
                };

                if (fldDataEncoding == FieldDataEncoding.OneHot)
                {
                    return(new OneHotEncoding(ops));
                }
                else if (fldDataEncoding == FieldDataEncoding.BinaryIntId)
                {
                    return(new BinaryCategoryEncoding(ops));
                }
                else if (fldDataEncoding == FieldDataEncoding.Id)
                {
                    return(new IdEncoding(ops));
                }
                else
                {
                    throw new NotImplementedException($"Field encoding not implemented: {fldDataEncoding}");
                }
            }
示例#4
0
 public IdEncoding(FieldEncodingOptions options) : base(options, FieldDataEncoding.Id)
 {
 }
示例#5
0
 public OneHotEncoding(FieldEncodingOptions options) : base(options, FieldDataEncoding.OneHot)
 {
 }