Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorporate per-region relative error #9

Open
ryan-williams opened this issue Oct 12, 2023 · 0 comments
Open

Incorporate per-region relative error #9

ryan-williams opened this issue Oct 12, 2023 · 0 comments

Comments

@ryan-williams
Copy link
Member

Currently, the error that is minimized is a sum of the absolute difference between target and actual region sizes (as a proportion of the overall area of the diagram) for each region:

$$ \sum_{region} \frac{|\text{actual} - \text{target}|}{\text{total diagram area}} $$

This optimizes for allocating areas proportionally to their targets. If 10% of the represented area is misplaced, that's considered equally bad, no matter where in the diagram the misplaced area is.

However, it's tempting to consider an error of size 0.1 (10% of the overall diagram) to be less bad on a region of size 0.5 (half the diagram, relative error 20%) than on a region of size 0.005 (1/200th of the diagram, relative error 2000%). This is apparent in the MPower example, where:

  • overall diagram area is ≈500
  • total error is ≈20 (≈4%)
  • half the total error comes from a single region ($\text{KRAS} \cap \text{KEAP1} \cap \text{TP53}$) that is supposed to be size 13, but is instead ≈1.

Incorporating a configurable mix of absolute and relative errors lead to more intuitive/aesthetic results, where invariants like "every region is within X% of its desired size" can hold.

As an example, these might all be considered to have equal "cost":

  • target 0.5, actual 0.6 (absolute error 0.1, relative error 0.2)
  • target 0.1, actual 0.15 (absolute error 0.05, relative error 0.5)
  • target 0.02, actual 0.045 (absolute error 0.025, relative error 1.25)

This can be achieved by scaled the absolute error $|A - T|$ by $2^{-\log_5{2T}}$:

$$ \text{error} = |A-T| \left( 2^{-\log_5{2T}} \right) $$

That exponent, $-\log_5{2T}$, serves to weight absolute errors half as much with each power of 5 that they decrease, and the inner $2T$ aligns the expression to the specific values given above.

TODO: work this into the error computation in step.rs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant