benchmarks.wiki / Public workspace
BigCodeBench / BigCodeBench v0.1.0_hf 64934759-54a2-5ffa-b0fe-66d7d91e6d47
Problem
Answer published by the source. Consult the official source to check your work against its answer.
complete prompt
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def task_func(mu, sigma, num_samples):
"""
Display a plot showing a normal distribution with a given mean and standard deviation and overlay a histogram of randomly generated samples from this distribution.
The plot title should be 'Normal Distribution'.
Parameters:
mu (float): The mean of the distribution.
sigma (float): The standard deviation of the distribution.
num_samples (int): The number of samples to generate.
Returns:
fig (matplotlib.figure.Figure): The generated figure. Useful for testing purposes.
Requirements:
- numpy
- scipy.stats
- matplotlib.pyplot
Example:
>>> plt = task_func(0, 1, 1000)
"""
instruct prompt
Display a plot showing a normal distribution with a given mean and standard deviation and overlay a histogram of randomly generated samples from this distribution. The plot title should be 'Normal Distribution'.
The function should output with:
fig (matplotlib.figure.Figure): The generated figure. Useful for testing purposes.
You should write self-contained code starting with:
Code
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def task_func(mu, sigma, num_samples):
code prompt
Code
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def task_func(mu, sigma, num_samples):
entry point
task_func
libs
- numpy
- matplotlib
- scipy
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
initial import