-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1247 from helmholtz-analytics/features/1246-Conti…
…nuous_Benchmarking_for_Preprocessing_Module Continuous Benchmarking for the Preprocessing Module
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# flake8: noqa | ||
import heat as ht | ||
from mpi4py import MPI | ||
from perun import monitor | ||
|
||
# we benchmark the in-place versions (`copy=False`) of the preprocessing functions | ||
# for each function, both the forward and the inverse transformation are applied | ||
|
||
|
||
@monitor() | ||
def apply_inplace_standard_scaler_and_inverse(X): | ||
scaler = ht.preprocessing.StandardScaler(copy=False) | ||
Y = scaler.fit_transform(X) | ||
X = scaler.inverse_transform(Y) | ||
|
||
|
||
@monitor() | ||
def apply_inplace_min_max_scaler_and_inverse(X): | ||
scaler = ht.preprocessing.MinMaxScaler(copy=False) | ||
Y = scaler.fit_transform(X) | ||
X = scaler.inverse_transform(Y) | ||
|
||
|
||
@monitor() | ||
def apply_inplace_max_abs_scaler_and_inverse(X): | ||
scaler = ht.preprocessing.MaxAbsScaler(copy=False) | ||
Y = scaler.fit_transform(X) | ||
X = scaler.inverse_transform(Y) | ||
|
||
|
||
@monitor() | ||
def apply_inplace_robust_scaler_and_inverse(X): | ||
scaler = ht.preprocessing.RobustScaler(copy=False) | ||
Y = scaler.fit_transform(X) | ||
X = scaler.inverse_transform(Y) | ||
|
||
|
||
@monitor() | ||
def apply_inplace_normalizer(X): | ||
scaler = ht.preprocessing.Normalizer(copy=False) | ||
scaler.fit_transform(X) | ||
|
||
|
||
def run_preprocessing_benchmarks(): | ||
n_data_points = 5000 | ||
n_features = 50 | ||
X = ht.random.randn(n_data_points, n_features, split=0) | ||
|
||
apply_inplace_standard_scaler_and_inverse(X) | ||
apply_inplace_min_max_scaler_and_inverse(X) | ||
apply_inplace_max_abs_scaler_and_inverse(X) | ||
apply_inplace_robust_scaler_and_inverse(X) | ||
apply_inplace_normalizer(X) | ||
|
||
del X |
41a3d0b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.heat_benchmarks_N1_GPU - RUNTIME
133.5355224609375
s (13.20767879486084
)56.0419921875
s (5.172030925750732
)2.38
This comment was automatically generated by workflow using github-action-benchmark.
CC: @web-flow