コード例 #1
0
        void AddCalibration()
        {
            foreach (var calibrationVariable in _model.CalibrationVariables())
            {
                var estimates = _model.satisfactionRateRepository
                                .GetCalibrationSatisfactionRates(calibrationVariable.Identifier)
                                .Where(x => x.ExpertIdentifier != null);
                foreach (var estimate in estimates)
                {
                    if (estimate is QuantileList qd)
                    {
                        ef.AddEstimate(estimate.ExpertIdentifier,
                                       calibrationVariable.Identifier,
                                       qd.Quantiles.ToArray());
                    }
                    else
                    {
                        throw new NotImplementedException("Distribution not supported");
                    }
                }
                var real_value = _model.satisfactionRateRepository
                                 .GetCalibrationSatisfactionRates(calibrationVariable.Identifier)
                                 .Where(x => x.ExpertIdentifier == null).Last();

                if (real_value is DoubleSatisfactionRate dsr)
                {
                    ef.SetValue(calibrationVariable.Identifier, dsr.SatisfactionRate);
                }
                else
                {
                    throw new NotImplementedException("Real value for the calibration variable must be a double.");
                }
            }
        }