body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
5f57334014259a323cfd497ef0ff8c08575214f1b2739b8f649d5157760c815c | def reg_loglikelihood(self, x, indices=None):
'\n Log likelihood with Regularization term\n\n :param x:\n :param indices:\n :return:\n '
res = self.loglikelihood(x, indices)
res = (res - np.sum((x ** 2)))
return res | Log likelihood with Regularization term
:param x:
:param indices:
:return: | code/classes/MNLogit.py | reg_loglikelihood | glederrey/IEEE2018-SNM | 1 | python | def reg_loglikelihood(self, x, indices=None):
'\n Log likelihood with Regularization term\n\n :param x:\n :param indices:\n :return:\n '
res = self.loglikelihood(x, indices)
res = (res - np.sum((x ** 2)))
return res | def reg_loglikelihood(self, x, indices=None):
'\n Log likelihood with Regularization term\n\n :param x:\n :param indices:\n :return:\n '
res = self.loglikelihood(x, indices)
res = (res - np.sum((x ** 2)))
return res<|docstring|>Log likelihood with Regularization term
... |
20ce0b9b6d75d31e6a53df52cb039fa8c4d5ae62c849bed61dbbf9469de9f3bc | def num_grad(self, x, indices=None):
'\n Compute the gradient with finite differences\n\n :param x: parameters\n :param indices: indices\n :return:\n '
eps = 1e-06
f = (lambda param: self.loglikelihood(param, indices))
n = len(x)
grad = np.zeros(n)
dx = np.zero... | Compute the gradient with finite differences
:param x: parameters
:param indices: indices
:return: | code/classes/MNLogit.py | num_grad | glederrey/IEEE2018-SNM | 1 | python | def num_grad(self, x, indices=None):
'\n Compute the gradient with finite differences\n\n :param x: parameters\n :param indices: indices\n :return:\n '
eps = 1e-06
f = (lambda param: self.loglikelihood(param, indices))
n = len(x)
grad = np.zeros(n)
dx = np.zero... | def num_grad(self, x, indices=None):
'\n Compute the gradient with finite differences\n\n :param x: parameters\n :param indices: indices\n :return:\n '
eps = 1e-06
f = (lambda param: self.loglikelihood(param, indices))
n = len(x)
grad = np.zeros(n)
dx = np.zero... |
9c9458aadb707c131ae508ad09468c5a22c966789c84ece532c428869489e801 | def num_hessian(self, x, indices=None):
'\n Compute the hessian with finite differences\n\n :param x: parameters\n :param indices: indices\n :return:\n '
eps = 1e-06
grad = (lambda param: self.num_grad(param, indices))
n = len(x)
hess = np.zeros((n, n))
dx = np... | Compute the hessian with finite differences
:param x: parameters
:param indices: indices
:return: | code/classes/MNLogit.py | num_hessian | glederrey/IEEE2018-SNM | 1 | python | def num_hessian(self, x, indices=None):
'\n Compute the hessian with finite differences\n\n :param x: parameters\n :param indices: indices\n :return:\n '
eps = 1e-06
grad = (lambda param: self.num_grad(param, indices))
n = len(x)
hess = np.zeros((n, n))
dx = np... | def num_hessian(self, x, indices=None):
'\n Compute the hessian with finite differences\n\n :param x: parameters\n :param indices: indices\n :return:\n '
eps = 1e-06
grad = (lambda param: self.num_grad(param, indices))
n = len(x)
hess = np.zeros((n, n))
dx = np... |
5541c2feb2a2dcdae543d693cfd8deecd7c681894a6b3c3635a2679f3a325d6b | def construct_report(subject_path, report_path):
"Construct structural QC report\n\n\n Parameters\n ----------\n\n subject_path : str\n path to subject's fMRIPREP output\n report_path : str\n path to folder where QC results will be stored\n\n\n "
print(' running ind_structural_qc... | Construct structural QC report
Parameters
----------
subject_path : str
path to subject's fMRIPREP output
report_path : str
path to folder where QC results will be stored | discovery_imaging_utils/reports/qc/ind_structural_qc.py | construct_report | erikglee/discovery_imaging_utils | 0 | python | def construct_report(subject_path, report_path):
"Construct structural QC report\n\n\n Parameters\n ----------\n\n subject_path : str\n path to subject's fMRIPREP output\n report_path : str\n path to folder where QC results will be stored\n\n\n "
print(' running ind_structural_qc... | def construct_report(subject_path, report_path):
"Construct structural QC report\n\n\n Parameters\n ----------\n\n subject_path : str\n path to subject's fMRIPREP output\n report_path : str\n path to folder where QC results will be stored\n\n\n "
print(' running ind_structural_qc... |
cf03819e900e1e911aef34d33bb28aff5ef22231dcf739302887c659ebcab7a5 | def _lookup_theory_cl(self, block, A, B, i, j, ell):
'\n This is a helper function for the compute_gaussian_covariance code.\n It looks up the theory value of C^{ij}_{AB}(ell) in the \n '
(section, ell_name, value_name) = type_table[(A, B)]
assert (ell_name == 'ell'), 'Gaussian covarian... | This is a helper function for the compute_gaussian_covariance code.
It looks up the theory value of C^{ij}_{AB}(ell) in the | cosmosis-standard-library/likelihood/2pt/2pt_like.py | _lookup_theory_cl | ktanidis2/Modified_CosmoSIS_for_galaxy_number_count_angular_power_spectra | 1 | python | def _lookup_theory_cl(self, block, A, B, i, j, ell):
'\n This is a helper function for the compute_gaussian_covariance code.\n It looks up the theory value of C^{ij}_{AB}(ell) in the \n '
(section, ell_name, value_name) = type_table[(A, B)]
assert (ell_name == 'ell'), 'Gaussian covarian... | def _lookup_theory_cl(self, block, A, B, i, j, ell):
'\n This is a helper function for the compute_gaussian_covariance code.\n It looks up the theory value of C^{ij}_{AB}(ell) in the \n '
(section, ell_name, value_name) = type_table[(A, B)]
assert (ell_name == 'ell'), 'Gaussian covarian... |
50aae604e173e56f982c2970861d6816fd692c10649da267a68ed4e5f6265bcf | def home_assistant_esp(self, entity, attribute, old, new, kwargs):
'Process data from a home assistant rssi sensor'
id = kwargs['id']
roomname = kwargs['roomname']
rssi_1m = kwargs['rssi_1m']
update_time = self.get_now()
distance = (10 ** ((rssi_1m - float(new)) / 35))
self.data[roomname] = ... | Process data from a home assistant rssi sensor | config/appdaemon/apps/RoomDetection.py | home_assistant_esp | stevenmaclean94/Home-Assistant | 0 | python | def home_assistant_esp(self, entity, attribute, old, new, kwargs):
id = kwargs['id']
roomname = kwargs['roomname']
rssi_1m = kwargs['rssi_1m']
update_time = self.get_now()
distance = (10 ** ((rssi_1m - float(new)) / 35))
self.data[roomname] = {'id': id, 'time': update_time, 'distance': dist... | def home_assistant_esp(self, entity, attribute, old, new, kwargs):
id = kwargs['id']
roomname = kwargs['roomname']
rssi_1m = kwargs['rssi_1m']
update_time = self.get_now()
distance = (10 ** ((rssi_1m - float(new)) / 35))
self.data[roomname] = {'id': id, 'time': update_time, 'distance': dist... |
9943af7bd951feaf4b4856bcdbe2ca060f11ed91af8004a560a36c127ab43a4a | def initialize_kalman2(self, pos):
'Super basic model of just velocity -> position filter. \n The covariance were estimated offline with pykalman em method '
trans_matrix = np.array([[1, self.dt, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, self.dt, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, self.dt], [0, ... | Super basic model of just velocity -> position filter.
The covariance were estimated offline with pykalman em method | config/appdaemon/apps/RoomDetection.py | initialize_kalman2 | stevenmaclean94/Home-Assistant | 0 | python | def initialize_kalman2(self, pos):
'Super basic model of just velocity -> position filter. \n The covariance were estimated offline with pykalman em method '
trans_matrix = np.array([[1, self.dt, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, self.dt, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, self.dt], [0, ... | def initialize_kalman2(self, pos):
'Super basic model of just velocity -> position filter. \n The covariance were estimated offline with pykalman em method '
trans_matrix = np.array([[1, self.dt, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0], [0, 0, 1, self.dt, 0, 0], [0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, self.dt], [0, ... |
d8f651e4934b7a44b3ebba4fcf0e31d5e95fbf37c615105e2ff923253b3e2099 | def initialize_kalman(self, pos):
'Super basic model of just velocity -> position filter. \n The covariance were estimated offline with pykalman em method '
trans_matrix = np.array([[1, 0.5, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.5], [0, 0, 0, 1]])
trans_cov = np.array([[0.0164479505, 0.0147195483, 2.88949... | Super basic model of just velocity -> position filter.
The covariance were estimated offline with pykalman em method | config/appdaemon/apps/RoomDetection.py | initialize_kalman | stevenmaclean94/Home-Assistant | 0 | python | def initialize_kalman(self, pos):
'Super basic model of just velocity -> position filter. \n The covariance were estimated offline with pykalman em method '
trans_matrix = np.array([[1, 0.5, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.5], [0, 0, 0, 1]])
trans_cov = np.array([[0.0164479505, 0.0147195483, 2.88949... | def initialize_kalman(self, pos):
'Super basic model of just velocity -> position filter. \n The covariance were estimated offline with pykalman em method '
trans_matrix = np.array([[1, 0.5, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.5], [0, 0, 0, 1]])
trans_cov = np.array([[0.0164479505, 0.0147195483, 2.88949... |
307caea6269f5e9a9bfbfb5a5c040b8cbc6fe6e037c0a995876171229171fc33 | def initialize_kalman(self, pos):
'Super basic model of just velocity -> position filter. \n The covariance were estimated offline with pykalman em method '
trans_matrix = np.array([[1, 0.5, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.5], [0, 0, 0, 1]])
trans_cov = np.array([[0.0164479505, 0.0147195483, 2.88949... | Super basic model of just velocity -> position filter.
The covariance were estimated offline with pykalman em method | config/appdaemon/apps/RoomDetection.py | initialize_kalman | stevenmaclean94/Home-Assistant | 0 | python | def initialize_kalman(self, pos):
'Super basic model of just velocity -> position filter. \n The covariance were estimated offline with pykalman em method '
trans_matrix = np.array([[1, 0.5, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.5], [0, 0, 0, 1]])
trans_cov = np.array([[0.0164479505, 0.0147195483, 2.88949... | def initialize_kalman(self, pos):
'Super basic model of just velocity -> position filter. \n The covariance were estimated offline with pykalman em method '
trans_matrix = np.array([[1, 0.5, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0.5], [0, 0, 0, 1]])
trans_cov = np.array([[0.0164479505, 0.0147195483, 2.88949... |
e0e3706c261c4004b65b9e26afd8e4bd9905e8bae8e43f9bcf0d631c64da273f | def get_fragment_span_sequence(self, reference=None):
'Obtain the sequence between the start and end of the molecule\n Args:\n reference(pysam.FastaFile) : reference to use.\n If not specified `self.reference` is used\n Returns:\n sequence (str)\n '
if ... | Obtain the sequence between the start and end of the molecule
Args:
reference(pysam.FastaFile) : reference to use.
If not specified `self.reference` is used
Returns:
sequence (str) | singlecellmultiomics/molecule/nlaIII.py | get_fragment_span_sequence | J-PTRson/SingleCellMultiOmics | 17 | python | def get_fragment_span_sequence(self, reference=None):
'Obtain the sequence between the start and end of the molecule\n Args:\n reference(pysam.FastaFile) : reference to use.\n If not specified `self.reference` is used\n Returns:\n sequence (str)\n '
if ... | def get_fragment_span_sequence(self, reference=None):
'Obtain the sequence between the start and end of the molecule\n Args:\n reference(pysam.FastaFile) : reference to use.\n If not specified `self.reference` is used\n Returns:\n sequence (str)\n '
if ... |
f8a127a6818b6a7f2cf8d849a8f6a5e362a1e6bc39fd26bb27fa2063d905723d | def get_undigested_site_count(self, reference=None):
'\n Obtain the amount of undigested sites in the span of the molecule\n\n Args:\n reference(pysam.FastaFile) : reference handle\n\n Returns:\n undigested_site_count : int\n amount of undigested cut sites in th... | Obtain the amount of undigested sites in the span of the molecule
Args:
reference(pysam.FastaFile) : reference handle
Returns:
undigested_site_count : int
amount of undigested cut sites in the mapping span of the molecule
Raises:
ValueError : when the span of the molecule is not properly defined | singlecellmultiomics/molecule/nlaIII.py | get_undigested_site_count | J-PTRson/SingleCellMultiOmics | 17 | python | def get_undigested_site_count(self, reference=None):
'\n Obtain the amount of undigested sites in the span of the molecule\n\n Args:\n reference(pysam.FastaFile) : reference handle\n\n Returns:\n undigested_site_count : int\n amount of undigested cut sites in th... | def get_undigested_site_count(self, reference=None):
'\n Obtain the amount of undigested sites in the span of the molecule\n\n Args:\n reference(pysam.FastaFile) : reference handle\n\n Returns:\n undigested_site_count : int\n amount of undigested cut sites in th... |
bba9ca7f863512e3cf4a01b38843658cbb3b11e6dffa1855cfcb2195eedc3ba3 | def get_normal(vertices, triangles):
' calculate normal direction in each vertex\n Args:\n vertices: [nver, 3]\n triangles: [ntri, 3]\n Returns:\n normal: [nver, 3]\n '
pt0 = vertices[(triangles[(:, 0)], :)]
pt1 = vertices[(triangles[(:, 1)], :)]
pt2 = vertices[(triangles[(... | calculate normal direction in each vertex
Args:
vertices: [nver, 3]
triangles: [ntri, 3]
Returns:
normal: [nver, 3] | python-package/insightface/thirdparty/face3d/mesh/light.py | get_normal | nijinjose/insightface | 12,377 | python | def get_normal(vertices, triangles):
' calculate normal direction in each vertex\n Args:\n vertices: [nver, 3]\n triangles: [ntri, 3]\n Returns:\n normal: [nver, 3]\n '
pt0 = vertices[(triangles[(:, 0)], :)]
pt1 = vertices[(triangles[(:, 1)], :)]
pt2 = vertices[(triangles[(... | def get_normal(vertices, triangles):
' calculate normal direction in each vertex\n Args:\n vertices: [nver, 3]\n triangles: [ntri, 3]\n Returns:\n normal: [nver, 3]\n '
pt0 = vertices[(triangles[(:, 0)], :)]
pt1 = vertices[(triangles[(:, 1)], :)]
pt2 = vertices[(triangles[(... |
80682a92e9e2c2f328af2722aeef331e77810c679db959de27fdc1fd7834a614 | def add_light_sh(vertices, triangles, colors, sh_coeff):
" \n In 3d face, usually assume:\n 1. The surface of face is Lambertian(reflect only the low frequencies of lighting)\n 2. Lighting can be an arbitrary combination of point sources\n --> can be expressed in terms of spherical harmonics(omit the li... | In 3d face, usually assume:
1. The surface of face is Lambertian(reflect only the low frequencies of lighting)
2. Lighting can be an arbitrary combination of point sources
--> can be expressed in terms of spherical harmonics(omit the lighting coefficients)
I = albedo * (sh(n) x sh_coeff)
albedo: n x 1
sh_coeff: 9 x 1
... | python-package/insightface/thirdparty/face3d/mesh/light.py | add_light_sh | nijinjose/insightface | 12,377 | python | def add_light_sh(vertices, triangles, colors, sh_coeff):
" \n In 3d face, usually assume:\n 1. The surface of face is Lambertian(reflect only the low frequencies of lighting)\n 2. Lighting can be an arbitrary combination of point sources\n --> can be expressed in terms of spherical harmonics(omit the li... | def add_light_sh(vertices, triangles, colors, sh_coeff):
" \n In 3d face, usually assume:\n 1. The surface of face is Lambertian(reflect only the low frequencies of lighting)\n 2. Lighting can be an arbitrary combination of point sources\n --> can be expressed in terms of spherical harmonics(omit the li... |
b084a47d22a3b8aab43609ef38f786e3116282a7ffeda73987e40928e503af17 | def add_light(vertices, triangles, colors, light_positions=0, light_intensities=0):
' Gouraud shading. add point lights.\n In 3d face, usually assume:\n 1. The surface of face is Lambertian(reflect only the low frequencies of lighting)\n 2. Lighting can be an arbitrary combination of point sources\n 3. ... | Gouraud shading. add point lights.
In 3d face, usually assume:
1. The surface of face is Lambertian(reflect only the low frequencies of lighting)
2. Lighting can be an arbitrary combination of point sources
3. No specular (unless skin is oil, 23333)
Ref: https://cs184.eecs.berkeley.edu/lecture/pipeline
Args:
v... | python-package/insightface/thirdparty/face3d/mesh/light.py | add_light | nijinjose/insightface | 12,377 | python | def add_light(vertices, triangles, colors, light_positions=0, light_intensities=0):
' Gouraud shading. add point lights.\n In 3d face, usually assume:\n 1. The surface of face is Lambertian(reflect only the low frequencies of lighting)\n 2. Lighting can be an arbitrary combination of point sources\n 3. ... | def add_light(vertices, triangles, colors, light_positions=0, light_intensities=0):
' Gouraud shading. add point lights.\n In 3d face, usually assume:\n 1. The surface of face is Lambertian(reflect only the low frequencies of lighting)\n 2. Lighting can be an arbitrary combination of point sources\n 3. ... |
850cbb46411b98de1c9e43b033850164524bc283f4c563712eff61221af18a79 | def db_for_write(self, model, **hints):
'\n Attempts to write auth and contenttypes models go to auth_db.\n '
return None | Attempts to write auth and contenttypes models go to auth_db. | ledger/payments/models.py | db_for_write | thakurpriya1990/ledger | 5 | python | def db_for_write(self, model, **hints):
'\n \n '
return None | def db_for_write(self, model, **hints):
'\n \n '
return None<|docstring|>Attempts to write auth and contenttypes models go to auth_db.<|endoftext|> |
726c44d92c10df59ad2d7115b0a262e50ec80f1426e746370fb21b0e72b9e0ee | def add_params(self, params, module, prefix='', is_dcn_module=None):
"Add all parameters of module to the params list.\n\n The parameters of the given module will be added to the list of param\n groups, with specific rules defined by paramwise_cfg.\n\n Args:\n params (list[dict]): A ... | Add all parameters of module to the params list.
The parameters of the given module will be added to the list of param
groups, with specific rules defined by paramwise_cfg.
Args:
params (list[dict]): A list of param groups, it will be modified
in place.
module (nn.Module): The module to be added.
... | mmcv/runner/optimizer/default_constructor.py | add_params | bladesaber/mmcv_py35 | 1 | python | def add_params(self, params, module, prefix=, is_dcn_module=None):
"Add all parameters of module to the params list.\n\n The parameters of the given module will be added to the list of param\n groups, with specific rules defined by paramwise_cfg.\n\n Args:\n params (list[dict]): A li... | def add_params(self, params, module, prefix=, is_dcn_module=None):
"Add all parameters of module to the params list.\n\n The parameters of the given module will be added to the list of param\n groups, with specific rules defined by paramwise_cfg.\n\n Args:\n params (list[dict]): A li... |
6edfbd9ad4d990de1aee5cc16d8b078e5c59b259d22db1018c920101c1822747 | def create_user(self, email, password=None, **extra_fields):
'create and saves a new user'
if (not email):
raise ValueError('User must have an email address')
user = self.model(email=self.normalize_email(email), **extra_fields)
user.set_password(password)
user.save(using=self._db)
return... | create and saves a new user | app/core/models.py | create_user | mnaovi/recipe-app-api-django | 0 | python | def create_user(self, email, password=None, **extra_fields):
if (not email):
raise ValueError('User must have an email address')
user = self.model(email=self.normalize_email(email), **extra_fields)
user.set_password(password)
user.save(using=self._db)
return user | def create_user(self, email, password=None, **extra_fields):
if (not email):
raise ValueError('User must have an email address')
user = self.model(email=self.normalize_email(email), **extra_fields)
user.set_password(password)
user.save(using=self._db)
return user<|docstring|>create and ... |
2b754ab07840ccb5f4cfc4dacf83ee0cebd8cd12aa75af85b4ee19fa248adcb7 | def create_superuser(self, email, password):
'Test by creating super user'
user = self.create_user(email, password)
user.is_staff = True
user.is_superuser = True
user.save(using=self._db)
return user | Test by creating super user | app/core/models.py | create_superuser | mnaovi/recipe-app-api-django | 0 | python | def create_superuser(self, email, password):
user = self.create_user(email, password)
user.is_staff = True
user.is_superuser = True
user.save(using=self._db)
return user | def create_superuser(self, email, password):
user = self.create_user(email, password)
user.is_staff = True
user.is_superuser = True
user.save(using=self._db)
return user<|docstring|>Test by creating super user<|endoftext|> |
e8f6f3049f3edc80e6bd69ad74ba04fbe5e55eb276b162ecfce73c641aff3d0e | def test_covid_data_plot():
"\n experi_phase_one = CovidDataPlotExperiment(earliest_date='06/21/20',\n latest_date='08/22/20',\n beta_interval=(0.10, 0.12),\n gamma_interval=(0.078, 0.082),\n ... | experi_phase_one = CovidDataPlotExperiment(earliest_date='06/21/20',
latest_date='08/22/20',
beta_interval=(0.10, 0.12),
gamma_interval=(0.078, 0.082),
eta=0.0015)
experi_phase_one.execute... | examples/test_covid.py | test_covid_data_plot | Tarheel-Formal-Methods/kaa-optimize | 0 | python | def test_covid_data_plot():
"\n experi_phase_one = CovidDataPlotExperiment(earliest_date='06/21/20',\n latest_date='08/22/20',\n beta_interval=(0.10, 0.12),\n gamma_interval=(0.078, 0.082),\n ... | def test_covid_data_plot():
"\n experi_phase_one = CovidDataPlotExperiment(earliest_date='06/21/20',\n latest_date='08/22/20',\n beta_interval=(0.10, 0.12),\n gamma_interval=(0.078, 0.082),\n ... |
eb6a5abc12c223b0121965a9815d84732084ff03327a4c081aaea9be59405679 | def __init__(self):
'\n Constructor\n '
self.colors = ['#4B82B8', '#B8474D', '#95BB58', '#234B7C', '#8060A9', '#53A2CB', '#FC943B'] | Constructor | WARP/Dipole/dipole_xy_slice.py | __init__ | DanielWinklehner/uspas_ionsource_problems | 1 | python | def __init__(self):
'\n \n '
self.colors = ['#4B82B8', '#B8474D', '#95BB58', '#234B7C', '#8060A9', '#53A2CB', '#FC943B'] | def __init__(self):
'\n \n '
self.colors = ['#4B82B8', '#B8474D', '#95BB58', '#234B7C', '#8060A9', '#53A2CB', '#FC943B']<|docstring|>Constructor<|endoftext|> |
90ea6b896336c76627b73b23e918028a0841c3882ce440d8eba311bd550832de | def add_arguments(self, parser):
'\n Adds the positional argument for ASINs\n\n :param parser: the argument parser\n '
parser.add_argument('asins', nargs='+', type=str) | Adds the positional argument for ASINs
:param parser: the argument parser | price_monitor/management/commands/price_monitor_batch_create_products.py | add_arguments | gomberg5264/pricemointor3 | 150 | python | def add_arguments(self, parser):
'\n Adds the positional argument for ASINs\n\n :param parser: the argument parser\n '
parser.add_argument('asins', nargs='+', type=str) | def add_arguments(self, parser):
'\n Adds the positional argument for ASINs\n\n :param parser: the argument parser\n '
parser.add_argument('asins', nargs='+', type=str)<|docstring|>Adds the positional argument for ASINs
:param parser: the argument parser<|endoftext|> |
e179e9e17766e61e688927acb9874ebf9b49faf23d1eb8e72eb1535cb7739b23 | def handle(self, *args, **options):
'Batch create products from given ASIN list.'
product_asins = [p.asin for p in Product.objects.filter(asin__in=options['asins'])]
asins = [a for a in options['asins'] if (a not in product_asins)]
for asin in asins:
Product.objects.create(asin=asin)
print('... | Batch create products from given ASIN list. | price_monitor/management/commands/price_monitor_batch_create_products.py | handle | gomberg5264/pricemointor3 | 150 | python | def handle(self, *args, **options):
product_asins = [p.asin for p in Product.objects.filter(asin__in=options['asins'])]
asins = [a for a in options['asins'] if (a not in product_asins)]
for asin in asins:
Product.objects.create(asin=asin)
print('created {0:d} products'.format(len(asins))) | def handle(self, *args, **options):
product_asins = [p.asin for p in Product.objects.filter(asin__in=options['asins'])]
asins = [a for a in options['asins'] if (a not in product_asins)]
for asin in asins:
Product.objects.create(asin=asin)
print('created {0:d} products'.format(len(asins)))<|... |
701fb600d6039d8e6dbda9aa63916f8d7809a7a05b0c72d8bf6472755f0b816b | def __init__(self, in_channels, num_classes):
'\n Args:\n in_channels: The input channel for this model\n num_classes: The number of classes\n '
super(VGGNet19, self).__init__()
self.conv1 = nn.Sequential(ConvBlock(in_channels, 64, kernel_size=3, stride=1, pad... | Args:
in_channels: The input channel for this model
num_classes: The number of classes | src/models/VGG19.py | __init__ | AdrienVerdier/ProjetIFT780 | 0 | python | def __init__(self, in_channels, num_classes):
'\n Args:\n in_channels: The input channel for this model\n num_classes: The number of classes\n '
super(VGGNet19, self).__init__()
self.conv1 = nn.Sequential(ConvBlock(in_channels, 64, kernel_size=3, stride=1, pad... | def __init__(self, in_channels, num_classes):
'\n Args:\n in_channels: The input channel for this model\n num_classes: The number of classes\n '
super(VGGNet19, self).__init__()
self.conv1 = nn.Sequential(ConvBlock(in_channels, 64, kernel_size=3, stride=1, pad... |
b0418a195ac9c6a58f0440c13e6b81d430ef85697546f4bfa7c9b503c83f7250 | def forward(self, x):
'\n This method implement the forward propagation of our model\n Args :\n x: The input of the model\n\n Returns :\n out: The output of the model\n '
out = self.conv1(x)
out = self.maxPool(out)
out = self.conv2(ou... | This method implement the forward propagation of our model
Args :
x: The input of the model
Returns :
out: The output of the model | src/models/VGG19.py | forward | AdrienVerdier/ProjetIFT780 | 0 | python | def forward(self, x):
'\n This method implement the forward propagation of our model\n Args :\n x: The input of the model\n\n Returns :\n out: The output of the model\n '
out = self.conv1(x)
out = self.maxPool(out)
out = self.conv2(ou... | def forward(self, x):
'\n This method implement the forward propagation of our model\n Args :\n x: The input of the model\n\n Returns :\n out: The output of the model\n '
out = self.conv1(x)
out = self.maxPool(out)
out = self.conv2(ou... |
62784fbaf1e56c10c955dd3faa1330bae20693c79b7f4f102caf9ed15890ed19 | def test_ValueAccess(self):
'[ GenApiTest@EnumerationTestSuite_TestValueAccess.xml|gxml\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumValue1">\n <Value>10</Value>\n </EnumEntry>\n <EnumEntry Name="EnumValue2">\n ... | [ GenApiTest@EnumerationTestSuite_TestValueAccess.xml|gxml
<Enumeration Name="Enum">
<EnumEntry Name="EnumValue1">
<Value>10</Value>
</EnumEntry>
<EnumEntry Name="EnumValue2">
<Value>20</Value>
</EnumEntry>
<pValue>Value</pValue>
</Enumeration>
<Integer Name="Value">
<... | tests/genicam_tests/enumerationtest.py | test_ValueAccess | fjp/pypylon | 358 | python | def test_ValueAccess(self):
'[ GenApiTest@EnumerationTestSuite_TestValueAccess.xml|gxml\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumValue1">\n <Value>10</Value>\n </EnumEntry>\n <EnumEntry Name="EnumValue2">\n ... | def test_ValueAccess(self):
'[ GenApiTest@EnumerationTestSuite_TestValueAccess.xml|gxml\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumValue1">\n <Value>10</Value>\n </EnumEntry>\n <EnumEntry Name="EnumValue2">\n ... |
59ab3c06e534c907de276d558b096ce2fbd183ff1f2aff993030236e58d81b05 | def test_EnumEntry(self):
'[ GenApiTest@EnumerationTestSuite_TestEnumEntry.xml|gxml\n \n <Enumeration Name="Value">\n <EnumEntry Name="MyEnumEntry0">\n <Value>0</Value>\n </EnumEntry>\n <EnumEntry Name="MyEnumEntry1">\n ... | [ GenApiTest@EnumerationTestSuite_TestEnumEntry.xml|gxml
<Enumeration Name="Value">
<EnumEntry Name="MyEnumEntry0">
<Value>0</Value>
</EnumEntry>
<EnumEntry Name="MyEnumEntry1">
<Value>1</Value>
</EnumEntry>
<EnumEntry Name="MyEnumEntry2">
<Value>2</Value>
</EnumEntry>
... | tests/genicam_tests/enumerationtest.py | test_EnumEntry | fjp/pypylon | 358 | python | def test_EnumEntry(self):
'[ GenApiTest@EnumerationTestSuite_TestEnumEntry.xml|gxml\n \n <Enumeration Name="Value">\n <EnumEntry Name="MyEnumEntry0">\n <Value>0</Value>\n </EnumEntry>\n <EnumEntry Name="MyEnumEntry1">\n ... | def test_EnumEntry(self):
'[ GenApiTest@EnumerationTestSuite_TestEnumEntry.xml|gxml\n \n <Enumeration Name="Value">\n <EnumEntry Name="MyEnumEntry0">\n <Value>0</Value>\n </EnumEntry>\n <EnumEntry Name="MyEnumEntry1">\n ... |
3f3f59f3df4b63e098c72ca5ad5805c5dcb52ada4d42032ed56cf0ab45dec4c7 | def test_EnumFalseEntry(self):
'[ GenApiTest@EnumerationTestSuite_TestEnumFalseEntry.xml|gxml\n <Enumeration Name="NoValue">\n <EnumEntry Name="MyEnumEntry1">\n <Value>3</Value>\n </EnumEntry>\n <pValue>Value2</pValue>\n </Enumeration... | [ GenApiTest@EnumerationTestSuite_TestEnumFalseEntry.xml|gxml
<Enumeration Name="NoValue">
<EnumEntry Name="MyEnumEntry1">
<Value>3</Value>
</EnumEntry>
<pValue>Value2</pValue>
</Enumeration>
<Integer Name="Value2">
<Value>10</Value>
</Integer> | tests/genicam_tests/enumerationtest.py | test_EnumFalseEntry | fjp/pypylon | 358 | python | def test_EnumFalseEntry(self):
'[ GenApiTest@EnumerationTestSuite_TestEnumFalseEntry.xml|gxml\n <Enumeration Name="NoValue">\n <EnumEntry Name="MyEnumEntry1">\n <Value>3</Value>\n </EnumEntry>\n <pValue>Value2</pValue>\n </Enumeration... | def test_EnumFalseEntry(self):
'[ GenApiTest@EnumerationTestSuite_TestEnumFalseEntry.xml|gxml\n <Enumeration Name="NoValue">\n <EnumEntry Name="MyEnumEntry1">\n <Value>3</Value>\n </EnumEntry>\n <pValue>Value2</pValue>\n </Enumeration... |
7e6341762ea9d911d8592b5e6f8cbc2c4f9efd0dbf1614a52df067f31230b3f2 | def test_EnumRef(self):
'[ GenApiTest@EnumerationTestSuite_TestEnumRef.xml|gxml\n <Enumeration Name="PixelFormat">\n <EnumEntry Name="Mono8">\n <Value>0</Value>\n </EnumEntry>\n <EnumEntry Name="Mono16">\n <Value>1</Value>\n ... | [ GenApiTest@EnumerationTestSuite_TestEnumRef.xml|gxml
<Enumeration Name="PixelFormat">
<EnumEntry Name="Mono8">
<Value>0</Value>
</EnumEntry>
<EnumEntry Name="Mono16">
<Value>1</Value>
</EnumEntry>
<EnumEntry Name="RGB24">
<Value>2</Value>
</EnumEntry>
<pValue>Value</pValue>
</Enumeration>... | tests/genicam_tests/enumerationtest.py | test_EnumRef | fjp/pypylon | 358 | python | def test_EnumRef(self):
'[ GenApiTest@EnumerationTestSuite_TestEnumRef.xml|gxml\n <Enumeration Name="PixelFormat">\n <EnumEntry Name="Mono8">\n <Value>0</Value>\n </EnumEntry>\n <EnumEntry Name="Mono16">\n <Value>1</Value>\n ... | def test_EnumRef(self):
'[ GenApiTest@EnumerationTestSuite_TestEnumRef.xml|gxml\n <Enumeration Name="PixelFormat">\n <EnumEntry Name="Mono8">\n <Value>0</Value>\n </EnumEntry>\n <EnumEntry Name="Mono16">\n <Value>1</Value>\n ... |
e7dff546f2a2c671a6595515fd69a90df066d5bff1d08e4f058c1e0ec9008c76 | def test_DisplayName(self):
'[ GenApiTest@EnumerationTestSuite_TestDisplayName.xml|gxml\n <Enumeration Name="Enumeration">\n <EnumEntry Name="EnumEntry0">\n <Value>0</Value>\n </EnumEntry>\n <EnumEntry Name="EnumEntry1">\n ... | [ GenApiTest@EnumerationTestSuite_TestDisplayName.xml|gxml
<Enumeration Name="Enumeration">
<EnumEntry Name="EnumEntry0">
<Value>0</Value>
</EnumEntry>
<EnumEntry Name="EnumEntry1">
<Value>1</Value>
<Symbolic>Symbolic1</Symbolic>
</EnumEntry>
<EnumEntry Name="EnumEntry2">
... | tests/genicam_tests/enumerationtest.py | test_DisplayName | fjp/pypylon | 358 | python | def test_DisplayName(self):
'[ GenApiTest@EnumerationTestSuite_TestDisplayName.xml|gxml\n <Enumeration Name="Enumeration">\n <EnumEntry Name="EnumEntry0">\n <Value>0</Value>\n </EnumEntry>\n <EnumEntry Name="EnumEntry1">\n ... | def test_DisplayName(self):
'[ GenApiTest@EnumerationTestSuite_TestDisplayName.xml|gxml\n <Enumeration Name="Enumeration">\n <EnumEntry Name="EnumEntry0">\n <Value>0</Value>\n </EnumEntry>\n <EnumEntry Name="EnumEntry1">\n ... |
2287fe1758d58723b2994af61dc1659d75a9336a7dd80c24acabde8a8709c31d | def test_NumericValue(self):
'[ GenApiTest@EnumerationTestSuite_TestNumericValue.xml|gxml\n \n <Integer Name="IntFromEnum">\n <pValue>Enum</pValue>\n </Integer>\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumValue1">\n <V... | [ GenApiTest@EnumerationTestSuite_TestNumericValue.xml|gxml
<Integer Name="IntFromEnum">
<pValue>Enum</pValue>
</Integer>
<Enumeration Name="Enum">
<EnumEntry Name="EnumValue1">
<Value>10</Value>
<NumericValue>1.5</NumericValue>
</EnumEntry>
<EnumEntry Name="EnumValue2">
<Value>... | tests/genicam_tests/enumerationtest.py | test_NumericValue | fjp/pypylon | 358 | python | def test_NumericValue(self):
'[ GenApiTest@EnumerationTestSuite_TestNumericValue.xml|gxml\n \n <Integer Name="IntFromEnum">\n <pValue>Enum</pValue>\n </Integer>\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumValue1">\n <V... | def test_NumericValue(self):
'[ GenApiTest@EnumerationTestSuite_TestNumericValue.xml|gxml\n \n <Integer Name="IntFromEnum">\n <pValue>Enum</pValue>\n </Integer>\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumValue1">\n <V... |
6657fc19587a0f623b88213fa98575f0c4d31bbf8ec6a5f40210845d9d6a0dd4 | def test_AutoGain(self):
'============ type definitions for the register space defined below ========== '
class EGainAuto():
Off = 1
Once = 2
Continuous = 3
'============ Setup the register space ========== '
regs = [('Gain', 'uint32_t', 0, RW, LittleEndian), ('GainAutoReg', 'ui... | ============ type definitions for the register space defined below ========== | tests/genicam_tests/enumerationtest.py | test_AutoGain | fjp/pypylon | 358 | python | def test_AutoGain(self):
' '
class EGainAuto():
Off = 1
Once = 2
Continuous = 3
'============ Setup the register space ========== '
regs = [('Gain', 'uint32_t', 0, RW, LittleEndian), ('GainAutoReg', 'uint8_t', 0, RW, LittleEndian)]
GainAutoFeaturePort = CStructTestPort(regs)... | def test_AutoGain(self):
' '
class EGainAuto():
Off = 1
Once = 2
Continuous = 3
'============ Setup the register space ========== '
regs = [('Gain', 'uint32_t', 0, RW, LittleEndian), ('GainAutoReg', 'uint8_t', 0, RW, LittleEndian)]
GainAutoFeaturePort = CStructTestPort(regs)... |
f087b131972443f0c591bbd70d8404c6dc0acb740e90ef85c6e29f36e7d80267 | def test_GetEntry(self):
'[ GenApiTest@EnumerationTestSuite_TestGetEntry.xml|gxml\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumValue1">\n <Value>10</Value>\n </EnumEntry>\n <EnumEntry Name="EnumValue2">\n ... | [ GenApiTest@EnumerationTestSuite_TestGetEntry.xml|gxml
<Enumeration Name="Enum">
<EnumEntry Name="EnumValue1">
<Value>10</Value>
</EnumEntry>
<EnumEntry Name="EnumValue2">
<Value>20</Value>
</EnumEntry>
<pValue>Value</pValue>
</Enumeration>
<Integer Name="Value">
<Value>10</Valu... | tests/genicam_tests/enumerationtest.py | test_GetEntry | fjp/pypylon | 358 | python | def test_GetEntry(self):
'[ GenApiTest@EnumerationTestSuite_TestGetEntry.xml|gxml\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumValue1">\n <Value>10</Value>\n </EnumEntry>\n <EnumEntry Name="EnumValue2">\n ... | def test_GetEntry(self):
'[ GenApiTest@EnumerationTestSuite_TestGetEntry.xml|gxml\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumValue1">\n <Value>10</Value>\n </EnumEntry>\n <EnumEntry Name="EnumValue2">\n ... |
236046581682edb031301bad29b0d7146dcb980c2e7bba4e0ded54cde955155e | def test_AccessMode(self):
'[ GenApiTest@EnumerationTestSuite_TestAccessMode.xml|gxml\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumEntry1">\n <pIsImplemented>Toggle_I</pIsImplemented>\n <pIsAvailable>Toggle_A</pIsAvailable>\n ... | [ GenApiTest@EnumerationTestSuite_TestAccessMode.xml|gxml
<Enumeration Name="Enum">
<EnumEntry Name="EnumEntry1">
<pIsImplemented>Toggle_I</pIsImplemented>
<pIsAvailable>Toggle_A</pIsAvailable>
<Value>10</Value>
</EnumEntry>
<EnumEntry Name="EnumEntry2">
<pIsImplemented>Togg... | tests/genicam_tests/enumerationtest.py | test_AccessMode | fjp/pypylon | 358 | python | def test_AccessMode(self):
'[ GenApiTest@EnumerationTestSuite_TestAccessMode.xml|gxml\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumEntry1">\n <pIsImplemented>Toggle_I</pIsImplemented>\n <pIsAvailable>Toggle_A</pIsAvailable>\n ... | def test_AccessMode(self):
'[ GenApiTest@EnumerationTestSuite_TestAccessMode.xml|gxml\n \n <Enumeration Name="Enum">\n <EnumEntry Name="EnumEntry1">\n <pIsImplemented>Toggle_I</pIsImplemented>\n <pIsAvailable>Toggle_A</pIsAvailable>\n ... |
beb2d864255f2b8b5ed2e9c9df5b5a1267ce9c6f6777ecf9c3e40a0aba71bcf9 | def test_Ticket778(self):
'[ GenApiTest@EnumerationTestSuite_TestTicket778.xml|gxml\n \n <Enumeration Name="EnumA">\n <EnumEntry Name="EnumValue1">\n <pIsAvailable>AvailableA</pIsAvailable>\n <Value>10</Value>\n </EnumEntry>\n ... | [ GenApiTest@EnumerationTestSuite_TestTicket778.xml|gxml
<Enumeration Name="EnumA">
<EnumEntry Name="EnumValue1">
<pIsAvailable>AvailableA</pIsAvailable>
<Value>10</Value>
</EnumEntry>
<EnumEntry Name="EnumValue2">
<Value>20</Value>
</EnumEntry>
<Value>10</Value>
</Enumerati... | tests/genicam_tests/enumerationtest.py | test_Ticket778 | fjp/pypylon | 358 | python | def test_Ticket778(self):
'[ GenApiTest@EnumerationTestSuite_TestTicket778.xml|gxml\n \n <Enumeration Name="EnumA">\n <EnumEntry Name="EnumValue1">\n <pIsAvailable>AvailableA</pIsAvailable>\n <Value>10</Value>\n </EnumEntry>\n ... | def test_Ticket778(self):
'[ GenApiTest@EnumerationTestSuite_TestTicket778.xml|gxml\n \n <Enumeration Name="EnumA">\n <EnumEntry Name="EnumValue1">\n <pIsAvailable>AvailableA</pIsAvailable>\n <Value>10</Value>\n </EnumEntry>\n ... |
4509405621dd1769c3e7e4cb5fbd9230be4cd12f5a7b26450f943264fd1ef182 | def read_file(fpath):
'Reads a file within package directories.'
with io.open(os.path.join(PATH_BASE, fpath)) as f:
return f.read() | Reads a file within package directories. | setup.py | read_file | idlesign/django-siteblocks | 13 | python | def read_file(fpath):
with io.open(os.path.join(PATH_BASE, fpath)) as f:
return f.read() | def read_file(fpath):
with io.open(os.path.join(PATH_BASE, fpath)) as f:
return f.read()<|docstring|>Reads a file within package directories.<|endoftext|> |
11bc02e440ff932ebcdb8261debd3984b23a99412dc18f84609912f2fd44bf5b | def get_version():
'Returns version number, without module import (which can lead to ImportError\n if some dependencies are unavailable before install.'
contents = read_file(os.path.join('siteblocks', '__init__.py'))
version = re.search('VERSION = \\(([^)]+)\\)', contents)
version = version.group(1).... | Returns version number, without module import (which can lead to ImportError
if some dependencies are unavailable before install. | setup.py | get_version | idlesign/django-siteblocks | 13 | python | def get_version():
'Returns version number, without module import (which can lead to ImportError\n if some dependencies are unavailable before install.'
contents = read_file(os.path.join('siteblocks', '__init__.py'))
version = re.search('VERSION = \\(([^)]+)\\)', contents)
version = version.group(1).... | def get_version():
'Returns version number, without module import (which can lead to ImportError\n if some dependencies are unavailable before install.'
contents = read_file(os.path.join('siteblocks', '__init__.py'))
version = re.search('VERSION = \\(([^)]+)\\)', contents)
version = version.group(1).... |
776459e973fbf42482bb1a754e7ae7fbcd4bc72f5192766fcf67d4f9c4291b3e | def quit() -> None:
'Устанавливает флаг окончания работы для событийно-ориентированной программы.\n Как только будет завершён текущий обработчик события, исполнение скрипта закончится.\n '
raise NotImplementedError | Устанавливает флаг окончания работы для событийно-ориентированной программы.
Как только будет завершён текущий обработчик события, исполнение скрипта закончится. | trik/script.py | quit | m1raynee/trikset.py-typehint | 1 | python | def quit() -> None:
'Устанавливает флаг окончания работы для событийно-ориентированной программы.\n Как только будет завершён текущий обработчик события, исполнение скрипта закончится.\n '
raise NotImplementedError | def quit() -> None:
'Устанавливает флаг окончания работы для событийно-ориентированной программы.\n Как только будет завершён текущий обработчик события, исполнение скрипта закончится.\n '
raise NotImplementedError<|docstring|>Устанавливает флаг окончания работы для событийно-ориентированной программы.
Ка... |
0bfd165b14b9a3df783edc9e40c552f711a0289f22476a2108b6902268d362ac | def random(min: int, max: int) -> int:
'Возвращает случайное число из заданного диапазона.\n\n Параметры\n ---------\n min: :class:`int`\n Минимальное значение\n max: :class:`int`\n Максимальное значение\n '
raise NotImplementedError | Возвращает случайное число из заданного диапазона.
Параметры
---------
min: :class:`int`
Минимальное значение
max: :class:`int`
Максимальное значение | trik/script.py | random | m1raynee/trikset.py-typehint | 1 | python | def random(min: int, max: int) -> int:
'Возвращает случайное число из заданного диапазона.\n\n Параметры\n ---------\n min: :class:`int`\n Минимальное значение\n max: :class:`int`\n Максимальное значение\n '
raise NotImplementedError | def random(min: int, max: int) -> int:
'Возвращает случайное число из заданного диапазона.\n\n Параметры\n ---------\n min: :class:`int`\n Минимальное значение\n max: :class:`int`\n Максимальное значение\n '
raise NotImplementedError<|docstring|>Возвращает случайное число из заданно... |
f8427096ab07b85cd06c50b5b5126896d3a5f3ee4a93b789dadb220928709356 | def readAll(fileName: str) -> List[str]:
'Считывает всё содержимое указанного файла в массив строк.\n\n Параметры\n ---------\n fileName: :class:`str`\n Название файла с расширением\n '
raise NotImplementedError | Считывает всё содержимое указанного файла в массив строк.
Параметры
---------
fileName: :class:`str`
Название файла с расширением | trik/script.py | readAll | m1raynee/trikset.py-typehint | 1 | python | def readAll(fileName: str) -> List[str]:
'Считывает всё содержимое указанного файла в массив строк.\n\n Параметры\n ---------\n fileName: :class:`str`\n Название файла с расширением\n '
raise NotImplementedError | def readAll(fileName: str) -> List[str]:
'Считывает всё содержимое указанного файла в массив строк.\n\n Параметры\n ---------\n fileName: :class:`str`\n Название файла с расширением\n '
raise NotImplementedError<|docstring|>Считывает всё содержимое указанного файла в массив строк.
Параметры
... |
daffbd83a9fb4c8c3d18a7d68d8335ccf7291bd42f47cbfdb0d953ca5e7fad3b | def removeFile(fileName: str) -> None:
'Удаляет указанный файл.\n\n Параметры\n ---------\n fileName: :class:`str`\n Название файла с расширением\n '
raise NotImplementedError | Удаляет указанный файл.
Параметры
---------
fileName: :class:`str`
Название файла с расширением | trik/script.py | removeFile | m1raynee/trikset.py-typehint | 1 | python | def removeFile(fileName: str) -> None:
'Удаляет указанный файл.\n\n Параметры\n ---------\n fileName: :class:`str`\n Название файла с расширением\n '
raise NotImplementedError | def removeFile(fileName: str) -> None:
'Удаляет указанный файл.\n\n Параметры\n ---------\n fileName: :class:`str`\n Название файла с расширением\n '
raise NotImplementedError<|docstring|>Удаляет указанный файл.
Параметры
---------
fileName: :class:`str`
Название файла с расширением<|end... |
62cd0d04b53ce487e2d1d3fa3d8ff46b6366a6bb7615c0467b513bdadb83b349 | def system(command: str) -> None:
'Выполняет переданную команду.\n\n Параметры\n ---------\n command: :class:`str`\n Команда консоли операционной системы' | Выполняет переданную команду.
Параметры
---------
command: :class:`str`
Команда консоли операционной системы | trik/script.py | system | m1raynee/trikset.py-typehint | 1 | python | def system(command: str) -> None:
'Выполняет переданную команду.\n\n Параметры\n ---------\n command: :class:`str`\n Команда консоли операционной системы' | def system(command: str) -> None:
'Выполняет переданную команду.\n\n Параметры\n ---------\n command: :class:`str`\n Команда консоли операционной системы'<|docstring|>Выполняет переданную команду.
Параметры
---------
command: :class:`str`
Команда консоли операционной системы<|endoftext|> |
70bd789565a55575b0ee5d8b04807da3c150dada9c163fd1a8287759639ace46 | def time() -> int:
'Возвращает временной штамп — количество миллисекунд,\n прошедших с начала 1 января 1970 года по Гринвичу.\n '
raise NotImplementedError | Возвращает временной штамп — количество миллисекунд,
прошедших с начала 1 января 1970 года по Гринвичу. | trik/script.py | time | m1raynee/trikset.py-typehint | 1 | python | def time() -> int:
'Возвращает временной штамп — количество миллисекунд,\n прошедших с начала 1 января 1970 года по Гринвичу.\n '
raise NotImplementedError | def time() -> int:
'Возвращает временной штамп — количество миллисекунд,\n прошедших с начала 1 января 1970 года по Гринвичу.\n '
raise NotImplementedError<|docstring|>Возвращает временной штамп — количество миллисекунд,
прошедших с начала 1 января 1970 года по Гринвичу.<|endoftext|> |
120ced1c39db2bb7b66c57f6bb8f749c3773e37147d1bde572a42a4bbee993ba | def timer(n: int) -> _qtimer:
'Создаёт и возвращает таймер (класс `«QTimer»`), посылающий сигнал `timeout` каждые `n` миллисекунд.\n\n Параметры\n ---------\n n: :class:`int`\n Время в миллисекундах\n '
raise NotImplementedError | Создаёт и возвращает таймер (класс `«QTimer»`), посылающий сигнал `timeout` каждые `n` миллисекунд.
Параметры
---------
n: :class:`int`
Время в миллисекундах | trik/script.py | timer | m1raynee/trikset.py-typehint | 1 | python | def timer(n: int) -> _qtimer:
'Создаёт и возвращает таймер (класс `«QTimer»`), посылающий сигнал `timeout` каждые `n` миллисекунд.\n\n Параметры\n ---------\n n: :class:`int`\n Время в миллисекундах\n '
raise NotImplementedError | def timer(n: int) -> _qtimer:
'Создаёт и возвращает таймер (класс `«QTimer»`), посылающий сигнал `timeout` каждые `n` миллисекунд.\n\n Параметры\n ---------\n n: :class:`int`\n Время в миллисекундах\n '
raise NotImplementedError<|docstring|>Создаёт и возвращает таймер (класс `«QTimer»`), посы... |
57233149b75a79dbf3e1ba531a94ce2a0b1bb1bce7380cd049a60f32d21eecb0 | def wait(msCount: int):
'Приостанавливает выполнение скрипта на переданное количество миллисекунд.\n\n Параметры\n ---------\n msCount: :class:`int`\n Время в миллисекундах\n '
raise NotImplementedError | Приостанавливает выполнение скрипта на переданное количество миллисекунд.
Параметры
---------
msCount: :class:`int`
Время в миллисекундах | trik/script.py | wait | m1raynee/trikset.py-typehint | 1 | python | def wait(msCount: int):
'Приостанавливает выполнение скрипта на переданное количество миллисекунд.\n\n Параметры\n ---------\n msCount: :class:`int`\n Время в миллисекундах\n '
raise NotImplementedError | def wait(msCount: int):
'Приостанавливает выполнение скрипта на переданное количество миллисекунд.\n\n Параметры\n ---------\n msCount: :class:`int`\n Время в миллисекундах\n '
raise NotImplementedError<|docstring|>Приостанавливает выполнение скрипта на переданное количество миллисекунд.
Пар... |
e359fbcb2553d39a85ab921614077d6925153e27753e75c070c38ee5b6d4d371 | def writeToFile(fileName: str, text: str) -> None:
'Записывает сроку в файл.\n\n Параметры\n ---------\n fileName: :class:`str`\n Название файла с расширением\n text: :class:`str`\n Записываемая строка\n '
raise NotImplementedError | Записывает сроку в файл.
Параметры
---------
fileName: :class:`str`
Название файла с расширением
text: :class:`str`
Записываемая строка | trik/script.py | writeToFile | m1raynee/trikset.py-typehint | 1 | python | def writeToFile(fileName: str, text: str) -> None:
'Записывает сроку в файл.\n\n Параметры\n ---------\n fileName: :class:`str`\n Название файла с расширением\n text: :class:`str`\n Записываемая строка\n '
raise NotImplementedError | def writeToFile(fileName: str, text: str) -> None:
'Записывает сроку в файл.\n\n Параметры\n ---------\n fileName: :class:`str`\n Название файла с расширением\n text: :class:`str`\n Записываемая строка\n '
raise NotImplementedError<|docstring|>Записывает сроку в файл.
Параметры
---... |
e6fc1dbedf4f8fc87c18ebb6ffc41c78385868f1ce64f95b9cba00de690de831 | def forward_logistic(X, W, b):
'\n For the RBM-std or partial RBC-std models\n\n x -[weights W]- z (bias b)\n\n this method computes\n\n E[z_k | x_d] = p(z_k=1 | x_d) = logistic( x_d^T W_:k + b_k )\n\n Inputs:\n - X (array): An N x F matrix of input row vectors.\n - W (array): T... | For the RBM-std or partial RBC-std models
x -[weights W]- z (bias b)
this method computes
E[z_k | x_d] = p(z_k=1 | x_d) = logistic( x_d^T W_:k + b_k )
Inputs:
- X (array): An N x F matrix of input row vectors.
- W (array): The F x H matrix of input/hidden weights.
- b (array): The size-H vector ... | RBMModels/python/bernoulli_lib.py | forward_logistic | gaj67/gaj-data-science | 0 | python | def forward_logistic(X, W, b):
'\n For the RBM-std or partial RBC-std models\n\n x -[weights W]- z (bias b)\n\n this method computes\n\n E[z_k | x_d] = p(z_k=1 | x_d) = logistic( x_d^T W_:k + b_k )\n\n Inputs:\n - X (array): An N x F matrix of input row vectors.\n - W (array): T... | def forward_logistic(X, W, b):
'\n For the RBM-std or partial RBC-std models\n\n x -[weights W]- z (bias b)\n\n this method computes\n\n E[z_k | x_d] = p(z_k=1 | x_d) = logistic( x_d^T W_:k + b_k )\n\n Inputs:\n - X (array): An N x F matrix of input row vectors.\n - W (array): T... |
18fda7f095d0d8bfb9baaa32e562697a421174be862eb65e3e73e9b93dc35382 | def backward_logistic(Z, a, W):
"\n For the RBM-std or partial RBC-std models\n\n x (bias a) -[weights W]- z\n\n this method computes\n\n E[x_i | z_d] = p(x_i=1 | z_d) = logistic( W_i: z_d + a_i )\n\n Inputs:\n - Z (array): An N x H matrix of 'hidden' row vectors.\n - a (array):... | For the RBM-std or partial RBC-std models
x (bias a) -[weights W]- z
this method computes
E[x_i | z_d] = p(x_i=1 | z_d) = logistic( W_i: z_d + a_i )
Inputs:
- Z (array): An N x H matrix of 'hidden' row vectors.
- a (array): The size-F vector of input biases.
- W (array): The F x H matrix of inpu... | RBMModels/python/bernoulli_lib.py | backward_logistic | gaj67/gaj-data-science | 0 | python | def backward_logistic(Z, a, W):
"\n For the RBM-std or partial RBC-std models\n\n x (bias a) -[weights W]- z\n\n this method computes\n\n E[x_i | z_d] = p(x_i=1 | z_d) = logistic( W_i: z_d + a_i )\n\n Inputs:\n - Z (array): An N x H matrix of 'hidden' row vectors.\n - a (array):... | def backward_logistic(Z, a, W):
"\n For the RBM-std or partial RBC-std models\n\n x (bias a) -[weights W]- z\n\n this method computes\n\n E[x_i | z_d] = p(x_i=1 | z_d) = logistic( W_i: z_d + a_i )\n\n Inputs:\n - Z (array): An N x H matrix of 'hidden' row vectors.\n - a (array):... |
3591978da90517388c3723f9e0c83f56e78855315a34bc46c9ae789767f1f270 | def bi_logistic(X, Y, W, b, U):
'\n For the RBC-std model\n\n x -[weights W] - z (bias b) -[weights U]- y\n\n this method computes\n\n p(z_k = 1 | x_d, y_d) = logistic( x_d W_:k + U_k: y_d + b_k )\n\n Inputs:\n - X (array): The N x F matrix of input row vectors.\n - Y (array): E... | For the RBC-std model
x -[weights W] - z (bias b) -[weights U]- y
this method computes
p(z_k = 1 | x_d, y_d) = logistic( x_d W_:k + U_k: y_d + b_k )
Inputs:
- X (array): The N x F matrix of input row vectors.
- Y (array): Either an N x C matrix of output vectors, or a
size-N vector of output... | RBMModels/python/bernoulli_lib.py | bi_logistic | gaj67/gaj-data-science | 0 | python | def bi_logistic(X, Y, W, b, U):
'\n For the RBC-std model\n\n x -[weights W] - z (bias b) -[weights U]- y\n\n this method computes\n\n p(z_k = 1 | x_d, y_d) = logistic( x_d W_:k + U_k: y_d + b_k )\n\n Inputs:\n - X (array): The N x F matrix of input row vectors.\n - Y (array): E... | def bi_logistic(X, Y, W, b, U):
'\n For the RBC-std model\n\n x -[weights W] - z (bias b) -[weights U]- y\n\n this method computes\n\n p(z_k = 1 | x_d, y_d) = logistic( x_d W_:k + U_k: y_d + b_k )\n\n Inputs:\n - X (array): The N x F matrix of input row vectors.\n - Y (array): E... |
8f3e06cddb7f9825d280199fd9ee3d0840bd93729c870d3398a07fba0263ecac | def forward_softmax(Z, U, c):
"\n For the partial RBC-std model\n\n z -[weights U]- y (bias c)\n\n this method computes\n\n p(y_j = 1 | z_d) = softmax( z_d U_:j + c_j )\n\n Inputs:\n - Z (array): An N x H matrix of 'hidden' row vectors.\n - U (array): The H x C matrix of hidden/... | For the partial RBC-std model
z -[weights U]- y (bias c)
this method computes
p(y_j = 1 | z_d) = softmax( z_d U_:j + c_j )
Inputs:
- Z (array): An N x H matrix of 'hidden' row vectors.
- U (array): The H x C matrix of hidden/output weights.
- c (array): The size-C vector of output biases.
Return... | RBMModels/python/bernoulli_lib.py | forward_softmax | gaj67/gaj-data-science | 0 | python | def forward_softmax(Z, U, c):
"\n For the partial RBC-std model\n\n z -[weights U]- y (bias c)\n\n this method computes\n\n p(y_j = 1 | z_d) = softmax( z_d U_:j + c_j )\n\n Inputs:\n - Z (array): An N x H matrix of 'hidden' row vectors.\n - U (array): The H x C matrix of hidden/... | def forward_softmax(Z, U, c):
"\n For the partial RBC-std model\n\n z -[weights U]- y (bias c)\n\n this method computes\n\n p(y_j = 1 | z_d) = softmax( z_d U_:j + c_j )\n\n Inputs:\n - Z (array): An N x H matrix of 'hidden' row vectors.\n - U (array): The H x C matrix of hidden/... |
1cba2b6858b9993a6648e4b45590dacff9e8b26c6a297e50dd724b5c5d87e95d | def hidden_softmax(X, W, b, U, c):
"\n For the RBC-std model\n\n x -[weights W]- z (bias b) -[weights U]- y (bias c)\n\n this method computes\n\n E[y_j|x_d] = p(y_j=1|x_d) = softmax(...x_d...summed over z...)\n\n where 'z' is a binary vector.\n\n Inputs:\n - X (array): An N x F matr... | For the RBC-std model
x -[weights W]- z (bias b) -[weights U]- y (bias c)
this method computes
E[y_j|x_d] = p(y_j=1|x_d) = softmax(...x_d...summed over z...)
where 'z' is a binary vector.
Inputs:
- X (array): An N x F matrix of input cases.
- W (array): The F x H matrix of input/hidden weights.
... | RBMModels/python/bernoulli_lib.py | hidden_softmax | gaj67/gaj-data-science | 0 | python | def hidden_softmax(X, W, b, U, c):
"\n For the RBC-std model\n\n x -[weights W]- z (bias b) -[weights U]- y (bias c)\n\n this method computes\n\n E[y_j|x_d] = p(y_j=1|x_d) = softmax(...x_d...summed over z...)\n\n where 'z' is a binary vector.\n\n Inputs:\n - X (array): An N x F matr... | def hidden_softmax(X, W, b, U, c):
"\n For the RBC-std model\n\n x -[weights W]- z (bias b) -[weights U]- y (bias c)\n\n this method computes\n\n E[y_j|x_d] = p(y_j=1|x_d) = softmax(...x_d...summed over z...)\n\n where 'z' is a binary vector.\n\n Inputs:\n - X (array): An N x F matr... |
0cc79c7c24ccfc16945f6dcd6f5e432e8ec6f8dc46efec660e902659f6affe22 | def hidden_logistic(X, W, b, U, c):
"\n For the 3-layer RBM model\n\n x -[weights W]- z (bias b) -[weights U]- y (bias c)\n\n with binary output 'y', this method computes\n\n E[y_j|x_d] = p(y_j=1|x_d) = logistic(...x_d...summed over z...)\n\n where 'z' is a binary vector.\n\n Inputs:\n ... | For the 3-layer RBM model
x -[weights W]- z (bias b) -[weights U]- y (bias c)
with binary output 'y', this method computes
E[y_j|x_d] = p(y_j=1|x_d) = logistic(...x_d...summed over z...)
where 'z' is a binary vector.
Inputs:
- X (array): An N x F matrix of input cases.
- W (array): The F x H matrix... | RBMModels/python/bernoulli_lib.py | hidden_logistic | gaj67/gaj-data-science | 0 | python | def hidden_logistic(X, W, b, U, c):
"\n For the 3-layer RBM model\n\n x -[weights W]- z (bias b) -[weights U]- y (bias c)\n\n with binary output 'y', this method computes\n\n E[y_j|x_d] = p(y_j=1|x_d) = logistic(...x_d...summed over z...)\n\n where 'z' is a binary vector.\n\n Inputs:\n ... | def hidden_logistic(X, W, b, U, c):
"\n For the 3-layer RBM model\n\n x -[weights W]- z (bias b) -[weights U]- y (bias c)\n\n with binary output 'y', this method computes\n\n E[y_j|x_d] = p(y_j=1|x_d) = logistic(...x_d...summed over z...)\n\n where 'z' is a binary vector.\n\n Inputs:\n ... |
0941ba59689807ca36985fa575df47b98b357c0064d99d8b6833ed25297f58fd | def binary_sample(probs):
"\n Stochastically assigns 1 (else 0) for each element, with the given element's\n Bernoulli probability.\n\n Input:\n - probs (array): An arbitrarily-sized tensor of independent probabilities.\n Returns:\n - res (array): The resulting binary tensor.\n "
re... | Stochastically assigns 1 (else 0) for each element, with the given element's
Bernoulli probability.
Input:
- probs (array): An arbitrarily-sized tensor of independent probabilities.
Returns:
- res (array): The resulting binary tensor. | RBMModels/python/bernoulli_lib.py | binary_sample | gaj67/gaj-data-science | 0 | python | def binary_sample(probs):
"\n Stochastically assigns 1 (else 0) for each element, with the given element's\n Bernoulli probability.\n\n Input:\n - probs (array): An arbitrarily-sized tensor of independent probabilities.\n Returns:\n - res (array): The resulting binary tensor.\n "
re... | def binary_sample(probs):
"\n Stochastically assigns 1 (else 0) for each element, with the given element's\n Bernoulli probability.\n\n Input:\n - probs (array): An arbitrarily-sized tensor of independent probabilities.\n Returns:\n - res (array): The resulting binary tensor.\n "
re... |
3194d9ae12c764edffd60f0ab680c6f48372e91c5b568adad5d63183e3af272d | def binary_decision(probs):
"\n Deterministically assigns 1 (else 0) to each element, if the element's\n Bernoulli probability exceeds 0.5.\n\n Input:\n - probs (array): An arbitrarily-sized tensor of independent probabilities.\n Returns:\n - res (array): The resulting binary tensor.\n ... | Deterministically assigns 1 (else 0) to each element, if the element's
Bernoulli probability exceeds 0.5.
Input:
- probs (array): An arbitrarily-sized tensor of independent probabilities.
Returns:
- res (array): The resulting binary tensor. | RBMModels/python/bernoulli_lib.py | binary_decision | gaj67/gaj-data-science | 0 | python | def binary_decision(probs):
"\n Deterministically assigns 1 (else 0) to each element, if the element's\n Bernoulli probability exceeds 0.5.\n\n Input:\n - probs (array): An arbitrarily-sized tensor of independent probabilities.\n Returns:\n - res (array): The resulting binary tensor.\n ... | def binary_decision(probs):
"\n Deterministically assigns 1 (else 0) to each element, if the element's\n Bernoulli probability exceeds 0.5.\n\n Input:\n - probs (array): An arbitrarily-sized tensor of independent probabilities.\n Returns:\n - res (array): The resulting binary tensor.\n ... |
00de4f9be95dea4ecfb1b13b8b425bd62a17c4aa41ce78f382fe723223226493 | def binary_vector(value, N=None):
'\n Converts the decimal value into a size-N vector of bits, using zero-padding\n or truncation (both on the left) as necessary.\n\n Inputs:\n - value (int): The decimal value.\n - N (int, optional): The size of the binary vector.\n Returns:\n - vec... | Converts the decimal value into a size-N vector of bits, using zero-padding
or truncation (both on the left) as necessary.
Inputs:
- value (int): The decimal value.
- N (int, optional): The size of the binary vector.
Returns:
- vec (array): The size-N binary vector. | RBMModels/python/bernoulli_lib.py | binary_vector | gaj67/gaj-data-science | 0 | python | def binary_vector(value, N=None):
'\n Converts the decimal value into a size-N vector of bits, using zero-padding\n or truncation (both on the left) as necessary.\n\n Inputs:\n - value (int): The decimal value.\n - N (int, optional): The size of the binary vector.\n Returns:\n - vec... | def binary_vector(value, N=None):
'\n Converts the decimal value into a size-N vector of bits, using zero-padding\n or truncation (both on the left) as necessary.\n\n Inputs:\n - value (int): The decimal value.\n - N (int, optional): The size of the binary vector.\n Returns:\n - vec... |
e144a995a55e4827fcadf9c62d016f38622341d275bdb0d301fafcad66216dea | def binary_matrix(values, N=None):
'\n Converts the decimal values into an M x N matrix of bits, using zero-padding\n or truncation (both on the left) as necessary.\n\n Inputs:\n - values (iterable of int): The size-M collection of decimal values.\n - N (int, optional): The size of each binar... | Converts the decimal values into an M x N matrix of bits, using zero-padding
or truncation (both on the left) as necessary.
Inputs:
- values (iterable of int): The size-M collection of decimal values.
- N (int, optional): The size of each binary row vector.
Returns:
- mat (array): The M x N binary vector. | RBMModels/python/bernoulli_lib.py | binary_matrix | gaj67/gaj-data-science | 0 | python | def binary_matrix(values, N=None):
'\n Converts the decimal values into an M x N matrix of bits, using zero-padding\n or truncation (both on the left) as necessary.\n\n Inputs:\n - values (iterable of int): The size-M collection of decimal values.\n - N (int, optional): The size of each binar... | def binary_matrix(values, N=None):
'\n Converts the decimal values into an M x N matrix of bits, using zero-padding\n or truncation (both on the left) as necessary.\n\n Inputs:\n - values (iterable of int): The size-M collection of decimal values.\n - N (int, optional): The size of each binar... |
d94f7e9189e814104c3963da644672cc6e5bbeed4e8e0c6a86541cf7f0e08a2d | def binary_scores(X, P):
'\n Computes the log-likelihoods of the binary row vectors, X = [x_i],\n given the probabilities, P = [p_i], of each bit being independently\n set to 1.\n\n The scores are given by:\n\n log p(x_i) = log prod_j [ p_ij^x_ij * (1 - p_ij)^(1-x_ij) ]\n\n Note that if X is N... | Computes the log-likelihoods of the binary row vectors, X = [x_i],
given the probabilities, P = [p_i], of each bit being independently
set to 1.
The scores are given by:
log p(x_i) = log prod_j [ p_ij^x_ij * (1 - p_ij)^(1-x_ij) ]
Note that if X is None (i.e. every x_i is unknown), then
E[log p(x_i)] = sum_{... | RBMModels/python/bernoulli_lib.py | binary_scores | gaj67/gaj-data-science | 0 | python | def binary_scores(X, P):
'\n Computes the log-likelihoods of the binary row vectors, X = [x_i],\n given the probabilities, P = [p_i], of each bit being independently\n set to 1.\n\n The scores are given by:\n\n log p(x_i) = log prod_j [ p_ij^x_ij * (1 - p_ij)^(1-x_ij) ]\n\n Note that if X is N... | def binary_scores(X, P):
'\n Computes the log-likelihoods of the binary row vectors, X = [x_i],\n given the probabilities, P = [p_i], of each bit being independently\n set to 1.\n\n The scores are given by:\n\n log p(x_i) = log prod_j [ p_ij^x_ij * (1 - p_ij)^(1-x_ij) ]\n\n Note that if X is N... |
3d2bf2e6850bb75c5d979279f0e9cc4a5713563aaa5ea6f1ba884b6b76549239 | def binary_errors(X, P):
'\n Computes the number of bit-wise errors made by deterministically\n reconstructing the binary row vectors, X = [x_i], from the given\n probabilities, P = [p_i], of each bit being independently\n set to 1.\n\n The scores are given by:\n\n e(x_i) = sum_j abs( x_ij - d... | Computes the number of bit-wise errors made by deterministically
reconstructing the binary row vectors, X = [x_i], from the given
probabilities, P = [p_i], of each bit being independently
set to 1.
The scores are given by:
e(x_i) = sum_j abs( x_ij - decide(p_ij) )
Inputs:
- X (array): The N x M matrix of bin... | RBMModels/python/bernoulli_lib.py | binary_errors | gaj67/gaj-data-science | 0 | python | def binary_errors(X, P):
'\n Computes the number of bit-wise errors made by deterministically\n reconstructing the binary row vectors, X = [x_i], from the given\n probabilities, P = [p_i], of each bit being independently\n set to 1.\n\n The scores are given by:\n\n e(x_i) = sum_j abs( x_ij - d... | def binary_errors(X, P):
'\n Computes the number of bit-wise errors made by deterministically\n reconstructing the binary row vectors, X = [x_i], from the given\n probabilities, P = [p_i], of each bit being independently\n set to 1.\n\n The scores are given by:\n\n e(x_i) = sum_j abs( x_ij - d... |
00a17ba42ae0691df597f6ecc4f3fb37825f208a22fb3be52fb554f6401c7730 | def one_hot_scores(X, P):
'\n Computes the log-likelihoods of the observed cases, X=[x_i], given the\n (dependent) probabilities, P = [[p_ij]], that x_i belongs to class j, i.e.\n the corresponding one-hot vector has a 1 at the j-th bit (with all other\n bits being 0).\n\n If X is a matrix of one-hot... | Computes the log-likelihoods of the observed cases, X=[x_i], given the
(dependent) probabilities, P = [[p_ij]], that x_i belongs to class j, i.e.
the corresponding one-hot vector has a 1 at the j-th bit (with all other
bits being 0).
If X is a matrix of one-hot row vectors, then the scores are given by:
log p(x_i... | RBMModels/python/bernoulli_lib.py | one_hot_scores | gaj67/gaj-data-science | 0 | python | def one_hot_scores(X, P):
'\n Computes the log-likelihoods of the observed cases, X=[x_i], given the\n (dependent) probabilities, P = [[p_ij]], that x_i belongs to class j, i.e.\n the corresponding one-hot vector has a 1 at the j-th bit (with all other\n bits being 0).\n\n If X is a matrix of one-hot... | def one_hot_scores(X, P):
'\n Computes the log-likelihoods of the observed cases, X=[x_i], given the\n (dependent) probabilities, P = [[p_ij]], that x_i belongs to class j, i.e.\n the corresponding one-hot vector has a 1 at the j-th bit (with all other\n bits being 0).\n\n If X is a matrix of one-hot... |
d58cba0fe7342641b11c773056aa3401d79b9a83f23b26eb3d45de867642fe8d | def main():
' Makes the appropriate method calls in order to submit\n asynchronous queries to the Wildfire 1 API to get hourly values for all weather stations.\n '
try:
logger.debug('Retrieving hourly actuals...')
bot = HourlyActualsBot()
loop = asyncio.new_event_loop()
asy... | Makes the appropriate method calls in order to submit
asynchronous queries to the Wildfire 1 API to get hourly values for all weather stations. | api/app/fireweather_bot/hourly_actuals.py | main | bcgov/wps | 19 | python | def main():
' Makes the appropriate method calls in order to submit\n asynchronous queries to the Wildfire 1 API to get hourly values for all weather stations.\n '
try:
logger.debug('Retrieving hourly actuals...')
bot = HourlyActualsBot()
loop = asyncio.new_event_loop()
asy... | def main():
' Makes the appropriate method calls in order to submit\n asynchronous queries to the Wildfire 1 API to get hourly values for all weather stations.\n '
try:
logger.debug('Retrieving hourly actuals...')
bot = HourlyActualsBot()
loop = asyncio.new_event_loop()
asy... |
05552d7e4c1afffd7e7feaca4010cda64c83f4c56bbdbdc669225a64f936c91f | def _get_start_date(self) -> datetime:
" Return time N hour ago. E.g. if it's 17h15 now, we'd get YYYYMMDD16. The intention is that\n this bot runs every hour, so if we ask for everything from an hour back, we should be fine.\n However, just to be on the safe side, we're asking for the last three hour... | Return time N hour ago. E.g. if it's 17h15 now, we'd get YYYYMMDD16. The intention is that
this bot runs every hour, so if we ask for everything from an hour back, we should be fine.
However, just to be on the safe side, we're asking for the last three hours - just in case there
was a station that came in late, or if f... | api/app/fireweather_bot/hourly_actuals.py | _get_start_date | bcgov/wps | 19 | python | def _get_start_date(self) -> datetime:
" Return time N hour ago. E.g. if it's 17h15 now, we'd get YYYYMMDD16. The intention is that\n this bot runs every hour, so if we ask for everything from an hour back, we should be fine.\n However, just to be on the safe side, we're asking for the last three hour... | def _get_start_date(self) -> datetime:
" Return time N hour ago. E.g. if it's 17h15 now, we'd get YYYYMMDD16. The intention is that\n this bot runs every hour, so if we ask for everything from an hour back, we should be fine.\n However, just to be on the safe side, we're asking for the last three hour... |
c600391312e97ca03ef8474bdfc3684a2233514c1702d51867b4e291debbf37d | def _get_end_date(self) -> datetime:
" Return now. E.g. if it's 17h15 now, we'd get YYYYMMDD17 "
return self.now | Return now. E.g. if it's 17h15 now, we'd get YYYYMMDD17 | api/app/fireweather_bot/hourly_actuals.py | _get_end_date | bcgov/wps | 19 | python | def _get_end_date(self) -> datetime:
" "
return self.now | def _get_end_date(self) -> datetime:
" "
return self.now<|docstring|>Return now. E.g. if it's 17h15 now, we'd get YYYYMMDD17<|endoftext|> |
204163c7cb9a7ffea1743a957c655c34c6c85e1325fa84193a8158a44fe76e25 | async def run_wfwx(self):
' Entry point for running the bot '
async with ClientSession() as session:
header = (await wfwx_api.get_auth_header(session))
start_date = self._get_start_date()
end_date = self._get_end_date()
hourly_actuals = (await wfwx_api.get_hourly_actuals_all_stat... | Entry point for running the bot | api/app/fireweather_bot/hourly_actuals.py | run_wfwx | bcgov/wps | 19 | python | async def run_wfwx(self):
' '
async with ClientSession() as session:
header = (await wfwx_api.get_auth_header(session))
start_date = self._get_start_date()
end_date = self._get_end_date()
hourly_actuals = (await wfwx_api.get_hourly_actuals_all_stations(session, header, start_dat... | async def run_wfwx(self):
' '
async with ClientSession() as session:
header = (await wfwx_api.get_auth_header(session))
start_date = self._get_start_date()
end_date = self._get_end_date()
hourly_actuals = (await wfwx_api.get_hourly_actuals_all_stations(session, header, start_dat... |
5dfbba943d4866c9b66a746ff757f01e4edb8f48ce709e442ee6f72454503e39 | def __init__(self, key: bytes=bytes([0, 0, 0, 0, 0])):
'Initializes the object with a list of integers between 0 and 255.'
self.key = list(key) | Initializes the object with a list of integers between 0 and 255. | 2-Cryptography_Intro/q1.py | __init__ | galtoubul/Introduction_to_Information_Security | 0 | python | def __init__(self, key: bytes=bytes([0, 0, 0, 0, 0])):
self.key = list(key) | def __init__(self, key: bytes=bytes([0, 0, 0, 0, 0])):
self.key = list(key)<|docstring|>Initializes the object with a list of integers between 0 and 255.<|endoftext|> |
fba28148103b84a858ce548805de6ba2d32976745265288048082833bba5ea47 | def encrypt(self, plaintext: str) -> bytes:
'Encrypts a given plaintext string and returns the ciphertext.'
return bytes([(k ^ p) for (k, p) in zip(itertools.cycle(self.key), plaintext.encode('latin-1'))]) | Encrypts a given plaintext string and returns the ciphertext. | 2-Cryptography_Intro/q1.py | encrypt | galtoubul/Introduction_to_Information_Security | 0 | python | def encrypt(self, plaintext: str) -> bytes:
return bytes([(k ^ p) for (k, p) in zip(itertools.cycle(self.key), plaintext.encode('latin-1'))]) | def encrypt(self, plaintext: str) -> bytes:
return bytes([(k ^ p) for (k, p) in zip(itertools.cycle(self.key), plaintext.encode('latin-1'))])<|docstring|>Encrypts a given plaintext string and returns the ciphertext.<|endoftext|> |
111637330d20a6b7b6e9c60442c5a61c6588a24b2f81e117c1f72d60b5bac7a0 | def decrypt(self, ciphertext: bytes) -> str:
'Decrypts a given ciphertext string and returns the plaintext.'
return self.encrypt(ciphertext.decode('latin-1')).decode('latin-1') | Decrypts a given ciphertext string and returns the plaintext. | 2-Cryptography_Intro/q1.py | decrypt | galtoubul/Introduction_to_Information_Security | 0 | python | def decrypt(self, ciphertext: bytes) -> str:
return self.encrypt(ciphertext.decode('latin-1')).decode('latin-1') | def decrypt(self, ciphertext: bytes) -> str:
return self.encrypt(ciphertext.decode('latin-1')).decode('latin-1')<|docstring|>Decrypts a given ciphertext string and returns the plaintext.<|endoftext|> |
374fb19ccb63c35cea5e25ad7c4170961e1b0685f8d3db2835382e318795e1e8 | def plaintext_score(self, plaintext: str) -> float:
'Scores a candidate plaintext string, higher means more likely.'
score = 0
for word in re.split('\\s+|[,.:!]', plaintext):
if (not word.strip()):
continue
word = word.lower()
if word.encode('latin-1').isalpha():
... | Scores a candidate plaintext string, higher means more likely. | 2-Cryptography_Intro/q1.py | plaintext_score | galtoubul/Introduction_to_Information_Security | 0 | python | def plaintext_score(self, plaintext: str) -> float:
score = 0
for word in re.split('\\s+|[,.:!]', plaintext):
if (not word.strip()):
continue
word = word.lower()
if word.encode('latin-1').isalpha():
if (len(word) == 1):
if (word not in ['i', '... | def plaintext_score(self, plaintext: str) -> float:
score = 0
for word in re.split('\\s+|[,.:!]', plaintext):
if (not word.strip()):
continue
word = word.lower()
if word.encode('latin-1').isalpha():
if (len(word) == 1):
if (word not in ['i', '... |
4e8ce2775b7c80aadb4131286099964c2c09767f85ea9f0df35c0198d98d74c3 | def brute_force(self, cipher_text: bytes, key_length: int) -> str:
'Breaks a Repeated Key Cipher by brute-forcing all keys.'
keys = itertools.product(range(0, 256), repeat=key_length)
max_score = 0
max_scored_text = ''
for key in keys:
k = RepeatedKeyCipher(bytes(key))
p = k.decrypt(... | Breaks a Repeated Key Cipher by brute-forcing all keys. | 2-Cryptography_Intro/q1.py | brute_force | galtoubul/Introduction_to_Information_Security | 0 | python | def brute_force(self, cipher_text: bytes, key_length: int) -> str:
keys = itertools.product(range(0, 256), repeat=key_length)
max_score = 0
max_scored_text =
for key in keys:
k = RepeatedKeyCipher(bytes(key))
p = k.decrypt(cipher_text)
score = self.plaintext_score(p)
... | def brute_force(self, cipher_text: bytes, key_length: int) -> str:
keys = itertools.product(range(0, 256), repeat=key_length)
max_score = 0
max_scored_text =
for key in keys:
k = RepeatedKeyCipher(bytes(key))
p = k.decrypt(cipher_text)
score = self.plaintext_score(p)
... |
1c7e6756454f158086929559184acd761faee1fac07f2603d8d51be52ff2d12c | def brute_force_one_byte(self, sub_cipher) -> int:
' Crack one byte og the key based on letters probability '
max_score = 0
for i in range(256):
curr_score = 0
for c in sub_cipher:
p = (c ^ i)
curr_score += letters_prob.get(chr(p).lower(), 0)
if (curr_score > ... | Crack one byte og the key based on letters probability | 2-Cryptography_Intro/q1.py | brute_force_one_byte | galtoubul/Introduction_to_Information_Security | 0 | python | def brute_force_one_byte(self, sub_cipher) -> int:
' '
max_score = 0
for i in range(256):
curr_score = 0
for c in sub_cipher:
p = (c ^ i)
curr_score += letters_prob.get(chr(p).lower(), 0)
if (curr_score > max_score):
max_score = curr_score
... | def brute_force_one_byte(self, sub_cipher) -> int:
' '
max_score = 0
for i in range(256):
curr_score = 0
for c in sub_cipher:
p = (c ^ i)
curr_score += letters_prob.get(chr(p).lower(), 0)
if (curr_score > max_score):
max_score = curr_score
... |
cc6a69ecd8c5c94fc882f49e81702d28e58a83ad356bfe9ac073db1a6f476b5a | def smarter_break(self, cipher_text: bytes, key_length: int) -> str:
'Breaks a Repeated Key Cipher any way you like.'
sub_ciphers = []
for i in range(key_length):
sub_cipher = []
for j in range(i, len(cipher_text), key_length):
sub_cipher.append(cipher_text[j])
sub_cipher... | Breaks a Repeated Key Cipher any way you like. | 2-Cryptography_Intro/q1.py | smarter_break | galtoubul/Introduction_to_Information_Security | 0 | python | def smarter_break(self, cipher_text: bytes, key_length: int) -> str:
sub_ciphers = []
for i in range(key_length):
sub_cipher = []
for j in range(i, len(cipher_text), key_length):
sub_cipher.append(cipher_text[j])
sub_ciphers.append(sub_cipher)
key = bytearray()
f... | def smarter_break(self, cipher_text: bytes, key_length: int) -> str:
sub_ciphers = []
for i in range(key_length):
sub_cipher = []
for j in range(i, len(cipher_text), key_length):
sub_cipher.append(cipher_text[j])
sub_ciphers.append(sub_cipher)
key = bytearray()
f... |
2285300080e69018179add1fd1b4f5466643d9c1c689be49289c4c994655fd04 | def set_manager(self, manager):
'\n the manager of the panel in this case the application itself\n '
self.manager = manager | the manager of the panel in this case the application itself | src/sas/sasview/welcome_panel.py | set_manager | m2cci-NMZ/sasview | 0 | python | def set_manager(self, manager):
'\n \n '
self.manager = manager | def set_manager(self, manager):
'\n \n '
self.manager = manager<|docstring|>the manager of the panel in this case the application itself<|endoftext|> |
22854c99ecf06cb788e12a24a90b792550a637b5c40650dc332cd936b9e9f473 | def on_close_page(self, event):
'\n Called when the welcome panel is closed\n '
if (self.parent is not None):
self.parent.on_close_welcome_panel()
event.Veto() | Called when the welcome panel is closed | src/sas/sasview/welcome_panel.py | on_close_page | m2cci-NMZ/sasview | 0 | python | def on_close_page(self, event):
'\n \n '
if (self.parent is not None):
self.parent.on_close_welcome_panel()
event.Veto() | def on_close_page(self, event):
'\n \n '
if (self.parent is not None):
self.parent.on_close_welcome_panel()
event.Veto()<|docstring|>Called when the welcome panel is closed<|endoftext|> |
91fc3bb458a949237dca058ad4643280daec017237cd569ee36ead1318a37258 | @abstractmethod
def remoteContentProviderChange(self, Event: 'RemoteContentProviderChangeEvent_d63a131c') -> None:
'\n gets called whenever changes to a com.sun.star.ucb.XRemoteContentProviderSupplier occur.\n ' | gets called whenever changes to a com.sun.star.ucb.XRemoteContentProviderSupplier occur. | ooobuild/lo/ucb/x_remote_content_provider_change_listener.py | remoteContentProviderChange | Amourspirit/ooo_uno_tmpl | 0 | python | @abstractmethod
def remoteContentProviderChange(self, Event: 'RemoteContentProviderChangeEvent_d63a131c') -> None:
'\n \n ' | @abstractmethod
def remoteContentProviderChange(self, Event: 'RemoteContentProviderChangeEvent_d63a131c') -> None:
'\n \n '<|docstring|>gets called whenever changes to a com.sun.star.ucb.XRemoteContentProviderSupplier occur.<|endoftext|> |
82954262a908dd0cb3ed7a228ede5373dc827a903ae72d3f16bb4a2bc3293cc9 | def __init__(self, image_size=(480, 640), mode='nose_chin_eyes_mouth'):
"\n :param image_size:\n :param mode: must in ['nose_eyes_ears','nose_chin_eyes_mouth', 'nose_eyes_mouth','nose_2eyes']\n "
self.model_points_3d = get_model_3d_points(mode=mode)
focal_length = image_size[1]
came... | :param image_size:
:param mode: must in ['nose_eyes_ears','nose_chin_eyes_mouth', 'nose_eyes_mouth','nose_2eyes'] | head_pose/head_pose_estimator.py | __init__ | DewMaple/head_pose | 3 | python | def __init__(self, image_size=(480, 640), mode='nose_chin_eyes_mouth'):
"\n :param image_size:\n :param mode: must in ['nose_eyes_ears','nose_chin_eyes_mouth', 'nose_eyes_mouth','nose_2eyes']\n "
self.model_points_3d = get_model_3d_points(mode=mode)
focal_length = image_size[1]
came... | def __init__(self, image_size=(480, 640), mode='nose_chin_eyes_mouth'):
"\n :param image_size:\n :param mode: must in ['nose_eyes_ears','nose_chin_eyes_mouth', 'nose_eyes_mouth','nose_2eyes']\n "
self.model_points_3d = get_model_3d_points(mode=mode)
focal_length = image_size[1]
came... |
cc75d51837ccf673e64f4c6ee247c291af8ba216c97047e672868ba5d67fa2c6 | def solve_pose(self, image_points):
'\n Solve pose from image points, if length is 3, order is sensitive, for example: nose, right eye, left eye\n Return (rotation_vector, translation_vector) as pose.\n '
if (len(image_points) == 3):
nose = image_points[0]
right = image_poin... | Solve pose from image points, if length is 3, order is sensitive, for example: nose, right eye, left eye
Return (rotation_vector, translation_vector) as pose. | head_pose/head_pose_estimator.py | solve_pose | DewMaple/head_pose | 3 | python | def solve_pose(self, image_points):
'\n Solve pose from image points, if length is 3, order is sensitive, for example: nose, right eye, left eye\n Return (rotation_vector, translation_vector) as pose.\n '
if (len(image_points) == 3):
nose = image_points[0]
right = image_poin... | def solve_pose(self, image_points):
'\n Solve pose from image points, if length is 3, order is sensitive, for example: nose, right eye, left eye\n Return (rotation_vector, translation_vector) as pose.\n '
if (len(image_points) == 3):
nose = image_points[0]
right = image_poin... |
5c83eab3ab10506d032d71d0a9d1061c29f71e1465c791c92e9a506b5bbd487e | def projection(self, rotation_vector, translation_vector, cube_edge=50.0):
'\n :param rotation_vector:\n :param translation_vector:\n :param cube_edge: the length of cube edge\n :return:\n '
points_3d = [(cube_edge, cube_edge, cube_edge), (cube_edge, cube_edge, (- cube_edge)),... | :param rotation_vector:
:param translation_vector:
:param cube_edge: the length of cube edge
:return: | head_pose/head_pose_estimator.py | projection | DewMaple/head_pose | 3 | python | def projection(self, rotation_vector, translation_vector, cube_edge=50.0):
'\n :param rotation_vector:\n :param translation_vector:\n :param cube_edge: the length of cube edge\n :return:\n '
points_3d = [(cube_edge, cube_edge, cube_edge), (cube_edge, cube_edge, (- cube_edge)),... | def projection(self, rotation_vector, translation_vector, cube_edge=50.0):
'\n :param rotation_vector:\n :param translation_vector:\n :param cube_edge: the length of cube edge\n :return:\n '
points_3d = [(cube_edge, cube_edge, cube_edge), (cube_edge, cube_edge, (- cube_edge)),... |
2c8e6cc94a1e6db951ee41bf3140cfe9705904360c0cb6c0be84affacb2afd7b | def calc_coef_fs(q=3.0, f=440.0, g=2.0, type='lpf2', fs=44100):
'\n Calculate IIR Filter coefficients\n \n Parameters:\n q: float\n Q factor\n f: float\n cutoff frequency\n g: float\n gain\n type: string\n type of filter\n fs: int\n samplingrate\n... | Calculate IIR Filter coefficients
Parameters:
q: float
Q factor
f: float
cutoff frequency
g: float
gain
type: string
type of filter
fs: int
samplingrate
Returns:
b: ndarray
filter coefficient b
a: ndarray
filter coefficient a | signal/filter/iir/iirfilter.py | calc_coef_fs | ansvver/pylufia | 0 | python | def calc_coef_fs(q=3.0, f=440.0, g=2.0, type='lpf2', fs=44100):
'\n Calculate IIR Filter coefficients\n \n Parameters:\n q: float\n Q factor\n f: float\n cutoff frequency\n g: float\n gain\n type: string\n type of filter\n fs: int\n samplingrate\n... | def calc_coef_fs(q=3.0, f=440.0, g=2.0, type='lpf2', fs=44100):
'\n Calculate IIR Filter coefficients\n \n Parameters:\n q: float\n Q factor\n f: float\n cutoff frequency\n g: float\n gain\n type: string\n type of filter\n fs: int\n samplingrate\n... |
a89fcf1745fd316f34bc991275f5246dc9ad27bbf8050eaffb13c961c619cbd0 | def calc_coef(q, f, g, type):
'\n Calculate IIR Filter coefficients (fs=44.1kHz fixed)\n \n Parameters:\n q: float\n Q factor\n f: float\n cutoff frequency\n g: float\n gain\n type: string\n type of filter\n fs: int\n samplingrate\n \n Retur... | Calculate IIR Filter coefficients (fs=44.1kHz fixed)
Parameters:
q: float
Q factor
f: float
cutoff frequency
g: float
gain
type: string
type of filter
fs: int
samplingrate
Returns:
b: ndarray
filter coefficient b
a: ndarray
filter coefficient a | signal/filter/iir/iirfilter.py | calc_coef | ansvver/pylufia | 0 | python | def calc_coef(q, f, g, type):
'\n Calculate IIR Filter coefficients (fs=44.1kHz fixed)\n \n Parameters:\n q: float\n Q factor\n f: float\n cutoff frequency\n g: float\n gain\n type: string\n type of filter\n fs: int\n samplingrate\n \n Retur... | def calc_coef(q, f, g, type):
'\n Calculate IIR Filter coefficients (fs=44.1kHz fixed)\n \n Parameters:\n q: float\n Q factor\n f: float\n cutoff frequency\n g: float\n gain\n type: string\n type of filter\n fs: int\n samplingrate\n \n Retur... |
713df857efd1b6035f90ef1dc8ae807a93d4d851fe5faf6af839df10ad3ec0aa | def apply(input, b, a):
'\n Apply IIR filter\n \n Parameters:\n inData: ndarray\n input signal\n b: ndarray\n filter coefficient b\n a: ndarray\n filter coefficient a\n \n Returns:\n result: ndarray\n filtered signal\n '
d0 = 0.0
d1 = 0.0
... | Apply IIR filter
Parameters:
inData: ndarray
input signal
b: ndarray
filter coefficient b
a: ndarray
filter coefficient a
Returns:
result: ndarray
filtered signal | signal/filter/iir/iirfilter.py | apply | ansvver/pylufia | 0 | python | def apply(input, b, a):
'\n Apply IIR filter\n \n Parameters:\n inData: ndarray\n input signal\n b: ndarray\n filter coefficient b\n a: ndarray\n filter coefficient a\n \n Returns:\n result: ndarray\n filtered signal\n '
d0 = 0.0
d1 = 0.0
... | def apply(input, b, a):
'\n Apply IIR filter\n \n Parameters:\n inData: ndarray\n input signal\n b: ndarray\n filter coefficient b\n a: ndarray\n filter coefficient a\n \n Returns:\n result: ndarray\n filtered signal\n '
d0 = 0.0
d1 = 0.0
... |
91fdaf97fe75944bfa829800d06b9e5da2aa8b85a4eaf77b1126443ac524c172 | @ti.kernel
def render(self, time: ti.float32):
'fragment shader imitation'
for frag_coord in ti.grouped(self.screen_field):
uv = ((frag_coord - (0.5 * resolution)) / resolution.y)
col = vec3(0.0)
phi = ts.atan(uv.y, uv.x)
rho = ts.length(uv)
st = vec2(((phi / ts.pi) * 2),... | fragment shader imitation | main.py | render | StanislavPetrovV/Tunnel-Shader-Imitation | 4 | python | @ti.kernel
def render(self, time: ti.float32):
for frag_coord in ti.grouped(self.screen_field):
uv = ((frag_coord - (0.5 * resolution)) / resolution.y)
col = vec3(0.0)
phi = ts.atan(uv.y, uv.x)
rho = ts.length(uv)
st = vec2(((phi / ts.pi) * 2), (0.25 / rho))
st.y... | @ti.kernel
def render(self, time: ti.float32):
for frag_coord in ti.grouped(self.screen_field):
uv = ((frag_coord - (0.5 * resolution)) / resolution.y)
col = vec3(0.0)
phi = ts.atan(uv.y, uv.x)
rho = ts.length(uv)
st = vec2(((phi / ts.pi) * 2), (0.25 / rho))
st.y... |
966a4e6f815cd520753f7fee7388178fdb1f504c4f0cdded350cfd3c17be6841 | def create_placeholders(n_x, n_y):
'\n Creates the placeholders for the tensorflow session.\n \n Arguments:\n n_x -- scalar, size of an image vector (num_px * num_px = 64 * 64 * 3 = 12288)\n n_y -- scalar, number of classes (from 0 to 5, so -> 6)\n \n Returns:\n X -- placeholder for the data... | Creates the placeholders for the tensorflow session.
Arguments:
n_x -- scalar, size of an image vector (num_px * num_px = 64 * 64 * 3 = 12288)
n_y -- scalar, number of classes (from 0 to 5, so -> 6)
Returns:
X -- placeholder for the data input, of shape [n_x, None] and dtype "float"
Y -- placeholder for the input lab... | model.py | create_placeholders | zhajio1988/jude_first_tensorflow_test | 1 | python | def create_placeholders(n_x, n_y):
'\n Creates the placeholders for the tensorflow session.\n \n Arguments:\n n_x -- scalar, size of an image vector (num_px * num_px = 64 * 64 * 3 = 12288)\n n_y -- scalar, number of classes (from 0 to 5, so -> 6)\n \n Returns:\n X -- placeholder for the data... | def create_placeholders(n_x, n_y):
'\n Creates the placeholders for the tensorflow session.\n \n Arguments:\n n_x -- scalar, size of an image vector (num_px * num_px = 64 * 64 * 3 = 12288)\n n_y -- scalar, number of classes (from 0 to 5, so -> 6)\n \n Returns:\n X -- placeholder for the data... |
c2524ee639e756a3ad03b7194a8554b6faa36cc80bf8baa37769c42fd08b6e15 | def model(X_train, Y_train, X_test, Y_test, learning_rate=0.0001, num_epochs=1500, minibatch_size=32, print_cost=True):
'\n Implements a three-layer tensorflow neural network: LINEAR->RELU->LINEAR->RELU->LINEAR->SOFTMAX.\n \n Arguments:\n X_train -- training set, of shape (input size = 12288, number of ... | Implements a three-layer tensorflow neural network: LINEAR->RELU->LINEAR->RELU->LINEAR->SOFTMAX.
Arguments:
X_train -- training set, of shape (input size = 12288, number of training examples = 1080)
Y_train -- test set, of shape (output size = 6, number of training examples = 1080)
X_test -- training set, of shape (in... | model.py | model | zhajio1988/jude_first_tensorflow_test | 1 | python | def model(X_train, Y_train, X_test, Y_test, learning_rate=0.0001, num_epochs=1500, minibatch_size=32, print_cost=True):
'\n Implements a three-layer tensorflow neural network: LINEAR->RELU->LINEAR->RELU->LINEAR->SOFTMAX.\n \n Arguments:\n X_train -- training set, of shape (input size = 12288, number of ... | def model(X_train, Y_train, X_test, Y_test, learning_rate=0.0001, num_epochs=1500, minibatch_size=32, print_cost=True):
'\n Implements a three-layer tensorflow neural network: LINEAR->RELU->LINEAR->RELU->LINEAR->SOFTMAX.\n \n Arguments:\n X_train -- training set, of shape (input size = 12288, number of ... |
b58ebc06b66b8cdec0d96bde52d883b694530554911b175d574ae237d0ad3e5e | def block_diag(*arrs):
'Create a block diagonal matrix from the provided arrays.\n\n Given the inputs `A`, `B` and `C`, the output will have these\n arrays arranged on the diagonal::\n\n [[A, 0, 0],\n [0, B, 0],\n [0, 0, C]]\n\n If all the input arrays are square, the output is known... | Create a block diagonal matrix from the provided arrays.
Given the inputs `A`, `B` and `C`, the output will have these
arrays arranged on the diagonal::
[[A, 0, 0],
[0, B, 0],
[0, 0, C]]
If all the input arrays are square, the output is known as a
block diagonal matrix.
Parameters
----------
A, B, C, ... | data-access/nexustiles/model/nexusmodel.py | block_diag | tloubrieu-jpl/incubator-sdap-nexus | 1 | python | def block_diag(*arrs):
'Create a block diagonal matrix from the provided arrays.\n\n Given the inputs `A`, `B` and `C`, the output will have these\n arrays arranged on the diagonal::\n\n [[A, 0, 0],\n [0, B, 0],\n [0, 0, C]]\n\n If all the input arrays are square, the output is known... | def block_diag(*arrs):
'Create a block diagonal matrix from the provided arrays.\n\n Given the inputs `A`, `B` and `C`, the output will have these\n arrays arranged on the diagonal::\n\n [[A, 0, 0],\n [0, B, 0],\n [0, 0, C]]\n\n If all the input arrays are square, the output is known... |
73ba22512ee0cb787dfe0e6e2b65823ed589d061ad5b75efdbcbaedf9ec4f5cb | def get_approximate_value_for_lat_lon(tile_list, lat, lon):
"\n This function pulls the value out of one of the tiles in tile_list that is the closest to the given\n lat, lon point.\n\n :returns float value closest to lat lon point or float('Nan') if the point is masked or not contained in any tile\n "
... | This function pulls the value out of one of the tiles in tile_list that is the closest to the given
lat, lon point.
:returns float value closest to lat lon point or float('Nan') if the point is masked or not contained in any tile | data-access/nexustiles/model/nexusmodel.py | get_approximate_value_for_lat_lon | tloubrieu-jpl/incubator-sdap-nexus | 1 | python | def get_approximate_value_for_lat_lon(tile_list, lat, lon):
"\n This function pulls the value out of one of the tiles in tile_list that is the closest to the given\n lat, lon point.\n\n :returns float value closest to lat lon point or float('Nan') if the point is masked or not contained in any tile\n "
... | def get_approximate_value_for_lat_lon(tile_list, lat, lon):
"\n This function pulls the value out of one of the tiles in tile_list that is the closest to the given\n lat, lon point.\n\n :returns float value closest to lat lon point or float('Nan') if the point is masked or not contained in any tile\n "
... |
4cd1fb3e1d1db57939e519829f614424e59a87afebfc3ffa17c111ad6c736101 | def flat_config(config):
'flat config to a dict'
f_config = {}
category = ['data', 'model', 'train', 'info']
for cate in category:
for (key, val) in config[cate].items():
f_config[key] = val
return f_config | flat config to a dict | examples/notebooks/xDeepFM/config_utils.py | flat_config | eisber/Recommenders | 1 | python | def flat_config(config):
f_config = {}
category = ['data', 'model', 'train', 'info']
for cate in category:
for (key, val) in config[cate].items():
f_config[key] = val
return f_config | def flat_config(config):
f_config = {}
category = ['data', 'model', 'train', 'info']
for cate in category:
for (key, val) in config[cate].items():
f_config[key] = val
return f_config<|docstring|>flat config to a dict<|endoftext|> |
8bf12ab2ab496e208e1d5ea3db86b6f47b92eda2aae1b5452b6b77ebaeb8edfb | def create_hparams(FLAGS):
'Create hparams.'
FLAGS = flat_config(FLAGS)
return tf.contrib.training.HParams(train_file=(FLAGS['train_file'] if ('train_file' in FLAGS) else None), eval_file=(FLAGS['eval_file'] if ('eval_file' in FLAGS) else None), test_file=(FLAGS['test_file'] if ('test_file' in FLAGS) else N... | Create hparams. | examples/notebooks/xDeepFM/config_utils.py | create_hparams | eisber/Recommenders | 1 | python | def create_hparams(FLAGS):
FLAGS = flat_config(FLAGS)
return tf.contrib.training.HParams(train_file=(FLAGS['train_file'] if ('train_file' in FLAGS) else None), eval_file=(FLAGS['eval_file'] if ('eval_file' in FLAGS) else None), test_file=(FLAGS['test_file'] if ('test_file' in FLAGS) else None), infer_file=... | def create_hparams(FLAGS):
FLAGS = flat_config(FLAGS)
return tf.contrib.training.HParams(train_file=(FLAGS['train_file'] if ('train_file' in FLAGS) else None), eval_file=(FLAGS['eval_file'] if ('eval_file' in FLAGS) else None), test_file=(FLAGS['test_file'] if ('test_file' in FLAGS) else None), infer_file=... |
973810025323f86ef66271f0f63bbfaee26329f7d483641898f788f17f555ca6 | def check_type(config):
'check config type'
int_parameters = ['FEATURE_COUNT', 'FIELD_COUNT', 'dim', 'epochs', 'batch_size', 'show_step', 'save_epoch', 'PAIR_NUM', 'DNN_FIELD_NUM', 'attention_layer_sizes', 'n_user', 'n_item', 'n_user_attr', 'n_item_attr']
for param in int_parameters:
if ((param in c... | check config type | examples/notebooks/xDeepFM/config_utils.py | check_type | eisber/Recommenders | 1 | python | def check_type(config):
int_parameters = ['FEATURE_COUNT', 'FIELD_COUNT', 'dim', 'epochs', 'batch_size', 'show_step', 'save_epoch', 'PAIR_NUM', 'DNN_FIELD_NUM', 'attention_layer_sizes', 'n_user', 'n_item', 'n_user_attr', 'n_item_attr']
for param in int_parameters:
if ((param in config) and (not isi... | def check_type(config):
int_parameters = ['FEATURE_COUNT', 'FIELD_COUNT', 'dim', 'epochs', 'batch_size', 'show_step', 'save_epoch', 'PAIR_NUM', 'DNN_FIELD_NUM', 'attention_layer_sizes', 'n_user', 'n_item', 'n_user_attr', 'n_item_attr']
for param in int_parameters:
if ((param in config) and (not isi... |
739faf5a604b6da93152d6b914223039294b6a50e247d8f827e14a1d58a75155 | def check_nn_config(config):
'check neural networks config'
if (config['model']['model_type'] in ['fm']):
required_parameters = ['train_file', 'eval_file', 'FEATURE_COUNT', 'dim', 'loss', 'data_format', 'method']
elif (config['model']['model_type'] in ['lr']):
required_parameters = ['train_f... | check neural networks config | examples/notebooks/xDeepFM/config_utils.py | check_nn_config | eisber/Recommenders | 1 | python | def check_nn_config(config):
if (config['model']['model_type'] in ['fm']):
required_parameters = ['train_file', 'eval_file', 'FEATURE_COUNT', 'dim', 'loss', 'data_format', 'method']
elif (config['model']['model_type'] in ['lr']):
required_parameters = ['train_file', 'eval_file', 'FEATURE_CO... | def check_nn_config(config):
if (config['model']['model_type'] in ['fm']):
required_parameters = ['train_file', 'eval_file', 'FEATURE_COUNT', 'dim', 'loss', 'data_format', 'method']
elif (config['model']['model_type'] in ['lr']):
required_parameters = ['train_file', 'eval_file', 'FEATURE_CO... |
1ef93f6bbb5b9551b7e0e8972c53b5e9af5120ce26e75856a596311df3e41d36 | def check_config(config):
'check networks config'
if (config['model']['model_type'] not in ['deepFM', 'deepWide', 'dnn', 'ipnn', 'opnn', 'fm', 'lr', 'din', 'cccfnet', 'deepcross', 'exDeepFM', 'cross', 'CIN']):
raise ValueError('model type must be cccfnet, deepFM, deepWide, dnn, ipnn, opnn, fm, lr, din, ... | check networks config | examples/notebooks/xDeepFM/config_utils.py | check_config | eisber/Recommenders | 1 | python | def check_config(config):
if (config['model']['model_type'] not in ['deepFM', 'deepWide', 'dnn', 'ipnn', 'opnn', 'fm', 'lr', 'din', 'cccfnet', 'deepcross', 'exDeepFM', 'cross', 'CIN']):
raise ValueError('model type must be cccfnet, deepFM, deepWide, dnn, ipnn, opnn, fm, lr, din, deepcross, exDeepFM, cr... | def check_config(config):
if (config['model']['model_type'] not in ['deepFM', 'deepWide', 'dnn', 'ipnn', 'opnn', 'fm', 'lr', 'din', 'cccfnet', 'deepcross', 'exDeepFM', 'cross', 'CIN']):
raise ValueError('model type must be cccfnet, deepFM, deepWide, dnn, ipnn, opnn, fm, lr, din, deepcross, exDeepFM, cr... |
4712ae4289e150f2abddb2c7379db3c6569468c06eb2a1de34ffd6152fd3ed0e | def load_yaml(yaml_name):
'load config from yaml'
print('training network configuration file is {0}'.format(yaml_name))
util.check_file_exist(yaml_name)
config = util.load_yaml_file(yaml_name)
return config | load config from yaml | examples/notebooks/xDeepFM/config_utils.py | load_yaml | eisber/Recommenders | 1 | python | def load_yaml(yaml_name):
print('training network configuration file is {0}'.format(yaml_name))
util.check_file_exist(yaml_name)
config = util.load_yaml_file(yaml_name)
return config | def load_yaml(yaml_name):
print('training network configuration file is {0}'.format(yaml_name))
util.check_file_exist(yaml_name)
config = util.load_yaml_file(yaml_name)
return config<|docstring|>load config from yaml<|endoftext|> |
715c26d95865b220e85cd498b808a6f5f3f4eaba31a87c554c4d4a79b245ef84 | def __init__(self, bert_model, deprel_i2l, dp):
'\n :param bert_model: The bert model nn.Module\n :param dp: the drop out probability\n '
super(DPModel, self).__init__()
self.numrels = len(deprel_i2l)
self._bert_model = bert_model
self._dp = nn.Dropout(dp)
self.arc_head = n... | :param bert_model: The bert model nn.Module
:param dp: the drop out probability | gr_nlp_toolkit/models/dp_model.py | __init__ | nlpaueb/gr-nlp-toolkit | 16 | python | def __init__(self, bert_model, deprel_i2l, dp):
'\n :param bert_model: The bert model nn.Module\n :param dp: the drop out probability\n '
super(DPModel, self).__init__()
self.numrels = len(deprel_i2l)
self._bert_model = bert_model
self._dp = nn.Dropout(dp)
self.arc_head = n... | def __init__(self, bert_model, deprel_i2l, dp):
'\n :param bert_model: The bert model nn.Module\n :param dp: the drop out probability\n '
super(DPModel, self).__init__()
self.numrels = len(deprel_i2l)
self._bert_model = bert_model
self._dp = nn.Dropout(dp)
self.arc_head = n... |
25e23bb4c779b5dfbe6daf45ec4ea682a283202841c8c0a79f09d1bbfa4f5e04 | def get_serial_settings(settings):
' extract serial settings\n '
serial_keys = ['port', 'baudrate', 'bytesize', 'parity', 'stopbits', 'timeout', 'xonxoff', 'rtscts', 'write_timeout', 'dsrdtr', 'inter_byte_timeout', 'exclusive']
serial_settings = {k: settings[k] for k in (settings.keys() & serial_keys)}
... | extract serial settings | emonitor/devices/base.py | get_serial_settings | ad3ller/emonitor | 0 | python | def get_serial_settings(settings):
' \n '
serial_keys = ['port', 'baudrate', 'bytesize', 'parity', 'stopbits', 'timeout', 'xonxoff', 'rtscts', 'write_timeout', 'dsrdtr', 'inter_byte_timeout', 'exclusive']
serial_settings = {k: settings[k] for k in (settings.keys() & serial_keys)}
return serial_settin... | def get_serial_settings(settings):
' \n '
serial_keys = ['port', 'baudrate', 'bytesize', 'parity', 'stopbits', 'timeout', 'xonxoff', 'rtscts', 'write_timeout', 'dsrdtr', 'inter_byte_timeout', 'exclusive']
serial_settings = {k: settings[k] for k in (settings.keys() & serial_keys)}
return serial_settin... |
1ee7121e727496a83a27eab503151846eac2d3155976c8b3218838752cf0f2db | def check_reset(self):
' check / reset connection '
try:
self.flush()
if (self.num_serial_errors > 0):
logger.info('Reconnected to serial device')
self.num_serial_errors = 0
except:
self.num_serial_errors += 1
if (self.num_serial_errors == 1):
... | check / reset connection | emonitor/devices/base.py | check_reset | ad3ller/emonitor | 0 | python | def check_reset(self):
' '
try:
self.flush()
if (self.num_serial_errors > 0):
logger.info('Reconnected to serial device')
self.num_serial_errors = 0
except:
self.num_serial_errors += 1
if (self.num_serial_errors == 1):
logger.warning('Disc... | def check_reset(self):
' '
try:
self.flush()
if (self.num_serial_errors > 0):
logger.info('Reconnected to serial device')
self.num_serial_errors = 0
except:
self.num_serial_errors += 1
if (self.num_serial_errors == 1):
logger.warning('Disc... |
95812addffe62ee0d82b830174a815aa7503019b61f6edb2ed695dca3fc30fc4 | def read_data(self, sensors=None):
' read all sensor data '
if (sensors is None):
sensors = self.sensors
logger.debug(f'read_data() sensors: {sensors}')
try:
self.check_reset()
except:
return
for sensor in sensors:
try:
self.flushInput()
re... | read all sensor data | emonitor/devices/base.py | read_data | ad3ller/emonitor | 0 | python | def read_data(self, sensors=None):
' '
if (sensors is None):
sensors = self.sensors
logger.debug(f'read_data() sensors: {sensors}')
try:
self.check_reset()
except:
return
for sensor in sensors:
try:
self.flushInput()
response = self.read_s... | def read_data(self, sensors=None):
' '
if (sensors is None):
sensors = self.sensors
logger.debug(f'read_data() sensors: {sensors}')
try:
self.check_reset()
except:
return
for sensor in sensors:
try:
self.flushInput()
response = self.read_s... |
c7c05b243aadb8819cd818a5ad22962025743551799aee5a7b05685b33455240 | def hex_char_to_bin(hex_char: str) -> str:
'Convert a hex character to a 4-bit binary string.'
return bin(int(hex_char, 16))[2:].zfill(4) | Convert a hex character to a 4-bit binary string. | day16_refactored.py | hex_char_to_bin | joelgrus/advent2021 | 13 | python | def hex_char_to_bin(hex_char: str) -> str:
return bin(int(hex_char, 16))[2:].zfill(4) | def hex_char_to_bin(hex_char: str) -> str:
return bin(int(hex_char, 16))[2:].zfill(4)<|docstring|>Convert a hex character to a 4-bit binary string.<|endoftext|> |
6f72304c676be35fc47f54233c2f089f812d3f25ef651bf91de5d1e70863c1c1 | def hex_to_bin(hex_str: str) -> str:
'Convert a hex string to a binary string.'
return ''.join((hex_char_to_bin(hex_char) for hex_char in hex_str)) | Convert a hex string to a binary string. | day16_refactored.py | hex_to_bin | joelgrus/advent2021 | 13 | python | def hex_to_bin(hex_str: str) -> str:
return .join((hex_char_to_bin(hex_char) for hex_char in hex_str)) | def hex_to_bin(hex_str: str) -> str:
return .join((hex_char_to_bin(hex_char) for hex_char in hex_str))<|docstring|>Convert a hex string to a binary string.<|endoftext|> |
ce39e73850a0244c1d7263989d4da3d10b79f935517abade0a7a44277e943810 | def _parse(bitstream: BitStream) -> Packet:
'\n Parse a single packet from a bitstream,\n consuming the bits that make it up.\n '
version = int(bitstream.read(3), 2)
type_id = int(bitstream.read(3), 2)
if (type_id == 4):
digits = []
while (bitstream.read(1) == '1'):
... | Parse a single packet from a bitstream,
consuming the bits that make it up. | day16_refactored.py | _parse | joelgrus/advent2021 | 13 | python | def _parse(bitstream: BitStream) -> Packet:
'\n Parse a single packet from a bitstream,\n consuming the bits that make it up.\n '
version = int(bitstream.read(3), 2)
type_id = int(bitstream.read(3), 2)
if (type_id == 4):
digits = []
while (bitstream.read(1) == '1'):
... | def _parse(bitstream: BitStream) -> Packet:
'\n Parse a single packet from a bitstream,\n consuming the bits that make it up.\n '
version = int(bitstream.read(3), 2)
type_id = int(bitstream.read(3), 2)
if (type_id == 4):
digits = []
while (bitstream.read(1) == '1'):
... |
7106c9c2fdee6181e2133386ebc30021d1b5a1347ddf29e2821441b63256e64c | def add_up_all_version_numbers(hex_string: str) -> int:
'Add up all version numbers in a hex string.'
packet = parse(hex_string)
return packet.sum_of_versions() | Add up all version numbers in a hex string. | day16_refactored.py | add_up_all_version_numbers | joelgrus/advent2021 | 13 | python | def add_up_all_version_numbers(hex_string: str) -> int:
packet = parse(hex_string)
return packet.sum_of_versions() | def add_up_all_version_numbers(hex_string: str) -> int:
packet = parse(hex_string)
return packet.sum_of_versions()<|docstring|>Add up all version numbers in a hex string.<|endoftext|> |
a29bdfb59910aad161c3858f25cfe6a9872a586a200f6a4319d3c79d32b79f10 | def evaluate(hex_str: str) -> int:
'Evaluate a hex string.'
packet = parse(hex_str)
return packet.evaluate() | Evaluate a hex string. | day16_refactored.py | evaluate | joelgrus/advent2021 | 13 | python | def evaluate(hex_str: str) -> int:
packet = parse(hex_str)
return packet.evaluate() | def evaluate(hex_str: str) -> int:
packet = parse(hex_str)
return packet.evaluate()<|docstring|>Evaluate a hex string.<|endoftext|> |
c3d908ca5c4ec66d95d5e033e9ff832e64035db5a1b5dcb8ff607d43a34f614d | def getSensors(self) -> dict:
'\n Obtiene el valor de los sensores del robot\n\n Return\n Los sensores del robot y sus valores\n '
sensors = super().getSensors()
self.enkilock.acquire()
sensors['groundSensorValues'] = self.myGroundSensorValues
self.enkilock.release()
... | Obtiene el valor de los sensores del robot
Return
Los sensores del robot y sus valores | pyplayground/server/RobotThymio2.py | getSensors | titos-carrasco/pyplayground | 0 | python | def getSensors(self) -> dict:
'\n Obtiene el valor de los sensores del robot\n\n Return\n Los sensores del robot y sus valores\n '
sensors = super().getSensors()
self.enkilock.acquire()
sensors['groundSensorValues'] = self.myGroundSensorValues
self.enkilock.release()
... | def getSensors(self) -> dict:
'\n Obtiene el valor de los sensores del robot\n\n Return\n Los sensores del robot y sus valores\n '
sensors = super().getSensors()
self.enkilock.acquire()
sensors['groundSensorValues'] = self.myGroundSensorValues
self.enkilock.release()
... |
e7fa3778fc8369289d29ca3ab5b26da2aca26e1bb95e6a6c323e261887d69502 | def setLedsIntensity(self, leds: list) -> dict:
'\n Cambia la intensidad de los leds del robot\n\n Parameters\n leds: un arreglo con el valor del tipo float (0 a 1) a\n asignar como intensidad a cada led. El indice del\n arreglo corresponde al led a operar\... | Cambia la intensidad de los leds del robot
Parameters
leds: un arreglo con el valor del tipo float (0 a 1) a
asignar como intensidad a cada led. El indice del
arreglo corresponde al led a operar | pyplayground/server/RobotThymio2.py | setLedsIntensity | titos-carrasco/pyplayground | 0 | python | def setLedsIntensity(self, leds: list) -> dict:
'\n Cambia la intensidad de los leds del robot\n\n Parameters\n leds: un arreglo con el valor del tipo float (0 a 1) a\n asignar como intensidad a cada led. El indice del\n arreglo corresponde al led a operar\... | def setLedsIntensity(self, leds: list) -> dict:
'\n Cambia la intensidad de los leds del robot\n\n Parameters\n leds: un arreglo con el valor del tipo float (0 a 1) a\n asignar como intensidad a cada led. El indice del\n arreglo corresponde al led a operar\... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.