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

add exponential distribution #513

Merged
merged 2 commits into from
Nov 12, 2024
Merged

add exponential distribution #513

merged 2 commits into from
Nov 12, 2024

Conversation

mck
Copy link
Collaborator

@mck mck commented Nov 11, 2024

No description provided.

Copy link
Contributor

Failed to generate code suggestions for PR

@mck mck requested a review from SorsOps November 11, 2024 20:43
@@ -0,0 +1,63 @@
import { Graph } from '../../../../src/graph/graph.js';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also spelt incorrectly


constructor(props: INodeDefinition) {
super(props);
this.addInput('value', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels very weird and unintuitive.

The formula for exponential decay is generally y(x)= Pe^(-kx)

With P the initial starting value and k the decay factor

In this calculation we are removing P and and just calculating this over the fixed domain o - length

Then when we do the reweighting we just get a function where the sum of the points equals this value over the range

Is there a reason why we really want this over a standard decay without the rebalancing?

const { value, length, decay, precision } = this.getAllInputs();

// Calculate weights using exponential decay
const weights = Array.from({ length: length }, (_, i) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do this and the total weighting in a single reduce call instead of 2 iterations of the array

Copy link

changeset-bot bot commented Nov 12, 2024

🦋 Changeset detected

Latest commit: f1612a4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@tokens-studio/graph-engine Minor
@tokens-studio/graph-engine-nodes-audio Major
@tokens-studio/graph-engine-nodes-design-tokens Major
@tokens-studio/graph-engine-nodes-fs Major
@tokens-studio/graph-engine-nodes-image Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@SorsOps SorsOps merged commit a986fde into master Nov 12, 2024
2 checks passed
@SorsOps SorsOps deleted the exponantial-distribution branch November 12, 2024 08:18
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

Successfully merging this pull request may close these issues.

2 participants