Skip to content

Commit daee32a

Browse files
committed
Tweaks to HighlightedAxes and predictor engine
1 parent 7126c2f commit daee32a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/script/domain/stores/HighlightedAxes.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* SPDX-License-Identifier: MIT
55
*/
6-
import { get, type Readable, type Unsubscriber, type Writable } from 'svelte/store';
6+
import { derived, get, type Readable, type Unsubscriber, type Writable } from 'svelte/store';
77
import Classifier from './Classifier';
88
import { type Subscriber } from 'svelte/motion';
99
import SelectedModel from '../SelectedModel';
@@ -53,7 +53,9 @@ class HighlightedAxes implements Writable<Axis[]> {
5353
run: Subscriber<Axis[]>,
5454
invalidate?: (value?: Axis[]) => void,
5555
): Unsubscriber {
56-
return this.value.subscribe(run, invalidate);
56+
return derived([this.value], ([store]) => {
57+
return [...store].toSorted((a, b) => a.index - b.index)
58+
}).subscribe(run, invalidate);
5759
}
5860

5961
public toggleAxis(axis: Axis) {

src/script/engine/PollingPredictorEngine.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,11 @@ class PollingPredictorEngine implements Engine {
9797
.filter((vecVal, vecIdx) =>
9898
this.highlightedAxes.isAxisIndexHighlighted(vecIdx),
9999
),
100-
e.value.getLabels(),
100+
e.value
101+
.getLabels()
102+
.filter((labelVal, vecIdx) =>
103+
this.highlightedAxes.isAxisIndexHighlighted(vecIdx),
104+
),
101105
),
102106
);
103107
return new ClassifierInput(sampleVectors);

0 commit comments

Comments
 (0)