Skip to content

Commit a6271fa

Browse files
patconclaude
andcommitted
feat: mean-impute NaN cells in vote matrix before dimensional reduction
Column means of observed values replace any NaN entries so DruidJS never sees missing data. Falls back to 0 for all-NaN columns. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 109b59a commit a6271fa

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Added
66

7-
- In-browser dimensional reduction via DruidJS. After importing an `.h5ad` file, a "Recompute" button in the projection selector opens a dialog to pick a dense `layers/` matrix as the vote matrix, choose an algorithm (UMAP, PaCMAP, or LocalMAP) and its parameters, and run the reduction in a web worker. The result is added as a new selectable projection and auto-selected. Mean imputation / moderated-column zeroing is expected to already be done in the chosen layer. A progress bar shows iteration progress (0–100 %) while the reduction runs.
7+
- In-browser dimensional reduction via DruidJS. After importing an `.h5ad` file, a "Recompute" button in the projection selector opens a dialog to pick a dense `layers/` matrix as the vote matrix, choose an algorithm (UMAP, PaCMAP, or LocalMAP) and its parameters, and run the reduction in a web worker. The result is added as a new selectable projection and auto-selected. Empty cells in the chosen layer are filled with the column mean before reduction (mean imputation). A progress bar shows iteration progress (0–100 %) while the reduction runs, preceded by a "Building KNN graph…" phase indicator.
88
- `includeAvatars` prop/toggle for `RoutingExperiment` navigation mode to show DiceBear adventurer-neutral avatars (circular crop, radius 90% of pin head) in each pin head, keyed by point ID for stable identity. Toggle appears in the Controls sheet under Waypoint Distribution when navigation mode is active.
99
- `waypointDensity` prop (0–1 slider, default 1.0 = all) for `RoutingExperiment` to sample intermediate waypoints evenly along the path; inactive waypoints remain visible as white dots while active ones stay orange.
1010
- `NavigationMode` story for `RoutingExperiment` with Google Maps-style 3D navigation: right-drag to tilt/orbit (heading + pitch), scroll to zoom, left-drag to pan, double-click to reset view. Adds `navigationMode` prop to the component.

src/components/convo-explorer/App.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,19 @@ export const App: React.FC<AppProps> = ({ testAnimation = false, kedroBaseUrl, i
930930
}
931931
matrix.push(row);
932932
}
933+
934+
// Mean imputation: replace NaN cells with the column mean of observed values.
935+
for (let j = 0; j < nVars; j++) {
936+
let sum = 0, count = 0;
937+
for (let i = 0; i < nObs; i++) {
938+
if (!isNaN(matrix[i][j])) { sum += matrix[i][j]; count++; }
939+
}
940+
const colMean = count > 0 ? sum / count : 0;
941+
for (let i = 0; i < nObs; i++) {
942+
if (isNaN(matrix[i][j])) matrix[i][j] = colMean;
943+
}
944+
}
945+
933946
pendingAlgorithmRef.current = algorithm;
934947
runReduction(matrix, algorithm, params);
935948
},

0 commit comments

Comments
 (0)