code: def test_incremental_pca():
      # Incremental PCA on dense arrays.
      X = iris.data
      batch_size = X.shape[0] // 3
      ipca = IncrementalPCA(n_components=2, batch_size=batch_size)
      pca = PCA(n_components=2)
      pca.fit_transform(X)
  
      X_transformed = ipca.fit_transform(X)
  
      assert X_transformed.shape == (X.shape[0], 2)
      np.testing.assert_allclose(
          ipca.explained_variance_ratio_.sum(),
          pca.explained_variance_ratio_.sum(),
          rtol=1e-3,
      )
  
      for n_components in [1, 2, X.shape[1]]:
          ipca = IncrementalPCA(n_components, batch_size=batch_size)
          ipca.fit(X)
          cov = ipca.get_covariance()
          precision = ipca.get_precision()
          np.testing.assert_allclose(
              np.dot(cov, precision), np.eye(X.shape[1]), atol=1e-13
          )
  
imports: import warnings
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from sklearn import datasets
  from sklearn.decomposition import PCA, IncrementalPCA
  from sklearn.utils._testing import assert_allclose_dense_sparse, assert_almost_equal, assert_array_almost_equal
  from sklearn.utils.fixes import CSC_CONTAINERS, CSR_CONTAINERS, LIL_CONTAINERS
label_desc: Use image node_id 1 for calling a global function with example usage: test_incremental_pca() without return types