index int64 0 731k | package stringlengths 2 98 ⌀ | name stringlengths 1 76 | docstring stringlengths 0 281k ⌀ | code stringlengths 4 8.19k | signature stringlengths 2 42.8k ⌀ | embed_func_code listlengths 768 768 |
|---|---|---|---|---|---|---|
725,045 | tf_keras.src.engine.training | test_on_batch | Test the model on a single batch of samples.
Args:
x: Input data. It could be:
- A Numpy array (or array-like), or a list of arrays (in case the
model has multiple inputs).
- A TensorFlow tensor, or a list of tensors (in case the model has
... | def test_on_batch(
self,
x,
y=None,
sample_weight=None,
reset_metrics=True,
return_dict=False,
):
"""Test the model on a single batch of samples.
Args:
x: Input data. It could be:
- A Numpy array (or array-like), or a list of arrays (in case the
model has ... | (self, x, y=None, sample_weight=None, reset_metrics=True, return_dict=False) | [
0.005801145453006029,
-0.031119173392653465,
-0.024379253387451172,
-0.00010139969526790082,
0.0006697795470245183,
0.02547689899802208,
-0.058964673429727554,
0.05830993875861168,
0.05653830245137215,
-0.02072044089436531,
-0.028558004647493362,
0.0022903692442923784,
0.04147939383983612,
... |
725,046 | tf_keras.src.engine.training | test_step | The logic for one evaluation step.
This method can be overridden to support custom evaluation logic.
This method is called by `Model.make_test_function`.
This function should contain the mathematical logic for one step of
evaluation.
This typically includes the forward pass, lo... | def test_step(self, data):
"""The logic for one evaluation step.
This method can be overridden to support custom evaluation logic.
This method is called by `Model.make_test_function`.
This function should contain the mathematical logic for one step of
evaluation.
This typically includes the forw... | (self, data) | [
0.000025679319151095115,
0.003955645486712456,
-0.05025552958250046,
0.04400184378027916,
0.028555991128087044,
0.022886233404278755,
-0.04984113201498985,
-0.00610770471394062,
0.026992570608854294,
-0.004106336738914251,
0.018638623878359795,
-0.003743735607713461,
0.0636293813586235,
0.... |
725,047 | tf_keras.src.engine.training | to_json | Returns a JSON string containing the network configuration.
To load a network from a JSON save file, use
`keras.models.model_from_json(json_string, custom_objects={})`.
Args:
**kwargs: Additional keyword arguments to be passed to
*`json.dumps()`.
Returns:
... | def to_json(self, **kwargs):
"""Returns a JSON string containing the network configuration.
To load a network from a JSON save file, use
`keras.models.model_from_json(json_string, custom_objects={})`.
Args:
**kwargs: Additional keyword arguments to be passed to
*`json.dumps()`.
R... | (self, **kwargs) | [
-0.03148387745022774,
-0.044199589639902115,
0.04331115633249283,
-0.04386642575263977,
-0.0011996171670034528,
-0.006542945746332407,
-0.08484543859958649,
0.009541410021483898,
0.038794949650764465,
-0.07299965620040894,
-0.00331774540245533,
-0.012030876241624355,
-0.042200613766908646,
... |
725,048 | tf_keras.src.engine.training | to_yaml | Returns a yaml string containing the network configuration.
Note: Since TF 2.6, this method is no longer supported and will raise a
RuntimeError.
To load a network from a yaml save file, use
`keras.models.model_from_yaml(yaml_string, custom_objects={})`.
`custom_objects` shoul... | def to_yaml(self, **kwargs):
"""Returns a yaml string containing the network configuration.
Note: Since TF 2.6, this method is no longer supported and will raise a
RuntimeError.
To load a network from a yaml save file, use
`keras.models.model_from_yaml(yaml_string, custom_objects={})`.
`custom_o... | (self, **kwargs) | [
-0.002999427728354931,
-0.05044601112604141,
-0.003936898894608021,
-0.04004991427063942,
-0.015574965626001358,
-0.01600653864443302,
-0.0830153375864029,
0.0021446747705340385,
0.047031793743371964,
-0.04035680741071701,
-0.026143692433834076,
-0.031437646597623825,
-0.014846088364720345,
... |
725,049 | tf_keras.src.engine.training | train_on_batch | Runs a single gradient update on a single batch of data.
Args:
x: Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
(in case the model has multiple inputs).
- A TensorFlow tensor, or a list of tensors
(in ca... | def train_on_batch(
self,
x,
y=None,
sample_weight=None,
class_weight=None,
reset_metrics=True,
return_dict=False,
):
"""Runs a single gradient update on a single batch of data.
Args:
x: Input data. It could be:
- A Numpy array (or array-like), or a list of arrays
... | (self, x, y=None, sample_weight=None, class_weight=None, reset_metrics=True, return_dict=False) | [
-0.0029623720329254866,
-0.04578791558742523,
0.0011848261347040534,
-0.0004862634523306042,
-0.012585786171257496,
0.006179993972182274,
-0.06393029540777206,
0.04425641521811485,
0.06165268272161484,
-0.006150542292743921,
-0.03502814844250679,
-0.04186099395155907,
0.032868340611457825,
... |
725,050 | tf_keras.src.engine.training | train_step | The logic for one training step.
This method can be overridden to support custom training logic.
For concrete examples of how to override this method see
[Customizing what happens in fit](
https://www.tensorflow.org/guide/keras/customizing_what_happens_in_fit).
This method is ca... | def train_step(self, data):
"""The logic for one training step.
This method can be overridden to support custom training logic.
For concrete examples of how to override this method see
[Customizing what happens in fit](
https://www.tensorflow.org/guide/keras/customizing_what_happens_in_fit).
Thi... | (self, data) | [
-0.010326405987143517,
-0.019385825842618942,
-0.04812638461589813,
0.03747608885169029,
-0.001849274500273168,
0.027511678636074066,
-0.04435400664806366,
-0.02166258916258812,
0.0024696686305105686,
0.002054087817668915,
0.007258967962116003,
-0.040124375373125076,
0.047935862094163895,
... |
725,051 | tf_keras.src.engine.sequential | Sequential | `Sequential` groups a linear stack of layers into a `tf.keras.Model`.
`Sequential` provides training and inference features on this model.
Examples:
```python
model = tf.keras.Sequential()
model.add(tf.keras.Input(shape=(16,)))
model.add(tf.keras.layers.Dense(8))
# Note that you can also... | class Sequential(functional.Functional):
"""`Sequential` groups a linear stack of layers into a `tf.keras.Model`.
`Sequential` provides training and inference features on this model.
Examples:
```python
model = tf.keras.Sequential()
model.add(tf.keras.Input(shape=(16,)))
model.add(tf.kera... | (layers=None, name=None) | [
-0.0012271906016394496,
-0.022092057392001152,
-0.042315106838941574,
0.04632611945271492,
-0.005397013854235411,
0.006825017277151346,
-0.10298426449298859,
0.03635109215974808,
0.02889607474207878,
-0.035448089241981506,
-0.00735526904463768,
-0.001859817304648459,
0.017682045698165894,
... |
725,057 | tf_keras.src.engine.sequential | __init__ | Creates a `Sequential` model instance.
Args:
layers: Optional list of layers to add to the model.
name: Optional name for the model.
| @tf.__internal__.tracking.no_automatic_dependency_tracking
@traceback_utils.filter_traceback
def add(self, layer):
"""Adds a layer instance on top of the layer stack.
Args:
layer: layer instance.
Raises:
TypeError: If `layer` is not a layer instance.
ValueError: In case the `layer` a... | (self, layers=None, name=None) | [
-0.03417421877384186,
-0.02748371660709381,
-0.054226212203502655,
0.07217157632112503,
-0.019379043951630592,
0.02921973541378975,
-0.09417415410280228,
0.04931074380874634,
0.027464210987091064,
-0.03433026373386383,
0.0004705782048404217,
-0.014804926700890064,
-0.00908484123647213,
-0.... |
725,067 | tf_keras.src.engine.sequential | _assert_weights_created | null | def _assert_weights_created(self):
if self._graph_initialized:
return
# When the graph has not been initialized, use the Model's
# implementation to to check if the weights has been created.
super(functional.Functional, self)._assert_weights_created()
| (self) | [
0.029665185138583183,
-0.00480002723634243,
0.003576698713004589,
0.020387394353747368,
0.009345635771751404,
0.0032607957255095243,
-0.04559177905321121,
0.023033345118165016,
0.05349570885300636,
0.06709861010313034,
0.01850469782948494,
0.025798026472330093,
0.07395094633102417,
-0.0276... |
725,069 | tf_keras.src.engine.sequential | _build_graph_network_for_inferred_shape | @tf.__internal__.tracking.no_automatic_dependency_tracking
@traceback_utils.filter_traceback
def add(self, layer):
"""Adds a layer instance on top of the layer stack.
Args:
layer: layer instance.
Raises:
TypeError: If `layer` is not a layer instance.
ValueError: In case the `layer` a... | (self, input_shape, input_dtype=None) | [
-0.034134022891521454,
-0.027482764795422554,
-0.05422433465719223,
0.07228610664606094,
-0.01937837153673172,
0.029218723997473717,
-0.09417089074850082,
0.04927002266049385,
0.027424249798059464,
-0.03434858098626137,
0.0005104864831082523,
-0.014833671040832996,
-0.009065020829439163,
-... | |
725,074 | tf_keras.src.engine.functional | _compute_tensor_usage_count | Compute the #. of tensor usages for all the output tensors of layers.
The computed tensor usage count is saved as `self._tensor_usage_count`.
This is later used for saving memory in eager computation by releasing
no-longer-needed tensors as early as possible.
| def _compute_tensor_usage_count(self):
"""Compute the #. of tensor usages for all the output tensors of layers.
The computed tensor usage count is saved as `self._tensor_usage_count`.
This is later used for saving memory in eager computation by releasing
no-longer-needed tensors as early as possible.
... | (self) | [
-0.07146269083023071,
-0.0942169800400734,
0.0022409865632653236,
0.06861840188503265,
0.016807954758405685,
0.0925104096531868,
-0.04191766679286957,
-0.014932502992451191,
-0.00039858894888311625,
-0.019056716933846474,
0.00824398547410965,
0.0021032162476330996,
-0.012879283167421818,
-... |
725,076 | tf_keras.src.engine.functional | _conform_to_reference_input | Set shape and dtype based on `keras.Input`s. | def _conform_to_reference_input(self, tensor, ref_input):
"""Set shape and dtype based on `keras.Input`s."""
if isinstance(tensor, tf.Tensor):
# Allow (None,) and (None, 1) Tensors to be passed interchangeably.
# Use the shape specified by the `keras.Input`.
t_shape = tensor.shape
... | (self, tensor, ref_input) | [
0.0010930983116850257,
-0.037653058767318726,
-0.023374000564217567,
0.02499289996922016,
-0.027703192085027695,
0.02803060971200466,
-0.04547470808029175,
0.04765749350190163,
0.05125909298658371,
-0.0067848265171051025,
-0.005265971180051565,
-0.039763085544109344,
-0.014424577355384827,
... |
725,087 | tf_keras.src.engine.functional | _flatten_to_reference_inputs | Maps `tensors` to their respective `keras.Input`. | def _flatten_to_reference_inputs(self, tensors):
"""Maps `tensors` to their respective `keras.Input`."""
if self._enable_dict_to_input_mapping and isinstance(tensors, dict):
ref_inputs = self._nested_inputs
if not tf.nest.is_nested(ref_inputs):
ref_inputs = [self._nested_inputs]
... | (self, tensors) | [
-0.017303060740232468,
-0.07611145079135895,
-0.03856949508190155,
0.03392720967531204,
-0.09123098850250244,
0.012807567603886127,
-0.01051394920796156,
0.02005540393292904,
0.111414834856987,
0.041431933641433716,
-0.017917750403285027,
-0.019284747540950775,
-0.050459615886211395,
-0.01... |
725,098 | tf_keras.src.engine.functional | _get_save_spec | null | def _get_save_spec(self, dynamic_batch=True, inputs_only=True):
if getattr(self, "_has_explicit_input_shape", True):
# Functional models and Sequential models that have an explicit
# input shape should use the batch size set by the input layer.
dynamic_batch = False
return super()._get_s... | (self, dynamic_batch=True, inputs_only=True) | [
0.053024835884571075,
-0.04618406668305397,
-0.028426416218280792,
0.02087675780057907,
-0.03700396418571472,
0.006840771064162254,
-0.04260418191552162,
0.028692249208688736,
0.03998129442334175,
-0.01301695965230465,
0.0322544127702713,
-0.015374013222754002,
-0.06543038040399551,
-0.024... |
725,102 | tf_keras.src.engine.functional | _graph_network_add_loss | null | def _graph_network_add_loss(self, symbolic_loss):
new_nodes, new_layers = _map_subgraph_network(
self.inputs, [symbolic_loss]
)
# Losses must be keyed on inputs no matter what in order to be supported
# in DistributionStrategy.
add_loss_layer = base_layer.AddLoss(
unconditional=False... | (self, symbolic_loss) | [
-0.06680051982402802,
-0.01587909832596779,
0.0018276683986186981,
0.07322901487350464,
-0.008240885101258755,
0.007948283106088638,
-0.0529303252696991,
-0.010420111939311028,
0.07930814474821091,
-0.003967590630054474,
-0.02981916442513466,
-0.01308409683406353,
0.003718661144375801,
-0.... |
725,103 | tf_keras.src.engine.functional | _graph_network_add_metric | null | def _graph_network_add_metric(self, value, aggregation, name):
new_nodes, new_layers = _map_subgraph_network(self.inputs, [value])
add_metric_layer = base_layer.AddMetric(
aggregation, name, dtype=value.dtype
)
add_metric_layer(value)
new_nodes.extend(add_metric_layer.inbound_nodes)
new_... | (self, value, aggregation, name) | [
-0.021777059882879257,
-0.019074294716119766,
0.008009309880435467,
0.05384873226284981,
-0.007910323329269886,
0.028628656640648842,
-0.024892987683415413,
-0.03453342616558075,
0.013109274208545685,
-0.016345705837011337,
-0.014236860908567905,
0.03918149322271347,
0.01759379915893078,
-... |
725,106 | tf_keras.src.engine.functional | _handle_deferred_layer_dependencies | Handles layer checkpoint dependencies that are added after init. | def _handle_deferred_layer_dependencies(self, layers):
"""Handles layer checkpoint dependencies that are added after init."""
layer_checkpoint_dependencies = self._layer_checkpoint_dependencies
layer_to_name = {v: k for k, v in layer_checkpoint_dependencies.items()}
for layer in layers:
if layer... | (self, layers) | [
-0.03418644517660141,
0.025936322286725044,
-0.06043214723467827,
0.09535767138004303,
-0.030112948268651962,
0.020281551405787468,
-0.03231298178434372,
0.07713864743709564,
0.03626616299152374,
0.029012931510806084,
0.011618922464549541,
0.009943116456270218,
-0.01076812855899334,
-0.080... |
725,113 | tf_keras.src.engine.functional | _init_graph_network | @tf.__internal__.tracking.no_automatic_dependency_tracking
def _init_graph_network(self, inputs, outputs):
# This method is needed for Sequential to reinitialize graph network
# when layer is added or removed.
self._is_graph_network = True
# Normalize and set self.inputs, self.outputs.
if isinstance... | (self, inputs, outputs) | [
-0.013987872749567032,
-0.051239367574453354,
-0.0321928933262825,
0.032925453037023544,
-0.05496154725551605,
0.02577807381749153,
-0.10699287056922913,
0.02953985147178173,
0.022491469979286194,
-0.03543990105390549,
0.006568261422216892,
0.013166220858693123,
-0.0350637249648571,
0.0257... | |
725,114 | tf_keras.src.engine.functional | _init_set_name | null | def _init_set_name(self, name, zero_based=True):
if not name:
cls_name = self.__class__.__name__
if self.__class__ == Functional:
# Hide the functional class name from user, since its not a
# public visible class. Use "Model" instead,
cls_name = "Model"
se... | (self, name, zero_based=True) | [
0.00366420135833323,
0.012700778432190418,
-0.0170147567987442,
0.04276464506983757,
-0.012691847048699856,
-0.040835414081811905,
0.020739246159791946,
0.056162092834711075,
0.039191994816064835,
-0.013986933045089245,
-0.012450693175196648,
0.062128420919179916,
0.03908481448888779,
0.00... |
725,115 | tf_keras.src.engine.functional | _insert_layers | Inserts Layers into the Network after Network creation.
This is only valid for TF-Keras Graph Networks. Layers added via this
function will be included in the `call` computation and `get_config` of
this Network. They will not be added to the Network's outputs.
Args:
layers:... | def _insert_layers(self, layers, relevant_nodes=None):
"""Inserts Layers into the Network after Network creation.
This is only valid for TF-Keras Graph Networks. Layers added via this
function will be included in the `call` computation and `get_config` of
this Network. They will not be added to the Ne... | (self, layers, relevant_nodes=None) | [
-0.043536461889743805,
-0.04164528846740723,
-0.061778437346220016,
0.041211891919374466,
-0.027264464646577835,
0.029411736875772476,
-0.08029621094465256,
0.02807215414941311,
0.03358808532357216,
-0.009908977895975113,
0.013238237239420414,
-0.020369548350572586,
-0.014439921826124191,
... |
725,118 | tf_keras.src.engine.sequential | _is_layer_name_unique | null | def _is_layer_name_unique(self, layer):
for ref_layer in self.layers:
if layer.name == ref_layer.name and ref_layer is not layer:
return False
return True
| (self, layer) | [
0.015642687678337097,
-0.03727986663579941,
-0.023356061428785324,
0.08651416748762131,
-0.032909244298934937,
-0.006361589767038822,
-0.04114951193332672,
0.05113457143306732,
0.06543843448162079,
0.026966577395796776,
-0.00234294799156487,
-0.012403588742017746,
0.0189336109906435,
-0.04... |
725,120 | tf_keras.src.engine.functional | _lookup_dependency | null | def _lookup_dependency(self, name, cached_dependencies=None):
if cached_dependencies:
return cached_dependencies.get(name)
# Fall back to slow lookup (`layer_checkpoint_dependencies` does a
# thorough check of all layer to see if they contain weights.)
layer_dependencies = self._layer_checkpoint... | (self, name, cached_dependencies=None) | [
0.014201151207089424,
-0.04509124532341957,
-0.024273255839943886,
0.0467497743666172,
0.016792600974440575,
-0.009493348188698292,
0.005809169262647629,
0.06589195877313614,
0.06703219562768936,
-0.01042627077549696,
0.038664449006319046,
0.007929840125143528,
-0.013492820784449577,
-0.08... |
725,133 | tf_keras.src.engine.functional | _run_internal_graph | Computes output tensors for new inputs.
# Note:
- Can be run on non-Keras tensors.
Args:
inputs: Tensor or nested structure of Tensors.
training: Boolean learning phase.
mask: (Optional) Tensor or nested structure of Tensors.
Returns:
... | def _run_internal_graph(self, inputs, training=None, mask=None):
"""Computes output tensors for new inputs.
# Note:
- Can be run on non-Keras tensors.
Args:
inputs: Tensor or nested structure of Tensors.
training: Boolean learning phase.
mask: (Optional) Tensor or nested stru... | (self, inputs, training=None, mask=None) | [
-0.0070323217660188675,
-0.07019384205341339,
-0.02099531516432762,
0.06671927124261856,
-0.05858727917075157,
0.04184277728199959,
-0.10098450630903244,
0.007674564141780138,
0.057995863258838654,
-0.016125362366437912,
0.009088421240448952,
-0.0037864570040255785,
-0.03476424887776375,
0... |
725,141 | tf_keras.src.engine.functional | _set_output_names | Assigns unique names to the Network's outputs.
Output layers with multiple output tensors would otherwise lead to
duplicate names in self.output_names.
| def _set_output_names(self):
"""Assigns unique names to the Network's outputs.
Output layers with multiple output tensors would otherwise lead to
duplicate names in self.output_names.
"""
uniquified = []
output_names = set()
prefix_count = {}
for layer in self._output_layers:
pro... | (self) | [
-0.05994502082467079,
-0.045725006610155106,
-0.038098230957984924,
-0.025125587359070778,
-0.04654470458626747,
0.044014327228069305,
-0.06978142261505127,
0.02231009677052498,
0.06700156629085541,
-0.017088964581489563,
0.004797918256372213,
0.008388560265302658,
0.005933915264904499,
0.... |
725,151 | tf_keras.src.engine.functional | _trackable_children | null | def _trackable_children(self, save_type="checkpoint", **kwargs):
dependencies = self._layer_checkpoint_dependencies
dependencies.update(super()._trackable_children(save_type, **kwargs))
return dependencies
| (self, save_type='checkpoint', **kwargs) | [
-0.03105040080845356,
-0.0005829577567055821,
-0.06464619934558868,
0.07046923786401749,
-0.013189010322093964,
0.015159080736339092,
-0.02097340300679207,
0.06558764725923538,
0.03223592787981033,
-0.007483651861548424,
0.053732357919216156,
-0.010643609799444675,
0.04288825765252113,
-0.... |
725,156 | tf_keras.src.engine.functional | _validate_graph_inputs_and_outputs | Validates the inputs and outputs of a Graph Network. | def _validate_graph_inputs_and_outputs(self):
"""Validates the inputs and outputs of a Graph Network."""
# Check for redundancy in inputs.
if len({id(i) for i in self.inputs}) != len(self.inputs):
raise ValueError(
"The list of inputs passed to the model "
"contains the same ... | (self) | [
-0.0326530747115612,
-0.06117236986756325,
-0.05241179093718529,
0.035611193627119064,
-0.07702485471963882,
0.0044419183395802975,
-0.08957789093255997,
0.043575357645750046,
0.04683687537908554,
0.004185927100479603,
0.02193937823176384,
-0.02195833995938301,
0.03966912627220154,
0.02070... |
725,158 | tf_keras.src.engine.sequential | add | Adds a layer instance on top of the layer stack.
Args:
layer: layer instance.
Raises:
TypeError: If `layer` is not a layer instance.
ValueError: In case the `layer` argument does not
know its input shape.
ValueError: In case the `layer` a... | @tf.__internal__.tracking.no_automatic_dependency_tracking
@traceback_utils.filter_traceback
def add(self, layer):
"""Adds a layer instance on top of the layer stack.
Args:
layer: layer instance.
Raises:
TypeError: If `layer` is not a layer instance.
ValueError: In case the `layer` a... | (self, layer) | [
-0.034134022891521454,
-0.027482764795422554,
-0.05422433465719223,
0.07228610664606094,
-0.01937837153673172,
0.029218723997473717,
-0.09417089074850082,
0.04927002266049385,
0.027424249798059464,
-0.03434858098626137,
0.0005104864831082523,
-0.014833671040832996,
-0.009065020829439163,
-... |
725,164 | tf_keras.src.engine.sequential | build | null | @generic_utils.default
def build(self, input_shape=None):
if self._graph_initialized:
self._init_graph_network(self.inputs, self.outputs)
else:
if input_shape is None:
raise ValueError("You must provide an `input_shape` argument.")
self._build_graph_network_for_inferred_shape... | (self, input_shape=None) | [
-0.043715089559555054,
-0.05427782982587814,
-0.005873997695744038,
-0.0028868867084383965,
-0.05724097415804863,
0.017813725396990776,
-0.07432262599468231,
0.006287965923547745,
0.06375989317893982,
-0.031862515956163406,
0.018667807802557945,
0.06051786243915558,
-0.002732193097472191,
... |
725,166 | tf_keras.src.engine.sequential | call | null | def call(self, inputs, training=None, mask=None):
# If applicable, update the static input shape of the model.
if not self._has_explicit_input_shape:
if not tf.is_tensor(inputs) and not isinstance(inputs, tf.Tensor):
# This is a Sequential with multiple inputs. This is technically
... | (self, inputs, training=None, mask=None) | [
-0.021304521709680557,
-0.06071217358112335,
-0.01743616908788681,
-0.004723486956208944,
-0.09085864573717117,
0.016492901369929314,
-0.11784183233976364,
0.026182839646935463,
0.1263788789510727,
0.027326194569468498,
0.007922500371932983,
-0.015330490656197071,
-0.00514033529907465,
0.0... |
725,170 | tf_keras.src.engine.sequential | compute_mask | null | def compute_mask(self, inputs, mask):
# TODO(omalleyt): b/123540974 This function is not really safe to call
# by itself because it will duplicate any updates and losses in graph
# mode by `call`ing the Layers again.
outputs = self.call(inputs, mask=mask)
return getattr(outputs, "_keras_mask", None)... | (self, inputs, mask) | [
0.010793878696858883,
-0.08054931461811066,
0.04702083393931389,
0.025230690836906433,
-0.050562575459480286,
-0.030678225681185722,
-0.060040947049856186,
0.009309720247983932,
0.10672447085380554,
0.0023906754795461893,
0.008904949761927128,
-0.029042279347777367,
-0.001795114716514945,
... |
725,172 | tf_keras.src.engine.sequential | compute_output_shape | null | def compute_output_shape(self, input_shape):
shape = input_shape
for layer in self.layers:
shape = layer.compute_output_shape(shape)
return shape
| (self, input_shape) | [
-0.05875066667795181,
-0.09206004440784454,
0.008556974120438099,
-0.004635930061340332,
-0.008323010988533497,
0.0036697504110634327,
-0.03070978820323944,
0.03507709503173828,
0.04672324284911156,
0.010710299015045166,
0.03299742564558983,
-0.03285878151655197,
0.0037369064521044493,
-0.... |
725,183 | tf_keras.src.engine.sequential | get_config | null | def get_config(self):
layer_configs = []
serialize_obj_fn = serialization_lib.serialize_keras_object
if getattr(self, "use_legacy_config", None):
serialize_obj_fn = legacy_serialization.serialize_keras_object
for layer in super().layers:
# `super().layers` include the InputLayer if avail... | (self) | [
0.002185183111578226,
-0.06527962535619736,
-0.03064580075442791,
0.01715235598385334,
-0.03302699699997902,
0.015622969716787338,
-0.06640246510505676,
0.00839710421860218,
0.014538847841322422,
0.0019032630370929837,
0.0012801348930224776,
-0.05633561685681343,
-0.027838699519634247,
0.0... |
725,192 | tf_keras.src.engine.functional | get_weight_paths | null | def get_weight_paths(self):
result = {}
for layer in self.layers:
(
descendants,
object_paths_dict,
) = tf.__internal__.tracking.ObjectGraphView(
layer
).breadth_first_traversal()
for descendant in descendants:
if isinstance(descend... | (self) | [
-0.019935710355639458,
-0.03635113686323166,
-0.029781201854348183,
0.00409209169447422,
-0.006428748834878206,
-0.0012659834465011954,
-0.022044112905859947,
0.022834764793515205,
0.017366092652082443,
0.014787063002586365,
0.008885415270924568,
-0.026750370860099792,
-0.017573168501257896,... |
725,199 | tf_keras.src.engine.sequential | pop | Removes the last layer in the model.
Raises:
TypeError: if there are no layers in the model.
| @tf.__internal__.tracking.no_automatic_dependency_tracking
@traceback_utils.filter_traceback
def add(self, layer):
"""Adds a layer instance on top of the layer stack.
Args:
layer: layer instance.
Raises:
TypeError: If `layer` is not a layer instance.
ValueError: In case the `layer` a... | (self) | [
-0.03417421877384186,
-0.02748371660709381,
-0.054226212203502655,
0.07217157632112503,
-0.019379043951630592,
0.02921973541378975,
-0.09417415410280228,
0.04931074380874634,
0.027464210987091064,
-0.03433026373386383,
0.0004705782048404217,
-0.014804926700890064,
-0.00908484123647213,
-0.... |
725,242 | safetensors_rust | SafetensorError | Custom Python Exception for Safetensor errors. | from builtins import type
| null | [
0.024378793314099312,
0.015226082876324654,
0.014569271355867386,
0.004356706980615854,
0.019192541018128395,
0.027551960200071335,
0.025231795385479927,
0.012974157929420471,
-0.037941522896289825,
-0.0242081917822361,
0.0014788919361308217,
0.04234301298856735,
-0.0018254240276291966,
-0... |
725,244 | builtins | safe_open | Opens a safetensors lazily and returns tensors as asked
Args:
filename (`str`, or `os.PathLike`):
The filename to open
framework (`str`):
The framework you want you tensors in. Supported values:
`pt`, `tf`, `flax`, `numpy`.
device (`str`, defaults to `"cpu"`):
The device o... | from builtins import safe_open
| (self, filename, framework, device='cpu') | [
-0.001867330283857882,
-0.037876687943935394,
0.0022026465740054846,
0.06386671215295792,
0.025363566353917122,
0.01890621706843376,
0.01362147182226181,
0.0661797896027565,
-0.018665270879864693,
-0.018938343971967697,
0.05278320237994194,
0.02576514333486557,
-0.013653597794473171,
0.016... |
725,247 | notebook | _jupyter_labextension_paths | null | def _jupyter_labextension_paths() -> list[dict[str, str]]:
return [{"src": "labextension", "dest": "@jupyter-notebook/lab-extension"}]
| () -> list[dict[str, str]] | [
0.008307082578539848,
-0.04122040793299675,
0.023814236745238304,
-0.005301052704453468,
-0.01527315191924572,
0.03627036139369011,
-0.01091710850596428,
0.07318872958421707,
0.02046620287001133,
0.013734136708080769,
0.03565835580229759,
-0.01834218204021454,
0.012348122894763947,
0.01289... |
725,248 | notebook | _jupyter_server_extension_paths | null | def _jupyter_server_extension_paths() -> list[dict[str, str]]:
return [{"module": "notebook"}]
| () -> list[dict[str, str]] | [
0.022643283009529114,
-0.04332822561264038,
0.022433459758758545,
-0.0017944145947694778,
-0.0005155390244908631,
0.04895844683051109,
0.00642142491415143,
0.07917280495166779,
-0.0008097814861685038,
0.017354020848870277,
0.030948733910918236,
-0.004474015440791845,
-0.029130276292562485,
... |
725,249 | notebook | _jupyter_server_extension_points | null | def _jupyter_server_extension_points() -> list[dict[str, Any]]:
from .app import JupyterNotebookApp
return [{"module": "notebook", "app": JupyterNotebookApp}]
| () -> list[dict[str, typing.Any]] | [
0.0191743653267622,
-0.06385321915149689,
-0.02195299230515957,
-0.007374402601271868,
0.01264183223247528,
0.05432123690843582,
0.018033472821116447,
0.06072495877742767,
0.0010822383919730783,
0.03218422830104828,
0.014721202664077282,
-0.01015762984752655,
-0.03139296546578407,
-0.00311... |
725,251 | dockerfile_parse.parser | DockerfileParser | null | class DockerfileParser(object):
def __init__(self, path=None,
cache_content=False,
env_replace=True,
parent_env=None,
fileobj=None,
build_args=None):
"""
Initialize source of Dockerfile
:param path: path to ... | (path=None, cache_content=False, env_replace=True, parent_env=None, fileobj=None, build_args=None) | [
0.04311678931117058,
-0.06786377727985382,
-0.029165318235754967,
0.014582659117877483,
-0.03961259871721268,
0.011219942010939121,
0.014375890605151653,
0.027902938425540924,
-0.008673417381942272,
-0.046838629990816116,
0.06938733905553818,
0.041310280561447144,
-0.009141368791460991,
0.... |
725,252 | dockerfile_parse.parser | __init__ |
Initialize source of Dockerfile
:param path: path to (directory with) Dockerfile; if not provided,
and fileobj is not provided, the current working
directory will be used
:param cache_content: cache Dockerfile content inside DockerfileParser
:pa... | def __init__(self, path=None,
cache_content=False,
env_replace=True,
parent_env=None,
fileobj=None,
build_args=None):
"""
Initialize source of Dockerfile
:param path: path to (directory with) Dockerfile; if not provided,
and f... | (self, path=None, cache_content=False, env_replace=True, parent_env=None, fileobj=None, build_args=None) | [
0.02465907298028469,
-0.07781140506267548,
-0.01833454705774784,
0.021426327526569366,
-0.0375712551176548,
-0.01858827844262123,
0.026952065527439117,
0.04386758804321289,
0.006145973224192858,
-0.0362556017935276,
0.0751425102353096,
0.054505571722984314,
-0.03266575187444687,
0.02845566... |
725,253 | dockerfile_parse.parser | _add_instruction |
:param instruction: instruction name to be added
:param value: instruction value
| def _add_instruction(self, instruction, value):
"""
:param instruction: instruction name to be added
:param value: instruction value
"""
if instruction in ('LABEL', 'ENV', 'ARG') and len(value) == 2:
new_line = instruction + ' ' + '='.join(map(quote, value)) + '\n'
else:
new_line... | (self, instruction, value) | [
0.02047058567404747,
-0.036819107830524445,
0.021763097494840622,
0.016261190176010132,
-0.01998152770102024,
-0.015125877223908901,
-0.01251465454697609,
0.006366492249071598,
-0.0012051796074956656,
-0.033448100090026855,
0.026985542848706245,
0.0058774338103830814,
0.05281830579042435,
... |
725,254 | dockerfile_parse.parser | _delete_instructions |
:param instruction: name of instruction to be deleted
:param value: if specified, delete instruction only when it has this value
if instruction is LABEL then value is label name
| def _delete_instructions(self, instruction, value=None):
"""
:param instruction: name of instruction to be deleted
:param value: if specified, delete instruction only when it has this value
if instruction is LABEL then value is label name
"""
if instruction == 'LABEL' and value:
... | (self, instruction, value=None) | [
0.0759417712688446,
-0.0042936732061207294,
-0.010334080085158348,
-0.03656252473592758,
-0.0705278068780899,
-0.030673012137413025,
-0.05604180693626404,
0.036086972802877426,
-0.0017192983068525791,
-0.028258679434657097,
-0.008441022597253323,
0.04751847684383392,
0.015208473429083824,
... |
725,255 | dockerfile_parse.parser | _instruction_getter |
Get LABEL or ENV or ARG instructions with environment replacement
:param name: e.g. 'LABEL' or 'ENV' or 'ARG'
:param env_replace: bool, whether to perform ENV substitution
:return: Labels instance or Envs instance
| def _instruction_getter(self, name, env_replace):
"""
Get LABEL or ENV or ARG instructions with environment replacement
:param name: e.g. 'LABEL' or 'ENV' or 'ARG'
:param env_replace: bool, whether to perform ENV substitution
:return: Labels instance or Envs instance
"""
if name not in ('LAB... | (self, name, env_replace) | [
0.04966501146554947,
-0.1286965012550354,
-0.06431030482053757,
-0.024528974667191505,
-0.05725324526429176,
-0.02033647522330284,
0.019179267808794975,
-0.029745887964963913,
0.0651070699095726,
-0.048640597611665726,
-0.009471068158745766,
0.009143825620412827,
0.005605809856206179,
0.01... |
725,256 | dockerfile_parse.parser | _instructions_setter | null | def _instructions_setter(self, name, instructions):
if not isinstance(instructions, dict):
raise TypeError('instructions needs to be a dictionary {name: value}')
if name == 'LABEL':
existing = self.labels
elif name == 'ENV':
existing = self.envs
elif name == 'ARG':
existi... | (self, name, instructions) | [
0.04799584299325943,
-0.05861666798591614,
-0.0015366204315796494,
-0.021866407245397568,
-0.10767827183008194,
-0.013165782205760479,
-0.029345085844397545,
0.01303715631365776,
0.05483139306306839,
0.015177858993411064,
-0.03037409298121929,
-0.0009273699251934886,
0.09033215045928955,
0... |
725,257 | dockerfile_parse.parser | _modify_instruction_arg | null | def _modify_instruction_arg(self, arg_key, arg_value):
self._modify_instruction_label_env('ARG', arg_key, arg_value)
| (self, arg_key, arg_value) | [
0.005814488511532545,
-0.02862517349421978,
-0.011252770200371742,
0.07443883270025253,
-0.021669523790478706,
-0.019562765955924988,
0.022455379366874695,
0.054641980677843094,
0.09089161455631256,
-0.09149354696273804,
-0.011403253301978111,
-0.010600677691400051,
0.03969402238726616,
0.... |
725,258 | dockerfile_parse.parser | _modify_instruction_env | null | def _modify_instruction_env(self, env_var_key, env_var_value):
self._modify_instruction_label_env('ENV', env_var_key, env_var_value)
| (self, env_var_key, env_var_value) | [
0.006347442511469126,
-0.04995161294937134,
-0.044363103806972504,
0.01563575118780136,
-0.05509166046977043,
-0.02416512742638588,
0.003936966881155968,
0.013824661262333393,
0.05371178314089775,
-0.006782966665923595,
-0.017403721809387207,
-0.020680934190750122,
0.035462886095047,
0.054... |
725,259 | dockerfile_parse.parser | _modify_instruction_label | null | def _modify_instruction_label(self, label_key, instr_value):
self._modify_instruction_label_env('LABEL', label_key, instr_value)
| (self, label_key, instr_value) | [
0.023162100464105606,
-0.04780549928545952,
-0.024811727926135063,
0.04874814301729202,
-0.05272071436047554,
-0.01677400805056095,
0.036022454500198364,
0.0435299389064312,
0.066153384745121,
-0.07628680765628815,
-0.025047387927770615,
-0.03693143278360367,
0.08477059751749039,
-0.006733... |
725,260 | dockerfile_parse.parser | _modify_instruction_label_env |
set <INSTRUCTION> instr_key to instr_value
:param instr_key: str, label key
:param instr_value: str or None, new label/env value or None to remove
| def _modify_instruction_label_env(self, instruction, instr_key, instr_value):
"""
set <INSTRUCTION> instr_key to instr_value
:param instr_key: str, label key
:param instr_value: str or None, new label/env value or None to remove
"""
if instruction == 'LABEL':
instructions = self.labels
... | (self, instruction, instr_key, instr_value) | [
0.044215988367795944,
-0.062381647527217865,
-0.0686430037021637,
0.020349403843283653,
-0.08186142146587372,
-0.0377613827586174,
0.007348395884037018,
0.02813744731247425,
0.05619759485125542,
-0.05751170590519905,
-0.01889035291969776,
-0.015595411881804466,
0.028601251542568207,
0.0197... |
725,261 | dockerfile_parse.parser | _open_dockerfile | null | @property
def structure(self):
"""
Returns a list of dicts describing the commands:
[
{"instruction": "FROM", # always upper-case
"startline": 0, # 0-based
"endline": 0, # 0-based
"content": "From fedora\n",
"value": "fedora"},
... | (self, mode) | [
0.05696684494614601,
-0.020701171830296516,
-0.008337435312569141,
-0.021763265132904053,
-0.010292653925716877,
0.013585143722593784,
0.013826528564095497,
0.006097383331507444,
-0.02606957219541073,
-0.04167269542813301,
0.027247531339526176,
0.054610926657915115,
0.025915086269378662,
0... |
725,262 | dockerfile_parse.parser | add_lines |
Add lines to the beginning or end of the build.
:param lines: one or more lines to add to the content, by default at the end.
:param all_stages: bool for whether to add in all stages for a multistage build
or (by default) only the last.
:param at_start: adds a... | def add_lines(self, *lines, **kwargs):
"""
Add lines to the beginning or end of the build.
:param lines: one or more lines to add to the content, by default at the end.
:param all_stages: bool for whether to add in all stages for a multistage build
or (by default) only the last.
... | (self, *lines, **kwargs) | [
-0.014445765875279903,
-0.03968900442123413,
-0.08505313098430634,
0.038141243159770966,
-0.06408466398715973,
-0.004157303366810083,
-0.04974944889545441,
0.02824663184583187,
-0.041457876563072205,
0.017228050157427788,
-0.00498876441270113,
0.024303527548909187,
0.005670515820384026,
0.... |
725,263 | dockerfile_parse.parser | add_lines_at |
Add lines at a specific location in the file.
:param anchor: structure_dict|line_str|line_num a reference to where adds should occur
:param lines: one or more lines to add to the content
:param replace: if True -- replace the anchor
:param after: if True -- insert after the anch... | def add_lines_at(self, anchor, *lines, **kwargs):
"""
Add lines at a specific location in the file.
:param anchor: structure_dict|line_str|line_num a reference to where adds should occur
:param lines: one or more lines to add to the content
:param replace: if True -- replace the anchor
:param af... | (self, anchor, *lines, **kwargs) | [
-0.021700013428926468,
-0.02052263356745243,
-0.030430736020207405,
0.0031177918426692486,
-0.041914716362953186,
0.007367679849267006,
-0.04745745658874512,
0.08375697582960129,
-0.06346981972455978,
-0.03655311092734337,
-0.029633739963173866,
-0.009079408831894398,
0.005434060003608465,
... |
725,378 | tushare.pro.data_pro | ht_subs | null | def ht_subs(username, password):
from tushare.subs.ht_subs.subscribe import InsightSubscribe
app = InsightSubscribe(username, password)
return app
| (username, password) | [
-0.0372295156121254,
-0.07362163066864014,
0.05635020509362221,
-0.04678986221551895,
-0.006485507357865572,
0.02494761534035206,
0.00007271389767993242,
0.014514976181089878,
0.0007807033252902329,
0.02098739892244339,
0.01334610115736723,
0.020324455574154854,
0.03667124733328819,
-0.009... |
725,404 | tushare.util.verify_token | wrapper |
沪深京 A 股 all -实时行情
@param src: 数据源 新浪sina |东方财富 dc
@param interval: 分页采集时间间隔(默认3秒翻译一夜)
@param page_count: 限制抓取的页数(仅对新浪有效)
@param proxies: 设置代理 防止被封禁
@return: 按涨跌幅 倒序排序
-------
DataFrame 实时交易数据
东方财富:
2、代码:TS_CODE
3、名称:NAME
4、最新价:PRICE
... | def require_permission(event_name, event_detail):
def decorator(func):
def wrapper(*args, **kwargs):
# event_name = kwargs["event_name"]
# event_detail = kwargs["event_detail"]
# 检查用户权限
token = get_token()
if token:
try:
... | (*args, **kwargs) | [
-0.013250689022243023,
0.05364478379487991,
0.009603628888726234,
0.05617721751332283,
0.03286812826991081,
-0.00935395248234272,
-0.036131758242845535,
0.0025346623733639717,
-0.006027904339134693,
-0.01756652630865574,
0.05182570964097977,
0.012742418795824051,
0.03133440390229225,
-0.07... |
725,405 | tushare.util.verify_token | wrapper |
获取实时交易数据 getting real time quotes data
用于跟踪交易情况(本次执行的结果-上一次执行的数据)
Parameters
------
ts_code : string
src : sina ,dc
return
-------
DataFrame 实时交易数据
属性:0:name,股票名字
1:open,今日开盘价
2:pre_close,昨日收盘价
3:price,当前价格
... | def require_permission(event_name, event_detail):
def decorator(func):
def wrapper(*args, **kwargs):
# event_name = kwargs["event_name"]
# event_detail = kwargs["event_detail"]
# 检查用户权限
token = get_token()
if token:
try:
... | (*args, **kwargs) | [
-0.013250689022243023,
0.05364478379487991,
0.009603628888726234,
0.05617721751332283,
0.03286812826991081,
-0.00935395248234272,
-0.036131758242845535,
0.0025346623733639717,
-0.006027904339134693,
-0.01756652630865574,
0.05182570964097977,
0.012742418795824051,
0.03133440390229225,
-0.07... |
725,406 | tushare.util.verify_token | wrapper |
历史分笔数据
:param ts_code: 股票代码
:type ts_code: str
:param src: 来源 腾讯财经tx 新浪财经sina
:type src: str
:param page_count: 限制页数
:type page_count: str
:return: 历史分笔数据
:rtype: pandas.DataFrame
1、TIME : 成交时间
2、PRICE : 成交价格
3、PCHANGE : 涨跌幅
4、CHANGE : 价格变动
... | def require_permission(event_name, event_detail):
def decorator(func):
def wrapper(*args, **kwargs):
# event_name = kwargs["event_name"]
# event_detail = kwargs["event_detail"]
# 检查用户权限
token = get_token()
if token:
try:
... | (*args, **kwargs) | [
-0.013250689022243023,
0.05364478379487991,
0.009603628888726234,
0.05617721751332283,
0.03286812826991081,
-0.00935395248234272,
-0.036131758242845535,
0.0025346623733639717,
-0.006027904339134693,
-0.01756652630865574,
0.05182570964097977,
0.012742418795824051,
0.03133440390229225,
-0.07... |
725,417 | tushare.pro.data_pro | subs | null | def subs(token=''):
if token == '' or token is None:
token = upass.get_token()
from tushare.subs.ts_subs.subscribe import TsSubscribe
app = TsSubscribe(token=token)
return app
| (token='') | [
0.01655317097902298,
-0.028735755011439323,
0.004252289421856403,
-0.032762203365564346,
0.020321514457464218,
0.038922324776649475,
0.0007216202211566269,
-0.015426110476255417,
0.008728270418941975,
0.05822862312197685,
0.033157963305711746,
0.017034968361258507,
0.004116784315556288,
-0... |
725,427 | lotkavolterra_simulator.simulator | LVobserver | This class contains observational simulators
for a prey and predator populations.
Attributes
----------
Xtrue : array, double, dimension=n
true number of preys to be observed
Ytrue : array, double, dimension=n
true number of predators to be observed
X0 : double
initial c... | class LVobserver(object):
"""This class contains observational simulators
for a prey and predator populations.
Attributes
----------
Xtrue : array, double, dimension=n
true number of preys to be observed
Ytrue : array, double, dimension=n
true number of predators to be observed
... | (Xtrue, Ytrue, X0, Y0) | [
0.021960239857435226,
-0.021333998069167137,
0.04007952660322189,
0.028744535520672798,
0.031437378376722336,
-0.05611133575439453,
-0.09502187371253967,
0.015979623422026634,
0.04256362095475197,
0.02861928753554821,
-0.05272962525486946,
0.03427634388208389,
0.047803185880184174,
0.05410... |
725,428 | lotkavolterra_simulator.simulator | Dnoise_cov | Covariance matrix for the demographic noise.
Demographic noise depends only on the observed population.
Parameters
----------
obsR : double
strength of demographic noise
Returns
-------
D : array, double, dimension=(2*n,2*n)
demographic n... | def Dnoise_cov(self, **metaparams):
"""Covariance matrix for the demographic noise.
Demographic noise depends only on the observed population.
Parameters
----------
obsR : double
strength of demographic noise
Returns
-------
D : array, double, dimension=(2*n,2*n)
demograp... | (self, **metaparams) | [
-0.01879691891372204,
-0.009997380897402763,
0.11853115260601044,
-0.016668442636728287,
0.01659473031759262,
-0.024804560467600822,
-0.03287617862224579,
-0.002635254291817546,
0.04411747306585312,
0.05834415927529335,
-0.04057922959327698,
0.06534693390130997,
0.018925916403532028,
0.062... |
725,429 | lotkavolterra_simulator.simulator | Onoise_cov | Covariance matrix for the observational noise.
Prey and predator populations introduce a noise to the other
population, and there is also a non-diagonal term
proportional to the geometric mean of both populations.
Parameters
----------
obsS : double
overall s... | def Onoise_cov(self, X, Y, **metaparams):
"""Covariance matrix for the observational noise.
Prey and predator populations introduce a noise to the other
population, and there is also a non-diagonal term
proportional to the geometric mean of both populations.
Parameters
----------
obsS : doub... | (self, X, Y, **metaparams) | [
-0.017283765599131584,
-0.025321222841739655,
0.0987010970711708,
-0.010713535360991955,
0.01908319629728794,
-0.05868913233280182,
-0.030267350375652313,
0.015595068223774433,
0.06703110784292221,
0.015133675187826157,
-0.020707298070192337,
0.031245503574609756,
0.017449866980314255,
0.0... |
725,430 | lotkavolterra_simulator.simulator | __init__ | null | def __init__(self, Xtrue, Ytrue, X0, Y0):
self.Xtrue=Xtrue
self.Ytrue=Ytrue
self.X0=X0
self.Y0=Y0
| (self, Xtrue, Ytrue, X0, Y0) | [
0.040873993188142776,
-0.045083723962306976,
0.05584193393588066,
0.01290804985910654,
-0.06217452138662338,
-0.03734789043664932,
-0.05933205410838127,
0.04188144952058792,
-0.004619013052433729,
0.016263242810964584,
-0.0033102177549153566,
0.02903636544942856,
-0.0012492024106904864,
0.... |
725,431 | lotkavolterra_simulator.simulator | censor | Censor part of the data during periods
when preys are not observable.
Parameters
----------
mask : array, double, dimension=n
a mask containing zeros and ones
| def censor(self, **metaparams):
"""Censor part of the data during periods
when preys are not observable.
Parameters
----------
mask : array, double, dimension=n
a mask containing zeros and ones
"""
import numpy as np
mask=metaparams["mask"]
self.Xobs = self.Xobs[np.where(mask... | (self, **metaparams) | [
0.010493135079741478,
0.008779344148933887,
0.05084392800927162,
0.029401816427707672,
-0.008113113231956959,
-0.030418694019317627,
-0.05245690792798996,
-0.043936166912317276,
0.06220491603016853,
0.05059847608208656,
-0.01733076572418213,
-0.009958396665751934,
0.01982913166284561,
-0.0... |
725,432 | lotkavolterra_simulator.simulator | make_demographic_noise | Simulate demographic noise.
Demographic noise depends only on the observed population.
Parameters
----------
obsR : double
strength of demographic noise
Returns
-------
XDnoise : array, double, dimension=n
demographic noise for preys
... | def make_demographic_noise(self, **metaparams):
"""Simulate demographic noise.
Demographic noise depends only on the observed population.
Parameters
----------
obsR : double
strength of demographic noise
Returns
-------
XDnoise : array, double, dimension=n
demographic noi... | (self, **metaparams) | [
0.028677958995103836,
-0.039642516523599625,
0.10842523723840714,
-0.006624035071581602,
0.03215407580137253,
-0.004703388549387455,
-0.06393834948539734,
0.0028751918580383062,
0.035741131752729416,
0.1101263165473938,
-0.014967638999223709,
0.09614789485931396,
0.045707229524850845,
0.09... |
725,433 | lotkavolterra_simulator.simulator | make_observational_noise | Simulate observational noise.
Parameters
----------
obsS : double
overall strength of observational noise
obsT : double
strength of non-diagonal term in observational noise
Returns
-------
XOnoise : array, double, dimension=n
... | def make_observational_noise(self, Xsignal, Ysignal, **metaparams):
"""Simulate observational noise.
Parameters
----------
obsS : double
overall strength of observational noise
obsT : double
strength of non-diagonal term in observational noise
Returns
-------
XOnoise : ar... | (self, Xsignal, Ysignal, **metaparams) | [
-0.004456489812582731,
-0.03045346774160862,
0.0905853658914566,
0.01867661438882351,
0.025273920968174934,
-0.05519809201359749,
-0.09187079966068268,
0.0035396721214056015,
0.06536815315485,
0.04986731708049774,
-0.03517933189868927,
0.07470645755529404,
-0.0006752078188583255,
0.0365025... |
725,434 | lotkavolterra_simulator.simulator | make_signal | Simulate the signal.
Parameters
----------
model : int, optional, default=0
0= correct data model; 1=misspecified data model
Xefficiency : array, double, dimension=len(t)
detection efficiency of preys as a function of time
Yefficiency : array, double, dim... | def make_signal(self, **metaparams):
"""Simulate the signal.
Parameters
----------
model : int, optional, default=0
0= correct data model; 1=misspecified data model
Xefficiency : array, double, dimension=len(t)
detection efficiency of preys as a function of time
Yefficiency : arr... | (self, **metaparams) | [
0.01743905618786812,
-0.027827279642224312,
0.024367673322558403,
0.015446021221578121,
0.011243725195527077,
-0.007417474407702684,
-0.10739826411008835,
0.004442023579031229,
0.01843557320535183,
0.023333551362156868,
-0.022393440827727318,
0.04264342784881592,
0.013782024383544922,
0.00... |
725,435 | lotkavolterra_simulator.simulator | observe | Simulate the observation process using a given data model.
Parameters
----------
model : int, optional, default=0
0= correct data model; 1=misspecified data model
threshold : double
maximum number of individuals (preys or predators) that can be observed
m... | def observe(self, **metaparams):
"""Simulate the observation process using a given data model.
Parameters
----------
model : int, optional, default=0
0= correct data model; 1=misspecified data model
threshold : double
maximum number of individuals (preys or predators) that can be obs... | (self, **metaparams) | [
0.050749555230140686,
-0.026080135256052017,
-0.025989703834056854,
0.0019951213616877794,
0.02859410084784031,
-0.0130762392655015,
-0.05548810958862305,
-0.03056548349559307,
0.028702616691589355,
0.0686909481883049,
-0.06283105909824371,
0.03754671290516853,
0.03590087965130806,
0.02049... |
725,436 | lotkavolterra_simulator.simulator | simulate_obs | Simulate the observational process, assuming additive noise, i.e.
data = signal + noise.
Parameters
----------
Xsignal : array, double, dimension=n
unobserved signal for the number of preys
Ysignal : array, double, dimension=n
unobserved signal for the nu... | def simulate_obs(self, Xsignal, Ysignal, **metaparams):
"""Simulate the observational process, assuming additive noise, i.e.
data = signal + noise.
Parameters
----------
Xsignal : array, double, dimension=n
unobserved signal for the number of preys
Ysignal : array, double, dimension=n
... | (self, Xsignal, Ysignal, **metaparams) | [
0.035291027277708054,
-0.013236476108431816,
0.01765487529337406,
0.00821429118514061,
0.05032481998205185,
-0.03502891957759857,
-0.10431915521621704,
-0.007222023326903582,
0.0415254645049572,
0.06706231832504272,
-0.05084903538227081,
0.05901184305548668,
0.02063167840242386,
0.04317300... |
725,437 | lotkavolterra_simulator.simulator | threshold | Threshold the data, excluding negative measurements
and measurements above a detection maximum.
Parameters
----------
threshold : double
maximum number of individuals (preys or predators) that can be observed
| def threshold(self, **metaparams):
"""Threshold the data, excluding negative measurements
and measurements above a detection maximum.
Parameters
----------
threshold : double
maximum number of individuals (preys or predators) that can be observed
"""
import numpy as np
if not "mo... | (self, **metaparams) | [
0.06576302647590637,
-0.004439095966517925,
0.03681919723749161,
0.051447514444589615,
-0.005556920543313026,
-0.01128864474594593,
-0.01635795459151268,
-0.023791715502738953,
-0.022282883524894714,
0.03082066774368286,
-0.040922485291957855,
-0.0077189672738313675,
0.007590164430439472,
... |
725,438 | lotkavolterra_simulator.simulator | LVsimulator | This class contains a basic Lotka-Volterra simulator
and the observational simulator.
X0 and Y0 are inputs and are the initial populations of each species
alpha, beta, gamma, delta are inputs and problem parameters
Attributes
----------
X0 : double
initial condition: number of preys
... | class LVsimulator(object):
"""This class contains a basic Lotka-Volterra simulator
and the observational simulator.
X0 and Y0 are inputs and are the initial populations of each species
alpha, beta, gamma, delta are inputs and problem parameters
Attributes
----------
X0 : double
ini... | (X0, Y0, alpha, beta, gamma, delta) | [
0.018159471452236176,
-0.021443743258714676,
-0.01895921304821968,
0.06449118256568909,
-0.021774303168058395,
-0.021742314100265503,
-0.10270817577838898,
-0.016879884526133537,
-0.06338220834732056,
0.008701191283762455,
0.008466600440442562,
-0.03431425616145134,
0.03738526254892349,
0.... |
725,439 | lotkavolterra_simulator.simulator | EEuler | Solves Lotka-Volterra equations for one prey and one predator species using
the explicit Euler method.
Parameters
----------
t : array, double, dimension=n
array of time values where we approximate X and Y values
timestep at each iteration is given by t[n+1] - t[... | def EEuler(self, t):
"""Solves Lotka-Volterra equations for one prey and one predator species using
the explicit Euler method.
Parameters
----------
t : array, double, dimension=n
array of time values where we approximate X and Y values
timestep at each iteration is given by t[n+1] -... | (self, t) | [
0.026558775454759598,
-0.007292855530977249,
-0.030581124126911163,
0.05371902510523796,
-0.02005535364151001,
-0.009971288032829762,
-0.07574795931577682,
-0.05518511310219765,
-0.07495852559804916,
0.033513303846120834,
0.006320161744952202,
-0.0655229240655899,
0.002254347549751401,
0.0... |
725,440 | lotkavolterra_simulator.simulator | __init__ | null | def __init__(self, X0, Y0, alpha, beta, gamma, delta):
self.X0=X0
self.Y0=Y0
self.alpha=alpha
self.beta=beta
self.gamma=gamma
self.delta=delta
| (self, X0, Y0, alpha, beta, gamma, delta) | [
0.039760518819093704,
-0.0541616789996624,
-0.030468257144093513,
0.003908026032149792,
-0.06278756260871887,
-0.029801879078149796,
-0.059122487902641296,
0.0244708601385355,
-0.016724223271012306,
0.04035285487771034,
-0.0010984815889969468,
0.01952856034040451,
-0.009708749130368233,
0.... |
725,441 | lotkavolterra_simulator.simulator | compute_dtheta_domega | Computes the gradient of the latent function theta with respect to
the parameters omega, using finite differences.
Parameters
----------
t : array, double, dimension=n
array of time values where we approximate X and Y values
timestep at each iteration is given by... | def compute_dtheta_domega(self, t, t_s, tres, Delta_omega):
"""Computes the gradient of the latent function theta with respect to
the parameters omega, using finite differences.
Parameters
----------
t : array, double, dimension=n
array of time values where we approximate X and Y values
... | (self, t, t_s, tres, Delta_omega) | [
-0.008200181648135185,
0.00281835300847888,
0.011391048319637775,
0.05924913287162781,
-0.010577402077615261,
0.0002389473229413852,
-0.0569356344640255,
-0.02793845720589161,
-0.06109209358692169,
-0.016880709677934647,
0.04383886978030205,
-0.015067161060869694,
0.030016684904694557,
-0.... |
725,442 | lotkavolterra_simulator.simulator | compute_theta | Solves the Lotka-Volterra system of equations and
returns theta, the latent function that is the next layer
of the Bayesian hierarchical model.
Parameters
----------
t : array, double, dimension=n
array of time values where we approximate X and Y values
t... | def compute_theta(self, omega, t, t_s, tres):
"""Solves the Lotka-Volterra system of equations and
returns theta, the latent function that is the next layer
of the Bayesian hierarchical model.
Parameters
----------
t : array, double, dimension=n
array of time values where we approximate ... | (self, omega, t, t_s, tres) | [
0.011234435252845287,
-0.024316878989338875,
0.015259802341461182,
0.08855808526277542,
0.006275914143770933,
0.0005120335845276713,
-0.09309577196836472,
-0.06107580289244652,
-0.028323950245976448,
-0.0004665766900870949,
0.024938981980085373,
-0.05836782976984978,
-0.0023923490662127733,
... |
725,443 | lotkavolterra_simulator.simulator | get_XY | two array, double, dimension=2*n: subsamples in time to get X and Y.
| @staticmethod
def get_XY(t_s, tres, Xth, Yth):
"""two array, double, dimension=2*n: subsamples in time to get X and Y.
"""
import numpy as np
X=np.array([Xth[tres*n] for n in range(len(t_s))])
Y=np.array([Yth[tres*n] for n in range(len(t_s))])
return X, Y
| (t_s, tres, Xth, Yth) | [
-0.02896062470972538,
-0.027852840721607208,
-0.005103716626763344,
0.027712170034646988,
-0.006506029982119799,
-0.0006022473680786788,
-0.042341943830251694,
0.026832977309823036,
0.01812896504998207,
-0.00838750321418047,
0.02361512929201126,
0.011438303627073765,
0.02889028936624527,
-... |
725,444 | lotkavolterra_simulator.simulator | get_theta | array, double, dimension=2*n: concatenates X and Y.
| @staticmethod
def get_theta(X, Y):
"""array, double, dimension=2*n: concatenates X and Y.
"""
import numpy as np
return np.concatenate((X, Y))
| (X, Y) | [
-0.07487742602825165,
-0.02460605651140213,
0.003390495665371418,
0.03325377404689789,
-0.012971576303243637,
-0.031881947070360184,
-0.05362279713153839,
0.016349049285054207,
0.06581295281648636,
-0.03141309320926666,
0.07550255954265594,
-0.043377507477998734,
0.04087696224451065,
0.011... |
725,446 | splitutils.core.splitutils | binning |
bins numeric data.
If X is one-dimensional:
binning is done either intrinsically into nbins classes
based on an equidistant percentile split, or extrinsically
by using the lower_boundaries values.
If X is two-dimensional
binning is done by kmeans clustering into nbins clus... | def binning(x: Union[list, np.array],
nbins: int = 2,
lower_boundaries: Union[list, np.array, dict] = None,
seed: int = 42) -> np.array:
'''
bins numeric data.
If X is one-dimensional:
binning is done either intrinsically into nbins classes
based on an e... | (x: Union[list, <built-in function array>], nbins: int = 2, lower_boundaries: Union[list, <built-in function array>, dict, NoneType] = None, seed: int = 42) -> <built-in function array> | [
-0.01255092490464449,
-0.04329634830355644,
-0.026143738999962807,
-0.04545730724930763,
0.04348929226398468,
0.022709358483552933,
-0.022227002307772636,
0.03955325856804848,
0.0023020480293780565,
-0.022111237049102783,
-0.024986082687973976,
0.023674072697758675,
0.0008983895531855524,
... |
725,448 | splitutils.core.splitutils | optimize_traindevtest_split | optimize group-disjunct split into training, dev, and test set, which is guided by:
- disjunct split of values in SPLIT_ON
- stratification by all keys in STRATIFY_ON (targets and groupings)
- test set proportion in X should be close to test_size (which is the test
proportion in set(split_on))
S... | def optimize_traindevtest_split(
X: Union[np.array, pd.DataFrame],
y: Union[np.array, list],
split_on: Union[np.array, list],
stratify_on: dict,
weight: dict = None,
dev_size: float = .1,
test_size: float = .1,
k: int = 30,
seed: int = 42) -> Tuple... | (X: Union[<built-in function array>, pandas.core.frame.DataFrame], y: Union[<built-in function array>, list], split_on: Union[<built-in function array>, list], stratify_on: dict, weight: Optional[dict] = None, dev_size: float = 0.1, test_size: float = 0.1, k: int = 30, seed: int = 42) -> Tuple[<built-in function array>... | [
0.012551795691251755,
0.021613581106066704,
-0.04502318799495697,
-0.020062463358044624,
0.03400209918618202,
-0.026450613513588905,
-0.01144968718290329,
-0.02826705202460289,
-0.00843929685652256,
0.002135335933417082,
-0.03983919695019722,
-0.002097068354487419,
0.04155358672142029,
0.0... |
725,449 | splitutils.core.splitutils | optimize_traintest_split | optimize group-disjunct split which is guided by:
- disjunct split of values in SPLIT_ON
- stratification by all keys in STRATIFY_ON (targets and groupings)
- test set proportion in X should be close to test_size (which is the test
proportion in set(split_on))
Score to be minimized: (sum_v[w(v) ... | def optimize_traintest_split(
X: Union[np.array, pd.DataFrame],
y: Union[np.array, list],
split_on: Union[np.array, list],
stratify_on: dict,
weight: dict = None,
test_size: float = .1,
k: int = 30,
seed: int = 42) -> Tuple[np.array, np.array, dict]:
'... | (X: Union[<built-in function array>, pandas.core.frame.DataFrame], y: Union[<built-in function array>, list], split_on: Union[<built-in function array>, list], stratify_on: dict, weight: Optional[dict] = None, test_size: float = 0.1, k: int = 30, seed: int = 42) -> Tuple[<built-in function array>, <built-in function ar... | [
-0.0012091627577319741,
0.020687459036707878,
-0.04070952907204628,
-0.03046661801636219,
0.0328458771109581,
-0.01928611472249031,
0.0026212178636342287,
-0.007546083070337772,
0.004254438448697329,
-0.011291400529444218,
-0.037120480090379715,
0.02776474691927433,
0.04560919106006622,
-0... |
725,450 | resfo.format | Format |
The format of an res file, either FORMATTED for ascii
or UNFORMATTED for binary.
| class Format(Enum):
"""
The format of an res file, either FORMATTED for ascii
or UNFORMATTED for binary.
"""
FORMATTED = auto()
UNFORMATTED = auto()
| (value, names=None, *, module=None, qualname=None, type=None, start=1) | [
0.06018441915512085,
-0.033283546566963196,
-0.031965386122465134,
-0.03649222478270531,
0.04166080057621002,
-0.06979311257600784,
0.03016158752143383,
-0.03999575600028038,
0.014811958186328411,
-0.042146436870098114,
0.01932145282626152,
0.035659704357385635,
-0.0006168035906739533,
0.0... |
725,451 | resfo.types | MESS |
The MESS value is a sentinell object used to signal that the type of the
array that is to be written should be an empty array of type MESS.
| class MESS:
"""
The MESS value is a sentinell object used to signal that the type of the
array that is to be written should be an empty array of type MESS.
"""
pass
| () | [
0.04392653703689575,
0.017850767821073532,
0.008427035063505173,
-0.022537941113114357,
0.023974623531103134,
-0.026165561750531197,
-0.07107982039451599,
-0.0152557622641325,
0.03390568494796753,
-0.01344195194542408,
0.0021987962536513805,
0.016845090314745903,
-0.00784787256270647,
-0.0... |
725,452 | resfo.errors | ResfoParsingError |
Indicates an error occurred during reading of an res file.
| class ResfoParsingError(ValueError):
"""
Indicates an error occurred during reading of an res file.
"""
pass
| null | [
0.00602620979771018,
-0.00945167988538742,
-0.020980460569262505,
0.029515773057937622,
0.007160760462284088,
-0.04084382578730583,
0.002978195669129491,
0.029376136139035225,
0.05163078382611275,
-0.046010393649339676,
0.07505489140748978,
0.04978059232234955,
0.04447438567876816,
0.00060... |
725,453 | resfo.errors | ResfoWriteError |
Indicates an error occurred during writing of an res file.
| class ResfoWriteError(ValueError):
"""
Indicates an error occurred during writing of an res file.
"""
pass
| null | [
-0.02636132761836052,
-0.018741657957434654,
-0.01388112735003233,
0.049032412469387054,
0.03160625696182251,
-0.04985246807336807,
-0.05036500096321106,
0.03973846510052681,
0.044556282460689545,
-0.06211911141872406,
0.08473894000053406,
0.032973017543554306,
0.06143573299050331,
-0.0071... |
725,459 | resfo.read | lazy_read |
Reads the contents of an res file and generates the entries
of that file. Each entry has a entry.read_keyword() and
entry.read_array() method which will return the corresponding
data, but only upon request. This requires the user to
pay attention to when values are read as it should happen
befo... | def lazy_read(filelike, fileformat: Optional[Format] = None) -> Iterator[ResArray]:
"""
Reads the contents of an res file and generates the entries
of that file. Each entry has a entry.read_keyword() and
entry.read_array() method which will return the corresponding
data, but only upon request. This ... | (filelike, fileformat: Optional[resfo.format.Format] = None) -> Iterator[resfo.array_entry.ResArray] | [
0.015238609164953232,
-0.027342967689037323,
-0.06672299653291702,
0.009912306442856789,
0.026804570108652115,
0.05960844084620476,
-0.019766926765441895,
0.033592239022254944,
0.09675795584917068,
-0.033207669854164124,
0.047263722866773605,
0.07852931320667267,
-0.017238376662135124,
0.0... |
725,460 | resfo.read | read |
Read the contents of a res file and return a list of
tuples (keyword, array). Takes the same parameters as
lazy_read, but differs in return type
| def read(*args, **kwargs) -> List[Tuple[str, "ReadArrayValue"]]:
"""
Read the contents of a res file and return a list of
tuples (keyword, array). Takes the same parameters as
lazy_read, but differs in return type
"""
return [
(arr.read_keyword(), arr.read_array()) for arr in lazy_read(*... | (*args, **kwargs) -> List[Tuple[str, ForwardRef('ReadArrayValue')]] | [
-0.004196879919618368,
-0.03671107068657875,
-0.04358553886413574,
-0.007840082049369812,
0.03531137481331825,
0.08674585074186325,
0.001612310647033155,
-0.0035656869877129793,
0.11084192246198654,
-0.032317083328962326,
0.046420369297266006,
0.06374827772378922,
-0.008358323946595192,
-0... |
725,464 | resfo.write | write |
Write the given contents to the given file in res format.
:param filelike: Either filename, pathlib.Path or stream
to write file to. For fileformat=Format.UNFORMATTED the
stream must be in binary mode and for fileformat=Format.FORMATTED
in text mode.
:param contents: list or iterab... | def write(
filelike,
contents: Union[Sequence[Tuple[str, WriteArrayValue]], Dict[str, WriteArrayValue]],
fileformat: Format = Format.UNFORMATTED,
):
"""
Write the given contents to the given file in res format.
:param filelike: Either filename, pathlib.Path or stream
to write file to. F... | (filelike, contents: Union[Sequence[Tuple[str, Union[ForwardRef('ArrayLike'), resfo.types.MESS]]], Dict[str, Union[ForwardRef('ArrayLike'), resfo.types.MESS]]], fileformat: resfo.format.Format = <Format.UNFORMATTED: 2>) | [
0.007882854901254177,
-0.0005601765587925911,
-0.03221447765827179,
0.007019802462309599,
0.028356125578284264,
0.008215153589844704,
-0.05774606764316559,
0.02848535217344761,
0.042312655597925186,
-0.0018495633266866207,
0.03836199641227722,
0.05763529986143112,
0.05970293655991554,
-0.0... |
725,465 | pydomainextractor | DomainExtractor |
PyDomainExtractor is a highly optimized Domain Name Extraction library written in Rust
| class DomainExtractor:
'''
PyDomainExtractor is a highly optimized Domain Name Extraction library written in Rust
'''
engine: typing.Optional[pydomainextractor.DomainExtractor] = None
def __new__(
cls,
suffix_list_data: typing.Optional[str] = None,
):
if suffix_list_data... | (suffix_list_data: Optional[str] = None) | [
0.032078810036182404,
-0.03506378456950188,
-0.04151831194758415,
0.025042792782187462,
-0.010282663628458977,
-0.0024834424257278442,
-0.029481491073966026,
-0.004962039180099964,
0.047488268464803696,
-0.024616366252303123,
0.03746727481484413,
0.05058954283595085,
-0.036459360271692276,
... |
725,466 | pydomainextractor | __new__ | null | def __new__(
cls,
suffix_list_data: typing.Optional[str] = None,
):
if suffix_list_data is None:
if DomainExtractor.engine is None:
DomainExtractor.engine = pydomainextractor.DomainExtractor()
return DomainExtractor.engine
else:
return pydomainextractor.DomainExtracto... | (cls, suffix_list_data: Optional[str] = None) | [
0.04916105046868324,
-0.02170056849718094,
-0.02927650511264801,
0.009314000606536865,
-0.01920582726597786,
0.004285540897399187,
0.012657135725021362,
0.012849744409322739,
0.04380469769239426,
0.007942811585962772,
0.03131265193223953,
0.05282978340983391,
-0.035531699657440186,
-0.0007... |
725,536 | syne_tune.report | Reporter |
Callback for reporting metric values from a training script back to Syne Tune.
Example:
.. code-block:: python
from syne_tune import Reporter
report = Reporter()
for epoch in range(1, epochs + 1):
# ...
report(epoch=epoch, accuracy=accuracy)
:param add_tim... | class Reporter:
"""
Callback for reporting metric values from a training script back to Syne Tune.
Example:
.. code-block:: python
from syne_tune import Reporter
report = Reporter()
for epoch in range(1, epochs + 1):
# ...
report(epoch=epoch, accuracy=accura... | (add_time: bool = True, add_cost: bool = True) -> None | [
0.04234132915735245,
-0.03904589265584946,
-0.045297231525182724,
0.04681512713432312,
-0.005447451490908861,
-0.016207540407776833,
-0.05907813459634781,
0.017216144129633904,
0.0019111017463728786,
-0.027861392125487328,
-0.001557841314934194,
0.033034224063158035,
0.05416494235396385,
-... |
725,537 | syne_tune.report | __call__ | Report metric values from training function back to Syne Tune
A time stamp :const:`~syne_tune.constants.ST_WORKER_TIMESTAMP` is added.
See :attr:`add_time`, :attr:`add_cost` comments for other automatically
added metrics.
:param kwargs: Keyword arguments for metrics to be reported, for... | def __call__(self, **kwargs) -> None:
"""Report metric values from training function back to Syne Tune
A time stamp :const:`~syne_tune.constants.ST_WORKER_TIMESTAMP` is added.
See :attr:`add_time`, :attr:`add_cost` comments for other automatically
added metrics.
:param kwargs: Keyword arguments for ... | (self, **kwargs) -> NoneType | [
0.010130084119737148,
-0.01650693640112877,
0.003996919374912977,
0.0437634214758873,
-0.00019500640337355435,
-0.004973944276571274,
-0.07400792092084885,
-0.028550075367093086,
0.03716793656349182,
-0.022355420514941216,
-0.028477197512984276,
0.021517319604754448,
0.07116566598415375,
-... |
725,538 | syne_tune.report | __eq__ | null | # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | (self, other) | [
0.07312266528606415,
-0.039373744279146194,
-0.043572552502155304,
0.007951990701258183,
-0.011021875776350498,
-0.015240490436553955,
-0.06840890645980835,
-0.025410721078515053,
0.00012626138050109148,
-0.009066062048077583,
-0.02087521366775036,
0.03277844190597534,
0.0267178975045681,
... |
725,540 | syne_tune.report | __post_init__ | null | def __post_init__(self):
if self.add_time:
self.start = perf_counter()
self.iter = 0
# TODO dollar-cost computation is not available for file-based backends, what would be
# needed to add support for those backends will be to add a way to access instance-type
# information.... | (self) | [
0.07912492752075195,
-0.03653176128864288,
-0.05556892976164818,
0.04246613383293152,
0.0038156001828610897,
-0.034426603466272354,
-0.020942699164152145,
-0.014545558020472527,
-0.06845395267009735,
-0.028818896040320396,
0.01430056057870388,
0.06489696353673935,
0.009872468188405037,
-0.... |
725,542 | syne_tune.report | _check_reported_values | null | @staticmethod
def _check_reported_values(kwargs: Dict[str, Any]):
assert all(
v is not None for v in kwargs.values()
), f"Invalid value in report: kwargs = {kwargs}"
| (kwargs: Dict[str, Any]) | [
0.02296316623687744,
-0.026852089911699295,
-0.0024747694842517376,
0.026666903868317604,
-0.040707431733608246,
-0.02314835414290428,
0.01696142926812172,
-0.023518728092312813,
0.02377125434577465,
-0.033788178116083145,
-0.013510220684111118,
0.08484923839569092,
0.042289938777685165,
-... |
725,543 | syne_tune.stopping_criterion | StoppingCriterion |
Stopping criterion that can be used in a Tuner, for instance
:code:`Tuner(stop_criterion=StoppingCriterion(max_wallclock_time=3600), ...)`.
If several arguments are used, the combined criterion is true whenever
one of the atomic criteria is true.
In principle, ``stop_criterion`` for ``Tuner`` can... | class StoppingCriterion:
"""
Stopping criterion that can be used in a Tuner, for instance
:code:`Tuner(stop_criterion=StoppingCriterion(max_wallclock_time=3600), ...)`.
If several arguments are used, the combined criterion is true whenever
one of the atomic criteria is true.
In principle, ``st... | (max_wallclock_time: float = None, max_num_evaluations: int = None, max_num_trials_started: int = None, max_num_trials_completed: int = None, max_cost: float = None, max_num_trials_finished: int = None, min_metric_value: Optional[Dict[str, float]] = None, max_metric_value: Optional[Dict[str, float]] = None) -> None | [
0.07093635201454163,
-0.010819786228239536,
-0.045311588793992996,
0.016418974846601486,
-0.03877587988972664,
-0.05025322362780571,
-0.0462680347263813,
-0.013997973874211311,
-0.03879580646753311,
-0.028673429042100906,
-0.047264330089092255,
0.0478222593665123,
0.05089085176587105,
-0.0... |
725,544 | syne_tune.stopping_criterion | __call__ | null | def __call__(self, status: TuningStatus) -> bool:
if (
self.max_wallclock_time is not None
and status.wallclock_time > self.max_wallclock_time
):
logger.info(
f"reaching max wallclock time ({self.max_wallclock_time}), stopping there."
)
return True
if (
... | (self, status: syne_tune.tuning_status.TuningStatus) -> bool | [
0.06075862795114517,
-0.02031799778342247,
-0.05153738334774971,
0.03456013277173042,
-0.02022031508386135,
-0.04469959810376167,
-0.04110487177968025,
-0.04063599556684494,
-0.05864868313074112,
-0.014750085771083832,
-0.04223799332976341,
0.057046689093112946,
0.05853146314620972,
-0.033... |
725,545 | syne_tune.stopping_criterion | __eq__ | null | # Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | (self, other) | [
0.06703952699899673,
-0.018748341128230095,
-0.0375981368124485,
0.005417540203779936,
-0.03147042915225029,
-0.03812568634748459,
-0.06285969913005829,
-0.038572076708078384,
-0.0486564114689827,
-0.028406577184796333,
-0.043096836656332016,
0.05555514991283417,
0.03688796982169151,
-0.00... |
725,548 | syne_tune.tuner | Tuner |
Controller of tuning loop, manages interplay between scheduler and
trial backend. Also, stopping criterion and number of workers are
maintained here.
:param trial_backend: Backend for trial evaluations
:param scheduler: Tuning algorithm for making decisions about which
trials to start, sto... | class Tuner:
"""
Controller of tuning loop, manages interplay between scheduler and
trial backend. Also, stopping criterion and number of workers are
maintained here.
:param trial_backend: Backend for trial evaluations
:param scheduler: Tuning algorithm for making decisions about which
... | (trial_backend: syne_tune.backend.trial_backend.TrialBackend, scheduler: syne_tune.optimizer.scheduler.TrialScheduler, stop_criterion: Callable[[syne_tune.tuning_status.TuningStatus], bool], n_workers: int, sleep_time: float = 5.0, results_update_interval: float = 10.0, print_update_interval: float = 30.0, max_failures... | [
0.05967482179403305,
-0.012728716246783733,
-0.08025498688220978,
0.02796301059424877,
-0.019757721573114395,
0.01866750791668892,
-0.08354475349187851,
-0.03993622958660126,
-0.017491227015852928,
-0.018399737775325775,
-0.019203051924705505,
0.00862607266753912,
0.0006580727058462799,
0.... |
725,549 | syne_tune.tuner | __init__ | null | def __init__(
self,
trial_backend: TrialBackend,
scheduler: TrialScheduler,
stop_criterion: Callable[[TuningStatus], bool],
n_workers: int,
sleep_time: float = TUNER_DEFAULT_SLEEP_TIME,
results_update_interval: float = 10.0,
print_update_interval: float = 30.0,
max_failures: int = 1,... | (self, trial_backend: syne_tune.backend.trial_backend.TrialBackend, scheduler: syne_tune.optimizer.scheduler.TrialScheduler, stop_criterion: Callable[[syne_tune.tuning_status.TuningStatus], bool], n_workers: int, sleep_time: float = 5.0, results_update_interval: float = 10.0, print_update_interval: float = 30.0, max_fa... | [
0.05733644589781761,
-0.021173883229494095,
-0.0619279146194458,
0.0375855378806591,
-0.03684559091925621,
0.0013862157939001918,
-0.0651533231139183,
-0.023431671783328056,
-0.03280434012413025,
-0.002397714415565133,
-0.007650867570191622,
0.04671155661344528,
-0.013072405941784382,
0.03... |
725,550 | syne_tune.tuner | _default_callback |
:return: Default callback to store results
| @staticmethod
def _default_callback():
"""
:return: Default callback to store results
"""
return StoreResultsCallback()
| () | [
-0.030576791614294052,
-0.05574081093072891,
-0.05652942880988121,
0.03925156965851784,
0.014069626107811928,
0.007093063089996576,
-0.047639574855566025,
0.03799695149064064,
0.07033021003007889,
-0.01304800994694233,
0.029859868809580803,
0.014141318388283253,
-0.003573416266590357,
-0.0... |
725,551 | syne_tune.tuner | _enrich_metadata |
:param metadata: Original metadata
:return: ``metadata`` enriched by default entries
| def _enrich_metadata(self, metadata: Dict[str, Any]) -> Dict[str, Any]:
"""
:param metadata: Original metadata
:return: ``metadata`` enriched by default entries
"""
res = metadata if metadata is not None else dict()
self._set_metadata(res, ST_TUNER_CREATION_TIMESTAMP, time.time())
self._set_... | (self, metadata: Dict[str, Any]) -> Dict[str, Any] | [
0.040511354804039,
-0.025781631469726562,
-0.024949965998530388,
-0.0017164653399959207,
0.009397820569574833,
-0.020736195147037506,
-0.014304647222161293,
0.038737133145332336,
0.0529678538441658,
0.023656263947486877,
0.01554290484637022,
0.012012946419417858,
0.0033520741853863,
0.0047... |
725,552 | syne_tune.tuner | _handle_failure | null | def _handle_failure(self, done_trials_statuses: Dict[int, Tuple[Trial, str]]):
logger.error(f"Stopped as {self.max_failures} failures were reached")
for trial_id, (_, status) in done_trials_statuses.items():
if status == Status.failed:
logger.error(f"showing log of first failure")
... | (self, done_trials_statuses: Dict[int, Tuple[syne_tune.backend.trial_status.Trial, str]]) | [
-0.030177580192685127,
0.0372263602912426,
-0.055105291306972504,
0.0670735314488411,
-0.029461689293384552,
-0.049708571285009384,
-0.01672249101102352,
0.049855418503284454,
0.003737779799848795,
0.04805651307106018,
0.00393510889261961,
0.07995957881212234,
0.018833454698324203,
-0.0355... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.