benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf eb34c4da-8ba3-5d6c-a07c-5ca70aff194a

Problem

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

complete prompt

import matplotlib.pyplot as plt
import numpy as np
from sklearn.preprocessing import StandardScaler


def task_func(x, y, labels):
    """
    Scale the "x" and "y" arrays using the standard scaler of sklearn and plot them with given labels.
    Each pair of x and y arrays are scaled independently and plotted as a separate series with a label.

    Parameters:
    - x (list of np.ndarray): List of numpy arrays representing the x-values of the data points.
    - y (list of np.ndarray): List of numpy arrays representing the y-values of the data points.
    - labels (list of str): List of strings representing the labels for each data series.

    Returns:
    - matplotlib.figure.Figure: The figure object containing the plot.

    Requirements:
    - numpy
    - matplotlib.pyplot
    - sklearn.preprocessing

    Example:
    >>> x = [np.array([1,2,3]), np.array([4,5,6]), np.array([7,8,9])]
    >>> y = [np.array([4,5,6]), np.array([7,8,9]), np.array([10,11,12])]
    >>> labels = ['A', 'B', 'C']
    >>> fig = task_func(x, y, labels)
    >>> plt.show()
    """

instruct prompt

Scale the "x" and "y" arrays using the standard scaler of sklearn and plot them with given labels. Each pair of x and y arrays are scaled independently and plotted as a separate series with a label.
The function should output with:
    matplotlib.figure.Figure: The figure object containing the plot.
You should write self-contained code starting with:

Code

import matplotlib.pyplot as plt
import numpy as np
from sklearn.preprocessing import StandardScaler
def task_func(x, y, labels):

code prompt

Code

import matplotlib.pyplot as plt
import numpy as np
from sklearn.preprocessing import StandardScaler
def task_func(x, y, labels):

entry point

task_func

libs

  • numpy
  • 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