benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 5d437f33-baca-52e4-bd1e-4d0932fbe18e

Problem

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

complete prompt

import pandas as pd
from sklearn.linear_model import LinearRegression

ROWS = 100
COLUMNS = ['X', 'Y']

def task_func(df):
    """
    Given a Pandas DataFrame with random numeric values and columns X & Y, use sklearn's linear regression to match the data to a linear model.

    Parameters:
    - df (DataFrame): The DataFrame to use.

    Returns:
    - model (LinearRegression): The fitted linear model.

    Requirements:
    - pandas
    - sklearn

    Example:
    >>> import numpy as np
    >>> np.random.seed(42)
    >>> df = pd.DataFrame(np.random.normal(size=(100, 2)), columns=['X', 'Y'])
    >>> model = task_func(df)
    >>> print(model)
    LinearRegression()
    """

instruct prompt

Given a Pandas DataFrame with random numeric values and columns X & Y, use sklearn's linear regression to match the data to a linear model.
The function should output with:
    model (LinearRegression): The fitted linear model.
You should write self-contained code starting with:

Code

import pandas as pd
from sklearn.linear_model import LinearRegression
ROWS = 100
COLUMNS = ['X', 'Y']
def task_func(df):

code prompt

Code

import pandas as pd
from sklearn.linear_model import LinearRegression
ROWS = 100
COLUMNS = ['X', 'Y']
def task_func(df):

entry point

task_func

libs

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