Skip to content

Commit

Permalink
Merge pull request #1247 from helmholtz-analytics/features/1246-Conti…
Browse files Browse the repository at this point in the history
…nuous_Benchmarking_for_Preprocessing_Module

Continuous Benchmarking for the Preprocessing Module
  • Loading branch information
mrfh92 authored Oct 30, 2023
2 parents 12e726c + 99d8197 commit 41a3d0b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions benchmarks/cb/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
from linalg import run_linalg_benchmarks
from cluster import run_cluster_benchmarks
from manipulations import run_manipulation_benchmarks
from preprocessing import run_preprocessing_benchmarks

run_linalg_benchmarks()
run_cluster_benchmarks()
run_manipulation_benchmarks()
run_preprocessing_benchmarks()
55 changes: 55 additions & 0 deletions benchmarks/cb/preprocessing.py
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

1 comment on commit 41a3d0b

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 41a3d0b Previous: 12e726c Ratio
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

Please sign in to comment.