Git Product home page Git Product logo

Comments (3)

CiaranWelsh avatar CiaranWelsh commented on June 17, 2024

Hey!

It’s been some time since I’ve worked on this project but if you post some code examples and describe what you’re trying to do I may be able to help.

from pycotools3.

kantundpeterpan avatar kantundpeterpan commented on June 17, 2024

Basically, I am following the tutorial to obtain the profile likelihoods here. The scans over the parameters work nicely, but the reports do not contain the values of the parameter that was scanned over, but only the values for the remaining optimized parameters. So I wondered if there's a way to get the "right" reports.

Example:

My variables are _k_neo _k_dig _k_trans

from pycotools3 import tasks, viz, model

mod = model.loada(antimony_str, 'test.cps')

with tasks.ParameterEstimation.Context(
    mod, experiment_filename,
    context='pl', parameters='a'
) as context:
    context.set('method', 'hooke_jeeves')
    context.set('pe_number', 5) # number of steps in each profile likelihood
    context.set('run_mode', 'parallel')
    context.set('separator', ',')
    context.set('number_of_iterations', 200)
    #context.set('report', 'profile_likelihood')
    context.set('prefix', '_')
    config = context.get_config()

pe = tasks.ParameterEstimation(config)

p = viz.Parse(pe)

print(p.data['_k_neo'])

Example output for _k_neo gives the values for the optimized values for the remaining parameters, but lacks the values for ´_k_neo` was scanned over.

         RSS     _k_dig  _k_trans
0    27.1121   0.000898  0.006912
1   822.0270   0.000564  0.016508
2   871.2460   0.000519  9.164050
3  1481.4700  12.288000  2.816190
4        inf   0.100000  0.100000

from pycotools3.

CiaranWelsh avatar CiaranWelsh commented on June 17, 2024

Ah I see, if I recall correctly, the issue with storing the actual values of the scanned parameter is that they are calculated within COPASI directly, and the communication system between pycotools and COPASI (i.e. the copasiML) doesn't allow access to these values. Therefore (as you'll see in viz.PlotProfileLikelihood) when plotting these data I ended up recalculating them:

def compute_x(self):
    lb = self.pl.config.settings.pl_lower_bound
    ub = self.pl.config.settings.pl_upper_bound
    parameters = self.get_best_original_parameter_set()
    num_steps = self.pl.config.settings.pe_number
    dct = {}
    for i in parameters:
        val = parameters.loc[0, i]
        low = numpy.log10(val / lb)
        high = numpy.log10(val * ub)
        dct[i] = pandas.Series(numpy.logspace(low, high, num_steps).flatten())
    df = pandas.concat(dct, axis=1)

    return df

If you wanted to do stuff with the data, it might be an idea to either copy and paste the source code for viz.PlotProfileLikelihood and use this as a starting point or deriving a new class from it. I.e.

class MyComplicatedBespokeProfileLikelihoodAnalysis(viz.PlotProfileLikelihood):
    pass

Personally, I'd opt for the former. Hope this helps.

Ciaran

from pycotools3.

Related Issues (9)

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.