code: def test_incremental_pca_set_params():
      # Test that components_ sign is stable over batch sizes.
      rng = np.random.RandomState(1999)
      n_samples = 100
      n_features = 20
      X = rng.randn(n_samples, n_features)
      X2 = rng.randn(n_samples, n_features)
      X3 = rng.randn(n_samples, n_features)
      ipca = IncrementalPCA(n_components=20)
      ipca.fit(X)
      # Decreasing number of components
      ipca.set_params(n_components=10)
      with pytest.raises(ValueError):
          ipca.partial_fit(X2)
      # Increasing number of components
      ipca.set_params(n_components=15)
      with pytest.raises(ValueError):
          ipca.partial_fit(X3)
      # Returning to original setting
      ipca.set_params(n_components=20)
      ipca.partial_fit(X)
  
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 8 for calling a global function with example usage: test_incremental_pca_set_params() without return types