body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
def send_job_data(self, current_job, data, poll_timeout=None): 'Send a Gearman JOB_DATA update for an inflight job' current_handler = self._get_handler_for_job(current_job) current_handler.send_job_data(current_job, data=data) self.wait_until_updates_sent([current_job], poll_timeout=poll_timeout)
500,194,096,815,165,760
Send a Gearman JOB_DATA update for an inflight job
client/python3_gearman/worker.py
send_job_data
aixiwang/gearman_test
python
def send_job_data(self, current_job, data, poll_timeout=None): current_handler = self._get_handler_for_job(current_job) current_handler.send_job_data(current_job, data=data) self.wait_until_updates_sent([current_job], poll_timeout=poll_timeout)
def send_job_warning(self, current_job, data, poll_timeout=None): 'Send a Gearman JOB_WARNING update for an inflight job' current_handler = self._get_handler_for_job(current_job) current_handler.send_job_warning(current_job, data=data) self.wait_until_updates_sent([current_job], poll_timeout=poll_timeou...
1,950,741,434,473,703,000
Send a Gearman JOB_WARNING update for an inflight job
client/python3_gearman/worker.py
send_job_warning
aixiwang/gearman_test
python
def send_job_warning(self, current_job, data, poll_timeout=None): current_handler = self._get_handler_for_job(current_job) current_handler.send_job_warning(current_job, data=data) self.wait_until_updates_sent([current_job], poll_timeout=poll_timeout)
def create_job(self, command_handler, job_handle, task, unique, data): 'Create a new job using our self.job_class' current_connection = self.handler_to_connection_map[command_handler] return self.job_class(current_connection, job_handle, task, unique, data)
4,949,514,335,659,896,000
Create a new job using our self.job_class
client/python3_gearman/worker.py
create_job
aixiwang/gearman_test
python
def create_job(self, command_handler, job_handle, task, unique, data): current_connection = self.handler_to_connection_map[command_handler] return self.job_class(current_connection, job_handle, task, unique, data)
def set_job_lock(self, command_handler, lock): "Set a worker level job lock so we don't try to hold onto 2 jobs at\n anytime" if (command_handler not in self.handler_to_connection_map): return False failed_lock = bool((lock and (self.command_handler_holding_job_lock is not None))) failed_...
-614,135,064,642,233,300
Set a worker level job lock so we don't try to hold onto 2 jobs at anytime
client/python3_gearman/worker.py
set_job_lock
aixiwang/gearman_test
python
def set_job_lock(self, command_handler, lock): "Set a worker level job lock so we don't try to hold onto 2 jobs at\n anytime" if (command_handler not in self.handler_to_connection_map): return False failed_lock = bool((lock and (self.command_handler_holding_job_lock is not None))) failed_...
def check_job_lock(self, command_handler): 'Check to see if we hold the job lock' return bool((self.command_handler_holding_job_lock == command_handler))
5,963,652,033,655,536,000
Check to see if we hold the job lock
client/python3_gearman/worker.py
check_job_lock
aixiwang/gearman_test
python
def check_job_lock(self, command_handler): return bool((self.command_handler_holding_job_lock == command_handler))
def get_bond_length_distribution_inner(input_fname, output_fname): 'Generate bond length distibutions.\n\n Args:\n input_fname: An existing TFRecord file containing Conformer protos.\n output_fname: An output file that will be created that contains all bond\n length distributions - all bond types, all a...
1,118,417,521,258,524,800
Generate bond length distibutions. Args: input_fname: An existing TFRecord file containing Conformer protos. output_fname: An output file that will be created that contains all bond length distributions - all bond types, all atom types. Requires post-processing to generate bond length distribution files.
smu/geometry/get_bond_length_distribution.py
get_bond_length_distribution_inner
10088/google-research
python
def get_bond_length_distribution_inner(input_fname, output_fname): 'Generate bond length distibutions.\n\n Args:\n input_fname: An existing TFRecord file containing Conformer protos.\n output_fname: An output file that will be created that contains all bond\n length distributions - all bond types, all a...
def get_bond_length_distribution(unused_argv): 'Scan Conformer protos to extract bond length distributions.' del unused_argv get_bond_length_distribution_inner(FLAGS.input, FLAGS.output)
-6,997,662,189,550,810,000
Scan Conformer protos to extract bond length distributions.
smu/geometry/get_bond_length_distribution.py
get_bond_length_distribution
10088/google-research
python
def get_bond_length_distribution(unused_argv): del unused_argv get_bond_length_distribution_inner(FLAGS.input, FLAGS.output)
@contextmanager def mktemp(contents): ' Create a temporary file with the given contents, and yield its path ' (_, path) = tempfile.mkstemp() fp = io.open(path, 'wt+', encoding='utf-8') fp.write(contents) fp.flush() try: (yield path) finally: fp.close() os.unlink(path)
-1,387,237,215,766,695,400
Create a temporary file with the given contents, and yield its path
tests/render-test.py
mktemp
arrikto/kolypto-j2cli
python
@contextmanager def mktemp(contents): ' ' (_, path) = tempfile.mkstemp() fp = io.open(path, 'wt+', encoding='utf-8') fp.write(contents) fp.flush() try: (yield path) finally: fp.close() os.unlink(path)
def _testme(self, argv, expected_output, stdin=None, env=None): ' Helper test shortcut ' with mock_environ((env or {})): result = render_command(os.getcwd(), (env or {}), stdin, argv) if isinstance(result, bytes): result = result.decode('utf-8') self.assertEqual(result, expected_output)
1,795,941,189,374,585,600
Helper test shortcut
tests/render-test.py
_testme
arrikto/kolypto-j2cli
python
def _testme(self, argv, expected_output, stdin=None, env=None): ' ' with mock_environ((env or {})): result = render_command(os.getcwd(), (env or {}), stdin, argv) if isinstance(result, bytes): result = result.decode('utf-8') self.assertEqual(result, expected_output)
def test_undefined(self): ' Test --undefined ' self.assertRaises(UndefinedError, self._testme, ['resources/name.j2'], u'Hello !\n', env=dict()) self._testme(['--undefined', 'resources/name.j2'], u'Hello !\n', env=dict())
-1,063,750,977,480,168,600
Test --undefined
tests/render-test.py
test_undefined
arrikto/kolypto-j2cli
python
def test_undefined(self): ' ' self.assertRaises(UndefinedError, self._testme, ['resources/name.j2'], u'Hello !\n', env=dict()) self._testme(['--undefined', 'resources/name.j2'], u'Hello !\n', env=dict())
def test_jinja2_extensions(self): ' Test that an extension is enabled ' with mktemp('{% do [] %}') as template: self._testme([template], '')
2,100,193,027,615,986,400
Test that an extension is enabled
tests/render-test.py
test_jinja2_extensions
arrikto/kolypto-j2cli
python
def test_jinja2_extensions(self): ' ' with mktemp('{% do [] %}') as template: self._testme([template], )
def test_customize(self): ' Test --customize ' with mktemp('<% if 1 %>1<% else %>2<% endif %>') as template: self._testme(['--customize=resources/customize.py', template], '1') with mktemp('<< my_function("hey") >>') as template: self._testme(['--customize=resources/customize.py', template]...
-1,975,867,084,036,834,000
Test --customize
tests/render-test.py
test_customize
arrikto/kolypto-j2cli
python
def test_customize(self): ' ' with mktemp('<% if 1 %>1<% else %>2<% endif %>') as template: self._testme(['--customize=resources/customize.py', template], '1') with mktemp('<< my_function("hey") >>') as template: self._testme(['--customize=resources/customize.py', template], 'my function s...
def _load_coco_keypoint_annotation_kernel(self, img_id): 'load annotation from COCOAPI.\n\n Note:\n bbox:[x1, y1, w, h]\n Args:\n img_id: coco image id\n Returns:\n dict: db entry\n ' img_ann = self.coco.loadImgs(img_id)[0] width = img_ann['width'...
-3,409,155,877,235,542,500
load annotation from COCOAPI. Note: bbox:[x1, y1, w, h] Args: img_id: coco image id Returns: dict: db entry
mmpose/datasets/datasets/top_down/topdown_coco_wholebody_dataset.py
_load_coco_keypoint_annotation_kernel
674106399/mmpose
python
def _load_coco_keypoint_annotation_kernel(self, img_id): 'load annotation from COCOAPI.\n\n Note:\n bbox:[x1, y1, w, h]\n Args:\n img_id: coco image id\n Returns:\n dict: db entry\n ' img_ann = self.coco.loadImgs(img_id)[0] width = img_ann['width'...
def _coco_keypoint_results_one_category_kernel(self, data_pack): 'Get coco keypoint results.' cat_id = data_pack['cat_id'] keypoints = data_pack['keypoints'] cat_results = [] for img_kpts in keypoints: if (len(img_kpts) == 0): continue _key_points = np.array([img_kpt['key...
911,176,376,589,387,800
Get coco keypoint results.
mmpose/datasets/datasets/top_down/topdown_coco_wholebody_dataset.py
_coco_keypoint_results_one_category_kernel
674106399/mmpose
python
def _coco_keypoint_results_one_category_kernel(self, data_pack): cat_id = data_pack['cat_id'] keypoints = data_pack['keypoints'] cat_results = [] for img_kpts in keypoints: if (len(img_kpts) == 0): continue _key_points = np.array([img_kpt['keypoints'] for img_kpt in img_...
def _do_python_keypoint_eval(self, res_file): 'Keypoint evaluation using COCOAPI.' coco_det = self.coco.loadRes(res_file) cuts = np.cumsum([0, self.body_num, self.foot_num, self.face_num, self.left_hand_num, self.right_hand_num]) coco_eval = COCOeval(self.coco, coco_det, 'keypoints_body', self.sigmas[cu...
147,649,272,100,721,250
Keypoint evaluation using COCOAPI.
mmpose/datasets/datasets/top_down/topdown_coco_wholebody_dataset.py
_do_python_keypoint_eval
674106399/mmpose
python
def _do_python_keypoint_eval(self, res_file): coco_det = self.coco.loadRes(res_file) cuts = np.cumsum([0, self.body_num, self.foot_num, self.face_num, self.left_hand_num, self.right_hand_num]) coco_eval = COCOeval(self.coco, coco_det, 'keypoints_body', self.sigmas[cuts[0]:cuts[1]], use_area=True) c...
def tearDown(self): 'Reset all bridge blocks in between test method runs.' for bridge in self.bridges: bridge._blockedIn = {}
-8,374,115,032,258,045,000
Reset all bridge blocks in between test method runs.
bridgedb/test/test_https_distributor.py
tearDown
isislovecruft/bridgedb
python
def tearDown(self): for bridge in self.bridges: bridge._blockedIn = {}
def test_HTTPSDistributor_init_with_proxies(self): 'The HTTPSDistributor, when initialised with proxies, should add an\n extra hashring for proxy users.\n ' dist = distributor.HTTPSDistributor(3, self.key, ProxySet(['1.1.1.1', '2.2.2.2'])) self.assertIsNotNone(dist.proxies) self.assertGrea...
3,944,217,055,337,707,000
The HTTPSDistributor, when initialised with proxies, should add an extra hashring for proxy users.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_init_with_proxies
isislovecruft/bridgedb
python
def test_HTTPSDistributor_init_with_proxies(self): 'The HTTPSDistributor, when initialised with proxies, should add an\n extra hashring for proxy users.\n ' dist = distributor.HTTPSDistributor(3, self.key, ProxySet(['1.1.1.1', '2.2.2.2'])) self.assertIsNotNone(dist.proxies) self.assertGrea...
def test_HTTPSDistributor_getSubnet_usingProxy(self): 'HTTPSDistributor.getSubnet(usingProxy=True) should return a proxy\n group number.\n ' clientRequest = self.randomClientRequest() expectedGroup = ((int(ipaddr.IPAddress(clientRequest.client)) % 4) + 1) subnet = distributor.HTTPSDistribu...
-178,428,863,725,358,530
HTTPSDistributor.getSubnet(usingProxy=True) should return a proxy group number.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_getSubnet_usingProxy
isislovecruft/bridgedb
python
def test_HTTPSDistributor_getSubnet_usingProxy(self): 'HTTPSDistributor.getSubnet(usingProxy=True) should return a proxy\n group number.\n ' clientRequest = self.randomClientRequest() expectedGroup = ((int(ipaddr.IPAddress(clientRequest.client)) % 4) + 1) subnet = distributor.HTTPSDistribu...
def test_HTTPSDistributor_mapSubnetToSubring_usingProxy(self): 'HTTPSDistributor.mapSubnetToSubring() when the client was using a\n proxy should map the client to the proxy subhashring.\n ' dist = distributor.HTTPSDistributor(3, self.key, ProxySet(['1.1.1.1', '2.2.2.2'])) subnet = 'proxy-group...
1,929,354,051,178,406,100
HTTPSDistributor.mapSubnetToSubring() when the client was using a proxy should map the client to the proxy subhashring.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_mapSubnetToSubring_usingProxy
isislovecruft/bridgedb
python
def test_HTTPSDistributor_mapSubnetToSubring_usingProxy(self): 'HTTPSDistributor.mapSubnetToSubring() when the client was using a\n proxy should map the client to the proxy subhashring.\n ' dist = distributor.HTTPSDistributor(3, self.key, ProxySet(['1.1.1.1', '2.2.2.2'])) subnet = 'proxy-group...
def test_HTTPSDistributor_mapSubnetToSubring_with_proxies(self): "HTTPSDistributor.mapSubnetToSubring() when the client wasn't using\n a proxy, but the distributor does have some known proxies and a\n proxySubring, should not map the client to the proxy subhashring.\n " dist = distributor.H...
9,026,591,236,788,420,000
HTTPSDistributor.mapSubnetToSubring() when the client wasn't using a proxy, but the distributor does have some known proxies and a proxySubring, should not map the client to the proxy subhashring.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_mapSubnetToSubring_with_proxies
isislovecruft/bridgedb
python
def test_HTTPSDistributor_mapSubnetToSubring_with_proxies(self): "HTTPSDistributor.mapSubnetToSubring() when the client wasn't using\n a proxy, but the distributor does have some known proxies and a\n proxySubring, should not map the client to the proxy subhashring.\n " dist = distributor.H...
def test_HTTPSDistributor_prepopulateRings_with_proxies(self): 'An HTTPSDistributor with proxies should prepopulate two extra\n subhashrings (one for each of HTTP-Proxy-IPv4 and HTTP-Proxy-IPv6).\n ' dist = distributor.HTTPSDistributor(3, self.key, ProxySet(['1.1.1.1', '2.2.2.2'])) [dist.inser...
2,776,454,485,375,904,300
An HTTPSDistributor with proxies should prepopulate two extra subhashrings (one for each of HTTP-Proxy-IPv4 and HTTP-Proxy-IPv6).
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_prepopulateRings_with_proxies
isislovecruft/bridgedb
python
def test_HTTPSDistributor_prepopulateRings_with_proxies(self): 'An HTTPSDistributor with proxies should prepopulate two extra\n subhashrings (one for each of HTTP-Proxy-IPv4 and HTTP-Proxy-IPv6).\n ' dist = distributor.HTTPSDistributor(3, self.key, ProxySet(['1.1.1.1', '2.2.2.2'])) [dist.inser...
def test_HTTPSDistributor_prepopulateRings_without_proxies(self): 'An HTTPSDistributor without proxies should prepopulate\n totalSubrings * 2 subrings.\n ' dist = distributor.HTTPSDistributor(3, self.key) [dist.insert(bridge) for bridge in self.bridges] dist.prepopulateRings() self.ass...
-71,506,198,677,698,360
An HTTPSDistributor without proxies should prepopulate totalSubrings * 2 subrings.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_prepopulateRings_without_proxies
isislovecruft/bridgedb
python
def test_HTTPSDistributor_prepopulateRings_without_proxies(self): 'An HTTPSDistributor without proxies should prepopulate\n totalSubrings * 2 subrings.\n ' dist = distributor.HTTPSDistributor(3, self.key) [dist.insert(bridge) for bridge in self.bridges] dist.prepopulateRings() self.ass...
def test_HTTPSDistributor_getBridges_with_proxy_and_nonproxy_users(self): 'An HTTPSDistributor should give separate bridges to proxy users.' proxies = ProxySet(['.'.join(['1.1.1', str(x)]) for x in range(1, 256)]) dist = distributor.HTTPSDistributor(3, self.key, proxies) [dist.insert(bridge) for bridge ...
6,604,173,368,182,695,000
An HTTPSDistributor should give separate bridges to proxy users.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_getBridges_with_proxy_and_nonproxy_users
isislovecruft/bridgedb
python
def test_HTTPSDistributor_getBridges_with_proxy_and_nonproxy_users(self): proxies = ProxySet(['.'.join(['1.1.1', str(x)]) for x in range(1, 256)]) dist = distributor.HTTPSDistributor(3, self.key, proxies) [dist.insert(bridge) for bridge in self.bridges] for _ in range(10): bridgeRequest1 = ...
def test_HTTPSDistributor_getBridges_same_bridges_to_same_client(self): 'The same client asking for bridges from the HTTPSDistributor\n multiple times in a row should get the same bridges in response each\n time.\n ' dist = distributor.HTTPSDistributor(3, self.key) [dist.insert(bridge) ...
7,259,232,939,965,180,000
The same client asking for bridges from the HTTPSDistributor multiple times in a row should get the same bridges in response each time.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_getBridges_same_bridges_to_same_client
isislovecruft/bridgedb
python
def test_HTTPSDistributor_getBridges_same_bridges_to_same_client(self): 'The same client asking for bridges from the HTTPSDistributor\n multiple times in a row should get the same bridges in response each\n time.\n ' dist = distributor.HTTPSDistributor(3, self.key) [dist.insert(bridge) ...
def test_HTTPSDistributor_getBridges_ipv4_ipv6(self): 'Asking for bridge addresses which are simultaneously IPv4 and IPv6\n (in that order) should return IPv4 bridges.\n ' dist = distributor.HTTPSDistributor(1, self.key) [dist.insert(bridge) for bridge in self.bridges[:250]] bridgeRequest ...
6,034,760,044,908,151,000
Asking for bridge addresses which are simultaneously IPv4 and IPv6 (in that order) should return IPv4 bridges.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_getBridges_ipv4_ipv6
isislovecruft/bridgedb
python
def test_HTTPSDistributor_getBridges_ipv4_ipv6(self): 'Asking for bridge addresses which are simultaneously IPv4 and IPv6\n (in that order) should return IPv4 bridges.\n ' dist = distributor.HTTPSDistributor(1, self.key) [dist.insert(bridge) for bridge in self.bridges[:250]] bridgeRequest ...
def test_HTTPSDistributor_getBridges_ipv6_ipv4(self): 'Asking for bridge addresses which are simultaneously IPv6 and IPv4\n (in that order) should return IPv6 bridges.\n ' dist = distributor.HTTPSDistributor(1, self.key) [dist.insert(bridge) for bridge in self.bridges[:250]] bridgeRequest ...
4,826,968,932,339,698,000
Asking for bridge addresses which are simultaneously IPv6 and IPv4 (in that order) should return IPv6 bridges.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_getBridges_ipv6_ipv4
isislovecruft/bridgedb
python
def test_HTTPSDistributor_getBridges_ipv6_ipv4(self): 'Asking for bridge addresses which are simultaneously IPv6 and IPv4\n (in that order) should return IPv6 bridges.\n ' dist = distributor.HTTPSDistributor(1, self.key) [dist.insert(bridge) for bridge in self.bridges[:250]] bridgeRequest ...
def test_HTTPSDistributor_getBridges_ipv6(self): 'A request for IPv6 bridges should return IPv6 bridges.' dist = distributor.HTTPSDistributor(3, self.key) [dist.insert(bridge) for bridge in self.bridges[:250]] for i in xrange(500): bridgeRequest = self.randomClientRequest() bridgeRequest...
2,056,632,888,544,047,600
A request for IPv6 bridges should return IPv6 bridges.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_getBridges_ipv6
isislovecruft/bridgedb
python
def test_HTTPSDistributor_getBridges_ipv6(self): dist = distributor.HTTPSDistributor(3, self.key) [dist.insert(bridge) for bridge in self.bridges[:250]] for i in xrange(500): bridgeRequest = self.randomClientRequest() bridgeRequest.withIPv6() bridgeRequest.generateFilters() ...
def test_HTTPSDistributor_getBridges_ipv4(self): 'A request for IPv4 bridges should return IPv4 bridges.' dist = distributor.HTTPSDistributor(1, self.key) [dist.insert(bridge) for bridge in self.bridges[:250]] for i in xrange(500): bridgeRequest = self.randomClientRequest() bridgeRequest...
3,335,645,459,602,166,300
A request for IPv4 bridges should return IPv4 bridges.
bridgedb/test/test_https_distributor.py
test_HTTPSDistributor_getBridges_ipv4
isislovecruft/bridgedb
python
def test_HTTPSDistributor_getBridges_ipv4(self): dist = distributor.HTTPSDistributor(1, self.key) [dist.insert(bridge) for bridge in self.bridges[:250]] for i in xrange(500): bridgeRequest = self.randomClientRequest() bridgeRequest.generateFilters() bridges = dist.getBridges(bri...
def _stash_exp(self, *args, params: Optional[dict]=None, detach_rev: Optional[str]=None, baseline_rev: Optional[str]=None, branch: Optional[str]=None, name: Optional[str]=None, **kwargs): "Stash changes from the workspace as an experiment.\n\n Args:\n params: Optional dictionary of parameter value...
1,772,051,208,236,786,200
Stash changes from the workspace as an experiment. Args: params: Optional dictionary of parameter values to be used. Values take priority over any parameters specified in the user's workspace. baseline_rev: Optional baseline rev for this experiment, defaults to the current SCM rev. ...
dvc/repo/experiments/__init__.py
_stash_exp
esthergold/dvc
python
def _stash_exp(self, *args, params: Optional[dict]=None, detach_rev: Optional[str]=None, baseline_rev: Optional[str]=None, branch: Optional[str]=None, name: Optional[str]=None, **kwargs): "Stash changes from the workspace as an experiment.\n\n Args:\n params: Optional dictionary of parameter value...
def _update_params(self, params: dict): 'Update experiment params files with the specified values.' from benedict import benedict from dvc.utils.serialize import MODIFIERS logger.debug("Using experiment params '%s'", params) for params_fname in params: path = (PathInfo(self.repo.root_dir) / ...
6,649,994,754,235,740,000
Update experiment params files with the specified values.
dvc/repo/experiments/__init__.py
_update_params
esthergold/dvc
python
def _update_params(self, params: dict): from benedict import benedict from dvc.utils.serialize import MODIFIERS logger.debug("Using experiment params '%s'", params) for params_fname in params: path = (PathInfo(self.repo.root_dir) / params_fname) suffix = path.suffix.lower() ...
def reproduce_one(self, queue=False, **kwargs): 'Reproduce and checkout a single experiment.' stash_rev = self.new(**kwargs) if queue: logger.info("Queued experiment '%s' for future execution.", stash_rev[:7]) return [stash_rev] results = self.reproduce([stash_rev], keep_stash=False) ...
-7,046,387,588,810,680,000
Reproduce and checkout a single experiment.
dvc/repo/experiments/__init__.py
reproduce_one
esthergold/dvc
python
def reproduce_one(self, queue=False, **kwargs): stash_rev = self.new(**kwargs) if queue: logger.info("Queued experiment '%s' for future execution.", stash_rev[:7]) return [stash_rev] results = self.reproduce([stash_rev], keep_stash=False) exp_rev = first(results) if (exp_rev is ...
@scm_locked def new(self, *args, checkpoint_resume: Optional[str]=None, **kwargs): "Create a new experiment.\n\n Experiment will be reproduced and checked out into the user's\n workspace.\n " if (checkpoint_resume is not None): return self._resume_checkpoint(*args, checkpoint_resume...
7,423,319,692,721,970,000
Create a new experiment. Experiment will be reproduced and checked out into the user's workspace.
dvc/repo/experiments/__init__.py
new
esthergold/dvc
python
@scm_locked def new(self, *args, checkpoint_resume: Optional[str]=None, **kwargs): "Create a new experiment.\n\n Experiment will be reproduced and checked out into the user's\n workspace.\n " if (checkpoint_resume is not None): return self._resume_checkpoint(*args, checkpoint_resume...
def _resume_checkpoint(self, *args, checkpoint_resume: Optional[str]=None, **kwargs): "Resume an existing (checkpoint) experiment.\n\n Experiment will be reproduced and checked out into the user's\n workspace.\n " assert checkpoint_resume if (checkpoint_resume == self.LAST_CHECKPOINT): ...
8,775,670,305,476,068,000
Resume an existing (checkpoint) experiment. Experiment will be reproduced and checked out into the user's workspace.
dvc/repo/experiments/__init__.py
_resume_checkpoint
esthergold/dvc
python
def _resume_checkpoint(self, *args, checkpoint_resume: Optional[str]=None, **kwargs): "Resume an existing (checkpoint) experiment.\n\n Experiment will be reproduced and checked out into the user's\n workspace.\n " assert checkpoint_resume if (checkpoint_resume == self.LAST_CHECKPOINT): ...
@scm_locked def reproduce(self, revs: Optional[Iterable]=None, keep_stash: Optional[bool]=True, **kwargs): 'Reproduce the specified experiments.\n\n Args:\n revs: If revs is not specified, all stashed experiments will be\n reproduced.\n keep_stash: If True, stashed experi...
-8,775,852,405,187,722,000
Reproduce the specified experiments. Args: revs: If revs is not specified, all stashed experiments will be reproduced. keep_stash: If True, stashed experiments will be preserved if they fail to reproduce successfully.
dvc/repo/experiments/__init__.py
reproduce
esthergold/dvc
python
@scm_locked def reproduce(self, revs: Optional[Iterable]=None, keep_stash: Optional[bool]=True, **kwargs): 'Reproduce the specified experiments.\n\n Args:\n revs: If revs is not specified, all stashed experiments will be\n reproduced.\n keep_stash: If True, stashed experi...
def _reproduce(self, executors: dict, jobs: Optional[int]=1) -> Mapping[(str, Mapping[(str, str)])]: 'Run dvc repro for the specified BaseExecutors in parallel.\n\n Returns dict containing successfully executed experiments.\n ' result = defaultdict(dict) manager = Manager() pid_q = manager...
5,327,217,892,181,162,000
Run dvc repro for the specified BaseExecutors in parallel. Returns dict containing successfully executed experiments.
dvc/repo/experiments/__init__.py
_reproduce
esthergold/dvc
python
def _reproduce(self, executors: dict, jobs: Optional[int]=1) -> Mapping[(str, Mapping[(str, str)])]: 'Run dvc repro for the specified BaseExecutors in parallel.\n\n Returns dict containing successfully executed experiments.\n ' result = defaultdict(dict) manager = Manager() pid_q = manager...
@scm_locked def get_baseline(self, rev): 'Return the baseline rev for an experiment rev.' return self._get_baseline(rev)
7,143,182,011,199,181,000
Return the baseline rev for an experiment rev.
dvc/repo/experiments/__init__.py
get_baseline
esthergold/dvc
python
@scm_locked def get_baseline(self, rev): return self._get_baseline(rev)
def get_branch_by_rev(self, rev: str, allow_multiple: bool=False) -> str: 'Returns full refname for the experiment branch containing rev.' ref_infos = list(exp_refs_by_rev(self.scm, rev)) if (not ref_infos): return None if ((len(ref_infos) > 1) and (not allow_multiple)): raise MultipleBr...
6,905,835,126,619,686,000
Returns full refname for the experiment branch containing rev.
dvc/repo/experiments/__init__.py
get_branch_by_rev
esthergold/dvc
python
def get_branch_by_rev(self, rev: str, allow_multiple: bool=False) -> str: ref_infos = list(exp_refs_by_rev(self.scm, rev)) if (not ref_infos): return None if ((len(ref_infos) > 1) and (not allow_multiple)): raise MultipleBranchError(rev) return str(ref_infos[0])
def get_exact_name(self, rev: str): 'Returns preferred name for the specified revision.\n\n Prefers tags, branches (heads), experiments in that orer.\n ' exclude = f'{EXEC_NAMESPACE}/*' ref = self.scm.describe(rev, base=EXPS_NAMESPACE, exclude=exclude) if ref: return ExpRefInfo.fro...
-4,535,959,236,294,254,000
Returns preferred name for the specified revision. Prefers tags, branches (heads), experiments in that orer.
dvc/repo/experiments/__init__.py
get_exact_name
esthergold/dvc
python
def get_exact_name(self, rev: str): 'Returns preferred name for the specified revision.\n\n Prefers tags, branches (heads), experiments in that orer.\n ' exclude = f'{EXEC_NAMESPACE}/*' ref = self.scm.describe(rev, base=EXPS_NAMESPACE, exclude=exclude) if ref: return ExpRefInfo.fro...
def create_model(self, model_input, vocab_size, l2_penalty=1e-08, **unused_params): "Creates a CNN model.\n\n Args:\n model_input: 'batch' x 'num_features' matrix of input features.\n vocab_size: The number of classes in the dataset.\n\n Returns:\n A dictionary with a tensor containing the prob...
-8,735,807,252,078,989,000
Creates a CNN model. Args: model_input: 'batch' x 'num_features' matrix of input features. vocab_size: The number of classes in the dataset. Returns: A dictionary with a tensor containing the probability predictions of the model in the 'predictions' key. The dimensions of the tensor are batch_size x num_cla...
video_level_models.py
create_model
abdoo8080/youtube-8m
python
def create_model(self, model_input, vocab_size, l2_penalty=1e-08, **unused_params): "Creates a CNN model.\n\n Args:\n model_input: 'batch' x 'num_features' matrix of input features.\n vocab_size: The number of classes in the dataset.\n\n Returns:\n A dictionary with a tensor containing the prob...
def create_model(self, model_input, vocab_size, l2_penalty=1e-08, **unused_params): "Creates a ResNet model.\n\n Args:\n model_input: 'batch' x 'num_features' matrix of input features.\n vocab_size: The number of classes in the dataset.\n\n Returns:\n A dictionary with a tensor containing the p...
6,562,285,822,841,482,000
Creates a ResNet model. Args: model_input: 'batch' x 'num_features' matrix of input features. vocab_size: The number of classes in the dataset. Returns: A dictionary with a tensor containing the probability predictions of the model in the 'predictions' key. The dimensions of the tensor are batch_size x num_...
video_level_models.py
create_model
abdoo8080/youtube-8m
python
def create_model(self, model_input, vocab_size, l2_penalty=1e-08, **unused_params): "Creates a ResNet model.\n\n Args:\n model_input: 'batch' x 'num_features' matrix of input features.\n vocab_size: The number of classes in the dataset.\n\n Returns:\n A dictionary with a tensor containing the p...
def create_model(self, model_input, vocab_size, l2_penalty=1e-08, **unused_params): "Creates a logistic model.\n\n Args:\n model_input: 'batch' x 'num_features' matrix of input features.\n vocab_size: The number of classes in the dataset.\n\n Returns:\n A dictionary with a tensor containing the...
6,376,754,502,288,288,000
Creates a logistic model. Args: model_input: 'batch' x 'num_features' matrix of input features. vocab_size: The number of classes in the dataset. Returns: A dictionary with a tensor containing the probability predictions of the model in the 'predictions' key. The dimensions of the tensor are batch_size x nu...
video_level_models.py
create_model
abdoo8080/youtube-8m
python
def create_model(self, model_input, vocab_size, l2_penalty=1e-08, **unused_params): "Creates a logistic model.\n\n Args:\n model_input: 'batch' x 'num_features' matrix of input features.\n vocab_size: The number of classes in the dataset.\n\n Returns:\n A dictionary with a tensor containing the...
def create_model(self, model_input, vocab_size, num_mixtures=None, l2_penalty=1e-08, **unused_params): "Creates a Mixture of (Logistic) Experts model.\n\n The model consists of a per-class softmax distribution over a\n configurable number of logistic classifiers. One of the classifiers in the\n mixture ...
-6,447,030,492,059,986,000
Creates a Mixture of (Logistic) Experts model. The model consists of a per-class softmax distribution over a configurable number of logistic classifiers. One of the classifiers in the mixture is not trained, and always predicts 0. Args: model_input: 'batch_size' x 'num_features' matrix of input features. vocab...
video_level_models.py
create_model
abdoo8080/youtube-8m
python
def create_model(self, model_input, vocab_size, num_mixtures=None, l2_penalty=1e-08, **unused_params): "Creates a Mixture of (Logistic) Experts model.\n\n The model consists of a per-class softmax distribution over a\n configurable number of logistic classifiers. One of the classifiers in the\n mixture ...
def get_corner_loss_lidar(pred_bbox3d: torch.Tensor, gt_bbox3d: torch.Tensor): '\n Args:\n pred_bbox3d: (N, 7) float Tensor.\n gt_bbox3d: (N, 7) float Tensor.\n\n Returns:\n corner_loss: (N) float Tensor.\n ' assert (pred_bbox3d.shape[0] == gt_bbox3d.shape[0]) pred_box_corners ...
5,956,361,160,264,300,000
Args: pred_bbox3d: (N, 7) float Tensor. gt_bbox3d: (N, 7) float Tensor. Returns: corner_loss: (N) float Tensor.
pcdet/utils/loss_utils.py
get_corner_loss_lidar
ocNflag/point2seq
python
def get_corner_loss_lidar(pred_bbox3d: torch.Tensor, gt_bbox3d: torch.Tensor): '\n Args:\n pred_bbox3d: (N, 7) float Tensor.\n gt_bbox3d: (N, 7) float Tensor.\n\n Returns:\n corner_loss: (N) float Tensor.\n ' assert (pred_bbox3d.shape[0] == gt_bbox3d.shape[0]) pred_box_corners ...
def __init__(self, gamma: float=2.0, alpha: float=0.25): '\n Args:\n gamma: Weighting parameter to balance loss for hard and easy examples.\n alpha: Weighting parameter to balance loss for positive and negative examples.\n ' super().__init__() self.alpha = alpha self....
2,511,071,533,760,564,700
Args: gamma: Weighting parameter to balance loss for hard and easy examples. alpha: Weighting parameter to balance loss for positive and negative examples.
pcdet/utils/loss_utils.py
__init__
ocNflag/point2seq
python
def __init__(self, gamma: float=2.0, alpha: float=0.25): '\n Args:\n gamma: Weighting parameter to balance loss for hard and easy examples.\n alpha: Weighting parameter to balance loss for positive and negative examples.\n ' super().__init__() self.alpha = alpha self....
@staticmethod def sigmoid_cross_entropy_with_logits(input: torch.Tensor, target: torch.Tensor): ' PyTorch Implementation for tf.nn.sigmoid_cross_entropy_with_logits:\n max(x, 0) - x * z + log(1 + exp(-abs(x))) in\n https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_log...
-8,905,405,198,205,577,000
PyTorch Implementation for tf.nn.sigmoid_cross_entropy_with_logits: max(x, 0) - x * z + log(1 + exp(-abs(x))) in https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_logits Args: input: (B, #anchors, #classes) float tensor. Predicted logits for each class target: (B, #anc...
pcdet/utils/loss_utils.py
sigmoid_cross_entropy_with_logits
ocNflag/point2seq
python
@staticmethod def sigmoid_cross_entropy_with_logits(input: torch.Tensor, target: torch.Tensor): ' PyTorch Implementation for tf.nn.sigmoid_cross_entropy_with_logits:\n max(x, 0) - x * z + log(1 + exp(-abs(x))) in\n https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_log...
def forward(self, input: torch.Tensor, target: torch.Tensor, weights: torch.Tensor): '\n Args:\n input: (B, #anchors, #classes) float tensor.\n Predicted logits for each class\n target: (B, #anchors, #classes) float tensor.\n One-hot encoded classification ...
-8,421,976,740,454,377,000
Args: input: (B, #anchors, #classes) float tensor. Predicted logits for each class target: (B, #anchors, #classes) float tensor. One-hot encoded classification targets weights: (B, #anchors) float tensor. Anchor-wise weights. Returns: weighted_loss: (B, #anchors, #classes) float...
pcdet/utils/loss_utils.py
forward
ocNflag/point2seq
python
def forward(self, input: torch.Tensor, target: torch.Tensor, weights: torch.Tensor): '\n Args:\n input: (B, #anchors, #classes) float tensor.\n Predicted logits for each class\n target: (B, #anchors, #classes) float tensor.\n One-hot encoded classification ...
def __init__(self, beta: float=(1.0 / 9.0), code_weights: list=None): '\n Args:\n beta: Scalar float.\n L1 to L2 change point.\n For beta values < 1e-5, L1 loss is computed.\n code_weights: (#codes) float list if not None.\n Code-wise weights...
6,300,698,351,211,915,000
Args: beta: Scalar float. L1 to L2 change point. For beta values < 1e-5, L1 loss is computed. code_weights: (#codes) float list if not None. Code-wise weights.
pcdet/utils/loss_utils.py
__init__
ocNflag/point2seq
python
def __init__(self, beta: float=(1.0 / 9.0), code_weights: list=None): '\n Args:\n beta: Scalar float.\n L1 to L2 change point.\n For beta values < 1e-5, L1 loss is computed.\n code_weights: (#codes) float list if not None.\n Code-wise weights...
def forward(self, input: torch.Tensor, target: torch.Tensor, weights: torch.Tensor=None): '\n Args:\n input: (B, #anchors, #codes) float tensor.\n Ecoded predicted locations of objects.\n target: (B, #anchors, #codes) float tensor.\n Regression targets.\n ...
-3,411,104,254,395,770,400
Args: input: (B, #anchors, #codes) float tensor. Ecoded predicted locations of objects. target: (B, #anchors, #codes) float tensor. Regression targets. weights: (B, #anchors) float tensor if not None. Returns: loss: (B, #anchors) float tensor. Weighted smooth l1 loss without red...
pcdet/utils/loss_utils.py
forward
ocNflag/point2seq
python
def forward(self, input: torch.Tensor, target: torch.Tensor, weights: torch.Tensor=None): '\n Args:\n input: (B, #anchors, #codes) float tensor.\n Ecoded predicted locations of objects.\n target: (B, #anchors, #codes) float tensor.\n Regression targets.\n ...
def __init__(self, code_weights: list=None): '\n Args:\n code_weights: (#codes) float list if not None.\n Code-wise weights.\n ' super(WeightedL1Loss, self).__init__() if (code_weights is not None): self.code_weights = np.array(code_weights, dtype=np.float32) ...
-778,590,620,506,814,300
Args: code_weights: (#codes) float list if not None. Code-wise weights.
pcdet/utils/loss_utils.py
__init__
ocNflag/point2seq
python
def __init__(self, code_weights: list=None): '\n Args:\n code_weights: (#codes) float list if not None.\n Code-wise weights.\n ' super(WeightedL1Loss, self).__init__() if (code_weights is not None): self.code_weights = np.array(code_weights, dtype=np.float32) ...
def forward(self, input: torch.Tensor, target: torch.Tensor, weights: torch.Tensor=None): '\n Args:\n input: (B, #anchors, #codes) float tensor.\n Ecoded predicted locations of objects.\n target: (B, #anchors, #codes) float tensor.\n Regression targets.\n ...
-169,834,570,559,773,700
Args: input: (B, #anchors, #codes) float tensor. Ecoded predicted locations of objects. target: (B, #anchors, #codes) float tensor. Regression targets. weights: (B, #anchors) float tensor if not None. Returns: loss: (B, #anchors) float tensor. Weighted smooth l1 loss without red...
pcdet/utils/loss_utils.py
forward
ocNflag/point2seq
python
def forward(self, input: torch.Tensor, target: torch.Tensor, weights: torch.Tensor=None): '\n Args:\n input: (B, #anchors, #codes) float tensor.\n Ecoded predicted locations of objects.\n target: (B, #anchors, #codes) float tensor.\n Regression targets.\n ...
def forward(self, input: torch.Tensor, target: torch.Tensor, weights: torch.Tensor): '\n Args:\n input: (B, #anchors, #classes) float tensor.\n Predited logits for each class.\n target: (B, #anchors, #classes) float tensor.\n One-hot classification targets....
5,017,373,398,995,985,000
Args: input: (B, #anchors, #classes) float tensor. Predited logits for each class. target: (B, #anchors, #classes) float tensor. One-hot classification targets. weights: (B, #anchors) float tensor. Anchor-wise weights. Returns: loss: (B, #anchors) float tensor. Weighted ...
pcdet/utils/loss_utils.py
forward
ocNflag/point2seq
python
def forward(self, input: torch.Tensor, target: torch.Tensor, weights: torch.Tensor): '\n Args:\n input: (B, #anchors, #classes) float tensor.\n Predited logits for each class.\n target: (B, #anchors, #classes) float tensor.\n One-hot classification targets....
def _neg_loss(self, pred, gt): ' Modified focal loss. Exactly the same as CornerNet.\n Runs faster and costs a little bit more memory\n Arguments:\n pred (batch x c x h x w)\n gt_regr (batch x c x h x w)\n ' pos_inds = gt.eq(1).float() neg_inds = gt.lt(...
389,137,059,020,501,800
Modified focal loss. Exactly the same as CornerNet. Runs faster and costs a little bit more memory Arguments: pred (batch x c x h x w) gt_regr (batch x c x h x w)
pcdet/utils/loss_utils.py
_neg_loss
ocNflag/point2seq
python
def _neg_loss(self, pred, gt): ' Modified focal loss. Exactly the same as CornerNet.\n Runs faster and costs a little bit more memory\n Arguments:\n pred (batch x c x h x w)\n gt_regr (batch x c x h x w)\n ' pos_inds = gt.eq(1).float() neg_inds = gt.lt(...
def _reg_loss(self, regr, gt_regr, mask): ' L1 regression loss\n Arguments:\n regr (batch x max_objects x dim)\n gt_regr (batch x max_objects x dim)\n mask (batch x max_objects)\n ' num = mask.float().sum() mask = mask.unsqueeze(2).expand_as(gt_regr).float(...
-2,449,150,389,028,161,000
L1 regression loss Arguments: regr (batch x max_objects x dim) gt_regr (batch x max_objects x dim) mask (batch x max_objects)
pcdet/utils/loss_utils.py
_reg_loss
ocNflag/point2seq
python
def _reg_loss(self, regr, gt_regr, mask): ' L1 regression loss\n Arguments:\n regr (batch x max_objects x dim)\n gt_regr (batch x max_objects x dim)\n mask (batch x max_objects)\n ' num = mask.float().sum() mask = mask.unsqueeze(2).expand_as(gt_regr).float(...
def __init__(self, gamma: float=2.0, alpha: float=0.25): '\n Args:\n gamma: Weighting parameter to balance loss for hard and easy examples.\n alpha: Weighting parameter to balance loss for positive and negative examples.\n ' super(ForegroundFocalLoss, self).__init__() sel...
-5,609,581,717,160,888,000
Args: gamma: Weighting parameter to balance loss for hard and easy examples. alpha: Weighting parameter to balance loss for positive and negative examples.
pcdet/utils/loss_utils.py
__init__
ocNflag/point2seq
python
def __init__(self, gamma: float=2.0, alpha: float=0.25): '\n Args:\n gamma: Weighting parameter to balance loss for hard and easy examples.\n alpha: Weighting parameter to balance loss for positive and negative examples.\n ' super(ForegroundFocalLoss, self).__init__() sel...
@staticmethod def sigmoid_cross_entropy_with_logits(input: torch.Tensor, target: torch.Tensor): ' PyTorch Implementation for tf.nn.sigmoid_cross_entropy_with_logits:\n max(x, 0) - x * z + log(1 + exp(-abs(x))) in\n https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_log...
-8,905,405,198,205,577,000
PyTorch Implementation for tf.nn.sigmoid_cross_entropy_with_logits: max(x, 0) - x * z + log(1 + exp(-abs(x))) in https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_logits Args: input: (B, #anchors, #classes) float tensor. Predicted logits for each class target: (B, #anc...
pcdet/utils/loss_utils.py
sigmoid_cross_entropy_with_logits
ocNflag/point2seq
python
@staticmethod def sigmoid_cross_entropy_with_logits(input: torch.Tensor, target: torch.Tensor): ' PyTorch Implementation for tf.nn.sigmoid_cross_entropy_with_logits:\n max(x, 0) - x * z + log(1 + exp(-abs(x))) in\n https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_log...
def forward(self, input: torch.Tensor, target: torch.Tensor): '\n Args:\n input: (B, #anchors, #classes) float tensor.\n Predicted logits for each class\n target: (B, #anchors, #classes) float tensor.\n One-hot encoded classification targets\n we...
-8,527,889,468,556,255,000
Args: input: (B, #anchors, #classes) float tensor. Predicted logits for each class target: (B, #anchors, #classes) float tensor. One-hot encoded classification targets weights: (B, #anchors) float tensor. Anchor-wise weights. Returns: weighted_loss: (B, #anchors, #classes) float...
pcdet/utils/loss_utils.py
forward
ocNflag/point2seq
python
def forward(self, input: torch.Tensor, target: torch.Tensor): '\n Args:\n input: (B, #anchors, #classes) float tensor.\n Predicted logits for each class\n target: (B, #anchors, #classes) float tensor.\n One-hot encoded classification targets\n we...
def _smooth_reg_loss(self, regr, gt_regr, mask, sigma=3): ' L1 regression loss\n Arguments:\n regr (batch x max_objects x dim)\n gt_regr (batch x max_objects x dim)\n mask (batch x max_objects)\n ' num = mask.float().sum() mask = mask.unsqueeze(2).expand_as(g...
7,120,285,669,924,297,000
L1 regression loss Arguments: regr (batch x max_objects x dim) gt_regr (batch x max_objects x dim) mask (batch x max_objects)
pcdet/utils/loss_utils.py
_smooth_reg_loss
ocNflag/point2seq
python
def _smooth_reg_loss(self, regr, gt_regr, mask, sigma=3): ' L1 regression loss\n Arguments:\n regr (batch x max_objects x dim)\n gt_regr (batch x max_objects x dim)\n mask (batch x max_objects)\n ' num = mask.float().sum() mask = mask.unsqueeze(2).expand_as(g...
def __init__(self, gamma: float=2.0, alpha: float=0.25, reduction='mean'): '\n Args:\n gamma: Weighting parameter to balance loss for hard and easy examples.\n alpha: Weighting parameter to balance loss for positive and negative examples.\n ' super(E2ESigmoidFocalClassificati...
8,031,476,695,436,176,000
Args: gamma: Weighting parameter to balance loss for hard and easy examples. alpha: Weighting parameter to balance loss for positive and negative examples.
pcdet/utils/loss_utils.py
__init__
ocNflag/point2seq
python
def __init__(self, gamma: float=2.0, alpha: float=0.25, reduction='mean'): '\n Args:\n gamma: Weighting parameter to balance loss for hard and easy examples.\n alpha: Weighting parameter to balance loss for positive and negative examples.\n ' super(E2ESigmoidFocalClassificati...
@staticmethod def sigmoid_cross_entropy_with_logits(input: torch.Tensor, target: torch.Tensor): ' PyTorch Implementation for tf.nn.sigmoid_cross_entropy_with_logits:\n max(x, 0) - x * z + log(1 + exp(-abs(x))) in\n https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_log...
-8,905,405,198,205,577,000
PyTorch Implementation for tf.nn.sigmoid_cross_entropy_with_logits: max(x, 0) - x * z + log(1 + exp(-abs(x))) in https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_logits Args: input: (B, #anchors, #classes) float tensor. Predicted logits for each class target: (B, #anc...
pcdet/utils/loss_utils.py
sigmoid_cross_entropy_with_logits
ocNflag/point2seq
python
@staticmethod def sigmoid_cross_entropy_with_logits(input: torch.Tensor, target: torch.Tensor): ' PyTorch Implementation for tf.nn.sigmoid_cross_entropy_with_logits:\n max(x, 0) - x * z + log(1 + exp(-abs(x))) in\n https://www.tensorflow.org/api_docs/python/tf/nn/sigmoid_cross_entropy_with_log...
def forward(self, input: torch.Tensor, target: torch.Tensor): '\n Args:\n input: (B, #anchors, #classes) float tensor.\n Predicted logits for each class\n target: (B, #anchors, #classes) float tensor.\n One-hot encoded classification targets\n we...
7,519,885,252,206,170,000
Args: input: (B, #anchors, #classes) float tensor. Predicted logits for each class target: (B, #anchors, #classes) float tensor. One-hot encoded classification targets weights: (B, #anchors) float tensor. Anchor-wise weights. Returns: weighted_loss: (B, #anchors, #classes) float...
pcdet/utils/loss_utils.py
forward
ocNflag/point2seq
python
def forward(self, input: torch.Tensor, target: torch.Tensor): '\n Args:\n input: (B, #anchors, #classes) float tensor.\n Predicted logits for each class\n target: (B, #anchors, #classes) float tensor.\n One-hot encoded classification targets\n we...
def parse_model_config_params(model_params, num_settings, random_state): '\n\n Args:\n model_params:\n num_settings:\n random_state:\n\n Returns:\n\n ' param_distributions = dict() dist_types = dict(randint=randint, expon=expon, uniform=uniform) for (param, param_value) in ...
-215,715,886,021,214,560
Args: model_params: num_settings: random_state: Returns:
scripts/search_ml_model_params.py
parse_model_config_params
NCAR/mlmicrophysics
python
def parse_model_config_params(model_params, num_settings, random_state): '\n\n Args:\n model_params:\n num_settings:\n random_state:\n\n Returns:\n\n ' param_distributions = dict() dist_types = dict(randint=randint, expon=expon, uniform=uniform) for (param, param_value) in ...
def validate_model_configuration(classifier_model_name, classifier_model_config, regressor_model_name, regressor_model_config, config_index, train_scaled_input, train_labels, train_scaled_output, val_scaled_input, val_labels, val_scaled_output, classifier_metric_list, regressor_metric_list): '\n Train a single m...
-7,930,543,682,850,534,000
Train a single machine learning model configuration to predict each microphysical tendency. Args: classifier_model_name: classifier_model_config: regressor_model_name: regressor_model_config: config_index: train_scaled_input: train_labels: train_scaled_output: val_scaled_input: ...
scripts/search_ml_model_params.py
validate_model_configuration
NCAR/mlmicrophysics
python
def validate_model_configuration(classifier_model_name, classifier_model_config, regressor_model_name, regressor_model_config, config_index, train_scaled_input, train_labels, train_scaled_output, val_scaled_input, val_labels, val_scaled_output, classifier_metric_list, regressor_metric_list): '\n Train a single m...
def test_integers(self): 'Adding an integer as a tag should raise a ValueError (#237).' apple = self.food_model.objects.create(name='apple') with self.assertRaisesRegexp(ValueError, "Cannot add 1 \\(<(type|class) 'int'>\\). Expected <class 'django.db.models.base.ModelBase'> or str."): apple.tags.add...
2,789,897,774,914,508,000
Adding an integer as a tag should raise a ValueError (#237).
tests/tests.py
test_integers
Immensa/django-taggit
python
def test_integers(self): apple = self.food_model.objects.create(name='apple') with self.assertRaisesRegexp(ValueError, "Cannot add 1 \\(<(type|class) 'int'>\\). Expected <class 'django.db.models.base.ModelBase'> or str."): apple.tags.add(1)
def test_similarity_by_tag(self): 'Test that pears are more similar to apples than watermelons' apple = self.food_model.objects.create(name='apple') apple.tags.add('green', 'juicy', 'small', 'sour') pear = self.food_model.objects.create(name='pear') pear.tags.add('green', 'juicy', 'small', 'sweet') ...
1,360,618,908,624,745,200
Test that pears are more similar to apples than watermelons
tests/tests.py
test_similarity_by_tag
Immensa/django-taggit
python
def test_similarity_by_tag(self): apple = self.food_model.objects.create(name='apple') apple.tags.add('green', 'juicy', 'small', 'sour') pear = self.food_model.objects.create(name='pear') pear.tags.add('green', 'juicy', 'small', 'sweet') watermelon = self.food_model.objects.create(name='waterme...
def test_with_simple_space_delimited_tags(self): '\n Test with simple space-delimited tags.\n ' self.assertEqual(parse_tags('one'), ['one']) self.assertEqual(parse_tags('one two'), ['one', 'two']) self.assertEqual(parse_tags('one two three'), ['one', 'three', 'two']) self.assertEqual(p...
-1,707,843,335,423,203,600
Test with simple space-delimited tags.
tests/tests.py
test_with_simple_space_delimited_tags
Immensa/django-taggit
python
def test_with_simple_space_delimited_tags(self): '\n \n ' self.assertEqual(parse_tags('one'), ['one']) self.assertEqual(parse_tags('one two'), ['one', 'two']) self.assertEqual(parse_tags('one two three'), ['one', 'three', 'two']) self.assertEqual(parse_tags('one one two two'), ['one', ...
def test_with_comma_delimited_multiple_words(self): '\n Test with comma-delimited multiple words.\n An unquoted comma in the input will trigger this.\n ' self.assertEqual(parse_tags(',one'), ['one']) self.assertEqual(parse_tags(',one two'), ['one two']) self.assertEqual(parse_tags('...
2,158,762,115,256,022,300
Test with comma-delimited multiple words. An unquoted comma in the input will trigger this.
tests/tests.py
test_with_comma_delimited_multiple_words
Immensa/django-taggit
python
def test_with_comma_delimited_multiple_words(self): '\n Test with comma-delimited multiple words.\n An unquoted comma in the input will trigger this.\n ' self.assertEqual(parse_tags(',one'), ['one']) self.assertEqual(parse_tags(',one two'), ['one two']) self.assertEqual(parse_tags('...
def test_with_double_quoted_multiple_words(self): '\n Test with double-quoted multiple words.\n A completed quote will trigger this. Unclosed quotes are ignored.\n ' self.assertEqual(parse_tags('"one'), ['one']) self.assertEqual(parse_tags('"one two'), ['one', 'two']) self.assertEq...
5,358,388,618,481,210,000
Test with double-quoted multiple words. A completed quote will trigger this. Unclosed quotes are ignored.
tests/tests.py
test_with_double_quoted_multiple_words
Immensa/django-taggit
python
def test_with_double_quoted_multiple_words(self): '\n Test with double-quoted multiple words.\n A completed quote will trigger this. Unclosed quotes are ignored.\n ' self.assertEqual(parse_tags('"one'), ['one']) self.assertEqual(parse_tags('"one two'), ['one', 'two']) self.assertEq...
def test_with_no_loose_commas(self): '\n Test with no loose commas -- split on spaces.\n ' self.assertEqual(parse_tags('one two "thr,ee"'), ['one', 'thr,ee', 'two'])
6,121,131,418,971,766,000
Test with no loose commas -- split on spaces.
tests/tests.py
test_with_no_loose_commas
Immensa/django-taggit
python
def test_with_no_loose_commas(self): '\n \n ' self.assertEqual(parse_tags('one two "thr,ee"'), ['one', 'thr,ee', 'two'])
def test_with_loose_commas(self): '\n Loose commas - split on commas\n ' self.assertEqual(parse_tags('"one", two three'), ['one', 'two three'])
4,144,708,498,068,357,000
Loose commas - split on commas
tests/tests.py
test_with_loose_commas
Immensa/django-taggit
python
def test_with_loose_commas(self): '\n \n ' self.assertEqual(parse_tags('"one", two three'), ['one', 'two three'])
def test_tags_with_double_quotes_can_contain_commas(self): '\n Double quotes can contain commas\n ' self.assertEqual(parse_tags('a-one "a-two, and a-three"'), ['a-one', 'a-two, and a-three']) self.assertEqual(parse_tags('"two", one, one, two, "one"'), ['one', 'two'])
2,664,990,977,619,601,400
Double quotes can contain commas
tests/tests.py
test_tags_with_double_quotes_can_contain_commas
Immensa/django-taggit
python
def test_tags_with_double_quotes_can_contain_commas(self): '\n \n ' self.assertEqual(parse_tags('a-one "a-two, and a-three"'), ['a-one', 'a-two, and a-three']) self.assertEqual(parse_tags('"two", one, one, two, "one"'), ['one', 'two'])
def test_with_naughty_input(self): '\n Test with naughty input.\n ' self.assertEqual(parse_tags(None), []) self.assertEqual(parse_tags(''), []) self.assertEqual(parse_tags('"'), []) self.assertEqual(parse_tags('""'), []) self.assertEqual(parse_tags(('"' * 7)), []) self.assertEq...
6,806,080,594,845,519,000
Test with naughty input.
tests/tests.py
test_with_naughty_input
Immensa/django-taggit
python
def test_with_naughty_input(self): '\n \n ' self.assertEqual(parse_tags(None), []) self.assertEqual(parse_tags(), []) self.assertEqual(parse_tags('"'), []) self.assertEqual(parse_tags(''), []) self.assertEqual(parse_tags(('"' * 7)), []) self.assertEqual(parse_tags(',,,,,,'), []...
@pytest.fixture def cache(request): '\n Return a cache object that can persist state between testing sessions.\n\n cache.get(key, default)\n cache.set(key, value)\n\n Keys must be a ``/`` separated value, where the first part is usually the\n name of your plugin or application to avoid clashes with o...
-824,272,688,077,182,200
Return a cache object that can persist state between testing sessions. cache.get(key, default) cache.set(key, value) Keys must be a ``/`` separated value, where the first part is usually the name of your plugin or application to avoid clashes with other cache users. Values can be any object handled by the json stdli...
src/_pytest/cacheprovider.py
cache
bigbZik/pytest
python
@pytest.fixture def cache(request): '\n Return a cache object that can persist state between testing sessions.\n\n cache.get(key, default)\n cache.set(key, value)\n\n Keys must be a ``/`` separated value, where the first part is usually the\n name of your plugin or application to avoid clashes with o...
def makedir(self, name): ' return a directory path object with the given name. If the\n directory does not yet exist, it will be created. You can use it\n to manage files likes e. g. store/retrieve database\n dumps across test sessions.\n\n :param name: must be a string not containing ...
-4,155,896,975,680,624,600
return a directory path object with the given name. If the directory does not yet exist, it will be created. You can use it to manage files likes e. g. store/retrieve database dumps across test sessions. :param name: must be a string not containing a ``/`` separator. Make sure the name contains your plugin or a...
src/_pytest/cacheprovider.py
makedir
bigbZik/pytest
python
def makedir(self, name): ' return a directory path object with the given name. If the\n directory does not yet exist, it will be created. You can use it\n to manage files likes e. g. store/retrieve database\n dumps across test sessions.\n\n :param name: must be a string not containing ...
def get(self, key, default): ' return cached value for the given key. If no value\n was yet cached or the value cannot be read, the specified\n default is returned.\n\n :param key: must be a ``/`` separated value. Usually the first\n name is the name of your plugin or your applicat...
1,390,270,008,379,693,000
return cached value for the given key. If no value was yet cached or the value cannot be read, the specified default is returned. :param key: must be a ``/`` separated value. Usually the first name is the name of your plugin or your application. :param default: must be provided in case of a cache-miss or in...
src/_pytest/cacheprovider.py
get
bigbZik/pytest
python
def get(self, key, default): ' return cached value for the given key. If no value\n was yet cached or the value cannot be read, the specified\n default is returned.\n\n :param key: must be a ``/`` separated value. Usually the first\n name is the name of your plugin or your applicat...
def set(self, key, value): ' save value for the given key.\n\n :param key: must be a ``/`` separated value. Usually the first\n name is the name of your plugin or your application.\n :param value: must be of any combination of basic\n python types, including nested types\n ...
1,058,034,138,620,027,000
save value for the given key. :param key: must be a ``/`` separated value. Usually the first name is the name of your plugin or your application. :param value: must be of any combination of basic python types, including nested types like e. g. lists of dictionaries.
src/_pytest/cacheprovider.py
set
bigbZik/pytest
python
def set(self, key, value): ' save value for the given key.\n\n :param key: must be a ``/`` separated value. Usually the first\n name is the name of your plugin or your application.\n :param value: must be of any combination of basic\n python types, including nested types\n ...
def __init__(self, policyId=None, policyType=None): '\n :param policyId: (Optional) 自动任务策略ID。\n :param policyType: (Optional) 自动任务策略类型,当前只支持 `AutoImage` 自动备份镜像。\n ' self.policyId = policyId self.policyType = policyType
-6,499,586,989,692,238,000
:param policyId: (Optional) 自动任务策略ID。 :param policyType: (Optional) 自动任务策略类型,当前只支持 `AutoImage` 自动备份镜像。
jdcloud_sdk/services/vm/models/Policy.py
__init__
jdcloud-api/jdcloud-sdk-python
python
def __init__(self, policyId=None, policyType=None): '\n :param policyId: (Optional) 自动任务策略ID。\n :param policyType: (Optional) 自动任务策略类型,当前只支持 `AutoImage` 自动备份镜像。\n ' self.policyId = policyId self.policyType = policyType
def _compute_delta(log_moments, eps): 'Compute delta for given log_moments and eps.\n\n Args:\n log_moments: the log moments of privacy loss, in the form of pairs\n of (moment_order, log_moment)\n eps: the target epsilon.\n Returns:\n delta\n ' min_delta = 1.0 for (moment_order, log_moment)...
8,862,847,200,555,492,000
Compute delta for given log_moments and eps. Args: log_moments: the log moments of privacy loss, in the form of pairs of (moment_order, log_moment) eps: the target epsilon. Returns: delta
CIFAR_tests/gaussian_moments.py
_compute_delta
DPBayes/ADADP
python
def _compute_delta(log_moments, eps): 'Compute delta for given log_moments and eps.\n\n Args:\n log_moments: the log moments of privacy loss, in the form of pairs\n of (moment_order, log_moment)\n eps: the target epsilon.\n Returns:\n delta\n ' min_delta = 1.0 for (moment_order, log_moment)...
def _compute_eps(log_moments, delta): 'Compute epsilon for given log_moments and delta.\n\n Args:\n log_moments: the log moments of privacy loss, in the form of pairs\n of (moment_order, log_moment)\n delta: the target delta.\n Returns:\n epsilon\n ' min_eps = float('inf') for (moment_order...
-6,687,883,152,029,463,000
Compute epsilon for given log_moments and delta. Args: log_moments: the log moments of privacy loss, in the form of pairs of (moment_order, log_moment) delta: the target delta. Returns: epsilon
CIFAR_tests/gaussian_moments.py
_compute_eps
DPBayes/ADADP
python
def _compute_eps(log_moments, delta): 'Compute epsilon for given log_moments and delta.\n\n Args:\n log_moments: the log moments of privacy loss, in the form of pairs\n of (moment_order, log_moment)\n delta: the target delta.\n Returns:\n epsilon\n ' min_eps = float('inf') for (moment_order...
def compute_log_moment(q, sigma, steps, lmbd, verify=False, verbose=False): 'Compute the log moment of Gaussian mechanism for given parameters.\n\n Args:\n q: the sampling ratio.\n sigma: the noise sigma.\n steps: the number of steps.\n lmbd: the moment order.\n verify: if False, only compute the sy...
-2,424,217,040,214,786,000
Compute the log moment of Gaussian mechanism for given parameters. Args: q: the sampling ratio. sigma: the noise sigma. steps: the number of steps. lmbd: the moment order. verify: if False, only compute the symbolic version. If True, computes both symbolic and numerical solutions and verifies the results...
CIFAR_tests/gaussian_moments.py
compute_log_moment
DPBayes/ADADP
python
def compute_log_moment(q, sigma, steps, lmbd, verify=False, verbose=False): 'Compute the log moment of Gaussian mechanism for given parameters.\n\n Args:\n q: the sampling ratio.\n sigma: the noise sigma.\n steps: the number of steps.\n lmbd: the moment order.\n verify: if False, only compute the sy...
def get_privacy_spent(log_moments, target_eps=None, target_delta=None): 'Compute delta (or eps) for given eps (or delta) from log moments.\n\n Args:\n log_moments: array of (moment_order, log_moment) pairs.\n target_eps: if not None, the epsilon for which we would like to compute\n corresponding delta v...
7,915,246,685,305,713,000
Compute delta (or eps) for given eps (or delta) from log moments. Args: log_moments: array of (moment_order, log_moment) pairs. target_eps: if not None, the epsilon for which we would like to compute corresponding delta value. target_delta: if not None, the delta for which we would like to compute corres...
CIFAR_tests/gaussian_moments.py
get_privacy_spent
DPBayes/ADADP
python
def get_privacy_spent(log_moments, target_eps=None, target_delta=None): 'Compute delta (or eps) for given eps (or delta) from log moments.\n\n Args:\n log_moments: array of (moment_order, log_moment) pairs.\n target_eps: if not None, the epsilon for which we would like to compute\n corresponding delta v...
def create(self, validated_data): 'Create a new user with encrypted password and return it' return get_user_model().objects.create_user(**validated_data)
-1,686,897,521,577,608,400
Create a new user with encrypted password and return it
app/user/serializers.py
create
siddharthisaiah/recipe-app-api
python
def create(self, validated_data): return get_user_model().objects.create_user(**validated_data)
def update(self, instance, validated_data): 'Update a user, setting the password correctly and return it' password = validated_data.pop('password', None) user = super().update(instance, validated_data) if password: user.set_password(password) user.save() return user
-203,708,244,252,171,460
Update a user, setting the password correctly and return it
app/user/serializers.py
update
siddharthisaiah/recipe-app-api
python
def update(self, instance, validated_data): password = validated_data.pop('password', None) user = super().update(instance, validated_data) if password: user.set_password(password) user.save() return user
def validate(self, attrs): 'Validate and authenticate the user' email = attrs.get('email') password = attrs.get('password') user = authenticate(request=self.context.get('request'), username=email, password=password) if (not user): msg = _('Unable to authenticate with provided credentials') ...
6,380,639,698,687,869,000
Validate and authenticate the user
app/user/serializers.py
validate
siddharthisaiah/recipe-app-api
python
def validate(self, attrs): email = attrs.get('email') password = attrs.get('password') user = authenticate(request=self.context.get('request'), username=email, password=password) if (not user): msg = _('Unable to authenticate with provided credentials') raise serializers.ValidationE...
def testProjectWorkflowStepDtoV2(self): 'Test ProjectWorkflowStepDtoV2' pass
5,664,496,987,346,935,000
Test ProjectWorkflowStepDtoV2
test/test_project_workflow_step_dto_v2.py
testProjectWorkflowStepDtoV2
unofficial-memsource/memsource-cli
python
def testProjectWorkflowStepDtoV2(self): pass
def binarize(tensor: tf.Tensor, bitsize: Optional[int]=None) -> tf.Tensor: 'Extract bits of values in `tensor`, returning a `tf.Tensor` with same\n dtype.' with tf.name_scope('binarize'): bitsize = (bitsize or (tensor.dtype.size * 8)) bit_indices_shape = (([1] * len(tensor.shape)) + [bitsize]) ...
3,900,341,414,611,682,300
Extract bits of values in `tensor`, returning a `tf.Tensor` with same dtype.
tf_encrypted/tensor/shared.py
binarize
Arash-Afshar/tf-encrypted
python
def binarize(tensor: tf.Tensor, bitsize: Optional[int]=None) -> tf.Tensor: 'Extract bits of values in `tensor`, returning a `tf.Tensor` with same\n dtype.' with tf.name_scope('binarize'): bitsize = (bitsize or (tensor.dtype.size * 8)) bit_indices_shape = (([1] * len(tensor.shape)) + [bitsize]) ...
def bits(tensor: tf.Tensor, bitsize: Optional[int]=None) -> list: 'Extract bits of values in `tensor`, returning a list of tensors.' with tf.name_scope('bits'): bitsize = (bitsize or (tensor.dtype.size * 8)) the_bits = [tf.bitwise.bitwise_and(tf.bitwise.right_shift(tensor, i), 1) for i in range(...
7,872,300,279,742,978,000
Extract bits of values in `tensor`, returning a list of tensors.
tf_encrypted/tensor/shared.py
bits
Arash-Afshar/tf-encrypted
python
def bits(tensor: tf.Tensor, bitsize: Optional[int]=None) -> list: with tf.name_scope('bits'): bitsize = (bitsize or (tensor.dtype.size * 8)) the_bits = [tf.bitwise.bitwise_and(tf.bitwise.right_shift(tensor, i), 1) for i in range(bitsize)] return the_bits
def im2col(x: Union[(tf.Tensor, np.ndarray)], h_filter: int, w_filter: int, padding: str, stride: int) -> tf.Tensor: 'Generic implementation of im2col on tf.Tensors.' with tf.name_scope('im2col'): nhwc_tensor = tf.transpose(x, [0, 2, 3, 1]) channels = int(nhwc_tensor.shape[3]) patch_tens...
426,579,149,317,277,900
Generic implementation of im2col on tf.Tensors.
tf_encrypted/tensor/shared.py
im2col
Arash-Afshar/tf-encrypted
python
def im2col(x: Union[(tf.Tensor, np.ndarray)], h_filter: int, w_filter: int, padding: str, stride: int) -> tf.Tensor: with tf.name_scope('im2col'): nhwc_tensor = tf.transpose(x, [0, 2, 3, 1]) channels = int(nhwc_tensor.shape[3]) patch_tensor = tf.extract_image_patches(nhwc_tensor, ksizes...
def conv2d(x: AbstractTensor, y: AbstractTensor, stride, padding) -> AbstractTensor: 'Generic convolution implementation with im2col over AbstractTensors.' with tf.name_scope('conv2d'): (h_filter, w_filter, in_filters, out_filters) = map(int, y.shape) (n_x, c_x, h_x, w_x) = map(int, x.shape) ...
-1,181,663,389,733,783,800
Generic convolution implementation with im2col over AbstractTensors.
tf_encrypted/tensor/shared.py
conv2d
Arash-Afshar/tf-encrypted
python
def conv2d(x: AbstractTensor, y: AbstractTensor, stride, padding) -> AbstractTensor: with tf.name_scope('conv2d'): (h_filter, w_filter, in_filters, out_filters) = map(int, y.shape) (n_x, c_x, h_x, w_x) = map(int, x.shape) if (c_x != in_filters): out_filters = in_filters ...
def _autolag(mod, endog, exog, startlag, maxlag, method, modargs=(), fitargs=(), regresults=False): "\n Returns the results for the lag length that maximizes the info criterion.\n\n Parameters\n ----------\n mod : Model class\n Model estimator class\n endog : array-like\n nobs array con...
-3,476,040,984,998,727,700
Returns the results for the lag length that maximizes the info criterion. Parameters ---------- mod : Model class Model estimator class endog : array-like nobs array containing endogenous variable exog : array-like nobs by (startlag + maxlag) array containing lags and possibly other variables startlag ...
statsmodels/tsa/stattools.py
_autolag
josef-pkt/statsmodels
python
def _autolag(mod, endog, exog, startlag, maxlag, method, modargs=(), fitargs=(), regresults=False): "\n Returns the results for the lag length that maximizes the info criterion.\n\n Parameters\n ----------\n mod : Model class\n Model estimator class\n endog : array-like\n nobs array con...
def adfuller(x, maxlag=None, regression='c', autolag='AIC', store=False, regresults=False): '\n Augmented Dickey-Fuller unit root test\n\n The Augmented Dickey-Fuller test can be used to test for a unit root in a\n univariate process in the presence of serial correlation.\n\n Parameters\n ----------\...
-4,962,697,273,032,497,000
Augmented Dickey-Fuller unit root test The Augmented Dickey-Fuller test can be used to test for a unit root in a univariate process in the presence of serial correlation. Parameters ---------- x : array_like, 1d data series maxlag : int Maximum lag which is included in test, default 12*(nobs/100)^{1/4} regres...
statsmodels/tsa/stattools.py
adfuller
josef-pkt/statsmodels
python
def adfuller(x, maxlag=None, regression='c', autolag='AIC', store=False, regresults=False): '\n Augmented Dickey-Fuller unit root test\n\n The Augmented Dickey-Fuller test can be used to test for a unit root in a\n univariate process in the presence of serial correlation.\n\n Parameters\n ----------\...
def acovf(x, unbiased=False, demean=True, fft=False, missing='none'): "\n Autocovariance for 1D\n\n Parameters\n ----------\n x : array\n Time series data. Must be 1d.\n unbiased : bool\n If True, then denominators is n-k, otherwise n\n demean : bool\n If True, then subtract t...
-5,403,537,379,756,743,000
Autocovariance for 1D Parameters ---------- x : array Time series data. Must be 1d. unbiased : bool If True, then denominators is n-k, otherwise n demean : bool If True, then subtract the mean x from each element of x fft : bool If True, use FFT convolution. This method should be preferred for lon...
statsmodels/tsa/stattools.py
acovf
josef-pkt/statsmodels
python
def acovf(x, unbiased=False, demean=True, fft=False, missing='none'): "\n Autocovariance for 1D\n\n Parameters\n ----------\n x : array\n Time series data. Must be 1d.\n unbiased : bool\n If True, then denominators is n-k, otherwise n\n demean : bool\n If True, then subtract t...
def q_stat(x, nobs, type='ljungbox'): "\n Return's Ljung-Box Q Statistic\n\n x : array-like\n Array of autocorrelation coefficients. Can be obtained from acf.\n nobs : int\n Number of observations in the entire sample (ie., not just the length\n of the autocorrelation function results...
-7,626,575,831,499,459,000
Return's Ljung-Box Q Statistic x : array-like Array of autocorrelation coefficients. Can be obtained from acf. nobs : int Number of observations in the entire sample (ie., not just the length of the autocorrelation function results. Returns ------- q-stat : array Ljung-Box Q-statistic for autocorrela...
statsmodels/tsa/stattools.py
q_stat
josef-pkt/statsmodels
python
def q_stat(x, nobs, type='ljungbox'): "\n Return's Ljung-Box Q Statistic\n\n x : array-like\n Array of autocorrelation coefficients. Can be obtained from acf.\n nobs : int\n Number of observations in the entire sample (ie., not just the length\n of the autocorrelation function results...
def acf(x, unbiased=False, nlags=40, qstat=False, fft=False, alpha=None, missing='none'): "\n Autocorrelation function for 1d arrays.\n\n Parameters\n ----------\n x : array\n Time series data\n unbiased : bool\n If True, then denominators for autocovariance are n-k, otherwise n\n nlag...
-6,031,796,841,099,306,000
Autocorrelation function for 1d arrays. Parameters ---------- x : array Time series data unbiased : bool If True, then denominators for autocovariance are n-k, otherwise n nlags: int, optional Number of lags to return autocorrelation for. qstat : bool, optional If True, returns the Ljung-Box q statistic ...
statsmodels/tsa/stattools.py
acf
josef-pkt/statsmodels
python
def acf(x, unbiased=False, nlags=40, qstat=False, fft=False, alpha=None, missing='none'): "\n Autocorrelation function for 1d arrays.\n\n Parameters\n ----------\n x : array\n Time series data\n unbiased : bool\n If True, then denominators for autocovariance are n-k, otherwise n\n nlag...
def pacf_yw(x, nlags=40, method='unbiased'): "Partial autocorrelation estimated with non-recursive yule_walker\n\n Parameters\n ----------\n x : 1d array\n observations of time series for which pacf is calculated\n nlags : int\n largest lag for which pacf is returned\n method : 'unbiase...
7,176,742,949,149,395,000
Partial autocorrelation estimated with non-recursive yule_walker Parameters ---------- x : 1d array observations of time series for which pacf is calculated nlags : int largest lag for which pacf is returned method : 'unbiased' (default) or 'mle' method for the autocovariance calculations in yule walker R...
statsmodels/tsa/stattools.py
pacf_yw
josef-pkt/statsmodels
python
def pacf_yw(x, nlags=40, method='unbiased'): "Partial autocorrelation estimated with non-recursive yule_walker\n\n Parameters\n ----------\n x : 1d array\n observations of time series for which pacf is calculated\n nlags : int\n largest lag for which pacf is returned\n method : 'unbiase...
def pacf_ols(x, nlags=40): 'Calculate partial autocorrelations\n\n Parameters\n ----------\n x : 1d array\n observations of time series for which pacf is calculated\n nlags : int\n Number of lags for which pacf is returned. Lag 0 is not returned.\n\n Returns\n -------\n pacf : 1d...
6,238,843,439,734,900,000
Calculate partial autocorrelations Parameters ---------- x : 1d array observations of time series for which pacf is calculated nlags : int Number of lags for which pacf is returned. Lag 0 is not returned. Returns ------- pacf : 1d array partial autocorrelations, maxlag+1 elements Notes ----- This solves...
statsmodels/tsa/stattools.py
pacf_ols
josef-pkt/statsmodels
python
def pacf_ols(x, nlags=40): 'Calculate partial autocorrelations\n\n Parameters\n ----------\n x : 1d array\n observations of time series for which pacf is calculated\n nlags : int\n Number of lags for which pacf is returned. Lag 0 is not returned.\n\n Returns\n -------\n pacf : 1d...
def pacf(x, nlags=40, method='ywunbiased', alpha=None): "\n Partial autocorrelation estimated\n\n Parameters\n ----------\n x : 1d array\n observations of time series for which pacf is calculated\n nlags : int\n largest lag for which pacf is returned\n method : {'ywunbiased', 'ywmle'...
2,415,925,801,062,447,000
Partial autocorrelation estimated Parameters ---------- x : 1d array observations of time series for which pacf is calculated nlags : int largest lag for which pacf is returned method : {'ywunbiased', 'ywmle', 'ols'} specifies which method for the calculations to use: - yw or ywunbiased : yule walker ...
statsmodels/tsa/stattools.py
pacf
josef-pkt/statsmodels
python
def pacf(x, nlags=40, method='ywunbiased', alpha=None): "\n Partial autocorrelation estimated\n\n Parameters\n ----------\n x : 1d array\n observations of time series for which pacf is calculated\n nlags : int\n largest lag for which pacf is returned\n method : {'ywunbiased', 'ywmle'...
def ccovf(x, y, unbiased=True, demean=True): ' crosscovariance for 1D\n\n Parameters\n ----------\n x, y : arrays\n time series data\n unbiased : boolean\n if True, then denominators is n-k, otherwise n\n\n Returns\n -------\n ccovf : array\n autocovariance function\n\n No...
4,675,003,449,293,840,000
crosscovariance for 1D Parameters ---------- x, y : arrays time series data unbiased : boolean if True, then denominators is n-k, otherwise n Returns ------- ccovf : array autocovariance function Notes ----- This uses np.correlate which does full convolution. For very long time series it is recommended to ...
statsmodels/tsa/stattools.py
ccovf
josef-pkt/statsmodels
python
def ccovf(x, y, unbiased=True, demean=True): ' crosscovariance for 1D\n\n Parameters\n ----------\n x, y : arrays\n time series data\n unbiased : boolean\n if True, then denominators is n-k, otherwise n\n\n Returns\n -------\n ccovf : array\n autocovariance function\n\n No...
def ccf(x, y, unbiased=True): 'cross-correlation function for 1d\n\n Parameters\n ----------\n x, y : arrays\n time series data\n unbiased : boolean\n if True, then denominators for autocovariance is n-k, otherwise n\n\n Returns\n -------\n ccf : array\n cross-correlation fun...
-2,296,032,143,774,643,000
cross-correlation function for 1d Parameters ---------- x, y : arrays time series data unbiased : boolean if True, then denominators for autocovariance is n-k, otherwise n Returns ------- ccf : array cross-correlation function of x and y Notes ----- This is based np.correlate which does full convolution. F...
statsmodels/tsa/stattools.py
ccf
josef-pkt/statsmodels
python
def ccf(x, y, unbiased=True): 'cross-correlation function for 1d\n\n Parameters\n ----------\n x, y : arrays\n time series data\n unbiased : boolean\n if True, then denominators for autocovariance is n-k, otherwise n\n\n Returns\n -------\n ccf : array\n cross-correlation fun...
def periodogram(X): '\n Returns the periodogram for the natural frequency of X\n\n Parameters\n ----------\n X : array-like\n Array for which the periodogram is desired.\n\n Returns\n -------\n pgram : array\n 1./len(X) * np.abs(np.fft.fft(X))**2\n\n\n References\n ---------...
6,612,493,813,122,968,000
Returns the periodogram for the natural frequency of X Parameters ---------- X : array-like Array for which the periodogram is desired. Returns ------- pgram : array 1./len(X) * np.abs(np.fft.fft(X))**2 References ---------- Brockwell and Davis.
statsmodels/tsa/stattools.py
periodogram
josef-pkt/statsmodels
python
def periodogram(X): '\n Returns the periodogram for the natural frequency of X\n\n Parameters\n ----------\n X : array-like\n Array for which the periodogram is desired.\n\n Returns\n -------\n pgram : array\n 1./len(X) * np.abs(np.fft.fft(X))**2\n\n\n References\n ---------...
def levinson_durbin(s, nlags=10, isacov=False): 'Levinson-Durbin recursion for autoregressive processes\n\n Parameters\n ----------\n s : array_like\n If isacov is False, then this is the time series. If iasacov is true\n then this is interpreted as autocovariance starting with lag 0\n nla...
-1,512,750,122,343,626,200
Levinson-Durbin recursion for autoregressive processes Parameters ---------- s : array_like If isacov is False, then this is the time series. If iasacov is true then this is interpreted as autocovariance starting with lag 0 nlags : integer largest lag to include in recursion or order of the autoregressive ...
statsmodels/tsa/stattools.py
levinson_durbin
josef-pkt/statsmodels
python
def levinson_durbin(s, nlags=10, isacov=False): 'Levinson-Durbin recursion for autoregressive processes\n\n Parameters\n ----------\n s : array_like\n If isacov is False, then this is the time series. If iasacov is true\n then this is interpreted as autocovariance starting with lag 0\n nla...