{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"bigcodebench","formal_name":"BigCodeBench","introduction":"BigCodeBench poses 1,140 function-level tasks drawn across 139 libraries. It tests whether a model can compose several real APIs correctly rather than write one self-contained function.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://bigcode-bench.github.io/","indexing_mode":"index","profile":{"resources":[],"task_format":"","scoring":"","metric":"","size":"","answer_access":"","license":"","citation":"","maintainer":"","released":"","why_hard":"","related":[],"history":"","construction":"","limitations":"","saturation":"","scores":[]}},"task_id":"df4334b9-3639-592f-bc4c-e963b1fded09","task_key":"default--v0~2e1~2e0~5fhf--df4334b9-3639-592f-bc4c-e963b1fded09","task_revision_id":"1","upstream_id":"","short_description":"BigCodeBench v0.1.0_hf df4334b9-3639-592f-bc4c-e963b1fded09","config":"default","split":"v0.1.0_hf","body":"{\"code_prompt\":\"import numpy as np\\nfrom sklearn.decomposition import PCA\\nimport matplotlib.pyplot as plt\\ndef task_func(data, n_components=2, random_state=None):\\n\",\"complete_prompt\":\"import numpy as np\\nfrom sklearn.decomposition import PCA\\nimport matplotlib.pyplot as plt\\n\\n\\ndef task_func(data, n_components=2, random_state=None):\\n    \\\"\\\"\\\"\\n    Performs Principal Component Analysis (PCA) on the provided dataset to reduce its dimensionality,\\n    and visualizes the results using a scatter plot.\\n\\n    This function applies PCA to the dataset, reducing its features to the specified number of principal components.\\n    It then visualizes the reduced data in a scatter plot. For datasets reduced to a single component, the function\\n    generates a 1D scatter plot along the X-axis, with all Y-values set to zero. For reductions resulting in two or more\\n    components, only the first two principal components are visualized.\\n\\n    Parameters:\\n    - data (ndarray): A numpy ndarray of shape (n_samples, n_features) representing the data.\\n    - n_components (int, optional): Number of components to keep. Defaults to 2.\\n    - random_state (int, optional): Seed for reproducibility. Defaults to None.\\n\\n    Returns:\\n    dict: A dictionary containing:\\n        - \\\"transformed_data\\\" (np.ndarray): The transformed data.\\n        - \\\"ax\\\" (plt.Axes): The scatter plot visualizing the transformed data.\\n\\n    Requirements:\\n    - numpy\\n    - matplotlib\\n    - sklearn\\n\\n    Example:\\n    >>> data = np.random.random((100, 5))\\n    >>> results = task_func(data, random_state=42)\\n    >>> results['transformed_data'].shape\\n    (100, 2)\\n    >>> type(results['ax'])\\n    <class 'matplotlib.axes._axes.Axes'>\\n    \\\"\\\"\\\"\\n\",\"entry_point\":\"task_func\",\"instruct_prompt\":\"Performs Principal Component Analysis (PCA) on the provided dataset to reduce its dimensionality, and visualizes the results using a scatter plot. This function applies PCA to the dataset, reducing its features to the specified number of principal components. It then visualizes the reduced data in a scatter plot. For datasets reduced to a single component, the function generates a 1D scatter plot along the X-axis, with all Y-values set to zero. For reductions resulting in two or more components, only the first two principal components are visualized.\\nThe function should output with:\\n    dict: A dictionary containing:\\n    \\\"transformed_data\\\" (np.ndarray): The transformed data.\\n    \\\"ax\\\" (plt.Axes): The scatter plot visualizing the transformed data.\\nYou should write self-contained code starting with:\\n```\\nimport numpy as np\\nfrom sklearn.decomposition import PCA\\nimport matplotlib.pyplot as plt\\ndef task_func(data, n_components=2, random_state=None):\\n```\",\"libs\":\"['numpy', 'matplotlib', 'sklearn']\"}","display_format":"code","language":"","answer_status":"published","assets":[],"source_url":"https://bigcode-bench.github.io/","history":"initial import","indexing_mode":"index","subproblems":[],"grids":[]}