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 get_api_key(): ' Get secret api key from a file on filesystem ' paren_dir = os.path.dirname(os.path.realpath(__file__)) api_path = os.path.join(paren_dir, 'weather_api.txt') with open(api_path, 'r') as file: api_key = file.read().replace('\n', '') return api_key
239,451,994,047,830,600
Get secret api key from a file on filesystem
.config/polybar/weather/weather.py
get_api_key
NearHuscarl/dotfiles
python
def get_api_key(): ' ' paren_dir = os.path.dirname(os.path.realpath(__file__)) api_path = os.path.join(paren_dir, 'weather_api.txt') with open(api_path, 'r') as file: api_key = file.read().replace('\n', ) return api_key
def get_city_id(): ' Workaround to get city id based on my schedule ' region_code = {'TPHCM': 1580578, 'TPHCM2': 1566083, 'Hai Duong': 1581326, 'Tan An': 1567069} hour = int(datetime.datetime.now().strftime('%H')) weekday = datetime.datetime.now().strftime('%a') if (((hour >= 17) and (weekday == 'Fr...
-7,807,401,822,778,362,000
Workaround to get city id based on my schedule
.config/polybar/weather/weather.py
get_city_id
NearHuscarl/dotfiles
python
def get_city_id(): ' ' region_code = {'TPHCM': 1580578, 'TPHCM2': 1566083, 'Hai Duong': 1581326, 'Tan An': 1567069} hour = int(datetime.datetime.now().strftime('%H')) weekday = datetime.datetime.now().strftime('%a') if (((hour >= 17) and (weekday == 'Fri')) or (weekday == 'Sat') or ((hour < 17) and...
def update_weather(city_id, units, api_key): ' Update weather by using openweather api ' url = 'http://api.openweathermap.org/data/2.5/weather?id={}&appid={}&units={}' temp_unit = ('C' if (units == 'metric') else 'K') error_icon = color_polybar('\ue2c1', 'red') try: req = requests.get(url.fo...
6,975,599,857,060,252,000
Update weather by using openweather api
.config/polybar/weather/weather.py
update_weather
NearHuscarl/dotfiles
python
def update_weather(city_id, units, api_key): ' ' url = 'http://api.openweathermap.org/data/2.5/weather?id={}&appid={}&units={}' temp_unit = ('C' if (units == 'metric') else 'K') error_icon = color_polybar('\ue2c1', 'red') try: req = requests.get(url.format(city_id, api_key, units)) ...
def main(): ' main function ' arg = get_args() if (arg.log == 'debug'): set_up_logging() units = arg.unit api_key = get_api_key() city_id = get_city_id() while True: try: update_weather(city_id, units, api_key) except MyInternetIsShitty: loggin...
-4,733,848,066,255,199,000
main function
.config/polybar/weather/weather.py
main
NearHuscarl/dotfiles
python
def main(): ' ' arg = get_args() if (arg.log == 'debug'): set_up_logging() units = arg.unit api_key = get_api_key() city_id = get_city_id() while True: try: update_weather(city_id, units, api_key) except MyInternetIsShitty: logging.info(cb('up...
def run_server(server_port): 'Run the UDP pinger server\n ' with Socket(socket.AF_INET, socket.SOCK_DGRAM) as server_socket: server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_socket.bind(('', server_port)) print('Ping server ready on port', server_port) ...
6,592,167,236,038,547,000
Run the UDP pinger server
ping/ping.py
run_server
akshayrb22/Kurose-and-Ross-socket-programming-exercises
python
def run_server(server_port): '\n ' with Socket(socket.AF_INET, socket.SOCK_DGRAM) as server_socket: server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) server_socket.bind((, server_port)) print('Ping server ready on port', server_port) while True: (...
def run_client(server_address, server_port): 'Ping a UDP pinger server running at the given address\n ' raise NotImplementedError return 0
-7,235,053,255,711,612,000
Ping a UDP pinger server running at the given address
ping/ping.py
run_client
akshayrb22/Kurose-and-Ross-socket-programming-exercises
python
def run_client(server_address, server_port): '\n ' raise NotImplementedError return 0
def _calculate_reciprocal_rank(self, hypothesis_ids: np.ndarray, reference_id: int) -> float: 'Calculate the reciprocal rank for a given hypothesis and reference\n \n Params:\n hypothesis_ids: Iterator of hypothesis ids (as numpy array) ordered by its relevance\n ...
-8,653,979,882,358,909,000
Calculate the reciprocal rank for a given hypothesis and reference Params: hypothesis_ids: Iterator of hypothesis ids (as numpy array) ordered by its relevance reference_id: Reference id (as a integer) of the correct id of response Returns: reciprocal rank
tasks/retriever/mrr.py
_calculate_reciprocal_rank
platiagro/tasks
python
def _calculate_reciprocal_rank(self, hypothesis_ids: np.ndarray, reference_id: int) -> float: 'Calculate the reciprocal rank for a given hypothesis and reference\n \n Params:\n hypothesis_ids: Iterator of hypothesis ids (as numpy array) ordered by its relevance\n ...
def forward(self, batch_hypothesis_ids: List[np.ndarray], batch_reference_id: List[int]) -> float: 'Score the mean reciprocal rank for the batch\n \n Example from http://en.wikipedia.org/wiki/Mean_reciprocal_rank\n \n >>> batch_hypothesis_ids = [[1, 0, 2], [0, 2, 1], [1, ...
-4,246,488,428,252,922,400
Score the mean reciprocal rank for the batch Example from http://en.wikipedia.org/wiki/Mean_reciprocal_rank >>> batch_hypothesis_ids = [[1, 0, 2], [0, 2, 1], [1, 0, 2]] >>> batch_reference_id = [2, 2, 1] >>> mrr = MRR() >>> mrr(batch_hypothesis_ids, batch_reference_id) 0.61111111111111105 Args: batch_hypothe...
tasks/retriever/mrr.py
forward
platiagro/tasks
python
def forward(self, batch_hypothesis_ids: List[np.ndarray], batch_reference_id: List[int]) -> float: 'Score the mean reciprocal rank for the batch\n \n Example from http://en.wikipedia.org/wiki/Mean_reciprocal_rank\n \n >>> batch_hypothesis_ids = [[1, 0, 2], [0, 2, 1], [1, ...
def get_oof_pred_proba(self, X, normalize=None, **kwargs): 'X should be the same X passed to `.fit`' y_oof_pred_proba = self._get_oof_pred_proba(X=X, **kwargs) if (normalize is None): normalize = self.normalize_pred_probas if normalize: y_oof_pred_proba = normalize_pred_probas(y_oof_pred...
-8,436,748,996,598,062,000
X should be the same X passed to `.fit`
tabular/src/autogluon/tabular/models/knn/knn_model.py
get_oof_pred_proba
taesup-aws/autogluon
python
def get_oof_pred_proba(self, X, normalize=None, **kwargs): y_oof_pred_proba = self._get_oof_pred_proba(X=X, **kwargs) if (normalize is None): normalize = self.normalize_pred_probas if normalize: y_oof_pred_proba = normalize_pred_probas(y_oof_pred_proba, self.problem_type) y_oof_pred...
def _fit_with_samples(self, X, y, time_limit, start_samples=10000, max_samples=None, sample_growth_factor=2, sample_time_growth_factor=8): '\n Fit model with samples of the data repeatedly, gradually increasing the amount of data until time_limit is reached or all data is used.\n\n X and y must alread...
7,872,693,222,056,237,000
Fit model with samples of the data repeatedly, gradually increasing the amount of data until time_limit is reached or all data is used. X and y must already be preprocessed. Parameters ---------- X : np.ndarray The training data features (preprocessed). y : Series The training data ground truth labels. time_l...
tabular/src/autogluon/tabular/models/knn/knn_model.py
_fit_with_samples
taesup-aws/autogluon
python
def _fit_with_samples(self, X, y, time_limit, start_samples=10000, max_samples=None, sample_growth_factor=2, sample_time_growth_factor=8): '\n Fit model with samples of the data repeatedly, gradually increasing the amount of data until time_limit is reached or all data is used.\n\n X and y must alread...
def naked_twins(values): "Eliminate values using the naked twins strategy.\n\n The naked twins strategy says that if you have two or more unallocated boxes\n in a unit and there are only two digits that can go in those two boxes, then\n those two digits can be eliminated from the possible assignments of al...
-1,691,231,728,503,389,700
Eliminate values using the naked twins strategy. The naked twins strategy says that if you have two or more unallocated boxes in a unit and there are only two digits that can go in those two boxes, then those two digits can be eliminated from the possible assignments of all other boxes in the same unit. Parameters --...
Projects/1_Sudoku/solution.py
naked_twins
justinlnx/artificial-intelligence
python
def naked_twins(values): "Eliminate values using the naked twins strategy.\n\n The naked twins strategy says that if you have two or more unallocated boxes\n in a unit and there are only two digits that can go in those two boxes, then\n those two digits can be eliminated from the possible assignments of al...
def eliminate(values): "Apply the eliminate strategy to a Sudoku puzzle\n\n The eliminate strategy says that if a box has a value assigned, then none\n of the peers of that box can have the same value.\n\n Parameters\n ----------\n values(dict)\n a dictionary of the form {'box_name': '12345678...
1,745,120,404,089,232,000
Apply the eliminate strategy to a Sudoku puzzle The eliminate strategy says that if a box has a value assigned, then none of the peers of that box can have the same value. Parameters ---------- values(dict) a dictionary of the form {'box_name': '123456789', ...} Returns ------- dict The values dictionary wit...
Projects/1_Sudoku/solution.py
eliminate
justinlnx/artificial-intelligence
python
def eliminate(values): "Apply the eliminate strategy to a Sudoku puzzle\n\n The eliminate strategy says that if a box has a value assigned, then none\n of the peers of that box can have the same value.\n\n Parameters\n ----------\n values(dict)\n a dictionary of the form {'box_name': '12345678...
def only_choice(values): "Apply the only choice strategy to a Sudoku puzzle\n\n The only choice strategy says that if only one box in a unit allows a certain\n digit, then that box must be assigned that digit.\n\n Parameters\n ----------\n values(dict)\n a dictionary of the form {'box_name': '...
-4,383,931,250,168,897,500
Apply the only choice strategy to a Sudoku puzzle The only choice strategy says that if only one box in a unit allows a certain digit, then that box must be assigned that digit. Parameters ---------- values(dict) a dictionary of the form {'box_name': '123456789', ...} Returns ------- dict The values dictiona...
Projects/1_Sudoku/solution.py
only_choice
justinlnx/artificial-intelligence
python
def only_choice(values): "Apply the only choice strategy to a Sudoku puzzle\n\n The only choice strategy says that if only one box in a unit allows a certain\n digit, then that box must be assigned that digit.\n\n Parameters\n ----------\n values(dict)\n a dictionary of the form {'box_name': '...
def reduce_puzzle(values): "Reduce a Sudoku puzzle by repeatedly applying all constraint strategies\n\n Parameters\n ----------\n values(dict)\n a dictionary of the form {'box_name': '123456789', ...}\n\n Returns\n -------\n dict or False\n The values dictionary after continued appli...
-3,851,804,040,853,470,000
Reduce a Sudoku puzzle by repeatedly applying all constraint strategies Parameters ---------- values(dict) a dictionary of the form {'box_name': '123456789', ...} Returns ------- dict or False The values dictionary after continued application of the constraint strategies no longer produces any changes, or...
Projects/1_Sudoku/solution.py
reduce_puzzle
justinlnx/artificial-intelligence
python
def reduce_puzzle(values): "Reduce a Sudoku puzzle by repeatedly applying all constraint strategies\n\n Parameters\n ----------\n values(dict)\n a dictionary of the form {'box_name': '123456789', ...}\n\n Returns\n -------\n dict or False\n The values dictionary after continued appli...
def search(values): "Apply depth first search to solve Sudoku puzzles in order to solve puzzles\n that cannot be solved by repeated reduction alone.\n\n Parameters\n ----------\n values(dict)\n a dictionary of the form {'box_name': '123456789', ...}\n\n Returns\n -------\n dict or False\...
-5,391,375,916,073,540,000
Apply depth first search to solve Sudoku puzzles in order to solve puzzles that cannot be solved by repeated reduction alone. Parameters ---------- values(dict) a dictionary of the form {'box_name': '123456789', ...} Returns ------- dict or False The values dictionary with all boxes assigned or False Notes -...
Projects/1_Sudoku/solution.py
search
justinlnx/artificial-intelligence
python
def search(values): "Apply depth first search to solve Sudoku puzzles in order to solve puzzles\n that cannot be solved by repeated reduction alone.\n\n Parameters\n ----------\n values(dict)\n a dictionary of the form {'box_name': '123456789', ...}\n\n Returns\n -------\n dict or False\...
def solve(grid): "Find the solution to a Sudoku puzzle using search and constraint propagation\n\n Parameters\n ----------\n grid(string)\n a string representing a sudoku grid.\n \n Ex. '2.............62....1....7...6..8...3...9...7...6..4...4....8....52.............3'\n\n Returns\n...
7,617,055,493,705,177,000
Find the solution to a Sudoku puzzle using search and constraint propagation Parameters ---------- grid(string) a string representing a sudoku grid. Ex. '2.............62....1....7...6..8...3...9...7...6..4...4....8....52.............3' Returns ------- dict or False The dictionary representation of t...
Projects/1_Sudoku/solution.py
solve
justinlnx/artificial-intelligence
python
def solve(grid): "Find the solution to a Sudoku puzzle using search and constraint propagation\n\n Parameters\n ----------\n grid(string)\n a string representing a sudoku grid.\n \n Ex. '2.............62....1....7...6..8...3...9...7...6..4...4....8....52.............3'\n\n Returns\n...
def basic_argument_parser(distributed=True, requires_config_file=True, requires_output_dir=True): ' Basic cli tool parser for Detectron2Go binaries ' parser = argparse.ArgumentParser(description='PyTorch Object Detection Training') parser.add_argument('--runner', type=str, default='d2go.runner.GeneralizedRC...
-3,745,655,481,647,895,000
Basic cli tool parser for Detectron2Go binaries
d2go/setup.py
basic_argument_parser
Dinesh101041/d2go
python
def basic_argument_parser(distributed=True, requires_config_file=True, requires_output_dir=True): ' ' parser = argparse.ArgumentParser(description='PyTorch Object Detection Training') parser.add_argument('--runner', type=str, default='d2go.runner.GeneralizedRCNNRunner', help='Full class name, i.e. (package...
def create_cfg_from_cli_args(args, default_cfg): "\n Instead of loading from defaults.py, this binary only includes necessary\n configs building from scratch, and overrides them from args. There're two\n levels of config:\n _C: the config system used by this binary, which is a sub-set of training\n ...
1,567,503,064,963,738,400
Instead of loading from defaults.py, this binary only includes necessary configs building from scratch, and overrides them from args. There're two levels of config: _C: the config system used by this binary, which is a sub-set of training config, override by configurable_cfg. It can also be override by ...
d2go/setup.py
create_cfg_from_cli_args
Dinesh101041/d2go
python
def create_cfg_from_cli_args(args, default_cfg): "\n Instead of loading from defaults.py, this binary only includes necessary\n configs building from scratch, and overrides them from args. There're two\n levels of config:\n _C: the config system used by this binary, which is a sub-set of training\n ...
def prepare_for_launch(args): '\n Load config, figure out working directory, create runner.\n - when args.config_file is empty, returned cfg will be the default one\n - returned output_dir will always be non empty, args.output_dir has higher\n priority than cfg.OUTPUT_DIR.\n ' pri...
8,141,107,573,497,229,000
Load config, figure out working directory, create runner. - when args.config_file is empty, returned cfg will be the default one - returned output_dir will always be non empty, args.output_dir has higher priority than cfg.OUTPUT_DIR.
d2go/setup.py
prepare_for_launch
Dinesh101041/d2go
python
def prepare_for_launch(args): '\n Load config, figure out working directory, create runner.\n - when args.config_file is empty, returned cfg will be the default one\n - returned output_dir will always be non empty, args.output_dir has higher\n priority than cfg.OUTPUT_DIR.\n ' pri...
def setup_after_launch(cfg, output_dir, runner): '\n Set things up after entering DDP, including\n - creating working directory\n - setting up logger\n - logging environment\n - initializing runner\n ' create_dir_on_global_main_process(output_dir) comm.synchronize() set...
-8,754,067,670,595,316,000
Set things up after entering DDP, including - creating working directory - setting up logger - logging environment - initializing runner
d2go/setup.py
setup_after_launch
Dinesh101041/d2go
python
def setup_after_launch(cfg, output_dir, runner): '\n Set things up after entering DDP, including\n - creating working directory\n - setting up logger\n - logging environment\n - initializing runner\n ' create_dir_on_global_main_process(output_dir) comm.synchronize() set...
def __init__(self, main_window, palette): "\n Creates a new window for user to input\n which regions to add to scene.\n\n Arguments:\n ----------\n\n main_window: reference to the App's main window\n palette: main_window's palette, used to style widg...
2,832,295,261,314,470,000
Creates a new window for user to input which regions to add to scene. Arguments: ---------- main_window: reference to the App's main window palette: main_window's palette, used to style widgets
brainrender_gui/widgets/add_regions.py
__init__
brainglobe/bg-brainrender-gui
python
def __init__(self, main_window, palette): "\n Creates a new window for user to input\n which regions to add to scene.\n\n Arguments:\n ----------\n\n main_window: reference to the App's main window\n palette: main_window's palette, used to style widg...
def ui(self): "\n Define UI's elements\n " self.setGeometry(self.left, self.top, self.width, self.height) layout = QVBoxLayout() label = QLabel(self) label.setObjectName('PopupLabel') label.setText(self.label_msg) self.textbox = QLineEdit(self) alpha_label = QLabel(self...
-7,489,549,448,365,388,000
Define UI's elements
brainrender_gui/widgets/add_regions.py
ui
brainglobe/bg-brainrender-gui
python
def ui(self): "\n \n " self.setGeometry(self.left, self.top, self.width, self.height) layout = QVBoxLayout() label = QLabel(self) label.setObjectName('PopupLabel') label.setText(self.label_msg) self.textbox = QLineEdit(self) alpha_label = QLabel(self) alpha_label.se...
def on_click(self): "\n On click or 'Enter' get the regions\n from the input and call the add_regions\n method of the main window\n " regions = self.textbox.text().split(' ') self.main_window.add_regions(regions, self.alpha_textbox.text(), self.color_textbox.text()) ...
-1,581,329,918,703,527,000
On click or 'Enter' get the regions from the input and call the add_regions method of the main window
brainrender_gui/widgets/add_regions.py
on_click
brainglobe/bg-brainrender-gui
python
def on_click(self): "\n On click or 'Enter' get the regions\n from the input and call the add_regions\n method of the main window\n " regions = self.textbox.text().split(' ') self.main_window.add_regions(regions, self.alpha_textbox.text(), self.color_textbox.text()) ...
def update_user_data(): 'Update user_data to enable or disable Telemetry.\n\n If employment data has been changed Telemetry might be switched on\n automatically. The opt-in decision is taken for the new employee. Non employees\n will have an option to enable data collection.\n ' is_employee_changed ...
4,639,693,185,802,704,000
Update user_data to enable or disable Telemetry. If employment data has been changed Telemetry might be switched on automatically. The opt-in decision is taken for the new employee. Non employees will have an option to enable data collection.
mozphab/telemetry.py
update_user_data
cgsheeh/review
python
def update_user_data(): 'Update user_data to enable or disable Telemetry.\n\n If employment data has been changed Telemetry might be switched on\n automatically. The opt-in decision is taken for the new employee. Non employees\n will have an option to enable data collection.\n ' is_employee_changed ...
def __init__(self): 'Initiate Glean, load pings and metrics.' import glean logging.getLogger('glean').setLevel(logging.DEBUG) logger.debug('Initializing Glean...') glean.Glean.initialize(application_id='MozPhab', application_version=MOZPHAB_VERSION, upload_enabled=True, configuration=glean.Configura...
-7,231,570,573,987,132,000
Initiate Glean, load pings and metrics.
mozphab/telemetry.py
__init__
cgsheeh/review
python
def __init__(self): import glean logging.getLogger('glean').setLevel(logging.DEBUG) logger.debug('Initializing Glean...') glean.Glean.initialize(application_id='MozPhab', application_version=MOZPHAB_VERSION, upload_enabled=True, configuration=glean.Configuration(), data_dir=(Path(environment.MOZBUI...
def _set_os(self): 'Collect human readable information about the OS version.\n\n For Linux it is setting a distribution name and version.\n ' (system, node, release, version, machine, processor) = platform.uname() if (system == 'Linux'): (distribution_name, distribution_number, _) = di...
-6,868,257,696,406,971,000
Collect human readable information about the OS version. For Linux it is setting a distribution name and version.
mozphab/telemetry.py
_set_os
cgsheeh/review
python
def _set_os(self): 'Collect human readable information about the OS version.\n\n For Linux it is setting a distribution name and version.\n ' (system, node, release, version, machine, processor) = platform.uname() if (system == 'Linux'): (distribution_name, distribution_number, _) = di...
def set_metrics(self, args): 'Sets metrics common to all commands.' self.usage.command.set(args.command) self._set_os() self._set_python() self.usage.override_switch.set((getattr(args, 'force_vcs', False) or getattr(args, 'force', False))) self.usage.command_time.start() self.user.installati...
-1,575,089,079,134,722,300
Sets metrics common to all commands.
mozphab/telemetry.py
set_metrics
cgsheeh/review
python
def set_metrics(self, args): self.usage.command.set(args.command) self._set_os() self._set_python() self.usage.override_switch.set((getattr(args, 'force_vcs', False) or getattr(args, 'force', False))) self.usage.command_time.start() self.user.installation.set(user_data.installation_id) ...
def binary_image_to_lut_indices(x): '\n Convert a binary image to an index image that can be used with a lookup table\n to perform morphological operations. Non-zero elements in the image are interpreted\n as 1, zero elements as 0\n\n :param x: a 2D NumPy array.\n :return: a 2D NumPy array, same shap...
-7,441,921,039,338,985,000
Convert a binary image to an index image that can be used with a lookup table to perform morphological operations. Non-zero elements in the image are interpreted as 1, zero elements as 0 :param x: a 2D NumPy array. :return: a 2D NumPy array, same shape as x
Benchmarking/bsds500/bsds/thin.py
binary_image_to_lut_indices
CipiOrhei/eecvf
python
def binary_image_to_lut_indices(x): '\n Convert a binary image to an index image that can be used with a lookup table\n to perform morphological operations. Non-zero elements in the image are interpreted\n as 1, zero elements as 0\n\n :param x: a 2D NumPy array.\n :return: a 2D NumPy array, same shap...
def apply_lut(x, lut): '\n Perform a morphological operation on the binary image x using the supplied lookup table\n :param x:\n :param lut:\n :return:\n ' if (lut.ndim != 1): raise ValueError('lut should have 1 dimension, not {}'.format(lut.ndim)) if (lut.shape[0] != 512): ra...
-4,490,145,918,969,152,000
Perform a morphological operation on the binary image x using the supplied lookup table :param x: :param lut: :return:
Benchmarking/bsds500/bsds/thin.py
apply_lut
CipiOrhei/eecvf
python
def apply_lut(x, lut): '\n Perform a morphological operation on the binary image x using the supplied lookup table\n :param x:\n :param lut:\n :return:\n ' if (lut.ndim != 1): raise ValueError('lut should have 1 dimension, not {}'.format(lut.ndim)) if (lut.shape[0] != 512): ra...
def identity_lut(): '\n Create identity lookup tablef\n :return:\n ' lut = np.zeros((512,), dtype=bool) inds = np.arange(512) lut[((inds & NEIGH_MASK_CENTRE) != 0)] = True return lut
-3,448,551,723,326,318,600
Create identity lookup tablef :return:
Benchmarking/bsds500/bsds/thin.py
identity_lut
CipiOrhei/eecvf
python
def identity_lut(): '\n Create identity lookup tablef\n :return:\n ' lut = np.zeros((512,), dtype=bool) inds = np.arange(512) lut[((inds & NEIGH_MASK_CENTRE) != 0)] = True return lut
def _lut_mutate_mask(lut): '\n Get a mask that shows which neighbourhood shapes result in changes to the image\n :param lut: lookup table\n :return: mask indicating which lookup indices result in changes\n ' return (lut != identity_lut())
-1,491,527,051,737,313,000
Get a mask that shows which neighbourhood shapes result in changes to the image :param lut: lookup table :return: mask indicating which lookup indices result in changes
Benchmarking/bsds500/bsds/thin.py
_lut_mutate_mask
CipiOrhei/eecvf
python
def _lut_mutate_mask(lut): '\n Get a mask that shows which neighbourhood shapes result in changes to the image\n :param lut: lookup table\n :return: mask indicating which lookup indices result in changes\n ' return (lut != identity_lut())
def lut_masks_zero(neigh): '\n Create a LUT index mask for which the specified neighbour is 0\n :param neigh: neighbour index; counter-clockwise from 1 staring at the eastern neighbour\n :return: a LUT index mask\n ' if (neigh > 8): neigh -= 8 return ((_LUT_INDS & MASKS[neigh]) == 0)
7,111,937,062,312,660,000
Create a LUT index mask for which the specified neighbour is 0 :param neigh: neighbour index; counter-clockwise from 1 staring at the eastern neighbour :return: a LUT index mask
Benchmarking/bsds500/bsds/thin.py
lut_masks_zero
CipiOrhei/eecvf
python
def lut_masks_zero(neigh): '\n Create a LUT index mask for which the specified neighbour is 0\n :param neigh: neighbour index; counter-clockwise from 1 staring at the eastern neighbour\n :return: a LUT index mask\n ' if (neigh > 8): neigh -= 8 return ((_LUT_INDS & MASKS[neigh]) == 0)
def lut_masks_one(neigh): '\n Create a LUT index mask for which the specified neighbour is 1\n :param neigh: neighbour index; counter-clockwise from 1 staring at the eastern neighbour\n :return: a LUT index mask\n ' if (neigh > 8): neigh -= 8 return ((_LUT_INDS & MASKS[neigh]) != 0)
6,568,589,080,645,123,000
Create a LUT index mask for which the specified neighbour is 1 :param neigh: neighbour index; counter-clockwise from 1 staring at the eastern neighbour :return: a LUT index mask
Benchmarking/bsds500/bsds/thin.py
lut_masks_one
CipiOrhei/eecvf
python
def lut_masks_one(neigh): '\n Create a LUT index mask for which the specified neighbour is 1\n :param neigh: neighbour index; counter-clockwise from 1 staring at the eastern neighbour\n :return: a LUT index mask\n ' if (neigh > 8): neigh -= 8 return ((_LUT_INDS & MASKS[neigh]) != 0)
def _thin_cond_g1(): '\n Thinning morphological operation; condition G1\n :return: a LUT index mask\n ' b = np.zeros(512, dtype=int) for i in range(1, 5): b += (lut_masks_zero(((2 * i) - 1)) & (lut_masks_one((2 * i)) | lut_masks_one(((2 * i) + 1)))) return (b == 1)
7,932,152,981,081,950,000
Thinning morphological operation; condition G1 :return: a LUT index mask
Benchmarking/bsds500/bsds/thin.py
_thin_cond_g1
CipiOrhei/eecvf
python
def _thin_cond_g1(): '\n Thinning morphological operation; condition G1\n :return: a LUT index mask\n ' b = np.zeros(512, dtype=int) for i in range(1, 5): b += (lut_masks_zero(((2 * i) - 1)) & (lut_masks_one((2 * i)) | lut_masks_one(((2 * i) + 1)))) return (b == 1)
def _thin_cond_g2(): '\n Thinning morphological operation; condition G2\n :return: a LUT index mask\n ' n1 = np.zeros(512, dtype=int) n2 = np.zeros(512, dtype=int) for k in range(1, 5): n1 += (lut_masks_one(((2 * k) - 1)) | lut_masks_one((2 * k))) n2 += (lut_masks_one((2 * k)) |...
5,711,260,385,655,939,000
Thinning morphological operation; condition G2 :return: a LUT index mask
Benchmarking/bsds500/bsds/thin.py
_thin_cond_g2
CipiOrhei/eecvf
python
def _thin_cond_g2(): '\n Thinning morphological operation; condition G2\n :return: a LUT index mask\n ' n1 = np.zeros(512, dtype=int) n2 = np.zeros(512, dtype=int) for k in range(1, 5): n1 += (lut_masks_one(((2 * k) - 1)) | lut_masks_one((2 * k))) n2 += (lut_masks_one((2 * k)) |...
def _thin_cond_g3(): '\n Thinning morphological operation; condition G3\n :return: a LUT index mask\n ' return ((((lut_masks_one(2) | lut_masks_one(3)) | lut_masks_zero(8)) & lut_masks_one(1)) == 0)
-1,797,199,284,587,221,000
Thinning morphological operation; condition G3 :return: a LUT index mask
Benchmarking/bsds500/bsds/thin.py
_thin_cond_g3
CipiOrhei/eecvf
python
def _thin_cond_g3(): '\n Thinning morphological operation; condition G3\n :return: a LUT index mask\n ' return ((((lut_masks_one(2) | lut_masks_one(3)) | lut_masks_zero(8)) & lut_masks_one(1)) == 0)
def _thin_cond_g3_prime(): "\n Thinning morphological operation; condition G3'\n :return: a LUT index mask\n " return ((((lut_masks_one(6) | lut_masks_one(7)) | lut_masks_zero(4)) & lut_masks_one(5)) == 0)
7,209,364,479,417,253,000
Thinning morphological operation; condition G3' :return: a LUT index mask
Benchmarking/bsds500/bsds/thin.py
_thin_cond_g3_prime
CipiOrhei/eecvf
python
def _thin_cond_g3_prime(): "\n Thinning morphological operation; condition G3'\n :return: a LUT index mask\n " return ((((lut_masks_one(6) | lut_masks_one(7)) | lut_masks_zero(4)) & lut_masks_one(5)) == 0)
def _thin_iter_1_lut(): '\n Thinning morphological operation; lookup table for iteration 1\n :return: lookup table\n ' lut = identity_lut() cond = ((_thin_cond_g1() & _thin_cond_g2()) & _thin_cond_g3()) lut[cond] = False return lut
5,085,434,141,869,963,000
Thinning morphological operation; lookup table for iteration 1 :return: lookup table
Benchmarking/bsds500/bsds/thin.py
_thin_iter_1_lut
CipiOrhei/eecvf
python
def _thin_iter_1_lut(): '\n Thinning morphological operation; lookup table for iteration 1\n :return: lookup table\n ' lut = identity_lut() cond = ((_thin_cond_g1() & _thin_cond_g2()) & _thin_cond_g3()) lut[cond] = False return lut
def _thin_iter_2_lut(): '\n Thinning morphological operation; lookup table for iteration 2\n :return: lookup table\n ' lut = identity_lut() cond = ((_thin_cond_g1() & _thin_cond_g2()) & _thin_cond_g3_prime()) lut[cond] = False return lut
-103,154,475,881,035,140
Thinning morphological operation; lookup table for iteration 2 :return: lookup table
Benchmarking/bsds500/bsds/thin.py
_thin_iter_2_lut
CipiOrhei/eecvf
python
def _thin_iter_2_lut(): '\n Thinning morphological operation; lookup table for iteration 2\n :return: lookup table\n ' lut = identity_lut() cond = ((_thin_cond_g1() & _thin_cond_g2()) & _thin_cond_g3_prime()) lut[cond] = False return lut
def binary_thin(x, max_iter=None): '\n Binary thinning morphological operation\n\n :param x: a binary image, or an image that is to be converted to a binary image\n :param max_iter: maximum number of iterations; default is `None` that results in an infinite\n number of iterations (note that `binary_thin...
3,673,415,387,885,628,400
Binary thinning morphological operation :param x: a binary image, or an image that is to be converted to a binary image :param max_iter: maximum number of iterations; default is `None` that results in an infinite number of iterations (note that `binary_thin` will automatically terminate when no more changes occur) :re...
Benchmarking/bsds500/bsds/thin.py
binary_thin
CipiOrhei/eecvf
python
def binary_thin(x, max_iter=None): '\n Binary thinning morphological operation\n\n :param x: a binary image, or an image that is to be converted to a binary image\n :param max_iter: maximum number of iterations; default is `None` that results in an infinite\n number of iterations (note that `binary_thin...
def play(self): "\n # 1. Create a deck of 52 cards\n # 2. Shuffle the deck\n # 3. Ask the Player for their bet\n # 4. Make sure that the Player's bet does not exceed their available chips\n # 5. Deal two cards to the Dealer and two cards to the Player\n # 6. Show only one o...
7,772,900,167,371,930,000
# 1. Create a deck of 52 cards # 2. Shuffle the deck # 3. Ask the Player for their bet # 4. Make sure that the Player's bet does not exceed their available chips # 5. Deal two cards to the Dealer and two cards to the Player # 6. Show only one of the Dealer's cards, the other remains hidden # 7. Show both of the Player'...
BlackJack.py
play
tse4a/Python-Challenge
python
def play(self): "\n # 1. Create a deck of 52 cards\n # 2. Shuffle the deck\n # 3. Ask the Player for their bet\n # 4. Make sure that the Player's bet does not exceed their available chips\n # 5. Deal two cards to the Dealer and two cards to the Player\n # 6. Show only one o...
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, account_name: Optional[pulumi.Input[str]]=None, active_directories: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ActiveDirectoryArgs']]]]]=None, location: Optional[pulumi.Input[str]]=None, resource_group_name: Optio...
-3,839,363,611,189,158,000
NetApp account resource :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] account_name: The name of the NetApp account :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ActiveDirectoryArgs']]]] active_directories: Active...
sdk/python/pulumi_azure_native/netapp/v20200901/account.py
__init__
pulumi-bot/pulumi-azure-native
python
def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions]=None, account_name: Optional[pulumi.Input[str]]=None, active_directories: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ActiveDirectoryArgs']]]]]=None, location: Optional[pulumi.Input[str]]=None, resource_group_name: Optio...
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'Account': "\n Get an existing Account resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique ...
329,630,109,003,327,500
Get an existing Account resource's state with the given name, id, and optional extra properties used to qualify the lookup. :param str resource_name: The unique name of the resulting resource. :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. :param pulumi.ResourceOptions opts: Options for...
sdk/python/pulumi_azure_native/netapp/v20200901/account.py
get
pulumi-bot/pulumi-azure-native
python
@staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions]=None) -> 'Account': "\n Get an existing Account resource's state with the given name, id, and optional extra\n properties used to qualify the lookup.\n\n :param str resource_name: The unique ...
@property @pulumi.getter(name='activeDirectories') def active_directories(self) -> pulumi.Output[Optional[Sequence['outputs.ActiveDirectoryResponse']]]: '\n Active Directories\n ' return pulumi.get(self, 'active_directories')
6,275,772,879,752,033,000
Active Directories
sdk/python/pulumi_azure_native/netapp/v20200901/account.py
active_directories
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter(name='activeDirectories') def active_directories(self) -> pulumi.Output[Optional[Sequence['outputs.ActiveDirectoryResponse']]]: '\n \n ' return pulumi.get(self, 'active_directories')
@property @pulumi.getter def location(self) -> pulumi.Output[str]: '\n Resource location\n ' return pulumi.get(self, 'location')
2,974,713,878,710,662,000
Resource location
sdk/python/pulumi_azure_native/netapp/v20200901/account.py
location
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter def location(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'location')
@property @pulumi.getter def name(self) -> pulumi.Output[str]: '\n Resource name\n ' return pulumi.get(self, 'name')
387,709,723,693,576,260
Resource name
sdk/python/pulumi_azure_native/netapp/v20200901/account.py
name
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter def name(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'name')
@property @pulumi.getter(name='provisioningState') def provisioning_state(self) -> pulumi.Output[str]: '\n Azure lifecycle management\n ' return pulumi.get(self, 'provisioning_state')
5,814,604,552,307,744,000
Azure lifecycle management
sdk/python/pulumi_azure_native/netapp/v20200901/account.py
provisioning_state
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter(name='provisioningState') def provisioning_state(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'provisioning_state')
@property @pulumi.getter def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]: '\n Resource tags\n ' return pulumi.get(self, 'tags')
-1,239,552,863,427,208,400
Resource tags
sdk/python/pulumi_azure_native/netapp/v20200901/account.py
tags
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter def tags(self) -> pulumi.Output[Optional[Mapping[(str, str)]]]: '\n \n ' return pulumi.get(self, 'tags')
@property @pulumi.getter def type(self) -> pulumi.Output[str]: '\n Resource type\n ' return pulumi.get(self, 'type')
8,967,421,614,257,702,000
Resource type
sdk/python/pulumi_azure_native/netapp/v20200901/account.py
type
pulumi-bot/pulumi-azure-native
python
@property @pulumi.getter def type(self) -> pulumi.Output[str]: '\n \n ' return pulumi.get(self, 'type')
def parse_input(input, inflv, starttime, endtime): 'Read simulations data from input file.\n\n Arguments:\n input -- prefix of file containing neutrino fluxes\n inflv -- neutrino flavor to consider\n starttime -- start time set by user via command line option (or None)\n endtime -- end time set by us...
6,570,633,104,090,349,000
Read simulations data from input file. Arguments: input -- prefix of file containing neutrino fluxes inflv -- neutrino flavor to consider starttime -- start time set by user via command line option (or None) endtime -- end time set by user via command line option (or None)
sntools/formats/warren2020.py
parse_input
arfon/sntools
python
def parse_input(input, inflv, starttime, endtime): 'Read simulations data from input file.\n\n Arguments:\n input -- prefix of file containing neutrino fluxes\n inflv -- neutrino flavor to consider\n starttime -- start time set by user via command line option (or None)\n endtime -- end time set by us...
def testEzsignformfieldResponseCompound(self): 'Test EzsignformfieldResponseCompound' pass
-4,861,070,669,607,094,000
Test EzsignformfieldResponseCompound
test/test_ezsignformfield_response_compound.py
testEzsignformfieldResponseCompound
eZmaxinc/eZmax-SDK-python
python
def testEzsignformfieldResponseCompound(self): pass
@patch('regulations.apps.get_app_template_dirs') def test_precompute_custom_templates(self, get_app_template_dirs): 'Verify that custom templates are found' get_app_template_dirs.return_value = [self.tmpdir] open(os.path.join(self.tmpdir, '123-45-a.html'), 'w').close() open(os.path.join(self.tmpdir, 'ot...
-4,249,644,129,594,510,300
Verify that custom templates are found
regulations/tests/apps_tests.py
test_precompute_custom_templates
CMSgov/cmcs-eregulations
python
@patch('regulations.apps.get_app_template_dirs') def test_precompute_custom_templates(self, get_app_template_dirs): get_app_template_dirs.return_value = [self.tmpdir] open(os.path.join(self.tmpdir, '123-45-a.html'), 'w').close() open(os.path.join(self.tmpdir, 'other.html'), 'w').close() Regulations...
def uvc_return_mapping(x_sol, data, tol=1e-08, maximum_iterations=1000): " Implements the time integration of the updated Voce-Chaboche material model.\n\n :param np.array x_sol: Updated Voce-Chaboche model parameters.\n :param pd.DataFrame data: stress-strain data.\n :param float tol: Local Newton toleran...
-8,363,361,874,546,954,000
Implements the time integration of the updated Voce-Chaboche material model. :param np.array x_sol: Updated Voce-Chaboche model parameters. :param pd.DataFrame data: stress-strain data. :param float tol: Local Newton tolerance. :param int maximum_iterations: maximum iterations in local Newton procedure, raises Runtime...
RESSPyLab/uvc_model.py
uvc_return_mapping
AlbanoCastroSousa/RESSPyLab
python
def uvc_return_mapping(x_sol, data, tol=1e-08, maximum_iterations=1000): " Implements the time integration of the updated Voce-Chaboche material model.\n\n :param np.array x_sol: Updated Voce-Chaboche model parameters.\n :param pd.DataFrame data: stress-strain data.\n :param float tol: Local Newton toleran...
def sim_curve_uvc(x_sol, test_clean): ' Returns the stress-strain approximation of the updated Voce-Chaboche material model to a given strain input.\n\n :param np.array x_sol: Voce-Chaboche model parameters\n :param DataFrame test_clean: stress-strain data\n :return DataFrame: Voce-Chaboche approximation\n...
3,410,126,839,265,906,700
Returns the stress-strain approximation of the updated Voce-Chaboche material model to a given strain input. :param np.array x_sol: Voce-Chaboche model parameters :param DataFrame test_clean: stress-strain data :return DataFrame: Voce-Chaboche approximation The strain column in the DataFrame is labeled "e_true" and t...
RESSPyLab/uvc_model.py
sim_curve_uvc
AlbanoCastroSousa/RESSPyLab
python
def sim_curve_uvc(x_sol, test_clean): ' Returns the stress-strain approximation of the updated Voce-Chaboche material model to a given strain input.\n\n :param np.array x_sol: Voce-Chaboche model parameters\n :param DataFrame test_clean: stress-strain data\n :return DataFrame: Voce-Chaboche approximation\n...
def error_single_test_uvc(x_sol, test_clean): ' Returns the relative error between a test and its approximation using the updated Voce-Chaboche material model.\n\n :param np.array x_sol: Voce-Chaboche model parameters\n :param DataFrame test_clean: stress-strain data\n :return float: relative error\n\n ...
-6,505,289,781,695,587,000
Returns the relative error between a test and its approximation using the updated Voce-Chaboche material model. :param np.array x_sol: Voce-Chaboche model parameters :param DataFrame test_clean: stress-strain data :return float: relative error The strain column in the DataFrame is labeled "e_true" and the stress colu...
RESSPyLab/uvc_model.py
error_single_test_uvc
AlbanoCastroSousa/RESSPyLab
python
def error_single_test_uvc(x_sol, test_clean): ' Returns the relative error between a test and its approximation using the updated Voce-Chaboche material model.\n\n :param np.array x_sol: Voce-Chaboche model parameters\n :param DataFrame test_clean: stress-strain data\n :return float: relative error\n\n ...
def normalized_error_single_test_uvc(x_sol, test_clean): ' Returns the error and the total area of a test and its approximation using the updated Voce-Chaboche\n material model.\n\n :param np.array x_sol: Voce-Chaboche model parameters\n :param DataFrame test_clean: stress-strain data\n :return list: (f...
1,769,212,009,327,486,500
Returns the error and the total area of a test and its approximation using the updated Voce-Chaboche material model. :param np.array x_sol: Voce-Chaboche model parameters :param DataFrame test_clean: stress-strain data :return list: (float) total error, (float) total area The strain column in the DataFrame is labeled...
RESSPyLab/uvc_model.py
normalized_error_single_test_uvc
AlbanoCastroSousa/RESSPyLab
python
def normalized_error_single_test_uvc(x_sol, test_clean): ' Returns the error and the total area of a test and its approximation using the updated Voce-Chaboche\n material model.\n\n :param np.array x_sol: Voce-Chaboche model parameters\n :param DataFrame test_clean: stress-strain data\n :return list: (f...
def calc_phi_total(x, data): ' Returns the sum of the normalized relative error of the updated Voce-Chaboche material model given x.\n\n :param np.array x: Updated Voce-Chaboche material model parameters.\n :param list data: (pd.DataFrame) Stress-strain history for each test considered.\n :return float: No...
-7,501,822,167,166,433,000
Returns the sum of the normalized relative error of the updated Voce-Chaboche material model given x. :param np.array x: Updated Voce-Chaboche material model parameters. :param list data: (pd.DataFrame) Stress-strain history for each test considered. :return float: Normalized error value expressed as a percent (raw va...
RESSPyLab/uvc_model.py
calc_phi_total
AlbanoCastroSousa/RESSPyLab
python
def calc_phi_total(x, data): ' Returns the sum of the normalized relative error of the updated Voce-Chaboche material model given x.\n\n :param np.array x: Updated Voce-Chaboche material model parameters.\n :param list data: (pd.DataFrame) Stress-strain history for each test considered.\n :return float: No...
def test_total_area(x, data): ' Returns the total squared area underneath all the tests.\n\n :param np.array x: Updated Voce-Chaboche material model parameters.\n :param list data: (pd.DataFrame) Stress-strain history for each test considered.\n :return float: Total squared area.\n ' area_total = 0....
-5,041,924,756,357,932,000
Returns the total squared area underneath all the tests. :param np.array x: Updated Voce-Chaboche material model parameters. :param list data: (pd.DataFrame) Stress-strain history for each test considered. :return float: Total squared area.
RESSPyLab/uvc_model.py
test_total_area
AlbanoCastroSousa/RESSPyLab
python
def test_total_area(x, data): ' Returns the total squared area underneath all the tests.\n\n :param np.array x: Updated Voce-Chaboche material model parameters.\n :param list data: (pd.DataFrame) Stress-strain history for each test considered.\n :return float: Total squared area.\n ' area_total = 0....
def uvc_get_hessian(x, data): ' Returns the Hessian of the material model error function for a given set of test data evaluated at x.\n\n :param np.array x: Updated Voce-Chaboche material model parameters.\n :param list data: (pd.DataFrame) Stress-strain history for each test considered.\n :return np.array...
-5,182,262,053,579,384,000
Returns the Hessian of the material model error function for a given set of test data evaluated at x. :param np.array x: Updated Voce-Chaboche material model parameters. :param list data: (pd.DataFrame) Stress-strain history for each test considered. :return np.array: Hessian matrix of the error function.
RESSPyLab/uvc_model.py
uvc_get_hessian
AlbanoCastroSousa/RESSPyLab
python
def uvc_get_hessian(x, data): ' Returns the Hessian of the material model error function for a given set of test data evaluated at x.\n\n :param np.array x: Updated Voce-Chaboche material model parameters.\n :param list data: (pd.DataFrame) Stress-strain history for each test considered.\n :return np.array...
def uvc_consistency_metric(x_base, x_sample, data): ' Returns the xi_2 consistency metric from de Sousa and Lignos 2019 using the updated Voce-Chaboche model.\n\n :param np.array x_base: Updated Voce-Chaboche material model parameters from the base case.\n :param np.array x_sample: Updated Voce-Chaboche mater...
7,123,153,927,627,399,000
Returns the xi_2 consistency metric from de Sousa and Lignos 2019 using the updated Voce-Chaboche model. :param np.array x_base: Updated Voce-Chaboche material model parameters from the base case. :param np.array x_sample: Updated Voce-Chaboche material model parameters from the sample case. :param list data: (pd.Data...
RESSPyLab/uvc_model.py
uvc_consistency_metric
AlbanoCastroSousa/RESSPyLab
python
def uvc_consistency_metric(x_base, x_sample, data): ' Returns the xi_2 consistency metric from de Sousa and Lignos 2019 using the updated Voce-Chaboche model.\n\n :param np.array x_base: Updated Voce-Chaboche material model parameters from the base case.\n :param np.array x_sample: Updated Voce-Chaboche mater...
def uvc_tangent_modulus(x_sol, data, tol=1e-08, maximum_iterations=1000): ' Returns the tangent modulus at each strain step.\n\n :param np.array x_sol: Updated Voce-Chaboche model parameters.\n :param pd.DataFrame data: stress-strain data.\n :param float tol: Local Newton tolerance.\n :param int maximum...
5,687,772,783,232,525,000
Returns the tangent modulus at each strain step. :param np.array x_sol: Updated Voce-Chaboche model parameters. :param pd.DataFrame data: stress-strain data. :param float tol: Local Newton tolerance. :param int maximum_iterations: maximum iterations in local Newton procedure, raises RuntimeError if exceeded. :return n...
RESSPyLab/uvc_model.py
uvc_tangent_modulus
AlbanoCastroSousa/RESSPyLab
python
def uvc_tangent_modulus(x_sol, data, tol=1e-08, maximum_iterations=1000): ' Returns the tangent modulus at each strain step.\n\n :param np.array x_sol: Updated Voce-Chaboche model parameters.\n :param pd.DataFrame data: stress-strain data.\n :param float tol: Local Newton tolerance.\n :param int maximum...
def get_wiki_references(url, outfile=None): 'get_wiki_references.\n Extracts references from predefined sections of wiki page\n Uses `urlscan`, `refextract`, `doi`, `wikipedia`, and `re` (for ArXiv URLs)\n\n :param url: URL of wiki article to scrape\n :param outfile: File to write extracted references t...
1,990,428,418,421,912,600
get_wiki_references. Extracts references from predefined sections of wiki page Uses `urlscan`, `refextract`, `doi`, `wikipedia`, and `re` (for ArXiv URLs) :param url: URL of wiki article to scrape :param outfile: File to write extracted references to
scraper/apis/wikipedia.py
get_wiki_references
antimike/citation-scraper
python
def get_wiki_references(url, outfile=None): 'get_wiki_references.\n Extracts references from predefined sections of wiki page\n Uses `urlscan`, `refextract`, `doi`, `wikipedia`, and `re` (for ArXiv URLs)\n\n :param url: URL of wiki article to scrape\n :param outfile: File to write extracted references t...
def asm_and_link_one_file(asm_path: str, work_dir: str) -> str: 'Assemble and link file at asm_path in work_dir.\n\n Returns the path to the resulting ELF\n\n ' otbn_as = os.path.join(UTIL_DIR, 'otbn-as') otbn_ld = os.path.join(UTIL_DIR, 'otbn-ld') obj_path = os.path.join(work_dir, 'tst.o') el...
-372,252,728,031,894,140
Assemble and link file at asm_path in work_dir. Returns the path to the resulting ELF
hw/ip/otbn/dv/otbnsim/test/testutil.py
asm_and_link_one_file
OneToughMonkey/opentitan
python
def asm_and_link_one_file(asm_path: str, work_dir: str) -> str: 'Assemble and link file at asm_path in work_dir.\n\n Returns the path to the resulting ELF\n\n ' otbn_as = os.path.join(UTIL_DIR, 'otbn-as') otbn_ld = os.path.join(UTIL_DIR, 'otbn-ld') obj_path = os.path.join(work_dir, 'tst.o') el...
def find_two_smallest(L: List[float]) -> Tuple[(int, int)]: ' (see above) ' smallest = min(L) min1 = L.index(smallest) L.remove(smallest) next_smallest = min(L) min2 = L.index(next_smallest) L.insert(min1, smallest) if (min1 <= min2): min2 += 1 return (min1, min2)
-1,861,280,632,368,825,900
(see above)
chapter12/examples/example02.py
find_two_smallest
YordanIH/Intro_to_CS_w_Python
python
def find_two_smallest(L: List[float]) -> Tuple[(int, int)]: ' ' smallest = min(L) min1 = L.index(smallest) L.remove(smallest) next_smallest = min(L) min2 = L.index(next_smallest) L.insert(min1, smallest) if (min1 <= min2): min2 += 1 return (min1, min2)
def paddedInt(i): "\n return a string that contains `i`, left-padded with 0's up to PAD_LEN digits\n " i_str = str(i) pad = (PAD_LEN - len(i_str)) return ((pad * '0') + i_str)
-4,372,382,450,324,855,300
return a string that contains `i`, left-padded with 0's up to PAD_LEN digits
credstash.py
paddedInt
traveloka/credstash
python
def paddedInt(i): "\n \n " i_str = str(i) pad = (PAD_LEN - len(i_str)) return ((pad * '0') + i_str)
def getHighestVersion(name, region='us-east-1', table='credential-store'): '\n Return the highest version of `name` in the table\n ' dynamodb = boto3.resource('dynamodb', region_name=region) secrets = dynamodb.Table(table) response = secrets.query(Limit=1, ScanIndexForward=False, ConsistentRead=Tr...
6,380,276,000,185,197,000
Return the highest version of `name` in the table
credstash.py
getHighestVersion
traveloka/credstash
python
def getHighestVersion(name, region='us-east-1', table='credential-store'): '\n \n ' dynamodb = boto3.resource('dynamodb', region_name=region) secrets = dynamodb.Table(table) response = secrets.query(Limit=1, ScanIndexForward=False, ConsistentRead=True, KeyConditionExpression=boto3.dynamodb.conditi...
def listSecrets(region='us-east-1', table='credential-store'): '\n do a full-table scan of the credential-store,\n and return the names and versions of every credential\n ' dynamodb = boto3.resource('dynamodb', region_name=region) secrets = dynamodb.Table(table) response = secrets.scan(Projecti...
-3,835,120,575,174,796,300
do a full-table scan of the credential-store, and return the names and versions of every credential
credstash.py
listSecrets
traveloka/credstash
python
def listSecrets(region='us-east-1', table='credential-store'): '\n do a full-table scan of the credential-store,\n and return the names and versions of every credential\n ' dynamodb = boto3.resource('dynamodb', region_name=region) secrets = dynamodb.Table(table) response = secrets.scan(Projecti...
def putSecret(name, secret, version, kms_key='alias/credstash', region='us-east-1', table='credential-store', context=None): '\n put a secret called `name` into the secret-store,\n protected by the key kms_key\n ' if (not context): context = {} kms = boto3.client('kms', region_name=region) ...
-7,699,812,481,823,265,000
put a secret called `name` into the secret-store, protected by the key kms_key
credstash.py
putSecret
traveloka/credstash
python
def putSecret(name, secret, version, kms_key='alias/credstash', region='us-east-1', table='credential-store', context=None): '\n put a secret called `name` into the secret-store,\n protected by the key kms_key\n ' if (not context): context = {} kms = boto3.client('kms', region_name=region) ...
def getAllSecrets(version='', region='us-east-1', table='credential-store', context=None): '\n fetch and decrypt all secrets\n ' output = {} secrets = listSecrets(region, table) for credential in set([x['name'] for x in secrets]): try: output[credential] = getSecret(credential,...
7,797,601,393,189,596,000
fetch and decrypt all secrets
credstash.py
getAllSecrets
traveloka/credstash
python
def getAllSecrets(version=, region='us-east-1', table='credential-store', context=None): '\n \n ' output = {} secrets = listSecrets(region, table) for credential in set([x['name'] for x in secrets]): try: output[credential] = getSecret(credential, version, region, table, contex...
def getSecret(name, version='', region='us-east-1', table='credential-store', context=None): '\n fetch and decrypt the secret called `name`\n ' if (not context): context = {} dynamodb = boto3.resource('dynamodb', region_name=region) secrets = dynamodb.Table(table) if (version == ''): ...
622,606,273,363,065,900
fetch and decrypt the secret called `name`
credstash.py
getSecret
traveloka/credstash
python
def getSecret(name, version=, region='us-east-1', table='credential-store', context=None): '\n \n ' if (not context): context = {} dynamodb = boto3.resource('dynamodb', region_name=region) secrets = dynamodb.Table(table) if (version == ): response = secrets.query(Limit=1, ScanI...
def createDdbTable(region='us-east-1', table='credential-store'): '\n create the secret store table in DDB in the specified region\n ' dynamodb = boto3.resource('dynamodb', region_name=region) if (table in (t.name for t in dynamodb.tables.all())): print('Credential Store table already exists')...
5,070,826,915,824,553,000
create the secret store table in DDB in the specified region
credstash.py
createDdbTable
traveloka/credstash
python
def createDdbTable(region='us-east-1', table='credential-store'): '\n \n ' dynamodb = boto3.resource('dynamodb', region_name=region) if (table in (t.name for t in dynamodb.tables.all())): print('Credential Store table already exists') return print('Creating table...') response ...
def make_layer(self, out_channels, num_blocks, stride, expand_ratio): 'Stack InvertedResidual blocks to build a layer for MobileNetV2.\n\n Args:\n out_channels (int): out_channels of block.\n num_blocks (int): number of blocks.\n stride (int): stride of the first block. Defau...
6,643,845,954,223,003,000
Stack InvertedResidual blocks to build a layer for MobileNetV2. Args: out_channels (int): out_channels of block. num_blocks (int): number of blocks. stride (int): stride of the first block. Default: 1 expand_ratio (int): Expand the number of channels of the hidden layer in InvertedResidual by t...
mmcls/models/backbones/mobilenet_v2.py
make_layer
ChaseMonsterAway/mmclassification
python
def make_layer(self, out_channels, num_blocks, stride, expand_ratio): 'Stack InvertedResidual blocks to build a layer for MobileNetV2.\n\n Args:\n out_channels (int): out_channels of block.\n num_blocks (int): number of blocks.\n stride (int): stride of the first block. Defau...
def __init__(self, code): "Initialize a PDBFile object with a pdb file of interest\n\n Parameters\n ----------\n code : the pdb code if interest\n Any valid PDB code can be passed into PDBFile.\n\n Examples\n --------\n >>> pdb_file = PDBFile('1rcy') \n \...
835,532,312,311,867,000
Initialize a PDBFile object with a pdb file of interest Parameters ---------- code : the pdb code if interest Any valid PDB code can be passed into PDBFile. Examples -------- >>> pdb_file = PDBFile('1rcy')
scalene-triangle/libs/PDB_filegetter.py
__init__
dsw7/BridgingInteractions
python
def __init__(self, code): "Initialize a PDBFile object with a pdb file of interest\n\n Parameters\n ----------\n code : the pdb code if interest\n Any valid PDB code can be passed into PDBFile.\n\n Examples\n --------\n >>> pdb_file = PDBFile('1rcy') \n \...
def fetch_from_PDB(self): "\n Connects to PDB FTP server, downloads a .gz file of interest,\n decompresses the .gz file into .ent and then dumps a copy of\n the pdb{code}.ent file into cwd.\n\n Parameters\n ----------\n None\n\n Examples\n --------\n \n...
5,381,435,870,021,593,000
Connects to PDB FTP server, downloads a .gz file of interest, decompresses the .gz file into .ent and then dumps a copy of the pdb{code}.ent file into cwd. Parameters ---------- None Examples -------- >>> inst = PDBFile('1rcy') >>> path_to_file = inst.fetch_from_PDB() >>> print(path_to_file)
scalene-triangle/libs/PDB_filegetter.py
fetch_from_PDB
dsw7/BridgingInteractions
python
def fetch_from_PDB(self): "\n Connects to PDB FTP server, downloads a .gz file of interest,\n decompresses the .gz file into .ent and then dumps a copy of\n the pdb{code}.ent file into cwd.\n\n Parameters\n ----------\n None\n\n Examples\n --------\n \n...
def clear(self): "\n Deletes file from current working directory after the file has\n been processed by some algorithm.\n\n Parameters\n ----------\n None\n\n Examples\n --------\n >>> inst = PDBFile('1rcy')\n >>> path_to_file = inst.fetch_from_PDB()\n ...
8,477,879,807,243,158,000
Deletes file from current working directory after the file has been processed by some algorithm. Parameters ---------- None Examples -------- >>> inst = PDBFile('1rcy') >>> path_to_file = inst.fetch_from_PDB() >>> print(path_to_file) # process the file using some algorithm >>> inst.clear()
scalene-triangle/libs/PDB_filegetter.py
clear
dsw7/BridgingInteractions
python
def clear(self): "\n Deletes file from current working directory after the file has\n been processed by some algorithm.\n\n Parameters\n ----------\n None\n\n Examples\n --------\n >>> inst = PDBFile('1rcy')\n >>> path_to_file = inst.fetch_from_PDB()\n ...
def gen_captcha_text_image(self, img_name): '\n 返回一个验证码的array形式和对应的字符串标签\n :return:tuple (str, numpy.array)\n ' label = img_name.split('_')[0] img_file = os.path.join(self.img_path, img_name) captcha_image = Image.open(img_file) captcha_array = np.array(captcha_image) return...
7,944,805,907,609,061,000
返回一个验证码的array形式和对应的字符串标签 :return:tuple (str, numpy.array)
train_model.py
gen_captcha_text_image
shineyjg/cnn_captcha
python
def gen_captcha_text_image(self, img_name): '\n 返回一个验证码的array形式和对应的字符串标签\n :return:tuple (str, numpy.array)\n ' label = img_name.split('_')[0] img_file = os.path.join(self.img_path, img_name) captcha_image = Image.open(img_file) captcha_array = np.array(captcha_image) return...
@staticmethod def convert2gray(img): '\n 图片转为灰度图,如果是3通道图则计算,单通道图则直接返回\n :param img:\n :return:\n ' if (len(img.shape) > 2): (r, g, b) = (img[:, :, 0], img[:, :, 1], img[:, :, 2]) gray = (((0.2989 * r) + (0.587 * g)) + (0.114 * b)) return gray else: ...
611,634,753,502,825,900
图片转为灰度图,如果是3通道图则计算,单通道图则直接返回 :param img: :return:
train_model.py
convert2gray
shineyjg/cnn_captcha
python
@staticmethod def convert2gray(img): '\n 图片转为灰度图,如果是3通道图则计算,单通道图则直接返回\n :param img:\n :return:\n ' if (len(img.shape) > 2): (r, g, b) = (img[:, :, 0], img[:, :, 1], img[:, :, 2]) gray = (((0.2989 * r) + (0.587 * g)) + (0.114 * b)) return gray else: ...
def text2vec(self, text): '\n 转标签为oneHot编码\n :param text: str\n :return: numpy.array\n ' text_len = len(text) if (text_len > self.max_captcha): raise ValueError('验证码最长{}个字符'.format(self.max_captcha)) vector = np.zeros((self.max_captcha * self.char_set_len)) for (i...
-1,980,550,115,108,716,800
转标签为oneHot编码 :param text: str :return: numpy.array
train_model.py
text2vec
shineyjg/cnn_captcha
python
def text2vec(self, text): '\n 转标签为oneHot编码\n :param text: str\n :return: numpy.array\n ' text_len = len(text) if (text_len > self.max_captcha): raise ValueError('验证码最长{}个字符'.format(self.max_captcha)) vector = np.zeros((self.max_captcha * self.char_set_len)) for (i...
def get_converter(from_unit, to_unit): 'Like Unit._get_converter, except returns None if no scaling is needed,\n i.e., if the inferred scale is unity.' try: scale = from_unit._to(to_unit) except UnitsError: return from_unit._apply_equivalencies(from_unit, to_unit, get_current_unit_registr...
6,356,987,915,934,134,000
Like Unit._get_converter, except returns None if no scaling is needed, i.e., if the inferred scale is unity.
astropy/units/quantity_helper/helpers.py
get_converter
PriyankaH21/astropy
python
def get_converter(from_unit, to_unit): 'Like Unit._get_converter, except returns None if no scaling is needed,\n i.e., if the inferred scale is unity.' try: scale = from_unit._to(to_unit) except UnitsError: return from_unit._apply_equivalencies(from_unit, to_unit, get_current_unit_registr...
def _raw_fetch(url, logger): '\n Fetch remote data and return the text output.\n\n :param url: The URL to fetch the data from\n :param logger: A logger instance to use.\n :return: Raw text data, None otherwise\n ' ret_data = None try: req = requests.get(url) if (req.status_cod...
-894,493,403,224,933,800
Fetch remote data and return the text output. :param url: The URL to fetch the data from :param logger: A logger instance to use. :return: Raw text data, None otherwise
atkinson/dlrn/http_data.py
_raw_fetch
jpichon/atkinson
python
def _raw_fetch(url, logger): '\n Fetch remote data and return the text output.\n\n :param url: The URL to fetch the data from\n :param logger: A logger instance to use.\n :return: Raw text data, None otherwise\n ' ret_data = None try: req = requests.get(url) if (req.status_cod...
def _fetch_yaml(url, logger): '\n Fetch remote data and process the text as yaml.\n\n :param url: The URL to fetch the data from\n :param logger: A logger instance to use.\n :return: Parsed yaml data in the form of a dictionary\n ' ret_data = None raw_data = _raw_fetch(url, logger) if (ra...
-3,088,369,978,945,365,500
Fetch remote data and process the text as yaml. :param url: The URL to fetch the data from :param logger: A logger instance to use. :return: Parsed yaml data in the form of a dictionary
atkinson/dlrn/http_data.py
_fetch_yaml
jpichon/atkinson
python
def _fetch_yaml(url, logger): '\n Fetch remote data and process the text as yaml.\n\n :param url: The URL to fetch the data from\n :param logger: A logger instance to use.\n :return: Parsed yaml data in the form of a dictionary\n ' ret_data = None raw_data = _raw_fetch(url, logger) if (ra...
def dlrn_http_factory(host, config_file=None, link_name=None, logger=getLogger()): '\n Create a DlrnData instance based on a host.\n\n :param host: A host name string to build instances\n :param config_file: A dlrn config file(s) to use in addition to\n the default.\n :param link_...
-4,437,842,762,096,356,400
Create a DlrnData instance based on a host. :param host: A host name string to build instances :param config_file: A dlrn config file(s) to use in addition to the default. :param link_name: A dlrn symlink to use. This overrides the config files link parameter. :param logger: An at...
atkinson/dlrn/http_data.py
dlrn_http_factory
jpichon/atkinson
python
def dlrn_http_factory(host, config_file=None, link_name=None, logger=getLogger()): '\n Create a DlrnData instance based on a host.\n\n :param host: A host name string to build instances\n :param config_file: A dlrn config file(s) to use in addition to\n the default.\n :param link_...
def __init__(self, url, release, link_name='current', logger=getLogger()): '\n Class constructor\n\n :param url: The URL to the host to obtain data.\n :param releases: The release name to use for lookup.\n :param link_name: The name of the dlrn symlink to fetch data from.\n :param...
-1,853,492,324,126,466,600
Class constructor :param url: The URL to the host to obtain data. :param releases: The release name to use for lookup. :param link_name: The name of the dlrn symlink to fetch data from. :param logger: An atkinson logger to use. Default is the base logger.
atkinson/dlrn/http_data.py
__init__
jpichon/atkinson
python
def __init__(self, url, release, link_name='current', logger=getLogger()): '\n Class constructor\n\n :param url: The URL to the host to obtain data.\n :param releases: The release name to use for lookup.\n :param link_name: The name of the dlrn symlink to fetch data from.\n :param...
def _fetch_commit(self): '\n Fetch the commit data from dlrn\n ' full_url = os.path.join(self.url, self._link_name, 'commit.yaml') data = _fetch_yaml(full_url, self._logger) if ((data is not None) and ('commits' in data)): pkg = data['commits'][0] if (pkg['status'] == 'SUCC...
6,997,459,630,592,828,000
Fetch the commit data from dlrn
atkinson/dlrn/http_data.py
_fetch_commit
jpichon/atkinson
python
def _fetch_commit(self): '\n \n ' full_url = os.path.join(self.url, self._link_name, 'commit.yaml') data = _fetch_yaml(full_url, self._logger) if ((data is not None) and ('commits' in data)): pkg = data['commits'][0] if (pkg['status'] == 'SUCCESS'): self._commit...
def _build_url(self): '\n Generate a url given a commit hash and distgit hash to match the format\n base/AB/CD/ABCD123_XYZ987 where ABCD123 is the commit hash and XYZ987\n is a portion of the distgit hash.\n\n :return: A string with the full URL.\n ' first = self._commit_data[...
-3,125,452,940,105,935,000
Generate a url given a commit hash and distgit hash to match the format base/AB/CD/ABCD123_XYZ987 where ABCD123 is the commit hash and XYZ987 is a portion of the distgit hash. :return: A string with the full URL.
atkinson/dlrn/http_data.py
_build_url
jpichon/atkinson
python
def _build_url(self): '\n Generate a url given a commit hash and distgit hash to match the format\n base/AB/CD/ABCD123_XYZ987 where ABCD123 is the commit hash and XYZ987\n is a portion of the distgit hash.\n\n :return: A string with the full URL.\n ' first = self._commit_data[...
@property def commit(self): '\n Get the dlrn commit information\n\n :return: A dictionary of name, dist-git hash, commit hash and\n extended hash.\n An empty dictionary is returned otherwise.\n ' return self._commit_data
-1,729,170,792,126,949,000
Get the dlrn commit information :return: A dictionary of name, dist-git hash, commit hash and extended hash. An empty dictionary is returned otherwise.
atkinson/dlrn/http_data.py
commit
jpichon/atkinson
python
@property def commit(self): '\n Get the dlrn commit information\n\n :return: A dictionary of name, dist-git hash, commit hash and\n extended hash.\n An empty dictionary is returned otherwise.\n ' return self._commit_data
@property def versions(self): '\n Get the version data for the versions.csv file and return the\n data in a dictionary\n\n :return: A dictionary of packages with commit and dist-git hashes\n ' ret_dict = {} full_url = os.path.join(self._build_url(), 'versions.csv') data = _ra...
-7,811,259,190,884,229,000
Get the version data for the versions.csv file and return the data in a dictionary :return: A dictionary of packages with commit and dist-git hashes
atkinson/dlrn/http_data.py
versions
jpichon/atkinson
python
@property def versions(self): '\n Get the version data for the versions.csv file and return the\n data in a dictionary\n\n :return: A dictionary of packages with commit and dist-git hashes\n ' ret_dict = {} full_url = os.path.join(self._build_url(), 'versions.csv') data = _ra...
def compute_train_val_test(X, y, model, scale=False, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True): "\n Compute the training-validation-test scores for the given model on the given dataset.\n\n The training and test scores are simply computed by splitting the dataset into the train...
-5,066,045,042,697,431,000
Compute the training-validation-test scores for the given model on the given dataset. The training and test scores are simply computed by splitting the dataset into the training and test sets. The validation score is performed applying the cross validation on the training set. Parameters ---------- X: np.array Tw...
model_selection.py
compute_train_val_test
EnricoPittini/model-selection
python
def compute_train_val_test(X, y, model, scale=False, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True): "\n Compute the training-validation-test scores for the given model on the given dataset.\n\n The training and test scores are simply computed by splitting the dataset into the train...
def compute_bias_variance_error(X, y, model, scale=False, N_TESTS=20, sample_size=0.67): '\n Compute the bias^2-variance-error scores for the given model on the given dataset.\n\n These measures are computed in an approximate way, using `N_TESTS` random samples of size `sample_size` from the\n dataset.\n\n...
1,135,176,463,303,326,600
Compute the bias^2-variance-error scores for the given model on the given dataset. These measures are computed in an approximate way, using `N_TESTS` random samples of size `sample_size` from the dataset. Parameters ---------- X: np.array Two-dimensional np.array, containing the explanatory features of the datase...
model_selection.py
compute_bias_variance_error
EnricoPittini/model-selection
python
def compute_bias_variance_error(X, y, model, scale=False, N_TESTS=20, sample_size=0.67): '\n Compute the bias^2-variance-error scores for the given model on the given dataset.\n\n These measures are computed in an approximate way, using `N_TESTS` random samples of size `sample_size` from the\n dataset.\n\n...
def plot_predictions(X, y, model, scale=False, test_size=0.2, plot_type=0, xvalues=None, xlabel='Index', title='Actual vs Predicted values', figsize=(6, 6)): "\n Plot the predictions made by the given model on the given dataset, versus its actual values.\n\n The dataset is split into training-test sets: the f...
6,549,853,644,879,781,000
Plot the predictions made by the given model on the given dataset, versus its actual values. The dataset is split into training-test sets: the former is used to train the `model`, on the latter the predictions are made. Parameters ---------- X: np.array Two-dimensional np.array, containing the explanatory feature...
model_selection.py
plot_predictions
EnricoPittini/model-selection
python
def plot_predictions(X, y, model, scale=False, test_size=0.2, plot_type=0, xvalues=None, xlabel='Index', title='Actual vs Predicted values', figsize=(6, 6)): "\n Plot the predictions made by the given model on the given dataset, versus its actual values.\n\n The dataset is split into training-test sets: the f...
def _plot_TrainVal_values(xvalues, train_val_scores, plot_train, xlabel, title, figsize=(6, 6), bar=False): "\n Plot the given list of training-validation scores.\n\n This function is an auxiliary function for the model selection functions. It's meant to be private in the\n module.\n\n Parameters\n -...
-2,627,312,043,539,120,600
Plot the given list of training-validation scores. This function is an auxiliary function for the model selection functions. It's meant to be private in the module. Parameters ---------- xvalues: list (in general iterable) Values to put in the x axis of the plot. train_val_scores: np.array Two dimensional np....
model_selection.py
_plot_TrainVal_values
EnricoPittini/model-selection
python
def _plot_TrainVal_values(xvalues, train_val_scores, plot_train, xlabel, title, figsize=(6, 6), bar=False): "\n Plot the given list of training-validation scores.\n\n This function is an auxiliary function for the model selection functions. It's meant to be private in the\n module.\n\n Parameters\n -...
def hyperparameter_validation(X, y, model, hyperparameter, hyperparameter_values, scale=False, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True, plot=False, plot_train=False, xvalues=None, xlabel=None, title='Hyperparameter validation', figsize=(6, 6)): "\n Select the best value for the s...
-3,417,247,821,585,341,400
Select the best value for the specified hyperparameter of the specified model on the given dataset. In other words, perform the tuning of the `hyperparameter` among the values in `hyperparameter_values`. This selection is made using the validation score (i.e. the best hyperparameter value is the one with the best val...
model_selection.py
hyperparameter_validation
EnricoPittini/model-selection
python
def hyperparameter_validation(X, y, model, hyperparameter, hyperparameter_values, scale=False, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True, plot=False, plot_train=False, xvalues=None, xlabel=None, title='Hyperparameter validation', figsize=(6, 6)): "\n Select the best value for the s...
def hyperparameters_validation(X, y, model, param_grid, scale=False, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True): "\n Select the best combination of values for the specified hyperparameters of the specified model on the given dataset.\n\n In other words, perform the tuning of mul...
-5,705,085,024,780,375,000
Select the best combination of values for the specified hyperparameters of the specified model on the given dataset. In other words, perform the tuning of multiple hyperparameters. The parameter `param_grid` is a dictionary that indicates which are the specified hyperparameters and what are the associated values to te...
model_selection.py
hyperparameters_validation
EnricoPittini/model-selection
python
def hyperparameters_validation(X, y, model, param_grid, scale=False, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True): "\n Select the best combination of values for the specified hyperparameters of the specified model on the given dataset.\n\n In other words, perform the tuning of mul...
def models_validation(X, y, model_paramGrid_list, scale_list=None, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True, plot=False, plot_train=False, xvalues=None, xlabel='Models', title='Models validation', figsize=(6, 6)): "\n Select the best model on the given dataset.\n\n The paramete...
-7,523,235,934,046,416,000
Select the best model on the given dataset. The parameter `model_paramGrid_list` is the list of the models to test. It also contains, for each model, the grid of hyperparameters that have to be tested on that model (i.e. the grid which contains the values to test for each specified hyperparameter of the model). (That ...
model_selection.py
models_validation
EnricoPittini/model-selection
python
def models_validation(X, y, model_paramGrid_list, scale_list=None, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True, plot=False, plot_train=False, xvalues=None, xlabel='Models', title='Models validation', figsize=(6, 6)): "\n Select the best model on the given dataset.\n\n The paramete...
def datasets_hyperparameter_validation(dataset_list, model, hyperparameter, hyperparameter_values, scale=False, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True, plot=False, plot_train=False, xvalues=None, xlabel='Datasets', title='Datasets validation', figsize=(6, 6), verbose=False, figsize_ver...
-8,298,506,111,670,680,000
Select the best dataset and the best value for the specified hyperparameter of the specified model (i.e. select the best couple dataset-hyperparameter value). For each dataset in `dataset_list`, all the specified values `hyperparameter_values` are tested for the specified `hyperparameter` of `model`. In other words, o...
model_selection.py
datasets_hyperparameter_validation
EnricoPittini/model-selection
python
def datasets_hyperparameter_validation(dataset_list, model, hyperparameter, hyperparameter_values, scale=False, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True, plot=False, plot_train=False, xvalues=None, xlabel='Datasets', title='Datasets validation', figsize=(6, 6), verbose=False, figsize_ver...
def datasets_hyperparameters_validation(dataset_list, model, param_grid, scale=False, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True, plot=False, plot_train=False, xvalues=None, xlabel='Datasets', title='Datasets validation', figsize=(6, 6)): "\n Select the best dataset and the best com...
-182,712,746,719,899,140
Select the best dataset and the best combination of values for the specified hyperparameters of the specified model (i.e. select the best couple dataset-combination of hyperparameters values). For each dataset in `dataset_list`, all the possible combinations of the hyperparameters values for `model` (specified with `p...
model_selection.py
datasets_hyperparameters_validation
EnricoPittini/model-selection
python
def datasets_hyperparameters_validation(dataset_list, model, param_grid, scale=False, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True, plot=False, plot_train=False, xvalues=None, xlabel='Datasets', title='Datasets validation', figsize=(6, 6)): "\n Select the best dataset and the best com...
def datasets_models_validation(dataset_list, model_paramGrid_list, scale_list=None, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True, plot=False, plot_train=False, xvalues=None, xlabel='Datasets', title='Datasets validation', figsize=(6, 6), verbose=False, figsize_verbose=(6, 6)): "\n Sel...
2,050,898,115,793,827,300
Select the best dataset and the best model (i.e. select the best couple dataset-model). For each dataset in `dataset_list`, all the models in `model_paramGrid_list` are tested: each model is tested performing an exhaustive tuning of the specified hyperparameters. In fact, `model_paramGrid_list` also contains, for each...
model_selection.py
datasets_models_validation
EnricoPittini/model-selection
python
def datasets_models_validation(dataset_list, model_paramGrid_list, scale_list=None, test_size=0.2, time_series=False, random_state=123, n_folds=5, regr=True, plot=False, plot_train=False, xvalues=None, xlabel='Datasets', title='Datasets validation', figsize=(6, 6), verbose=False, figsize_verbose=(6, 6)): "\n Sel...
def append(self, other): ' append the recarrays from one MfList to another\n Parameters\n ----------\n other: variable: an item that can be cast in to an MfList\n that corresponds with self\n Returns\n -------\n dict of {kper:recarray}\n ' ...
3,458,584,039,420,723,000
append the recarrays from one MfList to another Parameters ---------- other: variable: an item that can be cast in to an MfList that corresponds with self Returns ------- dict of {kper:recarray}
flopy/utils/util_list.py
append
aleaf/flopy
python
def append(self, other): ' append the recarrays from one MfList to another\n Parameters\n ----------\n other: variable: an item that can be cast in to an MfList\n that corresponds with self\n Returns\n -------\n dict of {kper:recarray}\n ' ...
def drop(self, fields): 'drop fields from an MfList\n\n Parameters\n ----------\n fields : list or set of field names to drop\n\n Returns\n -------\n dropped : MfList without the dropped fields\n ' if (not isinstance(fields, list)): fields = [fields] ...
1,912,237,700,778,697,200
drop fields from an MfList Parameters ---------- fields : list or set of field names to drop Returns ------- dropped : MfList without the dropped fields
flopy/utils/util_list.py
drop
aleaf/flopy
python
def drop(self, fields): 'drop fields from an MfList\n\n Parameters\n ----------\n fields : list or set of field names to drop\n\n Returns\n -------\n dropped : MfList without the dropped fields\n ' if (not isinstance(fields, list)): fields = [fields] ...
@property def fmt_string(self): 'Returns a C-style fmt string for numpy savetxt that corresponds to\n the dtype' if (self.list_free_format is not None): use_free = self.list_free_format else: use_free = True if self.package.parent.has_package('bas6'): use_free = se...
8,351,358,389,882,369,000
Returns a C-style fmt string for numpy savetxt that corresponds to the dtype
flopy/utils/util_list.py
fmt_string
aleaf/flopy
python
@property def fmt_string(self): 'Returns a C-style fmt string for numpy savetxt that corresponds to\n the dtype' if (self.list_free_format is not None): use_free = self.list_free_format else: use_free = True if self.package.parent.has_package('bas6'): use_free = se...