Skip to content

Commit

Permalink
🙈 change default minmax_ratio to 4 (#62)
Browse files Browse the repository at this point in the history
* 🙈 change default minmax_ratio to 4

* 🐛 pass preselected index in LTTB step of MinMaxLTTB
  • Loading branch information
jvdd authored Nov 24, 2023
1 parent 25d5648 commit 18b9fdf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ The following downsampling algorithms (classes) are implemented:
| `LTTBDownsampler` | performs the [**Largest Triangle Three Buckets**](https://skemman.is/bitstream/1946/15343/3/SS_MSthesis.pdf) algorithm | `n_threads` |
| `MinMaxLTTBDownsampler` | (*new two-step algorithm 🎉*) first selects `n_out` * `minmax_ratio` **min and max** values, then further reduces these to `n_out` values using the **Largest Triangle Three Buckets** algorithm | `n_threads`, `minmax_ratio`<sup>*</sup> |

<sup>*</sup><i>Default value for `minmax_ratio` is 30, which is empirically proven to be a good default. (More details in our upcomming paper)</i>
<sup>*</sup><i>Default value for `minmax_ratio` is 4, which is empirically proven to be a good default. More details here: https://arxiv.org/abs/2305.00332</i>


## Limitations & assumptions 🚨
Expand Down
2 changes: 1 addition & 1 deletion downsample_rs/src/m4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ where
// be the start and end of the bin, which would result in duplicate data in
// the output array. (this is for example the case for monotonic data).

// ----------------- GENERICS
// ----------------------------------- GENERICS ------------------------------------

// --------------------- WITHOUT X

Expand Down
5 changes: 3 additions & 2 deletions downsample_rs/src/minmax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ where
assert_eq!(n_out % 2, 0);
min_max_generic_parallel(arr, n_out, n_threads, |arr| arr.argminmax())
}
// ----------------- GENERICS
//

// ----------------------------------- GENERICS ------------------------------------

// --------------------- WITHOUT X

#[inline(always)]
Expand Down
4 changes: 2 additions & 2 deletions downsample_rs/src/minmaxlttb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ where
.map(|i| *y.get_unchecked(*i))
.collect::<Vec<Ty>>()
};
// Apply lttb on the reduced data
let index_points_selected = lttb_without_x(y.as_slice(), n_out);
// Apply lttb on the reduced data (using the preselect data its index)
let index_points_selected = lttb_with_x(index.as_slice(), y.as_slice(), n_out);
// Return the original index
return index_points_selected
.iter()
Expand Down
2 changes: 1 addition & 1 deletion tsdownsample/downsamplers.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def rust_mod(self):
return _tsdownsample_rs.minmaxlttb

def downsample(
self, *args, n_out: int, minmax_ratio: int = 30, n_threads: int = 1, **_
self, *args, n_out: int, minmax_ratio: int = 4, n_threads: int = 1, **_
):
assert minmax_ratio > 0, "minmax_ratio must be greater than 0"
return super().downsample(
Expand Down

0 comments on commit 18b9fdf

Please sign in to comment.