Code Monkey home page Code Monkey logo

Comments (5)

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


Can you think about when we would want common indexing, and when we wouldn't? I am not sure.

By common indexing, I mean that we create one RNG that creates an index, and we select that column from every presample package array. I could imagine that we would want every presample package to have the same index, but I can equally well imagine that we wouldn't want this behaviour if presample packages should be considered independent. We can stack arrays in a single package relatively easily, so we could go with option two.

Another alternative would be to use a consistent sampler only if we were inside a campaign.

from brightway2-calc.

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Pascal Lesage (Bitbucket: MPa, ).


Common indexing occurs when the same  seed is passed when creating the presamples package. If common indexing is required, the same seed value is passed. If different indexing is needed, different seed values is passed. If it doesn't matter, then the default (random) seed value is used.

from brightway2-calc.

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


OK, now you have opened another door of confusion :)

We know that:

  1. IrregularPresamplesArray is a subclass of RandomState, and only draws from the RNG to get an index.
  2. MatrixPresamples creates a seeded IrregularPresamplesArray for each presamples package.
  3. LCA (and its subclasses) create one instance of MatrixPresamples if needed on instantiation.

BTW, we might want to change the name of IrregularPresamplesArray, as we now ensure that presamples packages are regular.

So, I think my concern was unfounded; we get consistent sampling within presamples packages automatically with IrregularPresamplesArray, regardless of whether the RNG was seeded; we get consistent sampling across presample packages if a seed value is passed. Obviously, this should be documented and thoroughly tested.

"Common indexing occurs when the same seed is passed when creating the presamples package." I am not sure this is true, but probably we have to be more precise about what we mean here; for example, as the values from the first package be used to generate values from the second? If not, I don't think the seed matters; for example, using the same seed for two different versions of ecoinvent wouldn't lead to any correlation.

from brightway2-calc.

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Pascal Lesage (Bitbucket: MPa, ).


I think the simplest and quite logical solution is this: Seed values from the LCA object should not be passed to matrix_presamples in the LCA (here). Presamples seeds should be specific to the presamples package, and should not be overwritten during use of presamples.

As to "Common indexing occurs when the same seed is passed when creating the presamples package." This should be true for presamples with the same number of columns. This is ensured for parameter_presamples and matrix_presamples jointly created.

from brightway2-calc.

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


Fixed in upstream presamples code. Can access presamples.parameters to get all requested data.

from brightway2-calc.

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.