code: def test_pca_serverless_inference(
      sagemaker_session, cpu_instance_type, training_set
  ):
      job_name = unique_name_from_base("pca-serverless")
  
      with timeout(minutes=TRAINING_DEFAULT_TIMEOUT_MINUTES):
          pca = sagemaker.amazon.pca.PCA(
              role="SageMakerRole",
              instance_count=1,
              instance_type=cpu_instance_type,
              num_components=48,
              sagemaker_session=sagemaker_session,
              enable_network_isolation=True,
          )
  
          pca.algorithm_mode = "randomized"
          pca.subtract_mean = True
          pca.extra_components = 5
          pca.fit(
              pca.record_set(training_set[0][:100]), job_name=job_name
          )
  
      with timeout_and_delete_endpoint_by_name(
          job_name, sagemaker_session
      ):
          pca_model = sagemaker.amazon.pca.PCAModel(
              model_data=pca.model_data,
              role="SageMakerRole",
              sagemaker_session=sagemaker_session,
          )
          predictor = pca_model.deploy(
              serverless_inference_config=ServerlessInferenceConfig(),
              endpoint_name=job_name,
          )
  
          result = predictor.predict(training_set[0][:5])
  
          assert len(result) == 5
          for record in result:
              assert record.label["projection"] is not None
  
file_path: sagemaker-python-sdk/tests/integ/test_pca.py
imports: from __future__ import absolute_import
  import time
  import pytest
  import sagemaker.amazon.pca
  from sagemaker.serverless import ServerlessInferenceConfig
  from sagemaker.utils import unique_name_from_base
  from tests.integ import datasets, TRAINING_DEFAULT_TIMEOUT_MINUTES
  from tests.integ.timeout import timeout, timeout_and_delete_endpoint_by_name
label_desc: Use image node_id 4 for calling a global function with example usage: test_pca_serverless_inference(sagemaker_session, cpu_instance_type, training_set) without return types