mathematicalmichael / mud-examples

Creation of figures for papers pertaining to the MUD (Maximal Updated Density) method for Parameter Estimation.
https://mud-examples.readthedocs.io/
MIT License
0 stars 1 forks source link

[HIGH]: pde convergence plots in dim > 1 #36

Closed mathematicalmichael closed 3 years ago

mathematicalmichael commented 3 years ago

PDE should compute distance to projection instead of lam_true when dim > 1. In dim == 1, keep distance to truth.

mathematicalmichael commented 3 years ago

truth is pulled from the VERY messy data structure, so fixing one should fix the other automatically.

the fix should be inside of the function that calculates the statistics instead, passed to _re/_rm

tolerances:

    for _res in res:
        _prefix, _in, _rm, _re = _res
        regression_err_mean, slope_err_mean, \
            regression_err_vars, slope_err_vars, \
            sd_means, sd_vars, num_sensors = _re
        plt.plot(tolerances, regression_err_vars,
                 label=f"{_prefix:10s} slope: {slope_err_vars:1.4f}",
                 lw=linewidth)
        plt.scatter(tolerances, sd_vars, marker='x', lw=20)

...

    plt.figure(figsize=(10, 10))
    for _res in res:
        _prefix, _in, _rm, _re = _res
        regression_err_mean, slope_err_mean, \
            regression_err_vars, slope_err_vars, \
            sd_means, sd_vars, num_sensors = _re
        plt.plot(tolerances, regression_err_mean,
                 label=f"{_prefix:10s} slope: {slope_err_mean:1.4f}",
                 lw=linewidth)
        plt.scatter(tolerances, sd_means, marker='x', lw=20)

measurements:

    for _res in res:
        _prefix, _in, _rm, _re = _res
        solutions = _in[-1]
        measurements = list(solutions.keys())
        regression_mean, slope_mean, \
            regression_vars, slope_vars, \
            means, variances = _rm
        plt.plot(measurements[:len(regression_mean)], regression_mean,
                 label=f"{_prefix:4s} slope: {slope_mean:1.4f}",
                 lw=linewidth)
        plt.scatter(measurements[:len(means)], means, marker='x', lw=20)

...

    for _res in res:
        _prefix, _in, _rm, _re = _res
        regression_mean, slope_mean, \
            regression_vars, slope_vars, \
            means, variances = _rm
        plt.plot(measurements[:len(regression_vars)], regression_vars,
                 label=f"{_prefix:4s} slope: {slope_vars:1.4f}",
                 lw=linewidth)
        plt.scatter(measurements[:len(variances)], variances,
                    marker='x', lw=20)
mathematicalmichael commented 3 years ago
            _re = (regression_err_mean, slope_err_mean,
                   regression_err_vars, slope_err_vars,
                   sd_means, sd_vars, num_sensors)
_rm = (regression_mean, slope_mean, regression_vars, slope_vars, means, variances)

TODO:

mathematicalmichael commented 3 years ago

ode will also need to change if the function isn't backwards compatible.

mathematicalmichael commented 3 years ago