GithubHelp home page GithubHelp logo

Comments (3)

ArTheBu avatar ArTheBu commented on August 27, 2024 1

I think the bug is in ga.py file, plot_pop_evo function. Adding squeeze=False in plt.subplots and changing the axes[i] to axes[i,0] and axes[-1] to axes[-1,0] seems to be solved.

`def plot_pop_evo(self, file=None):
"""
Creates a plot with the evolution of all parameters as a scatter plot.
Can be interpreted as the population diversity.
The color of the points is darker for higher accuracy.

    :param file: string, path to the file. If ``None``, file not created.
    :return: Axes
    """
    estimates = self.all_estim_and_err
    pars = list(estimates.columns)
    pars.remove('individual')
    pars.remove(GA.ITER)
    pars.remove(GA.ERR)
    assert len(pars) > 0, 'No parameters found'

    fig, axes = plt.subplots(nrows=len(pars), sharex=True, squeeze=False)
    fig.subplots_adjust(right=0.75)
    i = 0

    last_err = self.fittest_errors[-1]
    first_err = self.fittest_errors[0]

    for v in pars:
        ax = axes[i,0]
        scatter = ax.scatter(x=estimates[GA.ITER],
                             y=estimates[v],
                             c=estimates[GA.ERR],
                             cmap='viridis',
                             edgecolors='none',
                             vmin=last_err,
                             vmax=first_err,
                             alpha=0.25)
        ax.set_xlim([0, estimates[GA.ITER].max() + 1])
        ax.text(x=1.05, y=0.5, s=v,
                transform=ax.transAxes, fontweight='bold',
                horizontalalignment='center', verticalalignment='center')
        i += 1
    axes[-1,0].set_xlabel('Generation')

    # Color bar on the side
    cbar_ax = fig.add_axes([0.85, 0.10, 0.05, 0.8])
    fig.colorbar(scatter, cax=cbar_ax, label='Error')

    if file:
        fig.set_size_inches(GA.FIG_SIZE)
        fig.savefig(file, dpi=GA.FIG_DPI)
    return axes`

from modest-py.

krzysztofarendt avatar krzysztofarendt commented on August 27, 2024

Thanks @ArTheBu, I'll test it and update in the coming days.

from modest-py.

krzysztofarendt avatar krzysztofarendt commented on August 27, 2024

@ArTheBu, it works like a charm (4615033). Thanks!

TODO:

  • update on PyPi
  • update on conda

from modest-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.