benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 1b0d8ecd-81eb-5fe3-b2af-d04adff9ef07

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs


def task_func(n_samples=100, centers=3, n_features=2, random_seed=42):
    """
    Create isotropic Gaussian blobs to form clusters and visualize them.

    Parameters:
    - n_samples (int): The total number of points divided among clusters.
    - centers (int): The number of centers to generate.
    - n_features (int): The number of features for each sample.
    - random_seed (int): The seed for the random number generator.

    Returns:
    tuple: A tuple containing:
        - X (numpy.ndarray): The matrix of blob points.
        - y (numpy.ndarray): The vector of blob labels.
        - ax (matplotlib.axes.Axes): The Axes object with the scatter plot.

    Requirements:
    - matplotlib.pyplot
    - sklearn

    Example:
    >>> X, y, ax = task_func(n_samples=500, centers=5, random_seed=0)
    >>> type(X), type(y), type(ax)
    (<class 'numpy.ndarray'>, <class 'numpy.ndarray'>, <class 'matplotlib.axes._axes.Axes'>)
    >>> ax
    <Axes: >
    """

instruct prompt

Create isotropic Gaussian blobs to form clusters and visualize them.
The function should output with:
    tuple: A tuple containing:
    X (numpy.ndarray): The matrix of blob points.
    y (numpy.ndarray): The vector of blob labels.
    ax (matplotlib.axes.Axes): The Axes object with the scatter plot.
You should write self-contained code starting with:

Code

import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
def task_func(n_samples=100, centers=3, n_features=2, random_seed=42):

code prompt

Code

import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
def task_func(n_samples=100, centers=3, n_features=2, random_seed=42):

entry point

task_func

libs

  • matplotlib
  • sklearn

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import