task_id stringlengths 8 8 | category stringclasses 5
values | prompt stringlengths 22 183 | input_data stringclasses 6
values | expected_output stringlengths 55 2.97k |
|---|---|---|---|---|
npsp-000 | array_ops | Return `a` reshaped to shape (8, 5) in C order. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [[-2.338592, 4.152282, 4.776106, 0.439501, 0.841571], [1.84993, 1.187283, 0.522289, -7.251883, 2.488212], [2.764342, -4.700811, -3.035897, 0.172288, 2.032965], [5.514732, -1.287731, 2.004718, 1.5833, 1.118473], [-0.955547, 0.913293, -1.082677, 4.96314, -3.769013], [-0.760205, -7.141644, 0.545738, 3.539238, 1.7... |
npsp-001 | array_ops | Return the element-wise absolute value of `a`. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, 7.251883, 2.488212, 2.764342, 4.700811, 3.035897, 0.172288, 2.032965, 5.514732, 1.287731, 2.004718, 1.5833, 1.118473, 0.955547, 0.913293, 1.082677, 4.96314, 3.769013, 0.760205, 7.141644, 0.545738, 3.539238, 1.790779, 0.597325, 1.77... |
npsp-002 | array_ops | Return `a` sorted in ascending order. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [-7.251883, -7.141644, -4.965906, -4.700811, -3.769013, -3.035897, -2.338592, -2.088676, -1.287731, -1.082677, -0.955547, -0.760205, -0.70312, -0.597325, -0.560894, -0.217803, 0.172288, 0.439501, 0.522289, 0.545738, 0.841571, 0.913293, 1.118473, 1.187283, 1.242958, 1.5833, 1.77417, 1.790779, 1.84993, 2.004718,... |
npsp-003 | array_ops | Return the cumulative sum of `a`. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [-2.338592, 1.8136899999999998, 6.589796, 7.029297, 7.870868, 9.720798, 10.908081000000001, 11.430370000000002, 4.178487000000001, 6.666699000000001, 9.431041, 4.730230000000001, 1.6943330000000008, 1.8666210000000008, 3.8995860000000007, 9.414318000000002, 8.126587, 10.131305000000001, 11.714605, 12.833078, 1... |
npsp-004 | array_ops | Clip `a` to the range [-2, 2] and return the result. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [-2.0, 2.0, 2.0, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -2.0, 2.0, 2.0, -2.0, -2.0, 0.172288, 2.0, 2.0, -1.287731, 2.0, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 2.0, -2.0, -0.760205, -2.0, 0.545738, 2.0, 1.790779, -0.597325, 1.77417, 2.0, 2.0, -0.560894, 1.242958, -2.0, -0.217803, -0.70312, ... |
npsp-005 | array_ops | Return only the strictly positive elements of `a`, in their original order. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, 2.488212, 2.764342, 0.172288, 2.032965, 5.514732, 2.004718, 1.5833, 1.118473, 0.913293, 4.96314, 0.545738, 3.539238, 1.790779, 1.77417, 2.053285, 3.682132, 1.242958], "dtype": "float64", "shape": [24]} |
npsp-006 | array_ops | Return the indices that would sort `a` ascending, as an int64 array. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [8, 26, 39, 11, 24, 12, 0, 36, 16, 22, 20, 25, 38, 30, 34, 37, 13, 3, 7, 27, 4, 21, 19, 6, 35, 18, 31, 29, 5, 17, 14, 32, 9, 10, 28, 33, 1, 2, 23, 15], "dtype": "int64", "shape": [40]} |
npsp-007 | array_ops | Return `m` transposed. | {"m": "{\"data\": [[1.78454, 2.056107, 0.09955, 0.002686, 0.572878, 0.637833], [-1.300929, 0.239739, -1.237216, -2.083909, 4.352373, -1.00321], [-5.19234, -2.996016, 2.224916, -0.723849, 0.180393, 1.828207], [-5.261445, 4.704098, -1.701475, 1.437119, 2.570229, -1.987346], [2.972197, 0.903369, -2.275477, 0.906412, -0.66... | {"data": [[1.78454, -1.300929, -5.19234, -5.261445, 2.972197, 0.261181], [2.056107, 0.239739, -2.996016, 4.704098, 0.903369, -1.040545], [0.09955, -1.237216, 2.224916, -1.701475, -2.275477, 0.122565], [0.002686, -2.083909, -0.723849, 1.437119, 0.906412, 1.966241], [0.572878, 4.352373, 0.180393, 2.570229, -0.662423, -0.... |
npsp-008 | array_ops | Return the row-wise sums of `g` as a 1-D array. | {"g": "{\"data\": [[2.430467, 7.321266, 6.262129, 7.057496, 0.582218], [7.481136, 5.140247, 5.339102, 6.517242, 9.002142], [6.280658, 6.390547, 4.376518, 7.55941, 7.296464], [4.761695, 5.810669, 7.955908, 0.774986, 2.944163], [0.959852, 7.128168, 1.758072, 3.474089, 0.428503], [6.620385, 8.587085, 9.46601, 5.026196, 1.... | {"data": [23.653576, 33.479868999999994, 31.903597, 22.247421, 13.748684, 31.081812, 24.56029, 24.326532], "dtype": "float64", "shape": [8]} |
npsp-009 | array_ops | Normalise each column of `g` to zero mean and unit standard deviation (population std, ddof=0). | {"g": "{\"data\": [[2.430467, 7.321266, 6.262129, 7.057496, 0.582218], [7.481136, 5.140247, 5.339102, 6.517242, 9.002142], [6.280658, 6.390547, 4.376518, 7.55941, 7.296464], [4.761695, 5.810669, 7.955908, 0.774986, 2.944163], [0.959852, 7.128168, 1.758072, 3.474089, 0.428503], [6.620385, 8.587085, 9.46601, 5.026196, 1.... | {"data": [[-1.2660775658668926, 0.6617000625629937, 0.02979758170916544, 1.1312832643940025, -0.8853699390260489], [0.9510995806064245, -0.41405339203916985, -0.3665703740808006, 0.9010901249329193, 1.4785331948954898], [0.42410555537056055, 0.20263749615991752, -0.7799249697276543, 1.3451403749373207, 0.99966217781017... |
npsp-010 | array_ops | Return the pairwise differences between consecutive elements of `a`. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [6.490874, 0.6238240000000008, -4.3366050000000005, 0.40207, 1.008359, -0.662647, -0.6649940000000001, -7.774172, 9.740095, 0.2761300000000002, -7.465153, 1.664914, 3.208185, 1.860677, 3.4817670000000005, -6.802463, 3.292449, -0.42141800000000007, -0.4648269999999999, -2.07402, 1.86884, -1.9959699999999998, 6.... |
npsp-011 | array_ops | Return `a` with every element rounded to 2 decimal places. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [-2.34, 4.15, 4.78, 0.44, 0.84, 1.85, 1.19, 0.52, -7.25, 2.49, 2.76, -4.7, -3.04, 0.17, 2.03, 5.51, -1.29, 2.0, 1.58, 1.12, -0.96, 0.91, -1.08, 4.96, -3.77, -0.76, -7.14, 0.55, 3.54, 1.79, -0.6, 1.77, 2.05, 3.68, -0.56, 1.24, -2.09, -0.22, -0.7, -4.97], "dtype": "float64", "shape": [40]} |
npsp-012 | linalg | Return the matrix product of `m` with itself. | {"m": "{\"data\": [[1.78454, 2.056107, 0.09955, 0.002686, 0.572878, 0.637833], [-1.300929, 0.239739, -1.237216, -2.083909, 4.352373, -1.00321], [-5.19234, -2.996016, 2.224916, -0.723849, 0.180393, 1.828207], [-5.261445, 4.704098, -1.701475, 1.437119, 2.570229, -1.987346], [2.972197, 0.903369, -2.275477, 0.906412, -0.66... | {"data": [[1.8480002336660002, 3.7303423232780006, -3.374672006323, -2.5747487846499992, 9.564270025251, 0.5043326394580003], [27.429066041225, -3.737883668820998, -9.659782107226, -0.6298657267659994, -8.081886910743, 5.680765749980999], [-12.098706500482999, -23.20457927686, 9.185277737281, 7.336923648391999, -17.743... |
npsp-013 | linalg | Return the inverse of `s`. | {"s": "{\"data\": [[7.482598, 2.108322, 0.11393, 2.668225, 0.521946], [2.108322, 8.632871, 3.298573, 3.224495, 1.566888], [0.11393, 3.298573, 11.173995, 1.36509, 1.007685], [2.668225, 3.224495, 1.36509, 11.597274, 1.147504], [0.521946, 1.566888, 1.007685, 1.147504, 7.777386]], \"dtype\": \"float64\", \"shape\": [5, 5]}... | {"data": [[0.15208937092635716, -0.030808448030359405, 0.011037185499583112, -0.02759045420805671, -0.0013591843049477223], [-0.030808448030359398, 0.1527266992649788, -0.039507616597080436, -0.028812611376798056, -0.019331876636481695], [0.011037185499583114, -0.039507616597080436, 0.10191021253933326, -0.003001934420... |
npsp-014 | linalg | Return the eigenvalues of `s` as a 1-D array sorted ascending. `s` is symmetric, so use a symmetric eigensolver. | {"s": "{\"data\": [[7.482598, 2.108322, 0.11393, 2.668225, 0.521946], [2.108322, 8.632871, 3.298573, 3.224495, 1.566888], [0.11393, 3.298573, 11.173995, 1.36509, 1.007685], [2.668225, 3.224495, 1.36509, 11.597274, 1.147504], [0.521946, 1.566888, 1.007685, 1.147504, 7.777386]], \"dtype\": \"float64\", \"shape\": [5, 5]}... | {"data": [5.009439718167531, 6.436258656101522, 7.370789253994382, 10.658719235771812, 17.188917135964758], "dtype": "float64", "shape": [5]} |
npsp-015 | linalg | Return the lower-triangular Cholesky factor of `s`. | {"s": "{\"data\": [[7.482598, 2.108322, 0.11393, 2.668225, 0.521946], [2.108322, 8.632871, 3.298573, 3.224495, 1.566888], [0.11393, 3.298573, 11.173995, 1.36509, 1.007685], [2.668225, 3.224495, 1.36509, 11.597274, 1.147504], [0.521946, 1.566888, 1.007685, 1.147504, 7.777386]], \"dtype\": \"float64\", \"shape\": [5, 5]}... | {"data": [[2.7354337864404616, 0.0, 0.0, 0.0, 0.0], [0.7707450315379399, 2.8352818372005943, 0.0, 0.0, 0.0], [0.04164970125204665, 1.1520800707841041, 3.137669806223674, 0.0, 0.0], [0.9754303003883278, 0.8721132798584621, 0.10189704779367277, 3.1424266336431446, 0.0], [0.19080922469675013, 0.5007695247309983, 0.1347532... |
npsp-016 | linalg | Solve s @ x = b where b is a vector of ones of the right length, and return x. | {"s": "{\"data\": [[7.482598, 2.108322, 0.11393, 2.668225, 0.521946], [2.108322, 8.632871, 3.298573, 3.224495, 1.566888], [0.11393, 3.298573, 11.173995, 1.36509, 1.007685], [2.668225, 3.224495, 1.36509, 11.597274, 1.147504], [0.521946, 1.566888, 1.007685, 1.147504, 7.777386]], \"dtype\": \"float64\", \"shape\": [5, 5]}... | {"data": [0.10336846988257643, 0.03426614662425921, 0.0648954365975996, 0.0352729012177597, 0.10112473180578156], "dtype": "float64", "shape": [5]} |
npsp-017 | linalg | Return the singular values of `m` as a 1-D array, in descending order. | {"m": "{\"data\": [[1.78454, 2.056107, 0.09955, 0.002686, 0.572878, 0.637833], [-1.300929, 0.239739, -1.237216, -2.083909, 4.352373, -1.00321], [-5.19234, -2.996016, 2.224916, -0.723849, 0.180393, 1.828207], [-5.261445, 4.704098, -1.701475, 1.437119, 2.570229, -1.987346], [2.972197, 0.903369, -2.275477, 0.906412, -0.66... | {"data": [9.041093142883927, 7.479526784078189, 4.433244106265389, 2.4954668025544176, 1.8696931841386275, 1.4945950345109649], "dtype": "float64", "shape": [6]} |
npsp-018 | linalg | Return the QR decomposition's R factor for `m`. | {"m": "{\"data\": [[1.78454, 2.056107, 0.09955, 0.002686, 0.572878, 0.637833], [-1.300929, 0.239739, -1.237216, -2.083909, 4.352373, -1.00321], [-5.19234, -2.996016, 2.224916, -0.723849, 0.180393, 1.828207], [-5.261445, 4.704098, -1.701475, 1.437119, 2.570229, -1.987346], [2.972197, 0.903369, -2.275477, 0.906412, -0.66... | {"data": [[-8.271781426019185, 0.4138742541122191, 0.9120497697598979, -0.2563581137094326, 2.5496179115449085, -0.904833313491212], [0.0, -6.092390187635642, 2.8432709853754634, -1.2004980477974794, -2.003037553465382, 2.138724751808887], [0.0, 0.0, -2.37963759715507, -0.1464142995470269, 1.8627004431044138, -0.265656... |
npsp-019 | linalg | Return the matrix exponential of `m` using scipy.linalg. | {"m": "{\"data\": [[1.78454, 2.056107, 0.09955, 0.002686, 0.572878, 0.637833], [-1.300929, 0.239739, -1.237216, -2.083909, 4.352373, -1.00321], [-5.19234, -2.996016, 2.224916, -0.723849, 0.180393, 1.828207], [-5.261445, 4.704098, -1.701475, 1.437119, 2.570229, -1.987346], [2.972197, 0.903369, -2.275477, 0.906412, -0.66... | {"data": [[61.87579349341, 40.058884091645595, -30.012743321305482, -7.047777163620306, 30.62436104382362, 0.8077703260435826], [76.40599472757842, 45.94008310271451, -33.68525373504877, -9.730570115529705, 34.35484989971315, 1.9560694670136451], [-182.92625737780722, -109.18836502431684, 81.2475821058694, 26.801893177... |
npsp-020 | linalg | Return the Moore-Penrose pseudo-inverse of `g`. | {"g": "{\"data\": [[2.430467, 7.321266, 6.262129, 7.057496, 0.582218], [7.481136, 5.140247, 5.339102, 6.517242, 9.002142], [6.280658, 6.390547, 4.376518, 7.55941, 7.296464], [4.761695, 5.810669, 7.955908, 0.774986, 2.944163], [0.959852, 7.128168, 1.758072, 3.474089, 0.428503], [6.620385, 8.587085, 9.46601, 5.026196, 1.... | {"data": [[-0.1429377816094195, 0.05448011061825246, 0.06866100778897095, -0.13419558172308646, -0.013981531950309963, 0.010526309268390682, 0.19418810840799997, -0.06381058193497365], [-0.08860145645427095, 0.006764157452084771, 0.022712524298697977, 0.08830243637736566, 0.17284553919549925, -0.014392729205936308, -0.... |
npsp-021 | linalg | Return a 1-element array containing the determinant of `s`. | {"s": "{\"data\": [[7.482598, 2.108322, 0.11393, 2.668225, 0.521946], [2.108322, 8.632871, 3.298573, 3.224495, 1.566888], [0.11393, 3.298573, 11.173995, 1.36509, 1.007685], [2.668225, 3.224495, 1.36509, 11.597274, 1.147504], [0.521946, 1.566888, 1.007685, 1.147504, 7.777386]], \"dtype\": \"float64\", \"shape\": [5, 5]}... | {"data": [43540.17579515116], "dtype": "float64", "shape": [1]} |
npsp-022 | statistics | Return a 1-D array [mean, median, population standard deviation (ddof=0)] of `a`. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [0.26237502499999993, 0.6936545, 2.9689772850166816], "dtype": "float64", "shape": [3]} |
npsp-023 | statistics | Return the 25th, 50th and 75th percentiles of `a` as a 1-D array, using linear interpolation. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [-0.9873295, 0.6936545, 2.01177975], "dtype": "float64", "shape": [3]} |
npsp-024 | statistics | Return the z-scores of `a` (population std, ddof=0) using scipy.stats. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [-0.8760481389083399, 1.3101841481344119, 1.520298251448104, 0.05965891887886399, 0.19508265621397156, 0.5347144227110785, 0.31152409944921605, 0.0875432682869245, -2.530924727151552, 0.7496982163632464, 0.842703306497659, -1.6716820468945128, -1.1109118421502062, -0.03034278014002851, 0.5963635976386569, 1.76... |
npsp-025 | statistics | Return the Pearson correlation matrix of `g`'s columns. | {"g": "{\"data\": [[2.430467, 7.321266, 6.262129, 7.057496, 0.582218], [7.481136, 5.140247, 5.339102, 6.517242, 9.002142], [6.280658, 6.390547, 4.376518, 7.55941, 7.296464], [4.761695, 5.810669, 7.955908, 0.774986, 2.944163], [0.959852, 7.128168, 1.758072, 3.474089, 0.428503], [6.620385, 8.587085, 9.46601, 5.026196, 1.... | {"data": [[1.0, -0.29586790448042755, 0.5677882138765642, -0.006749565036902352, 0.4820874218471303], [-0.29586790448042755, 1.0, 0.14570270311326347, 0.30853352196537975, -0.6718184313703766], [0.5677882138765642, 0.14570270311326347, 1.0, -0.28446555946137775, -0.24492884202224122], [-0.006749565036902353, 0.30853352... |
npsp-026 | statistics | Return the column-wise covariance matrix of `g` with ddof=1. | {"g": "{\"data\": [[2.430467, 7.321266, 6.262129, 7.057496, 0.582218], [7.481136, 5.140247, 5.339102, 6.517242, 9.002142], [6.280658, 6.390547, 4.376518, 7.55941, 7.296464], [4.761695, 5.810669, 7.955908, 0.774986, 2.944163], [0.959852, 7.128168, 1.758072, 3.474089, 0.428503], [6.620385, 8.587085, 9.46601, 5.026196, 1.... | {"data": [[5.930468114167553, -1.5616547137608392, 3.4422523291005707, -0.04124030443269642, 4.470383244098749], [-1.5616547137608392, 4.6977007272129825, 0.7861802393955721, 1.6778248341812676, -5.544585133234036], [3.4422523291005707, 0.7861802393955721, 6.197602002279143, -1.7768187298992866, -2.3218076587607155], [... |
npsp-027 | statistics | Return a 1-element array with the chi-square statistic from a chi-square test of independence on the contingency table `c`. | {"c": "{\"data\": [[32, 34, 9, 21, 8], [10, 9, 25, 17, 46], [15, 25, 25, 45, 13], [43, 34, 3, 4, 45]], \"dtype\": \"int64\", \"shape\": [4, 5]}"} | {"data": [147.36878573116684], "dtype": "float64", "shape": [1]} |
npsp-028 | statistics | Return a 1-D array [slope, intercept] of the least-squares line fitting `a` against the index 0..len(a)-1. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [-0.033694264446529086, 0.919413181707317], "dtype": "float64", "shape": [2]} |
npsp-029 | statistics | Return the ranks of `a` using scipy.stats.rankdata with the default average method. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [7.0, 37.0, 38.0, 18.0, 21.0, 29.0, 24.0, 19.0, 1.0, 33.0, 34.0, 4.0, 6.0, 17.0, 31.0, 40.0, 9.0, 30.0, 26.0, 23.0, 11.0, 22.0, 10.0, 39.0, 5.0, 12.0, 2.0, 20.0, 35.0, 28.0, 14.0, 27.0, 32.0, 36.0, 15.0, 25.0, 8.0, 16.0, 13.0, 3.0], "dtype": "float64", "shape": [40]} |
npsp-030 | signal | Return the magnitude spectrum of the real FFT of `sig`. | {"sig": "{\"data\": [0.0, 0.520765296, 0.933336503, 1.161951595, 1.185023003, 1.039089226, 0.80384301, 0.573441704, 0.423879533, 0.387472725, 0.443051568, 0.525100254, 0.548643713, 0.441324966, 0.171655089, -0.236317628, -0.707106781, -1.135513727, -1.418880102, -1.489188096, -1.334338671, -1.001534454, -0.581668737, -... | {"data": [0.0, 1.7244866097368884e-09, 2.966880286638235e-09, 4.024770390295366e-09, 3.169368566610847e-09, 64.00000000067347, 2.4711699997784958e-09, 3.34979198175915e-09, 2.82842747427887e-09, 4.927753918770411e-09, 1.0376383079187364e-08, 4.435839297617373e-09, 32.00000000945037, 2.291128886433326e-09, 1.03343582991... |
npsp-031 | signal | Return the real FFT frequencies for `sig` assuming a sample spacing of 1/128. | {"sig": "{\"data\": [0.0, 0.520765296, 0.933336503, 1.161951595, 1.185023003, 1.039089226, 0.80384301, 0.573441704, 0.423879533, 0.387472725, 0.443051568, 0.525100254, 0.548643713, 0.441324966, 0.171655089, -0.236317628, -0.707106781, -1.135513727, -1.418880102, -1.489188096, -1.334338671, -1.001534454, -0.581668737, -... | {"data": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53... |
npsp-032 | signal | Return `sig` convolved with a length-5 moving-average kernel using scipy.signal.convolve in 'same' mode. | {"sig": "{\"data\": [0.0, 0.520765296, 0.933336503, 1.161951595, 1.185023003, 1.039089226, 0.80384301, 0.573441704, 0.423879533, 0.387472725, 0.443051568, 0.525100254, 0.548643713, 0.441324966, 0.171655089, -0.236317628, -0.707106781, -1.135513727, -1.418880102, -1.489188096, -1.334338671, -1.001534454, -0.581668737, -... | {"data": [0.29082035980000004, 0.5232106788, 0.7602152794000001, 0.9680331246000001, 1.0246486674, 0.9526697076, 0.8050552952000001, 0.6455452396, 0.526337708, 0.4705891568, 0.4656295586, 0.4691186452, 0.4259551180000001, 0.2900812788, 0.04363987180000001, -0.2931916162, -0.6652326298, -0.9974012668000001, -1.217005475... |
npsp-033 | signal | Return the discrete cosine transform (type 2, norm='ortho') of `sig`. | {"sig": "{\"data\": [0.0, 0.520765296, 0.933336503, 1.161951595, 1.185023003, 1.039089226, 0.80384301, 0.573441704, 0.423879533, 0.387472725, 0.443051568, 0.525100254, 0.548643713, 0.441324966, 0.171655089, -0.236317628, -0.707106781, -1.135513727, -1.418880102, -1.489188096, -1.334338671, -1.001534454, -0.581668737, -... | {"data": [-1.4719616800160393e-17, 1.2300729989381387, -5.290094477731653e-12, 1.3227162999810274, -1.8197409967671446e-11, 1.5657062445721788, 3.7010113568210284e-11, 2.2096907074670753, 3.8831627266872375e-11, 5.562521437993276, -0.9792854016040347, -4.551343392546784, 4.5324525865470234e-11, -1.1721701723677374, -7.... |
npsp-034 | signal | Return `sig` detrended linearly using scipy.signal.detrend. | {"sig": "{\"data\": [0.0, 0.520765296, 0.933336503, 1.161951595, 1.185023003, 1.039089226, 0.80384301, 0.573441704, 0.423879533, 0.387472725, 0.443051568, 0.525100254, 0.548643713, 0.441324966, 0.171655089, -0.236317628, -0.707106781, -1.135513727, -1.418880102, -1.489188096, -1.334338671, -1.001534454, -0.581668737, -... | {"data": [-0.22688523042005815, 0.2974530613345884, 0.7135972640892351, 0.9457853518438815, 0.9724297555985282, 0.8300689743531747, 0.5983957541078213, 0.371567443862468, 0.2255782686171145, 0.1927444563717611, 0.25189629512640765, 0.33751797688105434, 0.36463443163570086, 0.2608886803903474, -0.005208200855005979, -0.... |
npsp-035 | signal | Return the indices of local maxima in `sig` found by scipy.signal.find_peaks with default arguments, as an int64 array. | {"sig": "{\"data\": [0.0, 0.520765296, 0.933336503, 1.161951595, 1.185023003, 1.039089226, 0.80384301, 0.573441704, 0.423879533, 0.387472725, 0.443051568, 0.525100254, 0.548643713, 0.441324966, 0.171655089, -0.236317628, -0.707106781, -1.135513727, -1.418880102, -1.489188096, -1.334338671, -1.001534454, -0.581668737, -... | {"data": [4, 12, 26, 34, 46, 56, 65, 79, 87, 100, 109, 119], "dtype": "int64", "shape": [12]} |
npsp-036 | optimization | Fit a degree-2 polynomial to `a` against the index 0..len(a)-1 with numpy.polyfit and return the coefficients (highest power first). | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [-0.0008460859671458246, -0.0006969117278418533, 0.7104299478222972], "dtype": "float64", "shape": [3]} |
npsp-037 | optimization | Return the least-squares solution x to g @ x = b, where b is a vector of ones of the right length. Use numpy.linalg.lstsq with rcond=None. | {"g": "{\"data\": [[2.430467, 7.321266, 6.262129, 7.057496, 0.582218], [7.481136, 5.140247, 5.339102, 6.517242, 9.002142], [6.280658, 6.390547, 4.376518, 7.55941, 7.296464], [4.761695, 5.810669, 7.955908, 0.774986, 2.944163], [0.959852, 7.128168, 1.758072, 3.474089, 0.428503], [6.620385, 8.587085, 9.46601, 5.026196, 1.... | {"data": [-0.02706994113417538, 0.11585748914975713, 0.046653553320631924, -0.030767321125194237, 0.07316462841678441], "dtype": "float64", "shape": [5]} |
npsp-038 | optimization | Minimise the function f(x) = (x[0]-3)**2 + (x[1]+1)**2 with scipy.optimize.minimize starting from [0, 0] using method 'BFGS', and return the located minimiser x rounded to 6 decimals. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [3.0, -1.0], "dtype": "float64", "shape": [2]} |
npsp-039 | optimization | Find the root of f(x) = x**3 - 2x - 5 on the bracket [1, 3] with scipy.optimize.brentq and return it as a 1-element array rounded to 9 decimals. | {"a": "{\"data\": [-2.338592, 4.152282, 4.776106, 0.439501, 0.841571, 1.84993, 1.187283, 0.522289, -7.251883, 2.488212, 2.764342, -4.700811, -3.035897, 0.172288, 2.032965, 5.514732, -1.287731, 2.004718, 1.5833, 1.118473, -0.955547, 0.913293, -1.082677, 4.96314, -3.769013, -0.760205, -7.141644, 0.545738, 3.539238, 1.790... | {"data": [2.094551482], "dtype": "float64", "shape": [1]} |
numpy-scipy-tasks-v1
Task dataset for a numpy/scipy RL / eval environment, in the shape used by the Prime Intellect Environments Hub.
40 numerical computing tasks across 5 categories. Each task gives the model one or more input
arrays and an instruction; the answer is the array left in result, graded with
numpy.testing.assert_allclose against a reference. Grading is deterministic — no LLM judge,
no external API.
| Category | Tasks | Covers |
|---|---|---|
| array_ops | 12 | reshape, abs, sort, cumsum, clip, boolean masking, argsort, transpose, axis reductions, standardisation, diff, rounding |
| linalg | 10 | matmul, inverse, symmetric eigenvalues, Cholesky, solve, SVD, QR, matrix exponential, pseudo-inverse, determinant |
| statistics | 8 | mean/median/std, percentiles, z-scores, correlation, covariance, chi-square test, linear regression, rank data |
| signal | 6 | real FFT magnitude, FFT frequencies, convolution, DCT-II, linear detrend, peak finding |
| optimization | 4 | polyfit, lstsq, BFGS minimisation, Brent root finding |
Fields
| Field | Description |
|---|---|
task_id |
stable id, e.g. npsp-017 |
category |
one of the five above |
prompt |
the natural-language instruction shown to the model |
input_data |
JSON object mapping array name (a, m, s, g, sig, c) to a serialised array |
expected_output |
the serialised reference result |
Arrays serialise as {"data": <nested list>, "dtype": <numpy dtype>, "shape": [...]}.
How it was built, and why you can trust the answer key
Tasks are defined as (deterministic input arrays, instruction, reference solution). The expected output is computed by executing the reference solution, never written by hand, so the answer key cannot drift from the instruction.
Every task is then independently verified:
- the reference solution runs and returns a real-valued array
- it is deterministic (executed twice, compared exactly)
- the result is finite — no NaN or inf in the answer key
- the result is non-empty and not identical to its input (identity tasks carry no signal)
- both the result and every input array survive the serialisation round-trip exactly, dtype and shape included
All 40 tasks pass. Builder and verifier:
build_tasks.py.
A note on grading tolerance
Grading uses assert_allclose (rtol 1e-6, atol 1e-8) rather than exact equality. Answers here
come from eigensolvers, matrix exponentials, FFTs and optimisers, whose final bits legitimately
differ across BLAS builds, CPU architectures and library versions; bit-exact grading would fail
correct solutions for reasons unrelated to the model.
Shape is still compared exactly, and an integer-valued reference requires an integer answer, so the tolerance never launders a wrong-shaped or wrong-typed result.
- Downloads last month
- -