internal PredictorModelImpl(IHostEnvironment env, RoleMappedData trainingData, IDataView startingData, IPredictor predictor) { Contracts.CheckValue(env, nameof(env)); env.CheckValue(trainingData, nameof(trainingData)); env.CheckValue(predictor, nameof(predictor)); TransformModel = new TransformModelImpl(env, trainingData.Data, startingData); _roleMappings = trainingData.Schema.GetColumnRoleNames().ToArray(); Predictor = predictor; }
internal PredictorModelImpl(IHostEnvironment env, Stream stream) { Contracts.CheckValue(env, nameof(env)); env.CheckValue(stream, nameof(stream)); using (var ch = env.Start("Loading predictor model")) { // REVIEW: address the asymmetry in the way we're loading and saving the model. TransformModel = new TransformModelImpl(env, stream); var roles = ModelFileUtils.LoadRoleMappingsOrNull(env, stream); env.CheckDecode(roles != null, "Predictor model must contain role mappings"); _roleMappings = roles.ToArray(); Predictor = ModelFileUtils.LoadPredictorOrNull(env, stream); env.CheckDecode(Predictor != null, "Predictor model must contain a predictor"); } }