protected void CreateFastValueMapper(int conc) { IDataTransform tr = _transforms.Last().transform; if (_predictor != null && _predictor.predictor != null) { var roles = new RoleMappedData(tr, _roles ?? new List <KeyValuePair <RoleMappedSchema.ColumnRole, string> >()); tr = PredictorHelper.Predict(_env, _predictor.predictor, roles); } _fastValueMapperObject = new ValueMapperDataFrameFromTransform(_env, tr, conc: conc); _fastValueMapper = _fastValueMapperObject.GetMapper <DataFrame, DataFrame>(); }
/// <summary> /// Computes the predictions for data stored in a <see cref="IDataView"/>. /// This method can be called from any thread as it creates new getters. /// It must follow the same schema as the training data. /// </summary> public IDataView Predict(IDataView data) { IDataView features = null; if (_transforms == null) { features = data; } else { var first = _transforms.First().transform; var pass = first as PassThroughTransform; pass.SetSource(data); features = _transforms.Last().transform; } if (_predictor == null || _predictor.predictor == null) { return(features); } var roles = new RoleMappedData(features, _roles ?? new List <KeyValuePair <RoleMappedSchema.ColumnRole, string> >()); return(PredictorHelper.Predict(_env, _predictor.predictor, roles)); }