benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 6f90de17-3879-567f-bd75-104991833985

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(mean=123456.908, std_dev=1.2, save_plots=False):
    """
    Generate a random sample from a normal distribution, analyze its skewness and kurtosis,
    and create a histogram and a QQ plot to visualize the distribution.

    Parameters:
    - mean (float, optional): Mean of the normal distribution. Defaults to 123456.908.
    - std_dev (float, optional): Standard deviation of the normal distribution. Defaults to 1.2.
    - save_plots (bool, optional): If True, saves the plots to files. Defaults to False.

    Returns:
    - float: Skewness of the sample.
    - float: Kurtosis of the sample.
    - list: Paths to the saved plot files, empty if save_plots is False.

    Requirements:
    - numpy
    - matplotlib.pyplot
    - scipy.stats

    Example:
    >>> np.random.seed(0)
    >>> skewness, kurtosis, plot_paths = task_func(123456.908, 1.2, True)
    >>> print(f'Skewness: {skewness}, Kurtosis: {kurtosis}, Plots: {plot_paths}')
    Skewness: 0.03385895323538189, Kurtosis: -0.04676632447765128, Plots: ['histogram_plot.png', 'qq_plot.png']

    """

instruct prompt

Generate a random sample from a normal distribution, analyze its skewness and kurtosis, and create a histogram and a QQ plot to visualize the distribution.
The function should output with:
    float: Skewness of the sample.
    float: Kurtosis of the sample.
    list: Paths to the saved plot files, empty if save_plots is False.
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(mean=123456.908, std_dev=1.2, save_plots=False):

code prompt

Code

import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
def task_func(mean=123456.908, std_dev=1.2, save_plots=False):

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