Replies: 1 comment
-
@DemonHa Heya, So, very much open to reviewing the algorithm here. The only requirement is that the scoring mechanism should return a normalized distribution result between 0.0 and 1.0. However the internal implementation may operate on larger values. const A = Type.String()
const B = Type.Number()
const C = Type.Boolean()
// scores are clamped to 0.0 - 1.0 ranges
const scores = Score([A, B, C], 1) // [0.0, 1.0, 0.0]
// where summing each score yields 1.0
const total = scores.reduce((result, score) => result + score, 0) // total === 1 Normalization can be achieved via const normalizedScores = scores.map(score => score / scores.length) Would like to see consideration given to exact and non-exact matches (ideally should line up to the set rules of the TS language) const A = Type.Number()
const B = Type.Literal(1)
cosnt scores = Score([A, B], 1) // [0.2, 0.8] - where exact literals significantly weight more than matching numbers. Objects with large property sets (as per example) may require some thinking. I would like to avoid excessive property enumeration if possible. The current General requirements:
Lets discuss! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The current scoring system for choosing an union branch has some flaws.
Currently when trying to score an object it is rewarding each property: (1.0 / propertyCount). This can lead to incorrect results (see example below)
Beta Was this translation helpful? Give feedback.
All reactions