예제 #1
0
    def test_coefficients_gaussian_distribution_default_initial_guess(self):
        """Ensure that the values for the optimised_coefficients match the
        expected values, and the coefficient names also match
        expected values for a Gaussian distribution, where the default
        values for the initial guess are used, rather than using a linear
        least-squares regression to construct an initial guess."""
        expected = [-0.0002, 0.7977, 0.0004, 0.9973]
        plugin = Plugin(self.distribution, self.current_cycle)
        plugin.ESTIMATE_COEFFICIENTS_FROM_LINEAR_MODEL_FLAG = False
        result = plugin.process(self.historic_temperature_forecast_cube,
                                self.temperature_truth_cube)

        self.assertEMOSCoefficientsAlmostEqual(result.data, expected)
        self.assertArrayEqual(
            result.coord("coefficient_name").points, self.coeff_names)
예제 #2
0
    def test_coefficients_truncated_gaussian_default_initial_guess(self):
        """Ensure that the values for the optimised_coefficients match the
        expected values, and the coefficient names also match
        expected values for a truncated Gaussian distribution, where the
        default values for the initial guess are used, rather than using a
        linear least-squares regression to construct an initial guess.."""
        distribution = "truncated_gaussian"

        plugin = Plugin(distribution, self.current_cycle)
        plugin.ESTIMATE_COEFFICIENTS_FROM_LINEAR_MODEL_FLAG = False
        result = plugin.process(self.historic_wind_speed_forecast_cube,
                                self.wind_speed_truth_cube)

        self.assertEMOSCoefficientsAlmostEqual(
            result.data, self.expected_mean_predictor_truncated_gaussian)
        self.assertArrayEqual(
            result.coord("coefficient_name").points, self.coeff_names)