code: def test_incremental_pca_validation():
      # Test that n_components is >=1 and <= n_features.
      X = np.array([[0, 1, 0], [1, 0, 0]])
      X = da.from_array(X, chunks=[4, -1])
      n_samples, n_features = X.shape
      for n_components in [-1, 0, 0.99, 4]:
          with pytest.raises(
              ValueError,
              match="n_components={} invalid"
              " for n_features={}, need more rows than"
              " columns for IncrementalPCA"
              " processing".format(n_components, n_features),
          ):
              IncrementalPCA(n_components, batch_size=10).fit(X)
  
      # Tests that n_components is also <= n_samples.
      n_components = 3
      with pytest.raises(
          ValueError,
          match="n_components={} must be"
          " less or equal to the batch number of"
          " samples {}".format(n_components, n_samples),
      ):
          IncrementalPCA(n_components=n_components).partial_fit(X)
  
imports: import numpy
  import pytest
  from dask import array
  from sklearn import datasets, decomposition
  from sklearn.decomposition import PCA
  from dask_ml.decomposition import IncrementalPCA
  from dask_ml.utils import flip_vector_signs
label_desc: Use image node_id 5 for calling a global function with example usage: test_incremental_pca_validation() without return types