/// <summary> /// Constructs a new general regression reconciler. /// </summary> /// <param name="estimatorFactory">The delegate to create the training estimator. It is assumed that this estimator /// will produce a single new scalar <see cref="float"/> column named <see cref="DefaultColumnNames.Score"/>.</param> /// <param name="label">The input label column.</param> /// <param name="features">The input features column.</param> /// <param name="weights">The input weights column, or <c>null</c> if there are no weights.</param> public Regression(EstimatorFactory estimatorFactory, Scalar <float> label, Vector <float> features, Scalar <float> weights) : base(MakeInputs(Contracts.CheckRef(label, nameof(label)), Contracts.CheckRef(features, nameof(features)), weights), _fixedOutputNames) { Contracts.CheckValue(estimatorFactory, nameof(estimatorFactory)); _estFact = estimatorFactory; Contracts.Assert(Inputs.Length == 2 || Inputs.Length == 3); Score = new Impl(this); }
/// <summary> /// Constructs a new general regression reconciler. /// </summary> /// <param name="estimatorFactory">The delegate to create the training estimator. It is assumed that this estimator /// will produce a single new scalar <see cref="float"/> column named <see cref="DefaultColumnNames.Score"/>.</param> /// <param name="label">The input label column.</param> /// <param name="features">The input features column.</param> /// <param name="weights">The input weights column, or <c>null</c> if there are no weights.</param> public BinaryClassifier(EstimatorFactory estimatorFactory, Scalar <bool> label, Vector <float> features, Scalar <float> weights) : base(MakeInputs(Contracts.CheckRef(label, nameof(label)), Contracts.CheckRef(features, nameof(features)), weights), _fixedOutputNames) { Contracts.CheckValue(estimatorFactory, nameof(estimatorFactory)); _estFact = estimatorFactory; Contracts.Assert(Inputs.Length == 2 || Inputs.Length == 3); Output = (new Impl(this), new Impl(this), new ImplBool(this)); }
public FloodingSimulator() { environment = new Environment(); BuildSimulation(); sensorFactory = new DummySensorFactory(environment); actuatorFactory = new DummyActuatorFactory(environment); estimatorFactory = new EstimatorFactory(sensorFactory, actuatorFactory); warnerFactory = new WarnerFactory(actuatorFactory); var speedEstimator = estimatorFactory.GetUltrasoundSpeedEstimator(); var depthEstimator = estimatorFactory.GetRadarDepthEstimator(); warner = warnerFactory.GetSMSWarner(); controller = new FloodingWarningSystem(speedEstimator, depthEstimator, warner); }
public async Task <double> GetRiskFromValuables(IHasValuables subject) { var totalValue = 0; double result = 0; foreach (var item in subject.Valuables) { using (var estimator = EstimatorFactory.GetEstimator(item)) { var value = await estimator.GetValue(item).ConfigureAwait(false); totalValue += value; } } if (totalValue > 100) { result = 1.0; } return(result); }
private void btnStart_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(ecgFile) || String.IsNullOrEmpty(segmentStartFile) || String.IsNullOrEmpty(segmentStopFile)) { MessageBox.Show("Load all neccesary files", "Missing files", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { //"D:\\Fax\\Diplomski\\3.Semestar\\ISS\\data\\S_04_ecg.csv" reader = new CSVReader(ecgFile, bufferSize, samplingFrequency); reader.DataReady += new EventHandler <Herz.Common.DataReadyEventArgs>(reader_DataReady); PanTompkins = new Pipeline <ECGSample>(reader.Frequency); PanTompkins.Register(lp); PanTompkins.Register(derivative); PanTompkins.Register(square); PanTompkins.Register(integrator); PanTompkins.Register(new Delay(PanTompkins.FilterDelay)); detector = new Detector(samplingFrequency, bufferSize); estimator = EstimatorFactory.CreateEstimatorFromFile(segmentStartFile, segmentStopFile, samplingFrequency); cBoxSegments.DataSource = estimator.Segments; cBoxSegments.DisplayMember = "Index"; cBoxSegments.ValueMember = "Index"; // Plot data with 50 samples per second. plotFrequency = reader.Frequency / 50; TaskScheduler uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); Task.Factory.StartNew(() => reader.Read()); Task.Factory.StartNew(() => PlotRaw(uiScheduler)); //Task.Factory.StartNew(() => PlotProcessed(uiScheduler)); Task.Factory.StartNew(() => PlotDetectedQRS(uiScheduler)); } }