Skip to content

Commit

Permalink
introduce SortedDataSelection class (#144)
Browse files Browse the repository at this point in the history
introduce SortedDataSelection class using a new pivot strategy

SortedDataSelection uses a lot more memory than a selection but enables getting the k-highest element quickly (roughly O(log N) time).

I went back a bunch with the fancy new GPT-4 chain of thought to make this.

Includes tests.

The next PR in this stack will allow faster in-order iteration over a list using a minheap structure.
<!-- ELLIPSIS_HIDDEN -->


----

| 🚀 | This description was created by 39c3fa1  | 
|--------|--------|

feat: add `SortedDataSelection` class for efficient data sorting and selection

### Summary:
Introduce `SortedDataSelection` class for efficient data sorting and selection with tests, documentation updates, and future enhancements.

**Key points**:
- Introduces `SortedDataSelection` class in `selection.ts` for efficient k-highest element retrieval using a pivot strategy.
- Supports sorting by numeric fields and quick selection using Quickselect algorithm.
- Updates `DataSelection` to support new sorting functionality.
- Adds `SelectionTile` class to manage tile-specific sorting data.
- Updates exports in `deepscatter.ts` to include `SortedDataSelection`.
- Adds tests for `SortedDataSelection` in `dataset.spec.js` to verify sorting and selection behavior.
- Adds `publish_docs_if_stable.sh` script for documentation publishing.
- Minor type and function adjustments in `utilityFunctions.ts`.
- SortedDataSelection uses more memory but enables quick k-highest element retrieval.
- Future PR will allow faster in-order iteration over a list using a minheap structure.


----
Generated with ❤️ by [ellipsis.dev](https://www.ellipsis.dev)



<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
bmschmidt authored Sep 20, 2024
1 parent d70b585 commit 8b458b7
Show file tree
Hide file tree
Showing 8 changed files with 491 additions and 58 deletions.
30 changes: 30 additions & 0 deletions publish_docs_if_stable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Extract version from package.json
VERSION=$(node -p "require('./package.json').version")

# Check if this is a pre-release version (it will contain a '-')
if [[ $VERSION == *"-"* ]]; then
echo "Pre-release version detected. Skipping documentation publish."
exit 0
fi

# Build the project
vite build && tsc || true

# Generate documentation
typedoc --skipErrorChecking src/*

# Switch to the gh-pages branch
git checkout gh-pages

# Copy the generated documentation to the branch
cp -R ./docs/* ./

# Commit and push the changes
git add .
git commit -m "Update documentation for $VERSION"
git push origin gh-pages

# Switch back to the original branch
git checkout -
5 changes: 3 additions & 2 deletions src/aesthetics/AestheticSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ export class AestheticSet {
return this;
}

public dim(aesthetic: keyof typeof dimensions) {
public dim<T extends keyof AesMap>(aesthetic: T) {
// Returns the stateful aesthetic corresponding to the given aesthetic.
// Used for things like 'what color would this point be?'

if (this.store[aesthetic]) {
return this.store[aesthetic];
const v = this.store[aesthetic]
return v;
}
if (!dimensions[aesthetic]) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
Expand Down
2 changes: 1 addition & 1 deletion src/deepscatter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { Scatterplot } from './scatterplot';
export { Bitmask, DataSelection } from './selection';
export { Bitmask, DataSelection, SortedDataSelection } from './selection';
export { Deeptable } from './Deeptable';
export { LabelMaker } from './label_rendering';
export { dictionaryFromArrays } from './utilityFunctions';
Expand Down
Loading

0 comments on commit 8b458b7

Please sign in to comment.