public XGBoostScalarRowMapperBase(RoleMappedSchema schema, XGBoostPredictorBase <TOutput> parent, IHostEnvironment env, ISchema outputSchema) { Contracts.AssertValue(env, "env"); env.AssertValue(schema, "schema"); env.AssertValue(parent, "parent"); env.AssertValue(schema.Feature, "schema"); // REVIEW xadupre: only one feature columns is allowed. // This should be revisited in the future. // XGBoost has plans for others types. // Look at https://github.com/dmlc/xgboost/issues/874. env.Check(schema.Feature != null, "Unexpected number of feature columns, 1 expected."); _parent = parent; var columns = new[] { schema.Feature }; var fc = new[] { new KeyValuePair <RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Feature, columns[0].Name) }; _inputSchema = new RoleMappedSchema(schema.Schema, fc); _outputSchema = outputSchema; _inputCols = new List <int>(); foreach (var kvp in columns) { int index; if (schema.Schema.TryGetColumnIndex(kvp.Name, out index)) { _inputCols.Add(index); } else { Contracts.Assert(false); } } _booster = _parent.GetBooster(); }
public XGBoostScalarRowMapper(RoleMappedSchema schema, XGBoostPredictorBase <Float> parent, IHostEnvironment env, ISchema outputSchema) : base(schema, parent, env, outputSchema) { env.CheckParam(outputSchema.ColumnCount == 1, nameof(outputSchema)); env.CheckParam(outputSchema.GetColumnType(0).IsNumber, nameof(outputSchema)); }