prompt stringlengths 859 2.51M | target_function_prompt stringlengths 8 20.9k | target stringlengths 28 531k | dependency_context stringlengths 49 2.51M | target_function_name stringlengths 1 105 | target_source stringlengths 5 159 | import_statements sequencelengths 0 224 | example stringlengths 0 300k |
|---|---|---|---|---|---|---|---|
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def create_quad_func(a,b,c):
'''return function f(x) = ax^2 + bx + c''' | def create_quad_func(a,b,c):
'''return function f(x) = ax^2 + bx + c'''
return lambda x: a*x**2 + b*x + c | {
"courses/python_scrimba/27Lambda/lambda.py": {
"import_statements": [],
"classes": [
{
"name": "Player",
"file_path": "courses/python_scrimba/27Lambda/lambda.py",
"description": "DOCSTRING",
"base_classes": [],
"methods": [
{
"name": "Playe... | create_quad_func | courses/python_scrimba/27Lambda/lambda.py | [] | |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def extract_feature(df, train, flag):
# # speed split
# date_nunique = df.groupby(['ship'])['speed_cat'].nunique().to_dict()
# train['speed_cat_nunique'] = train['ship'].map(date_nunique)
'''
统计feature
''' | def extract_feature(df, train, flag):
# # speed split
# date_nunique = df.groupby(['ship'])['speed_cat'].nunique().to_dict()
# train['speed_cat_nunique'] = train['ship'].map(date_nunique)
'''
统计feature
'''
if (flag == 'on_night') or (flag == 'on_day'):
t = group_feature(df, 'sh... | {
"feature_selector/feature_selector.py": {
"import_statements": [
"from itertools import chain",
"from sklearn.model_selection import train_test_split",
"import gc",
"import lightgbm",
"import matplotlib.pyplot",
"import numpy",
"import pandas",
"import seaborn"
... | extract_feature | model.py | [
"from feature_selector import FeatureSelector",
"from copy import deepcopy",
"from glob import glob",
"from scipy.sparse import csr_matrix",
"from sklearn import metrics",
"from sklearn.metrics import f1_score",
"from sklearn.metrics import precision_recall_fscore_support",
"from sklearn.model_selecti... | |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def quaternion_conjugate(quaternion):
"""Return conjugate of quaternion.
>>> q0 = random_quaternion()
>>> q1 = quaternion_conjugate(q0)
>>> q1[0] == q0[0] and all(q1[1:] == -q0[1:])
True
""" | def quaternion_conjugate(quaternion):
"""Return conjugate of quaternion.
>>> q0 = random_quaternion()
>>> q1 = quaternion_conjugate(q0)
>>> q1[0] == q0[0] and all(q1[1:] == -q0[1:])
True
"""
q = numpy.array(quaternion, dtype=numpy.float64, copy=True)
numpy.negative(q[1:], q[1:])
re... | {
"transformations.py": {
"import_statements": [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
]
}
} | quaternion_conjugate | transformations.py | [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
] | |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def translation_matrix(direction):
"""Return matrix to translate by direction vector.
>>> v = numpy.random.random(3) - 0.5
>>> numpy.allclose(v, translation_matrix(v)[:3, 3])
True
""" | def translation_matrix(direction):
"""Return matrix to translate by direction vector.
>>> v = numpy.random.random(3) - 0.5
>>> numpy.allclose(v, translation_matrix(v)[:3, 3])
True
"""
M = numpy.identity(4)
M[:3, 3] = direction[:3]
return M | {
"transformations.py": {
"import_statements": [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
],
"classes": [],
"variable": [
"_EPS = numpy.finfo(float).eps * 4.0"
],
"functions": []
}
} | translation_matrix | transformations.py | [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
] | |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def random_vector(size):
"""Return array of random doubles in the half-open interval [0.0, 1.0).
>>> v = random_vector(10000)
>>> numpy.all(v >= 0) and numpy.all(v < 1)
True
>>> v0 = random_vector(10)
>>> v1 = random_vector(10)
>>> numpy.any(v0 == v1)
False
""" | def random_vector(size):
"""Return array of random doubles in the half-open interval [0.0, 1.0).
>>> v = random_vector(10000)
>>> numpy.all(v >= 0) and numpy.all(v < 1)
True
>>> v0 = random_vector(10)
>>> v1 = random_vector(10)
>>> numpy.any(v0 == v1)
False
"""
return numpy.ran... | {
"transformations.py": {
"import_statements": [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
],
"classes": [],
"variable": [
"_EPS = numpy.finfo(float).eps * 4.0"
],
"functions": []
}
} | random_vector | transformations.py | [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
] | |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def unit_vector(data, axis=None, out=None):
"""Return ndarray normalized by length, i.e. Euclidean norm, along axis.
>>> v0 = numpy.random.random(3)
>>> v1 = unit_vector(v0)
>>> numpy.allclose(v1, v0 / numpy.linalg.norm(v0))
True
>>> v0 = numpy.random.rand(5, 4, 3)
>>> v1 = unit_vector(v0, ... | def unit_vector(data, axis=None, out=None):
"""Return ndarray normalized by length, i.e. Euclidean norm, along axis.
>>> v0 = numpy.random.random(3)
>>> v1 = unit_vector(v0)
>>> numpy.allclose(v1, v0 / numpy.linalg.norm(v0))
True
>>> v0 = numpy.random.rand(5, 4, 3)
>>> v1 = unit_vector(v0, ... | {
"transformations.py": {
"import_statements": [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
],
"classes": [
{
"name": "Arcball",
"file_path": "transformations.py",
"description": "Virtual T... | unit_vector | transformations.py | [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
] | def euler_from_quaternion(quaternion, axes='sxyz'):
"""Return Euler angles from quaternion for specified axis sequence.
>>> angles = euler_from_quaternion([0.99810947, 0.06146124, 0, 0])
>>> numpy.allclose(angles, [0.123, 0, 0])
True
"""
return euler_from_matrix(quaternion_matrix(quaternion), ... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def quaternion_imag(quaternion):
"""Return imaginary part of quaternion.
>>> quaternion_imag([3, 0, 1, 2])
array([ 0., 1., 2.])
""" | def quaternion_imag(quaternion):
"""Return imaginary part of quaternion.
>>> quaternion_imag([3, 0, 1, 2])
array([ 0., 1., 2.])
"""
return numpy.array(quaternion[1:4], dtype=numpy.float64, copy=True) | {
"transformations.py": {
"import_statements": [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
]
}
} | quaternion_imag | transformations.py | [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
] | |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def arcball_map_to_sphere(point, center, radius):
"""Return unit sphere coordinates from window coordinates.""" | def arcball_map_to_sphere(point, center, radius):
"""Return unit sphere coordinates from window coordinates."""
v0 = (point[0] - center[0]) / radius
v1 = (center[1] - point[1]) / radius
n = v0*v0 + v1*v1
if n > 1.0:
# position outside of sphere
n = math.sqrt(n)
return numpy.a... | {
"transformations.py": {
"import_statements": [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
],
"classes": [
{
"name": "Arcball",
"file_path": "transformations.py",
"description": "Virtual T... | arcball_map_to_sphere | transformations.py | [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
] | def arcball_nearest_axis(point, axes):
"""Return axis, which arc is nearest to point."""
point = numpy.array(point, dtype=numpy.float64, copy=False)
nearest = None
mx = -1.0
for axis in axes:
t = numpy.dot(arcball_constrain_to_axis(point, axis), point)
if t > mx:
nearest ... |
[BEGIN OF TASK INSTRUCTION]
You are a Python programmer currently working with a repository.
Your task is to generate the most suitable implementation of the target function using the provided context.
[END OF TASK INSTRUCTION]
[BEGIN OF AVAILABLE CONTEXT]
Below is all the available context (import statements and cod... | def is_same_transform(matrix0, matrix1):
"""Return True if two matrices perform same transformation.
>>> is_same_transform(numpy.identity(4), numpy.identity(4))
True
>>> is_same_transform(numpy.identity(4), random_rotation_matrix())
False
""" | def is_same_transform(matrix0, matrix1):
"""Return True if two matrices perform same transformation.
>>> is_same_transform(numpy.identity(4), numpy.identity(4))
True
>>> is_same_transform(numpy.identity(4), random_rotation_matrix())
False
"""
matrix0 = numpy.array(matrix0, dtype=numpy.floa... | {
"transformations.py": {
"import_statements": [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
],
"classes": [],
"variable": [],
"functions": [
{
"name": "rotation_matrix",
"file_path": "trans... | is_same_transform | transformations.py | [
"from __future__ import division",
"from __future__ import print_function",
"import math",
"import numpy"
] | def dataTransform(x1_b, Rs_b, ts_b, epoch, aug_cl = False):
angle = computeAngle(epoch)
x1 = x1_b
R = Rs_b
t = ts_b
x1_b = []
Rs_b = []
ts_b = []
step = epoch
for i in range(len(x1)):
x1_b1 = []
R_b1 = []
t_b1 = []
if not aug_cl:
ang... |
"\n[BEGIN OF TASK INSTRUCTION]\nYou are a Python programmer currently working with a repository. \nY(...TRUNCATED) | "def vector_norm(data, axis=None, out=None):\n \"\"\"Return length, i.e. Euclidean norm, of ndarr(...TRUNCATED) | "def vector_norm(data, axis=None, out=None):\n \"\"\"Return length, i.e. Euclidean norm, of ndarr(...TRUNCATED) | "{\n \"transformations.py\": {\n \"import_statements\": [\n \"from __future__ import divisi(...TRUNCATED) | vector_norm | transformations.py | ["from __future__ import division","from __future__ import print_function","import math","import num(...TRUNCATED) | "def euler_from_quaternion(quaternion, axes='sxyz'):\n \"\"\"Return Euler angles from quaternion (...TRUNCATED) |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 13