public void PostConfigure(string name, ModelPredictionEngineOptions <TData, TPrediction> options) { _options = options; if (_logger.IsEnabled(options.LogLevel)) { options.MLContext().Log += Log; } }
public ModelPredictionEnginePooledObjectPolicy( MLContext mlContext, ITransformer model, ModelPredictionEngineOptions <TData, TPrediction> options, ILogger logger) { _mlContext = mlContext ?? throw new ArgumentNullException(nameof(mlContext)); _model = model ?? throw new ArgumentNullException(nameof(model)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _options = options ?? throw new ArgumentNullException(nameof(options)); }
public ModelPoolLoader(ModelPredictionEngineOptions <TInput, TPrediction> options) { _options = options ?? throw new ArgumentNullException(nameof(options)); _mlContext = _options.ServiceProvider.GetRequiredService <IOptions <MLContextOptions> >().Value.MLContext ?? throw new NullReferenceException("MLContext instance is missing"); _logger = _options.ServiceProvider.GetRequiredService <ILoggerFactory>().CreateLogger(nameof(ModelPoolLoader <TInput, TPrediction>)); LoadPool(); _changeToken = ChangeToken.OnChange( () => _options.GetReloadToken(), () => LoadPool()); }
public ModelPredictionEngineObjectPool( Func <ModelPredictionEngineOptions <TData, TPrediction> > options, ILoggerFactory loggerFactory) { _funcOptions = options ?? throw new ArgumentNullException(nameof(options)); _logger = loggerFactory.CreateLogger(nameof(ModelPredictionEngineObjectPool <TData, TPrediction>)) ?? throw new ArgumentNullException(nameof(loggerFactory)); _options = _funcOptions(); LoadPool(); _changeToken = ChangeToken.OnChange( () => _options.GetReloadToken(), () => LoadPool()); }
public ModelPredictionEngineObjectPool( Func <ModelPredictionEngineOptions <TData, TPrediction> > options, ILoggerFactory loggerFactory) { _options = options() ?? throw new ArgumentNullException(nameof(options)); _logger = loggerFactory.CreateLogger(nameof(ModelPredictionEngineObjectPool <TData, TPrediction>)) ?? throw new ArgumentNullException(nameof(loggerFactory)); // get mlcontext _mlContext = _options.MLContext(); // get prediction model Model = _options.CreateModel(_mlContext); // create PredictionEngine Object Pool _predictionEnginePool = CreatePredictionEngineObjectPool(); }
public void Configure(ModelPredictionEngineOptions <TData, TPrediction> options) { Configure(options.ModelName, options); }
public void Configure(string name, ModelPredictionEngineOptions <TData, TPrediction> options) { options.ModelName = name; options.ServiceProvider = _serviceProvider; }
public void Configure(string name, ModelPredictionEngineOptions <TData, TPrediction> options) { options.ModelName = name; }