public BinaryCategoryEncoding(FieldEncodingOptions options) : base(options, FieldDataEncoding.BinaryIntId) { Limit = 20; EmptyFieldExtra = new FieldExtra { Key = EncodeKey(9), Value = "none" }; }
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; } }
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}"); } }
public IdEncoding(FieldEncodingOptions options) : base(options, FieldDataEncoding.Id) { }
public OneHotEncoding(FieldEncodingOptions options) : base(options, FieldDataEncoding.OneHot) { }