Skip to content

Commit

Permalink
added benchmark and reference to this example in the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoppe committed Nov 25, 2024
1 parent 7d887f4 commit e05c174
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions benchmarks/cb/decomposition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# flake8: noqa
import heat as ht
from mpi4py import MPI
from perun import monitor
from heat.decomposition import IncrementalPCA


@monitor()
def incremental_pca_split0(list_of_X, n_components):
ipca = IncrementalPCA(n_components=n_components)
for X in list_of_X:
ipca.partial_fit(X)


def run_decomposition_benchmarks():
list_of_X = [ht.random.rand(50000, 500, split=0) for _ in range(10)]
incremental_pca_split0(list_of_X, 50)
2 changes: 2 additions & 0 deletions benchmarks/cb/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
from cluster import run_cluster_benchmarks
from manipulations import run_manipulation_benchmarks
from preprocessing import run_preprocessing_benchmarks
from decomposition import run_decomposition_benchmarks

run_linalg_benchmarks()
run_cluster_benchmarks()
run_manipulation_benchmarks()
run_preprocessing_benchmarks()
run_decomposition_benchmarks()
2 changes: 2 additions & 0 deletions heat/decomposition/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ class IncrementalPCA(ht.TransformMixin, ht.BaseEstimator):
This class allows for incremental updates of the PCA model. This is especially useful for large data sets that do not fit into memory.
An example how to apply this class is given in, e.g., `benchmarks/cb/decomposition.py`.
Parameters
----------
n_components : int, optional
Expand Down

0 comments on commit e05c174

Please sign in to comment.