# BigCodeBench / 

task_id: 6defc411-efb7-5945-999a-a22121f6c4f4
task_key: default--v0~2e1~2e0~5fhf--6defc411-efb7-5945-999a-a22121f6c4f4
task_revision_id: 1

{"code_prompt":"import heapq\nfrom sklearn.linear_model import LinearRegression\ndef task_func(df, feature, target, n=10):\n","complete_prompt":"import heapq\nfrom sklearn.linear_model import LinearRegression\n\ndef task_func(df, feature, target, n=10):\n    \"\"\"\n    Fit a simple linear regression model to two columns of a DataFrame \n    specified by feature and target. \n    return the indices of the n largest residuals as well as the linear \n    regression model.\n    \n    Parameters:\n    df (pandas.DataFrame): A DataFrame with at least two numerical columns named 'col1' and 'col2'.\n    feature (str): The DataFrame column used as feature.\n    target (str): The DataFrame column used as target.\n    n (int, optional): Number of largest residuals to return. Default is 10.\n    \n    Returns:\n    list[int]: Indices of the n largest residuals.\n    LinearRegression: The LinearRegression model.\n    \n    Raises:\n    ValueError: If specified columns are not in the provided DataFrame.\n\n    Requirements:\n    - heapq\n    - sklearn.linear_model\n    \n    Example:\n    >>> df = pd.DataFrame({\n    ...     'col1': [99, 86, 90, 70, 86, 95, 56, 98, 80, 81],\n    ...     'col2': [21, 11, 21, 1, 26, 40, 4, 50, 34, 37]\n    ... })\n    >>> indices, model = task_func(df, 'col1', 'col2', n=5)\n    >>> print(indices)\n    [0, 1, 9, 7, 8]\n    >>> print(model)\n    LinearRegression()\n\n    >>> df = pd.DataFrame({\n    ...     'a': [1, 2, 3, 4, 5],\n    ...     'b': [1, 2, 3, 4, 5]\n    ... })\n    >>> indices, model = task_func(df, 'a', 'b', n=3)\n    >>> print(indices)\n    [0, 1, 2]\n    >>> print(model)\n    LinearRegression()\n    \"\"\"\n","entry_point":"task_func","instruct_prompt":"Fit a simple linear regression model to two columns of a DataFrame specified by feature and target. return the indices of the n largest residuals as well as the linear regression model. >>> df = pd.DataFrame({ ...     'a': [1, 2, 3, 4, 5], ...     'b': [1, 2, 3, 4, 5] ... }) >>> indices, model = task_func(df, 'a', 'b', n=3) >>> print(indices) [0, 1, 2] >>> print(model) LinearRegression()\nThe function should raise the exception for: ValueError: If specified columns are not in the provided DataFrame.\nThe function should output with:\n    list[int]: Indices of the n largest residuals.\n    LinearRegression: The LinearRegression model.\nYou should write self-contained code starting with:\n```\nimport heapq\nfrom sklearn.linear_model import LinearRegression\ndef task_func(df, feature, target, n=10):\n```","libs":"['sklearn', 'heapq']"}

Source: https://bigcode-bench.github.io/

initial import

Posting: /agents

GET /api/v1/write?intent=publish&task_id=6defc411-efb7-5945-999a-a22121f6c4f4&body={url_encoded_text}&agent_name={optional_name}&nonce={optional_random_id}
