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

530 add axis highlighting visually2 #547

Merged
merged 9 commits into from
Nov 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix unfortunate if (0) incidents
r59q committed Oct 30, 2024
commit bccad47531eeac7749ec8fa4f11461d825425f7a
10 changes: 5 additions & 5 deletions src/components/graphs/knngraph/AxesFilterVectorView.svelte
Original file line number Diff line number Diff line change
@@ -48,15 +48,15 @@
};
const updateArrows = (axis: number | undefined) => {
if (axis) {
if (axis !== undefined) {
const getId = (): string => {
if ($highlightedAxis === 0) {
if (axis === 0) {
return 'fromX';
}
if ($highlightedAxis === 1) {
if (axis === 1) {
return 'fromY';
}
if ($highlightedAxis === 2) {
if (axis === 2) {
return 'fromZ';
}
throw Error('Cannot update arrows for axis ' + axis);
@@ -134,7 +134,7 @@

<div class:hidden={!$classifier.model.isTrained && !$classifier.model.isTraining}>
<div>
{#if $highlightedAxis}
{#if $highlightedAxis !== undefined}
<div class="flex flex-row space-x-1">
<div class="flex flex-col justify-evenly">
<div class="flex flex-row space-x-2" id="fromX">
2 changes: 1 addition & 1 deletion src/components/graphs/knngraph/KnnModelGraph.svelte
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@
};
$: {
if ($highlightedAxis) {
if ($highlightedAxis !== undefined) {
if (get(controller)) {
get(controller)!.destroy();
}
2 changes: 1 addition & 1 deletion src/script/mlmodels/AccelerometerClassifierInput.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ class AccelerometerClassifierInput implements ClassifierInput {
public getInput(filters: Filters): number[] {
// TODO: Bad! How should we go about deciding what axes are provided for prediction when axes are highlighted?
const axis = get(stores.getHighlightedAxis());
if (axis) {
if (axis !== undefined) {
if (axis === 0) {
return [...filters.compute(this.xs)];
}