-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update `vaa-matching` on a variety of counts: - Remove the types that are defined in `vaa-shared` as of commmit 324fdd8 - Rewrite handling of subdimensions so that they can be used universally with all distance metrics. This involves restructuring the `metric` functions in a composable format - Implement a Euclidian distance metric - Remove the `AbsoluteMaximum` missing value imputation method because it does not fit the general mathematical matching model - Create an example implementation of `CategoricalQuestion` for multiple choice questions whose values cannot be ordered - Change both question implementation to adhere more closely to the upcoming `vaa-data` model - Implement passing of question weights to the matching algorithm - Abbreviate and rename some types - Apply the new TS style guide requirements to the code - Rewrite many of the tests - Update the README Also apply the required changes to consumers of `vaa-matching`.
- Loading branch information
Showing
45 changed files
with
1,760 additions
and
1,217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
import {MultipleChoiceQuestion} from '$voter/vaa-matching'; | ||
import type {CoordinateOrMissing, Id} from 'vaa-shared'; | ||
import {OrdinalQuestion} from '$voter/vaa-matching'; | ||
|
||
/** | ||
* A dummy question object for matching. | ||
*/ | ||
export class LikertQuestion extends MultipleChoiceQuestion { | ||
export class LikertQuestion extends OrdinalQuestion { | ||
public readonly category: QuestionCategoryProps; | ||
constructor({id, values, category}: LikertQuestionOptions) { | ||
super(id, values); | ||
super({id, values}); | ||
this.category = category; | ||
} | ||
|
||
normalizeValue(value: number): CoordinateOrMissing { | ||
// The current frontend implemenation of questions uses numbers for choice keys | ||
return super.normalizeValue(`${value}`); | ||
} | ||
} | ||
/** | ||
* Options for a dummy question object for matching. | ||
*/ | ||
interface LikertQuestionOptions { | ||
id: ConstructorParameters<typeof MultipleChoiceQuestion>[0]; | ||
values: ConstructorParameters<typeof MultipleChoiceQuestion>[1]; | ||
id: Id; | ||
values: ConstructorParameters<typeof OrdinalQuestion>[0]['values']; | ||
category: QuestionCategoryProps; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.