benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 1adb0552-da43-599b-bb63-5fee880bba1c

Problem

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

complete prompt

import warnings
import sklearn.model_selection as model_selection
import sklearn.svm as svm
import sklearn.datasets as datasets
import sklearn.metrics as metrics

def task_func():
    """
    Perform an SVM classification of the iris dataset and warn if the accuracy is less than 0.9.
    The warning action is set to 'always'. The test size for the train-test split is 0.33.

    Parameters:
    - None

    Returns:
    tuple: A tuple containing:
        - accuracy (float): The accuracy of the SVM classification.
        - warning_msg (str or None): A warning message if the accuracy is below 0.9, None otherwise.

    Requirements:
    - warnings
    - sklearn

    Example:
    >>> task_func()
    (1.0, None)
    """

instruct prompt

Perform an SVM classification of the iris dataset and warn if the accuracy is less than 0.9. The warning action is set to 'always'. The test size for the train-test split is 0.33.
The function should output with:
    tuple: A tuple containing:
    accuracy (float): The accuracy of the SVM classification.
    warning_msg (str or None): A warning message if the accuracy is below 0.9, None otherwise.
You should write self-contained code starting with:

Code

import warnings
import sklearn.model_selection as model_selection
import sklearn.svm as svm
import sklearn.datasets as datasets
import sklearn.metrics as metrics
def task_func():

code prompt

Code

import warnings
import sklearn.model_selection as model_selection
import sklearn.svm as svm
import sklearn.datasets as datasets
import sklearn.metrics as metrics
def task_func():

entry point

task_func

libs

  • warnings
  • 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