benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 59519092-c7eb-5d9e-aea2-8cd5eed826a1

Problem

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

complete prompt

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


def task_func(mu, sigma, num_samples=1000, seed=77):
    """
    Generate a normal distribution with the given mean and standard deviation. 
    Creates a figure containing a histogram and a Q-Q plot of the generated samples.

    Parameters:
    mu (float): The mean of the normal distribution.
    sigma (float): The standard deviation of the normal distribution.
    num_samples (int, Optional): The number of samples to generate. Default is 1000.
    seed (int, Optional): The seed for the random number generator. Default is 77.

    Returns:
    matplotlib.figure.Figure: A matplotlib figure containing the histogram and Q-Q plot.

    Requirements:
    - numpy for generating the samples.
    - matplotlib.pyplot for plotting.
    - scipy.stats for the Q-Q plot.

    Example:
    >>> fig = task_func(0, 1)
    >>> type(fig)
    <class 'matplotlib.figure.Figure'>
    """

instruct prompt

Generate a normal distribution with the given mean and standard deviation. Creates a figure containing a histogram and a Q-Q plot of the generated samples.
The function should output with:
    matplotlib.figure.Figure: A matplotlib figure containing the histogram and Q-Q plot.
You should write self-contained code starting with:

Code

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

code prompt

Code

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

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