benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 24e95fa8-e21c-51fd-b613-4896c82ccb9e

Problem

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

complete prompt

import pickle
import os
from sklearn.datasets import make_classification

# Constants
FILE_NAME = 'save.pkl'
DATA, TARGET = make_classification(n_samples=100, n_features=20, n_informative=2, n_redundant=10, n_classes=2, random_state=1)

def task_func(data, target):
    """
    Save the Sklearn dataset ("Data" and "Destination") in the pickle file "save.pkl" and then read it back for validation.

    Parameters:
    - data (numpy array): The data part of the sklearn dataset.
    - target (numpy array): The target part of the sklearn dataset.

    Returns:
    tuple: The loaded tuple (data, target) from 'save.pkl'.

    Requirements:
    - pickle
    - os
    - sklearn.datasets

    Example:
    >>> data, target = make_classification(n_samples=100, n_features=20, n_informative=2, n_redundant=10, n_classes=2, random_state=1)
    >>> loaded_data, loaded_target = task_func(data, target)
    >>> assert np.array_equal(data, loaded_data) and np.array_equal(target, loaded_target)
    """

instruct prompt

Save the Sklearn dataset ("Data" and "Destination") in the pickle file "save.pkl" and then read it back for validation.
The function should output with:
    tuple: The loaded tuple (data, target) from 'save.pkl'.
You should write self-contained code starting with:

Code

import pickle
import os
from sklearn.datasets import make_classification
# Constants
FILE_NAME = 'save.pkl'
DATA, TARGET = make_classification(n_samples=100, n_features=20, n_informative=2, n_redundant=10, n_classes=2, random_state=1)
def task_func(data, target):

code prompt

Code

import pickle
import os
from sklearn.datasets import make_classification
# Constants
FILE_NAME = 'save.pkl'
DATA, TARGET = make_classification(n_samples=100, n_features=20, n_informative=2, n_redundant=10, n_classes=2, random_state=1)
def task_func(data, target):

entry point

task_func

libs

  • pickle
  • os
  • 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