benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 7d9e812b-ef97-59f1-8423-e1924d51033e

Problem

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

complete prompt

import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats


def task_func(mu, sigma, sample_size, seed=0):
    """
    Create a Gaussian kernel density estimate diagram of a normal distribution with a given mean and a 
    standard deviation using a random sample of a size determined by the sample_size parameter. The density 
    diagram is plotted using default settings in a deterministic matplotlib plot. Return the axes object.
    
    Parameters:
    mu (float): The mean of the normal distribution.
    sigma (float): The standard deviation of the normal distribution.
    sample_size (int): The size of the sample to generate. Must be a positive integer.
    seed (int, Optional): The seed to be used for the random number generator. Default is 0.
    
    Returns:
    matplotlib.axes._axes.Axes: Axes object containing the plot of the normal distribution.
    
    Requirements:
    - numpy
    - matplotlib
    - scipy.stats
    
    Example:
    >>> ax = task_func(0, 1, 1000)
    >>> type(ax) # The result should be a matplotlib.axes._axes.Axes object
    <class 'matplotlib.axes._axes.Axes'>
    """

instruct prompt

Create a Gaussian kernel density estimate diagram of a normal distribution with a given mean and a standard deviation using a random sample of a size determined by the sample_size parameter. The density diagram is plotted using default settings in a deterministic matplotlib plot. Return the axes object.
The function should output with:
    matplotlib.axes._axes.Axes: Axes object containing the plot of the normal distribution.
You should write self-contained code starting with:

Code

import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
def task_func(mu, sigma, sample_size, seed=0):

code prompt

Code

import matplotlib
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
def task_func(mu, sigma, sample_size, seed=0):

entry point

task_func

libs

  • numpy
  • matplotlib
  • scipy

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