benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 179b68f4-dac4-5793-a07c-62fb8d72e251

Problem

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

complete prompt

import numpy as np
import random
from sklearn.preprocessing import MinMaxScaler


def task_func(list_of_lists, seed=42):
    """
    Scale the values in a list of lists to a (0,1) range using MinMaxScaler.
    If any inner list is empty, the function fills it with five random integers between 0 and 100, and then scales the values.
    
    Parameters:
    list_of_lists (list of list of int): A list containing inner lists of integers.
    seed (int, Optional): Seed for random number generation. Default is 42.
    
    Returns:
    list of list of float: A list of lists containing scaled values between the range [0, 1].
    
    Requirements:
    - numpy
    - random
    - sklearn.preprocessing.MinMaxScaler
    
    Example:
    >>> task_func([[1, 2, 3], [], [4, 5, 6]])
    [[0.0, 0.5, 1.0], [0.8571428571428572, 0.1208791208791209, 0.0, 1.0, 0.3516483516483517], [0.0, 0.5, 1.0]]
    """

instruct prompt

Scale the values in a list of lists to a (0,1) range using MinMaxScaler. If any inner list is empty, the function fills it with five random integers between 0 and 100, and then scales the values.
The function should output with:
    list of list of float: A list of lists containing scaled values between the range [0, 1].
You should write self-contained code starting with:

Code

import numpy as np
import random
from sklearn.preprocessing import MinMaxScaler
def task_func(list_of_lists, seed=42):

code prompt

Code

import numpy as np
import random
from sklearn.preprocessing import MinMaxScaler
def task_func(list_of_lists, seed=42):

entry point

task_func

libs

  • numpy
  • random
  • 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