body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
ab251e511d598dd68211c975bc2bc57ace6e3b10d3aeb12321b6f6a42e8a1af0 | def error(name=None, message=''):
'\n If name is None Then return empty dict\n\n Otherwise raise an exception with __name__ from name, message from message\n\n CLI Example:\n\n .. code-block:: bash\n\n salt-wheel error\n salt-wheel error.error name="Exception" message="This is an error."\n... | If name is None Then return empty dict
Otherwise raise an exception with __name__ from name, message from message
CLI Example:
.. code-block:: bash
salt-wheel error
salt-wheel error.error name="Exception" message="This is an error." | salt/wheel/error.py | error | preoctopus/salt | 3 | python | def error(name=None, message=):
'\n If name is None Then return empty dict\n\n Otherwise raise an exception with __name__ from name, message from message\n\n CLI Example:\n\n .. code-block:: bash\n\n salt-wheel error\n salt-wheel error.error name="Exception" message="This is an error."\n ... | def error(name=None, message=):
'\n If name is None Then return empty dict\n\n Otherwise raise an exception with __name__ from name, message from message\n\n CLI Example:\n\n .. code-block:: bash\n\n salt-wheel error\n salt-wheel error.error name="Exception" message="This is an error."\n ... |
17cd771c34bc7122f3ae81fc6a9feb7feb77189b2bfb4dad7abe12a8b5fd289c | def get_keras_logreg(input_dim, output_dim=2):
'Create a simple logistic regression model (using keras)\n '
model = tf.keras.Sequential()
if (output_dim == 1):
loss = 'binary_crossentropy'
activation = tf.nn.sigmoid
else:
loss = 'categorical_crossentropy'
activation = ... | Create a simple logistic regression model (using keras) | server/verifier/keraslogreg.py | get_keras_logreg | AlessandraBotto/ruler | 20 | python | def get_keras_logreg(input_dim, output_dim=2):
'\n '
model = tf.keras.Sequential()
if (output_dim == 1):
loss = 'binary_crossentropy'
activation = tf.nn.sigmoid
else:
loss = 'categorical_crossentropy'
activation = tf.nn.softmax
dense = tf.keras.layers.Dense(units=o... | def get_keras_logreg(input_dim, output_dim=2):
'\n '
model = tf.keras.Sequential()
if (output_dim == 1):
loss = 'binary_crossentropy'
activation = tf.nn.sigmoid
else:
loss = 'categorical_crossentropy'
activation = tf.nn.softmax
dense = tf.keras.layers.Dense(units=o... |
48879ec31b3ce2cfe46a61806319dac15fdb9eb484d003fa5cb1aa3d359c72a4 | def get_keras_early_stopping(patience=10):
'Create early stopping condition\n '
return tf.keras.callbacks.EarlyStopping(monitor='val_accuracy', patience=10, verbose=1, restore_best_weights=True) | Create early stopping condition | server/verifier/keraslogreg.py | get_keras_early_stopping | AlessandraBotto/ruler | 20 | python | def get_keras_early_stopping(patience=10):
'\n '
return tf.keras.callbacks.EarlyStopping(monitor='val_accuracy', patience=10, verbose=1, restore_best_weights=True) | def get_keras_early_stopping(patience=10):
'\n '
return tf.keras.callbacks.EarlyStopping(monitor='val_accuracy', patience=10, verbose=1, restore_best_weights=True)<|docstring|>Create early stopping condition<|endoftext|> |
eab5e4a8ac530ab1b39008ed18282db3aa8095c11d811bc892a87b50944f2615 | def __init__(self, cardinality=2):
'Summary\n \n Args:\n cardinality (int, optional): Number of output classes\n '
snork_seed(123)
tf.random.set_seed(123)
np_seed(123)
py_seed(123)
self.cardinality = cardinality
self.keras_model = None | Summary
Args:
cardinality (int, optional): Number of output classes | server/verifier/keraslogreg.py | __init__ | AlessandraBotto/ruler | 20 | python | def __init__(self, cardinality=2):
'Summary\n \n Args:\n cardinality (int, optional): Number of output classes\n '
snork_seed(123)
tf.random.set_seed(123)
np_seed(123)
py_seed(123)
self.cardinality = cardinality
self.keras_model = None | def __init__(self, cardinality=2):
'Summary\n \n Args:\n cardinality (int, optional): Number of output classes\n '
snork_seed(123)
tf.random.set_seed(123)
np_seed(123)
py_seed(123)
self.cardinality = cardinality
self.keras_model = None<|docstring|>Summary
Arg... |
5a75baebfe20fe82c87f3f730476d3b6f6272009337b01bed03b702df1e9ad42 | def fit(self, X_train, Y_train, X_valid, Y_valid):
'Train the model using the given training and validation data.\n \n Args:\n X_train (list(str)): Training text examples, length n\n Y_train (matrix): Training labels, size n*m, where m is the cardinality\n X_valid (lis... | Train the model using the given training and validation data.
Args:
X_train (list(str)): Training text examples, length n
Y_train (matrix): Training labels, size n*m, where m is the cardinality
X_valid (list(str)): Validation test examples, length p
Y_valid (matrix): Validation labels, size p*m | server/verifier/keraslogreg.py | fit | AlessandraBotto/ruler | 20 | python | def fit(self, X_train, Y_train, X_valid, Y_valid):
'Train the model using the given training and validation data.\n \n Args:\n X_train (list(str)): Training text examples, length n\n Y_train (matrix): Training labels, size n*m, where m is the cardinality\n X_valid (lis... | def fit(self, X_train, Y_train, X_valid, Y_valid):
'Train the model using the given training and validation data.\n \n Args:\n X_train (list(str)): Training text examples, length n\n Y_train (matrix): Training labels, size n*m, where m is the cardinality\n X_valid (lis... |
62a95ce2ccfc18107b93b2a45cc811312266e3d0ec5efc711571a71596087bcc | def predict(self, X):
'Predict probabilities that each sample in X belongs to each class.\n \n Args:\n X (list(str)): Texts to predict class, length n\n \n Returns:\n matrix: size n*m, where m is the cardinality of the model\n '
X_v = self.vectorizer.tran... | Predict probabilities that each sample in X belongs to each class.
Args:
X (list(str)): Texts to predict class, length n
Returns:
matrix: size n*m, where m is the cardinality of the model | server/verifier/keraslogreg.py | predict | AlessandraBotto/ruler | 20 | python | def predict(self, X):
'Predict probabilities that each sample in X belongs to each class.\n \n Args:\n X (list(str)): Texts to predict class, length n\n \n Returns:\n matrix: size n*m, where m is the cardinality of the model\n '
X_v = self.vectorizer.tran... | def predict(self, X):
'Predict probabilities that each sample in X belongs to each class.\n \n Args:\n X (list(str)): Texts to predict class, length n\n \n Returns:\n matrix: size n*m, where m is the cardinality of the model\n '
X_v = self.vectorizer.tran... |
9f244454b590df5740a096f461692081134551308216e0fd25ff88a60fec78fc | @classmethod
def handle(cls, value, context, **kwargs):
'Retrieve a variable from the variable definition.\n\n The value is retrieved from the variables passed to Runway using\n either a variables file or the ``variables`` directive of the\n config file.\n\n Args:\n value: The... | Retrieve a variable from the variable definition.
The value is retrieved from the variables passed to Runway using
either a variables file or the ``variables`` directive of the
config file.
Args:
value: The value passed to the Lookup.
variables: The resolved variables pass to Runway.
Raises:
ValueError: ... | runway/lookups/handlers/var.py | handle | pataraco/runway | 1 | python | @classmethod
def handle(cls, value, context, **kwargs):
'Retrieve a variable from the variable definition.\n\n The value is retrieved from the variables passed to Runway using\n either a variables file or the ``variables`` directive of the\n config file.\n\n Args:\n value: The... | @classmethod
def handle(cls, value, context, **kwargs):
'Retrieve a variable from the variable definition.\n\n The value is retrieved from the variables passed to Runway using\n either a variables file or the ``variables`` directive of the\n config file.\n\n Args:\n value: The... |
1c08afeedad14809cdb9381ef64001fd52092c06c33b21894a2e173accd39cbd | def slicer(data, affine=None, value_range=None, opacity=1.0, lookup_colormap=None):
' Cuts 3D scalar or rgb volumes into 2D images\n\n Parameters\n ----------\n data : array, shape (X, Y, Z) or (X, Y, Z, 3)\n A grayscale or rgb 4D volume as a numpy array.\n affine : array, shape (4, 4)\n G... | Cuts 3D scalar or rgb volumes into 2D images
Parameters
----------
data : array, shape (X, Y, Z) or (X, Y, Z, 3)
A grayscale or rgb 4D volume as a numpy array.
affine : array, shape (4, 4)
Grid to space (usually RAS 1mm) transformation matrix. Default is None.
If None then the identity matrix is used.
valu... | dipy/viz/actor.py | slicer | JohnGriffiths/dipy | 0 | python | def slicer(data, affine=None, value_range=None, opacity=1.0, lookup_colormap=None):
' Cuts 3D scalar or rgb volumes into 2D images\n\n Parameters\n ----------\n data : array, shape (X, Y, Z) or (X, Y, Z, 3)\n A grayscale or rgb 4D volume as a numpy array.\n affine : array, shape (4, 4)\n G... | def slicer(data, affine=None, value_range=None, opacity=1.0, lookup_colormap=None):
' Cuts 3D scalar or rgb volumes into 2D images\n\n Parameters\n ----------\n data : array, shape (X, Y, Z) or (X, Y, Z, 3)\n A grayscale or rgb 4D volume as a numpy array.\n affine : array, shape (4, 4)\n G... |
5150e67d5985d52d19c7dae043b4eb4ca87731cd2598b0674ff988908c9f1106 | def streamtube(lines, colors=None, opacity=1, linewidth=0.01, tube_sides=9, lod=True, lod_points=(10 ** 4), lod_points_size=3, spline_subdiv=None, lookup_colormap=None):
' Uses streamtubes to visualize polylines\n\n Parameters\n ----------\n lines : list\n list of N curves represented as 2D ndarrays... | Uses streamtubes to visualize polylines
Parameters
----------
lines : list
list of N curves represented as 2D ndarrays
colors : array (N, 3), list of arrays, tuple (3,), array (K,), None
If None then a standard orientation colormap is used for every line.
If one tuple of color is used. Then all streamline... | dipy/viz/actor.py | streamtube | JohnGriffiths/dipy | 0 | python | def streamtube(lines, colors=None, opacity=1, linewidth=0.01, tube_sides=9, lod=True, lod_points=(10 ** 4), lod_points_size=3, spline_subdiv=None, lookup_colormap=None):
' Uses streamtubes to visualize polylines\n\n Parameters\n ----------\n lines : list\n list of N curves represented as 2D ndarrays... | def streamtube(lines, colors=None, opacity=1, linewidth=0.01, tube_sides=9, lod=True, lod_points=(10 ** 4), lod_points_size=3, spline_subdiv=None, lookup_colormap=None):
' Uses streamtubes to visualize polylines\n\n Parameters\n ----------\n lines : list\n list of N curves represented as 2D ndarrays... |
0fe8e9c2e842f8853b9698eb85188f448b0c29f9b4fb1093ffaa16964f9d8f29 | def line(lines, colors=None, opacity=1, linewidth=1, spline_subdiv=None, lod=True, lod_points=(10 ** 4), lod_points_size=3, lookup_colormap=None):
' Create an actor for one or more lines.\n\n Parameters\n ------------\n lines : list of arrays\n\n colors : array (N, 3), list of arrays, tuple (3,), array... | Create an actor for one or more lines.
Parameters
------------
lines : list of arrays
colors : array (N, 3), list of arrays, tuple (3,), array (K,), None
If None then a standard orientation colormap is used for every line.
If one tuple of color is used. Then all streamlines will have the same
colour.
... | dipy/viz/actor.py | line | JohnGriffiths/dipy | 0 | python | def line(lines, colors=None, opacity=1, linewidth=1, spline_subdiv=None, lod=True, lod_points=(10 ** 4), lod_points_size=3, lookup_colormap=None):
' Create an actor for one or more lines.\n\n Parameters\n ------------\n lines : list of arrays\n\n colors : array (N, 3), list of arrays, tuple (3,), array... | def line(lines, colors=None, opacity=1, linewidth=1, spline_subdiv=None, lod=True, lod_points=(10 ** 4), lod_points_size=3, lookup_colormap=None):
' Create an actor for one or more lines.\n\n Parameters\n ------------\n lines : list of arrays\n\n colors : array (N, 3), list of arrays, tuple (3,), array... |
359453b52d619369559c9fba31b913dc6ad3253b383e144f30005332b9b607d5 | def scalar_bar(lookup_table=None, title=' '):
' Default scalar bar actor for a given colormap (colorbar)\n\n Parameters\n ----------\n lookup_table : vtkLookupTable or None\n If None then ``colormap_lookup_table`` is called with default options.\n title : str\n\n Returns\n -------\n scal... | Default scalar bar actor for a given colormap (colorbar)
Parameters
----------
lookup_table : vtkLookupTable or None
If None then ``colormap_lookup_table`` is called with default options.
title : str
Returns
-------
scalar_bar : vtkScalarBarActor
See Also
--------
:func:`dipy.viz.actor.colormap_lookup_table` | dipy/viz/actor.py | scalar_bar | JohnGriffiths/dipy | 0 | python | def scalar_bar(lookup_table=None, title=' '):
' Default scalar bar actor for a given colormap (colorbar)\n\n Parameters\n ----------\n lookup_table : vtkLookupTable or None\n If None then ``colormap_lookup_table`` is called with default options.\n title : str\n\n Returns\n -------\n scal... | def scalar_bar(lookup_table=None, title=' '):
' Default scalar bar actor for a given colormap (colorbar)\n\n Parameters\n ----------\n lookup_table : vtkLookupTable or None\n If None then ``colormap_lookup_table`` is called with default options.\n title : str\n\n Returns\n -------\n scal... |
c51490a627b70cd2f3a1090fad2e259d9f772c5363db7afd5d42ba1ad0584f27 | def _arrow(pos=(0, 0, 0), color=(1, 0, 0), scale=(1, 1, 1), opacity=1):
' Internal function for generating arrow actors.\n '
arrow = vtk.vtkArrowSource()
arrowm = vtk.vtkPolyDataMapper()
if (major_version <= 5):
arrowm.SetInput(arrow.GetOutput())
else:
arrowm.SetInputConnection(ar... | Internal function for generating arrow actors. | dipy/viz/actor.py | _arrow | JohnGriffiths/dipy | 0 | python | def _arrow(pos=(0, 0, 0), color=(1, 0, 0), scale=(1, 1, 1), opacity=1):
' \n '
arrow = vtk.vtkArrowSource()
arrowm = vtk.vtkPolyDataMapper()
if (major_version <= 5):
arrowm.SetInput(arrow.GetOutput())
else:
arrowm.SetInputConnection(arrow.GetOutputPort())
arrowa = vtk.vtkActor... | def _arrow(pos=(0, 0, 0), color=(1, 0, 0), scale=(1, 1, 1), opacity=1):
' \n '
arrow = vtk.vtkArrowSource()
arrowm = vtk.vtkPolyDataMapper()
if (major_version <= 5):
arrowm.SetInput(arrow.GetOutput())
else:
arrowm.SetInputConnection(arrow.GetOutputPort())
arrowa = vtk.vtkActor... |
d31227902fac7cdc85fa5e886bdb3fbc8c4eb5f410a897737fde9a89a5545364 | def axes(scale=(1, 1, 1), colorx=(1, 0, 0), colory=(0, 1, 0), colorz=(0, 0, 1), opacity=1):
" Create an actor with the coordinate's system axes where\n red = x, green = y, blue = z.\n\n Parameters\n ----------\n scale : tuple (3,)\n Axes size e.g. (100, 100, 100). Default is (1, 1, 1).\n color... | Create an actor with the coordinate's system axes where
red = x, green = y, blue = z.
Parameters
----------
scale : tuple (3,)
Axes size e.g. (100, 100, 100). Default is (1, 1, 1).
colorx : tuple (3,)
x-axis color. Default red (1, 0, 0).
colory : tuple (3,)
y-axis color. Default green (0, 1, 0).
colorz : t... | dipy/viz/actor.py | axes | JohnGriffiths/dipy | 0 | python | def axes(scale=(1, 1, 1), colorx=(1, 0, 0), colory=(0, 1, 0), colorz=(0, 0, 1), opacity=1):
" Create an actor with the coordinate's system axes where\n red = x, green = y, blue = z.\n\n Parameters\n ----------\n scale : tuple (3,)\n Axes size e.g. (100, 100, 100). Default is (1, 1, 1).\n color... | def axes(scale=(1, 1, 1), colorx=(1, 0, 0), colory=(0, 1, 0), colorz=(0, 0, 1), opacity=1):
" Create an actor with the coordinate's system axes where\n red = x, green = y, blue = z.\n\n Parameters\n ----------\n scale : tuple (3,)\n Axes size e.g. (100, 100, 100). Default is (1, 1, 1).\n color... |
e30f1e9f9270b004572ad51d7b225d818cb6117d9108985e2e9ef57055d61411 | def __init__(self, settings, ui_id, job_id):
'\n Initialises the slurm scheduler class for Bilby\n\n :param settings: The settings from settings.py\n :param ui_id: The UI id of the job\n :param job_id: The Slurm id of the Job\n '
super().__init__(settings, ui_id, job_id)
s... | Initialises the slurm scheduler class for Bilby
:param settings: The settings from settings.py
:param ui_id: The UI id of the job
:param job_id: The Slurm id of the Job | misc/job_controller_scripts/slurm/bilby_slurm.py | __init__ | ASVO-TAO/SS18B-PLasky | 0 | python | def __init__(self, settings, ui_id, job_id):
'\n Initialises the slurm scheduler class for Bilby\n\n :param settings: The settings from settings.py\n :param ui_id: The UI id of the job\n :param job_id: The Slurm id of the Job\n '
super().__init__(settings, ui_id, job_id)
s... | def __init__(self, settings, ui_id, job_id):
'\n Initialises the slurm scheduler class for Bilby\n\n :param settings: The settings from settings.py\n :param ui_id: The UI id of the job\n :param job_id: The Slurm id of the Job\n '
super().__init__(settings, ui_id, job_id)
s... |
a08b4cdd6586afad4591ecc8f2c00aced1c55658b863cbd052d354473a5f2ce9 | def generate_template_dict(self):
'\n Called before a job is submitted before writing the slurm script\n\n We add in our custom slurm arguments\n\n :return: A dict of key/value pairs used in the slurm script template\n '
params = super().generate_template_dict()
params['job_param... | Called before a job is submitted before writing the slurm script
We add in our custom slurm arguments
:return: A dict of key/value pairs used in the slurm script template | misc/job_controller_scripts/slurm/bilby_slurm.py | generate_template_dict | ASVO-TAO/SS18B-PLasky | 0 | python | def generate_template_dict(self):
'\n Called before a job is submitted before writing the slurm script\n\n We add in our custom slurm arguments\n\n :return: A dict of key/value pairs used in the slurm script template\n '
params = super().generate_template_dict()
params['job_param... | def generate_template_dict(self):
'\n Called before a job is submitted before writing the slurm script\n\n We add in our custom slurm arguments\n\n :return: A dict of key/value pairs used in the slurm script template\n '
params = super().generate_template_dict()
params['job_param... |
9f6cbbf7cf1ea7dd150179128009e270a204002b9e1f3ff6fd881cb8d4d8e436 | def submit(self, job_parameters):
'\n Called when a job is submitted\n\n :param job_parameters: The parameters for this job, this is a string representing a json dump\n :return: The super call return to submit\n '
job_parameters = json.loads(job_parameters)
job_parameters['name']... | Called when a job is submitted
:param job_parameters: The parameters for this job, this is a string representing a json dump
:return: The super call return to submit | misc/job_controller_scripts/slurm/bilby_slurm.py | submit | ASVO-TAO/SS18B-PLasky | 0 | python | def submit(self, job_parameters):
'\n Called when a job is submitted\n\n :param job_parameters: The parameters for this job, this is a string representing a json dump\n :return: The super call return to submit\n '
job_parameters = json.loads(job_parameters)
job_parameters['name']... | def submit(self, job_parameters):
'\n Called when a job is submitted\n\n :param job_parameters: The parameters for this job, this is a string representing a json dump\n :return: The super call return to submit\n '
job_parameters = json.loads(job_parameters)
job_parameters['name']... |
1fc044d117f562172c53044908c5023f73284bc39d9c6615996c656a425006fb | def load_blend_results(path, survey):
'Load results exported from a DrawBlendsGenerator.\n\n Args;\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the DrawBlendsGenerator to save\n the files.\n survey (str): Name of ... | Load results exported from a DrawBlendsGenerator.
Args;
path (str): Path to the files. Should be the same as the save_path
which was provided to the DrawBlendsGenerator to save
the files.
survey (str): Name of the survey for which you want to load the files.
Returns:
Dictio... | btk/utils.py | load_blend_results | b-biswas/BlendingToolKit | 16 | python | def load_blend_results(path, survey):
'Load results exported from a DrawBlendsGenerator.\n\n Args;\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the DrawBlendsGenerator to save\n the files.\n survey (str): Name of ... | def load_blend_results(path, survey):
'Load results exported from a DrawBlendsGenerator.\n\n Args;\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the DrawBlendsGenerator to save\n the files.\n survey (str): Name of ... |
ecdb6a57fa48a5ababd9975b992ad621d4e81ad9d1cc2c1e9d5b2e2d44fa0c86 | def load_measure_results(path, measure_name, n_batch):
'Load results exported from a MeasureGenerator.\n\n Args:\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the MeasureGenerator to save\n the files.\n measure_nam... | Load results exported from a MeasureGenerator.
Args:
path (str): Path to the files. Should be the same as the save_path
which was provided to the MeasureGenerator to save
the files.
measure_name (str): Name of the measure function for which you
want to load the f... | btk/utils.py | load_measure_results | b-biswas/BlendingToolKit | 16 | python | def load_measure_results(path, measure_name, n_batch):
'Load results exported from a MeasureGenerator.\n\n Args:\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the MeasureGenerator to save\n the files.\n measure_nam... | def load_measure_results(path, measure_name, n_batch):
'Load results exported from a MeasureGenerator.\n\n Args:\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the MeasureGenerator to save\n the files.\n measure_nam... |
7d08e6d3425eead9dc97e642a3b69b7184755c936562b96e618f085ec6fb73b3 | def load_metrics_results(path, measure_name, survey_name):
'Load results exported from a MetricsGenerator.\n\n Args:\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the MetricsGenerator to save\n the files.\n measure... | Load results exported from a MetricsGenerator.
Args:
path (str): Path to the files. Should be the same as the save_path
which was provided to the MetricsGenerator to save
the files.
measure_name (str): Name of the measure function for which you
want to load the f... | btk/utils.py | load_metrics_results | b-biswas/BlendingToolKit | 16 | python | def load_metrics_results(path, measure_name, survey_name):
'Load results exported from a MetricsGenerator.\n\n Args:\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the MetricsGenerator to save\n the files.\n measure... | def load_metrics_results(path, measure_name, survey_name):
'Load results exported from a MetricsGenerator.\n\n Args:\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the MetricsGenerator to save\n the files.\n measure... |
36bf89fd923fd20ff5051bfac44ee7ba496d163224fa49ae917f53220cdd4d9f | def load_all_results(path, surveys, measure_names, n_batch, n_meas_kwargs=1):
'Load results exported from a MetricsGenerator.\n\n Args:\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the MetricsGenerator to save\n the file... | Load results exported from a MetricsGenerator.
Args:
path (str): Path to the files. Should be the same as the save_path
which was provided to the MetricsGenerator to save
the files.
surveys (list): Names of the surveys for which you want to load
the files
... | btk/utils.py | load_all_results | b-biswas/BlendingToolKit | 16 | python | def load_all_results(path, surveys, measure_names, n_batch, n_meas_kwargs=1):
'Load results exported from a MetricsGenerator.\n\n Args:\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the MetricsGenerator to save\n the file... | def load_all_results(path, surveys, measure_names, n_batch, n_meas_kwargs=1):
'Load results exported from a MetricsGenerator.\n\n Args:\n path (str): Path to the files. Should be the same as the save_path\n which was provided to the MetricsGenerator to save\n the file... |
457bace977144cccf9cb074dc1e5f96fc5d29f189a1dd10229fb3128a628e9cc | def reverse_list_dictionary(to_reverse, keys):
'Transforms a list of dictionaries into a dictionary of lists.\n\n Additionally, if the initial list contains None instead of dictionaries,\n the dictionnary will contain lists of None.\n Mainly used in the measure.py file.\n\n Args:\n to_reverse (li... | Transforms a list of dictionaries into a dictionary of lists.
Additionally, if the initial list contains None instead of dictionaries,
the dictionnary will contain lists of None.
Mainly used in the measure.py file.
Args:
to_reverse (list): List to reverse, should contain dictionaries (or None)
keys (list): Ke... | btk/utils.py | reverse_list_dictionary | b-biswas/BlendingToolKit | 16 | python | def reverse_list_dictionary(to_reverse, keys):
'Transforms a list of dictionaries into a dictionary of lists.\n\n Additionally, if the initial list contains None instead of dictionaries,\n the dictionnary will contain lists of None.\n Mainly used in the measure.py file.\n\n Args:\n to_reverse (li... | def reverse_list_dictionary(to_reverse, keys):
'Transforms a list of dictionaries into a dictionary of lists.\n\n Additionally, if the initial list contains None instead of dictionaries,\n the dictionnary will contain lists of None.\n Mainly used in the measure.py file.\n\n Args:\n to_reverse (li... |
8c7311774d3e73cd98334b56f6f6ff046a03f902e16f4b465f7db67191c8aac0 | def reverse_dictionary_dictionary(to_reverse):
'Exchanges two dictionary layers.\n\n For instance, dic[keyA][key1] will become dic[key1][keyA].\n\n Args:\n to_reverse (dict): Dictionary of dictionaries.\n\n Returns:\n Reversed dictionary.\n '
first_keys = list(to_reverse.keys())
se... | Exchanges two dictionary layers.
For instance, dic[keyA][key1] will become dic[key1][keyA].
Args:
to_reverse (dict): Dictionary of dictionaries.
Returns:
Reversed dictionary. | btk/utils.py | reverse_dictionary_dictionary | b-biswas/BlendingToolKit | 16 | python | def reverse_dictionary_dictionary(to_reverse):
'Exchanges two dictionary layers.\n\n For instance, dic[keyA][key1] will become dic[key1][keyA].\n\n Args:\n to_reverse (dict): Dictionary of dictionaries.\n\n Returns:\n Reversed dictionary.\n '
first_keys = list(to_reverse.keys())
se... | def reverse_dictionary_dictionary(to_reverse):
'Exchanges two dictionary layers.\n\n For instance, dic[keyA][key1] will become dic[key1][keyA].\n\n Args:\n to_reverse (dict): Dictionary of dictionaries.\n\n Returns:\n Reversed dictionary.\n '
first_keys = list(to_reverse.keys())
se... |
c0954b0c80e4c94113e696e94f51c709ef9e1c5ef6820158e4d71a948c1d97b5 | def __init__(self, domain, discretization=20, seed=1):
'\n :param domain: the problem :py:class:`~rlpy.Domains.Domain.Domain` to learn\n :param discretization: Number of bins used for each continuous dimension.\n For discrete dimensions, this parameter is ignored.\n '
for v in ['... | :param domain: the problem :py:class:`~rlpy.Domains.Domain.Domain` to learn
:param discretization: Number of bins used for each continuous dimension.
For discrete dimensions, this parameter is ignored. | rlpy/Representations/Representation.py | __init__ | okkhoy/rlpy | 265 | python | def __init__(self, domain, discretization=20, seed=1):
'\n :param domain: the problem :py:class:`~rlpy.Domains.Domain.Domain` to learn\n :param discretization: Number of bins used for each continuous dimension.\n For discrete dimensions, this parameter is ignored.\n '
for v in ['... | def __init__(self, domain, discretization=20, seed=1):
'\n :param domain: the problem :py:class:`~rlpy.Domains.Domain.Domain` to learn\n :param discretization: Number of bins used for each continuous dimension.\n For discrete dimensions, this parameter is ignored.\n '
for v in ['... |
4902058c6089f06ccb69fb525ecd002903c1f352084a5568a63fe13ac68d4a4d | def init_randomization(self):
'\n Any stochastic behavior in __init__() is broken out into this function\n so that if the random seed is later changed (eg, by the Experiment),\n other member variables and functions are updated accordingly.\n \n '
pass | Any stochastic behavior in __init__() is broken out into this function
so that if the random seed is later changed (eg, by the Experiment),
other member variables and functions are updated accordingly. | rlpy/Representations/Representation.py | init_randomization | okkhoy/rlpy | 265 | python | def init_randomization(self):
'\n Any stochastic behavior in __init__() is broken out into this function\n so that if the random seed is later changed (eg, by the Experiment),\n other member variables and functions are updated accordingly.\n \n '
pass | def init_randomization(self):
'\n Any stochastic behavior in __init__() is broken out into this function\n so that if the random seed is later changed (eg, by the Experiment),\n other member variables and functions are updated accordingly.\n \n '
pass<|docstring|>Any stochasti... |
0db76094d7bf6454f38d112effaaf0aded30a20ae034cc48fc8308968c7de39a | def V(self, s, terminal, p_actions, phi_s=None):
' Returns the value of state s under possible actions p_actions.\n\n :param s: The queried state\n :param terminal: Whether or not *s* is a terminal state\n :param p_actions: the set of possible actions\n :param phi_s: (optional) The featu... | Returns the value of state s under possible actions p_actions.
:param s: The queried state
:param terminal: Whether or not *s* is a terminal state
:param p_actions: the set of possible actions
:param phi_s: (optional) The feature vector evaluated at state s.
If the feature vector phi(s) has already been cached,
... | rlpy/Representations/Representation.py | V | okkhoy/rlpy | 265 | python | def V(self, s, terminal, p_actions, phi_s=None):
' Returns the value of state s under possible actions p_actions.\n\n :param s: The queried state\n :param terminal: Whether or not *s* is a terminal state\n :param p_actions: the set of possible actions\n :param phi_s: (optional) The featu... | def V(self, s, terminal, p_actions, phi_s=None):
' Returns the value of state s under possible actions p_actions.\n\n :param s: The queried state\n :param terminal: Whether or not *s* is a terminal state\n :param p_actions: the set of possible actions\n :param phi_s: (optional) The featu... |
096ef6e2d64e35240b084f68ab720fcee4e659e4c9601f0befba943f4e2adc2f | def Qs(self, s, terminal, phi_s=None):
'\n Returns an array of actions available at a state and their\n associated values.\n\n :param s: The queried state\n :param terminal: Whether or not *s* is a terminal state\n :param phi_s: (optional) The feature vector evaluated at state s.\... | Returns an array of actions available at a state and their
associated values.
:param s: The queried state
:param terminal: Whether or not *s* is a terminal state
:param phi_s: (optional) The feature vector evaluated at state s.
If the feature vector phi(s) has already been cached,
pass it here as input so that... | rlpy/Representations/Representation.py | Qs | okkhoy/rlpy | 265 | python | def Qs(self, s, terminal, phi_s=None):
'\n Returns an array of actions available at a state and their\n associated values.\n\n :param s: The queried state\n :param terminal: Whether or not *s* is a terminal state\n :param phi_s: (optional) The feature vector evaluated at state s.\... | def Qs(self, s, terminal, phi_s=None):
'\n Returns an array of actions available at a state and their\n associated values.\n\n :param s: The queried state\n :param terminal: Whether or not *s* is a terminal state\n :param phi_s: (optional) The feature vector evaluated at state s.\... |
5b1ee7b741842444c5dc182bc5b169095bf3f0cf28d0828d5ae76608c69da8f7 | def Q(self, s, terminal, a, phi_s=None):
' Returns the learned value of a state-action pair, *Q(s,a)*.\n\n :param s: The queried state in the state-action pair.\n :param terminal: Whether or not *s* is a terminal state\n :param a: The queried action in the state-action pair.\n :param phi... | Returns the learned value of a state-action pair, *Q(s,a)*.
:param s: The queried state in the state-action pair.
:param terminal: Whether or not *s* is a terminal state
:param a: The queried action in the state-action pair.
:param phi_s: (optional) The feature vector evaluated at state s.
If the feature vector ph... | rlpy/Representations/Representation.py | Q | okkhoy/rlpy | 265 | python | def Q(self, s, terminal, a, phi_s=None):
' Returns the learned value of a state-action pair, *Q(s,a)*.\n\n :param s: The queried state in the state-action pair.\n :param terminal: Whether or not *s* is a terminal state\n :param a: The queried action in the state-action pair.\n :param phi... | def Q(self, s, terminal, a, phi_s=None):
' Returns the learned value of a state-action pair, *Q(s,a)*.\n\n :param s: The queried state in the state-action pair.\n :param terminal: Whether or not *s* is a terminal state\n :param a: The queried action in the state-action pair.\n :param phi... |
1c9112b0bffeb2cfef5cfdf0e85834c19771496a63ea653b22ef6f4685a0b2dd | def phi(self, s, terminal):
'\n Returns :py:meth:`~rlpy.Representations.Representation.Representation.phi_nonTerminal`\n for a given representation, or a zero feature vector in a terminal state.\n\n :param s: The state for which to compute the feature vector\n\n :return: numpy array, the... | Returns :py:meth:`~rlpy.Representations.Representation.Representation.phi_nonTerminal`
for a given representation, or a zero feature vector in a terminal state.
:param s: The state for which to compute the feature vector
:return: numpy array, the feature vector evaluted at state *s*.
.. note::
If state *s* is te... | rlpy/Representations/Representation.py | phi | okkhoy/rlpy | 265 | python | def phi(self, s, terminal):
'\n Returns :py:meth:`~rlpy.Representations.Representation.Representation.phi_nonTerminal`\n for a given representation, or a zero feature vector in a terminal state.\n\n :param s: The state for which to compute the feature vector\n\n :return: numpy array, the... | def phi(self, s, terminal):
'\n Returns :py:meth:`~rlpy.Representations.Representation.Representation.phi_nonTerminal`\n for a given representation, or a zero feature vector in a terminal state.\n\n :param s: The state for which to compute the feature vector\n\n :return: numpy array, the... |
0c449f7e19839a7524792004406cd04a0b6af864c70efcd2890e173927d32de5 | def phi_sa(self, s, terminal, a, phi_s=None, snippet=False):
'\n Returns the feature vector corresponding to a state-action pair.\n We use the copy paste technique (Lagoudakis & Parr 2003).\n Essentially, we append the phi(s) vector to itself *|A|* times, where\n *|A|* is the size of the... | Returns the feature vector corresponding to a state-action pair.
We use the copy paste technique (Lagoudakis & Parr 2003).
Essentially, we append the phi(s) vector to itself *|A|* times, where
*|A|* is the size of the action space.
We zero the feature values of all of these blocks except the one
corresponding to the ac... | rlpy/Representations/Representation.py | phi_sa | okkhoy/rlpy | 265 | python | def phi_sa(self, s, terminal, a, phi_s=None, snippet=False):
'\n Returns the feature vector corresponding to a state-action pair.\n We use the copy paste technique (Lagoudakis & Parr 2003).\n Essentially, we append the phi(s) vector to itself *|A|* times, where\n *|A|* is the size of the... | def phi_sa(self, s, terminal, a, phi_s=None, snippet=False):
'\n Returns the feature vector corresponding to a state-action pair.\n We use the copy paste technique (Lagoudakis & Parr 2003).\n Essentially, we append the phi(s) vector to itself *|A|* times, where\n *|A|* is the size of the... |
befe7cc3ef342188f46848d5e3e8af0435e4196fde4f4534059199383b664138 | def addNewWeight(self):
'\n Add a new zero weight, corresponding to a newly added feature,\n to all actions.\n '
self.weight_vec = addNewElementForAllActions(self.weight_vec, self.actions_num) | Add a new zero weight, corresponding to a newly added feature,
to all actions. | rlpy/Representations/Representation.py | addNewWeight | okkhoy/rlpy | 265 | python | def addNewWeight(self):
'\n Add a new zero weight, corresponding to a newly added feature,\n to all actions.\n '
self.weight_vec = addNewElementForAllActions(self.weight_vec, self.actions_num) | def addNewWeight(self):
'\n Add a new zero weight, corresponding to a newly added feature,\n to all actions.\n '
self.weight_vec = addNewElementForAllActions(self.weight_vec, self.actions_num)<|docstring|>Add a new zero weight, corresponding to a newly added feature,
to all actions.<|endoft... |
eb0619cb6dba62dc26905d287fc81cb3983292fda0c25af39e2558f4154e1e31 | def hashState(self, s):
'\n Returns a unique id for a given state.\n Essentially, enumerate all possible states and return the ID associated\n with *s*.\n\n Under the hood: first, discretize continuous dimensions into bins\n as necessary. Then map the binstate to an integer.\n ... | Returns a unique id for a given state.
Essentially, enumerate all possible states and return the ID associated
with *s*.
Under the hood: first, discretize continuous dimensions into bins
as necessary. Then map the binstate to an integer. | rlpy/Representations/Representation.py | hashState | okkhoy/rlpy | 265 | python | def hashState(self, s):
'\n Returns a unique id for a given state.\n Essentially, enumerate all possible states and return the ID associated\n with *s*.\n\n Under the hood: first, discretize continuous dimensions into bins\n as necessary. Then map the binstate to an integer.\n ... | def hashState(self, s):
'\n Returns a unique id for a given state.\n Essentially, enumerate all possible states and return the ID associated\n with *s*.\n\n Under the hood: first, discretize continuous dimensions into bins\n as necessary. Then map the binstate to an integer.\n ... |
11f3bfa142d7935a6982109d3553dbd97af399b90598f0af9a4ace92a87059d6 | def setBinsPerDimension(self, domain, discretization):
'\n Set the number of bins for each dimension of the domain.\n Continuous spaces will be slices using the ``discretization`` parameter.\n :param domain: the problem :py:class:`~rlpy.Domains.Domain.Domain` to learn\n :param discretiza... | Set the number of bins for each dimension of the domain.
Continuous spaces will be slices using the ``discretization`` parameter.
:param domain: the problem :py:class:`~rlpy.Domains.Domain.Domain` to learn
:param discretization: The number of bins a continuous domain should be sliced into. | rlpy/Representations/Representation.py | setBinsPerDimension | okkhoy/rlpy | 265 | python | def setBinsPerDimension(self, domain, discretization):
'\n Set the number of bins for each dimension of the domain.\n Continuous spaces will be slices using the ``discretization`` parameter.\n :param domain: the problem :py:class:`~rlpy.Domains.Domain.Domain` to learn\n :param discretiza... | def setBinsPerDimension(self, domain, discretization):
'\n Set the number of bins for each dimension of the domain.\n Continuous spaces will be slices using the ``discretization`` parameter.\n :param domain: the problem :py:class:`~rlpy.Domains.Domain.Domain` to learn\n :param discretiza... |
9f082aae3888f1d4781707a7acfff4ae5c36dfb7047bd4f8f33b4c282d2ae7c0 | def binState(self, s):
'\n Returns a vector where each element is the zero-indexed bin number\n corresponding with the given state.\n (See :py:meth:`~rlpy.Representations.Representation.Representation.hashState`)\n Note that this vector will have the same dimensionality as *s*.\n\n ... | Returns a vector where each element is the zero-indexed bin number
corresponding with the given state.
(See :py:meth:`~rlpy.Representations.Representation.Representation.hashState`)
Note that this vector will have the same dimensionality as *s*.
(Note: This method is binary compact; the negative case of binary feature... | rlpy/Representations/Representation.py | binState | okkhoy/rlpy | 265 | python | def binState(self, s):
'\n Returns a vector where each element is the zero-indexed bin number\n corresponding with the given state.\n (See :py:meth:`~rlpy.Representations.Representation.Representation.hashState`)\n Note that this vector will have the same dimensionality as *s*.\n\n ... | def binState(self, s):
'\n Returns a vector where each element is the zero-indexed bin number\n corresponding with the given state.\n (See :py:meth:`~rlpy.Representations.Representation.Representation.hashState`)\n Note that this vector will have the same dimensionality as *s*.\n\n ... |
f71bce01f8f6835e3edb440467e50d71341552470f979b3b2a88ad7b83fd1a8b | def bestActions(self, s, terminal, p_actions, phi_s=None):
'\n Returns a list of the best actions at a given state.\n If *phi_s* [the feature vector at state *s*] is given, it is used to\n speed up code by preventing re-computation within this function.\n\n See :py:meth:`~rlpy.Representa... | Returns a list of the best actions at a given state.
If *phi_s* [the feature vector at state *s*] is given, it is used to
speed up code by preventing re-computation within this function.
See :py:meth:`~rlpy.Representations.Representation.Representation.bestAction`
:param s: The given state
:param terminal: Whether or... | rlpy/Representations/Representation.py | bestActions | okkhoy/rlpy | 265 | python | def bestActions(self, s, terminal, p_actions, phi_s=None):
'\n Returns a list of the best actions at a given state.\n If *phi_s* [the feature vector at state *s*] is given, it is used to\n speed up code by preventing re-computation within this function.\n\n See :py:meth:`~rlpy.Representa... | def bestActions(self, s, terminal, p_actions, phi_s=None):
'\n Returns a list of the best actions at a given state.\n If *phi_s* [the feature vector at state *s*] is given, it is used to\n speed up code by preventing re-computation within this function.\n\n See :py:meth:`~rlpy.Representa... |
2a1d959b40c2b6f01f250b0e6413d841315242de7baae9c2a27c616bc903f145 | def pre_discover(self, s, terminal, a, sn, terminaln):
'\n Identifies and adds ("discovers") new features for this adaptive\n representation BEFORE having obtained the TD-Error.\n For example, see :py:class:`~rlpy.Representations.IncrementalTabular.IncrementalTabular`.\n In that class, a... | Identifies and adds ("discovers") new features for this adaptive
representation BEFORE having obtained the TD-Error.
For example, see :py:class:`~rlpy.Representations.IncrementalTabular.IncrementalTabular`.
In that class, a new feature is added anytime a novel state is observed.
.. note::
For adaptive representati... | rlpy/Representations/Representation.py | pre_discover | okkhoy/rlpy | 265 | python | def pre_discover(self, s, terminal, a, sn, terminaln):
'\n Identifies and adds ("discovers") new features for this adaptive\n representation BEFORE having obtained the TD-Error.\n For example, see :py:class:`~rlpy.Representations.IncrementalTabular.IncrementalTabular`.\n In that class, a... | def pre_discover(self, s, terminal, a, sn, terminaln):
'\n Identifies and adds ("discovers") new features for this adaptive\n representation BEFORE having obtained the TD-Error.\n For example, see :py:class:`~rlpy.Representations.IncrementalTabular.IncrementalTabular`.\n In that class, a... |
5e7bbb966cb1801f6d050a569469018d7361bb7f3c90a01f994bd0f9d1233785 | def post_discover(self, s, terminal, a, td_error, phi_s):
'\n Identifies and adds ("discovers") new features for this adaptive\n representation AFTER having obtained the TD-Error.\n For example, see :py:class:`~rlpy.Representations.iFDD.iFDD`.\n In that class, a new feature is added base... | Identifies and adds ("discovers") new features for this adaptive
representation AFTER having obtained the TD-Error.
For example, see :py:class:`~rlpy.Representations.iFDD.iFDD`.
In that class, a new feature is added based on regions of high TD-Error.
.. note::
For adaptive representations that do not require acces... | rlpy/Representations/Representation.py | post_discover | okkhoy/rlpy | 265 | python | def post_discover(self, s, terminal, a, td_error, phi_s):
'\n Identifies and adds ("discovers") new features for this adaptive\n representation AFTER having obtained the TD-Error.\n For example, see :py:class:`~rlpy.Representations.iFDD.iFDD`.\n In that class, a new feature is added base... | def post_discover(self, s, terminal, a, td_error, phi_s):
'\n Identifies and adds ("discovers") new features for this adaptive\n representation AFTER having obtained the TD-Error.\n For example, see :py:class:`~rlpy.Representations.iFDD.iFDD`.\n In that class, a new feature is added base... |
d43a389426735e661f366e2aa5bd1786736fe9c504b57a9e5f8a8b24af712e47 | def bestAction(self, s, terminal, p_actions, phi_s=None):
'\n Returns the best action at a given state.\n If there are multiple best actions, this method selects one of them\n uniformly randomly.\n If *phi_s* [the feature vector at state *s*] is given, it is used to\n speed up cod... | Returns the best action at a given state.
If there are multiple best actions, this method selects one of them
uniformly randomly.
If *phi_s* [the feature vector at state *s*] is given, it is used to
speed up code by preventing re-computation within this function.
See :py:meth:`~rlpy.Representations.Representation.Repr... | rlpy/Representations/Representation.py | bestAction | okkhoy/rlpy | 265 | python | def bestAction(self, s, terminal, p_actions, phi_s=None):
'\n Returns the best action at a given state.\n If there are multiple best actions, this method selects one of them\n uniformly randomly.\n If *phi_s* [the feature vector at state *s*] is given, it is used to\n speed up cod... | def bestAction(self, s, terminal, p_actions, phi_s=None):
'\n Returns the best action at a given state.\n If there are multiple best actions, this method selects one of them\n uniformly randomly.\n If *phi_s* [the feature vector at state *s*] is given, it is used to\n speed up cod... |
031760b9626b9d5211fb05851b405656b124b942718050289497fc3798537df5 | def phi_nonTerminal(self, s):
' *Abstract Method* \n\n Returns the feature vector evaluated at state *s* for non-terminal\n states; see\n function :py:meth:`~rlpy.Representations.Representation.Representation.phi`\n for the general case.\n\n :param s: The given state\n\n :r... | *Abstract Method*
Returns the feature vector evaluated at state *s* for non-terminal
states; see
function :py:meth:`~rlpy.Representations.Representation.Representation.phi`
for the general case.
:param s: The given state
:return: The feature vector evaluated at state *s*. | rlpy/Representations/Representation.py | phi_nonTerminal | okkhoy/rlpy | 265 | python | def phi_nonTerminal(self, s):
' *Abstract Method* \n\n Returns the feature vector evaluated at state *s* for non-terminal\n states; see\n function :py:meth:`~rlpy.Representations.Representation.Representation.phi`\n for the general case.\n\n :param s: The given state\n\n :r... | def phi_nonTerminal(self, s):
' *Abstract Method* \n\n Returns the feature vector evaluated at state *s* for non-terminal\n states; see\n function :py:meth:`~rlpy.Representations.Representation.Representation.phi`\n for the general case.\n\n :param s: The given state\n\n :r... |
1dfd07f6ce917d59e868edf15bee7c876d163cc3c1eeabe4c6a11de9ef54db09 | def activeInitialFeatures(self, s):
'\n Returns the index of active initial features based on bins in each\n dimension.\n :param s: The state\n\n :return: The active initial features of this representation\n (before expansion)\n '
bs = self.binState(s)
shifts = ... | Returns the index of active initial features based on bins in each
dimension.
:param s: The state
:return: The active initial features of this representation
(before expansion) | rlpy/Representations/Representation.py | activeInitialFeatures | okkhoy/rlpy | 265 | python | def activeInitialFeatures(self, s):
'\n Returns the index of active initial features based on bins in each\n dimension.\n :param s: The state\n\n :return: The active initial features of this representation\n (before expansion)\n '
bs = self.binState(s)
shifts = ... | def activeInitialFeatures(self, s):
'\n Returns the index of active initial features based on bins in each\n dimension.\n :param s: The state\n\n :return: The active initial features of this representation\n (before expansion)\n '
bs = self.binState(s)
shifts = ... |
0b8250026e8f89c0f3b790661abdec6e341da4522fdbbf4b6311906098610408 | def batchPhi_s_a(self, all_phi_s, all_actions, all_phi_s_a=None, use_sparse=False):
'\n Builds the feature vector for a series of state-action pairs (s,a)\n using the copy-paste method.\n\n .. note::\n See :py:meth:`~rlpy.Representations.Representation.Representation.phi_sa`\n ... | Builds the feature vector for a series of state-action pairs (s,a)
using the copy-paste method.
.. note::
See :py:meth:`~rlpy.Representations.Representation.Representation.phi_sa`
for more information.
:param all_phi_s: The feature vectors evaluated at a series of states.
Has dimension *p* x *n*, where *p... | rlpy/Representations/Representation.py | batchPhi_s_a | okkhoy/rlpy | 265 | python | def batchPhi_s_a(self, all_phi_s, all_actions, all_phi_s_a=None, use_sparse=False):
'\n Builds the feature vector for a series of state-action pairs (s,a)\n using the copy-paste method.\n\n .. note::\n See :py:meth:`~rlpy.Representations.Representation.Representation.phi_sa`\n ... | def batchPhi_s_a(self, all_phi_s, all_actions, all_phi_s_a=None, use_sparse=False):
'\n Builds the feature vector for a series of state-action pairs (s,a)\n using the copy-paste method.\n\n .. note::\n See :py:meth:`~rlpy.Representations.Representation.Representation.phi_sa`\n ... |
413d1fb9e9b0859ff2796a2926d31acd738ee2adf2746726328150930ab230ff | def batchBestAction(self, all_s, all_phi_s, action_mask=None, useSparse=True):
'\n Accepts a batch of states, returns the best action associated with each.\n\n .. note::\n See :py:meth:`~rlpy.Representations.Representation.Representation.bestAction`\n\n :param all_s: An array of all ... | Accepts a batch of states, returns the best action associated with each.
.. note::
See :py:meth:`~rlpy.Representations.Representation.Representation.bestAction`
:param all_s: An array of all the states to consider.
:param all_phi_s: The feature vectors evaluated at a series of states.
Has dimension *p* x *n*,... | rlpy/Representations/Representation.py | batchBestAction | okkhoy/rlpy | 265 | python | def batchBestAction(self, all_s, all_phi_s, action_mask=None, useSparse=True):
'\n Accepts a batch of states, returns the best action associated with each.\n\n .. note::\n See :py:meth:`~rlpy.Representations.Representation.Representation.bestAction`\n\n :param all_s: An array of all ... | def batchBestAction(self, all_s, all_phi_s, action_mask=None, useSparse=True):
'\n Accepts a batch of states, returns the best action associated with each.\n\n .. note::\n See :py:meth:`~rlpy.Representations.Representation.Representation.bestAction`\n\n :param all_s: An array of all ... |
1519cc5822d49d0439fef2820bd5e1286f17d0572d4c2fb5130efb8082aee9c7 | def featureType(self):
" *Abstract Method* \n\n Return the data type for the underlying features (eg 'float').\n "
raise NotImplementedError | *Abstract Method*
Return the data type for the underlying features (eg 'float'). | rlpy/Representations/Representation.py | featureType | okkhoy/rlpy | 265 | python | def featureType(self):
" *Abstract Method* \n\n Return the data type for the underlying features (eg 'float').\n "
raise NotImplementedError | def featureType(self):
" *Abstract Method* \n\n Return the data type for the underlying features (eg 'float').\n "
raise NotImplementedError<|docstring|>*Abstract Method*
Return the data type for the underlying features (eg 'float').<|endoftext|> |
2948ddd17fde8b1acacc4b615a8b2c773ff8bbb8970527791dcfa7281f16c139 | def Q_oneStepLookAhead(self, s, a, ns_samples, policy=None):
'\n Returns the state action value, Q(s,a), by performing one step\n look-ahead on the domain.\n\n .. note::\n For an example of how this function works, see\n `Line 8 of Figure 4.3 <http://webdocs.cs.ualberta.ca... | Returns the state action value, Q(s,a), by performing one step
look-ahead on the domain.
.. note::
For an example of how this function works, see
`Line 8 of Figure 4.3 <http://webdocs.cs.ualberta.ca/~sutton/book/ebook/node43.html>`_
in Sutton and Barto 1998.
If the domain does not define ``expectedStep()`... | rlpy/Representations/Representation.py | Q_oneStepLookAhead | okkhoy/rlpy | 265 | python | def Q_oneStepLookAhead(self, s, a, ns_samples, policy=None):
'\n Returns the state action value, Q(s,a), by performing one step\n look-ahead on the domain.\n\n .. note::\n For an example of how this function works, see\n `Line 8 of Figure 4.3 <http://webdocs.cs.ualberta.ca... | def Q_oneStepLookAhead(self, s, a, ns_samples, policy=None):
'\n Returns the state action value, Q(s,a), by performing one step\n look-ahead on the domain.\n\n .. note::\n For an example of how this function works, see\n `Line 8 of Figure 4.3 <http://webdocs.cs.ualberta.ca... |
365430ab4ccbce11cad1adccd4ffcf3a362c7aa02de4fb01f686e0fdcaa2aabb | def Qs_oneStepLookAhead(self, s, ns_samples, policy=None):
'\n Returns an array of actions and their associated values Q(s,a),\n by performing one step look-ahead on the domain for each of them.\n\n .. note::\n For an example of how this function works, see\n `Line 8 of Fi... | Returns an array of actions and their associated values Q(s,a),
by performing one step look-ahead on the domain for each of them.
.. note::
For an example of how this function works, see
`Line 8 of Figure 4.3 <http://webdocs.cs.ualberta.ca/~sutton/book/ebook/node43.html>`_
in Sutton and Barto 1998.
If the... | rlpy/Representations/Representation.py | Qs_oneStepLookAhead | okkhoy/rlpy | 265 | python | def Qs_oneStepLookAhead(self, s, ns_samples, policy=None):
'\n Returns an array of actions and their associated values Q(s,a),\n by performing one step look-ahead on the domain for each of them.\n\n .. note::\n For an example of how this function works, see\n `Line 8 of Fi... | def Qs_oneStepLookAhead(self, s, ns_samples, policy=None):
'\n Returns an array of actions and their associated values Q(s,a),\n by performing one step look-ahead on the domain for each of them.\n\n .. note::\n For an example of how this function works, see\n `Line 8 of Fi... |
da984124c20392199e74c6e46080f3fe5cff5a9f7d2729851ae62ed9c71d0564 | def V_oneStepLookAhead(self, s, ns_samples):
'\n Returns the value of being in state *s*, V(s),\n by performing one step look-ahead on the domain.\n\n .. note::\n For an example of how this function works, see\n `Line 6 of Figure 4.5 <http://webdocs.cs.ualberta.ca/~sutton/... | Returns the value of being in state *s*, V(s),
by performing one step look-ahead on the domain.
.. note::
For an example of how this function works, see
`Line 6 of Figure 4.5 <http://webdocs.cs.ualberta.ca/~sutton/book/ebook/node43.html>`_
in Sutton and Barto 1998.
If the domain does not define ``expected... | rlpy/Representations/Representation.py | V_oneStepLookAhead | okkhoy/rlpy | 265 | python | def V_oneStepLookAhead(self, s, ns_samples):
'\n Returns the value of being in state *s*, V(s),\n by performing one step look-ahead on the domain.\n\n .. note::\n For an example of how this function works, see\n `Line 6 of Figure 4.5 <http://webdocs.cs.ualberta.ca/~sutton/... | def V_oneStepLookAhead(self, s, ns_samples):
'\n Returns the value of being in state *s*, V(s),\n by performing one step look-ahead on the domain.\n\n .. note::\n For an example of how this function works, see\n `Line 6 of Figure 4.5 <http://webdocs.cs.ualberta.ca/~sutton/... |
daef4e381011f92eb86fa2c93b9b8b829b2ec76189f8fff2485766c2a6c41a74 | def stateID2state(self, s_id):
'\n Returns the state vector correponding to a state_id.\n If dimensions are continuous it returns the state representing the\n middle of the bin (each dimension is discretized according to\n ``representation.discretization``.\n\n :param s_id: The id... | Returns the state vector correponding to a state_id.
If dimensions are continuous it returns the state representing the
middle of the bin (each dimension is discretized according to
``representation.discretization``.
:param s_id: The id of the state, often calculated using the
``state2bin`` function
:return: The ... | rlpy/Representations/Representation.py | stateID2state | okkhoy/rlpy | 265 | python | def stateID2state(self, s_id):
'\n Returns the state vector correponding to a state_id.\n If dimensions are continuous it returns the state representing the\n middle of the bin (each dimension is discretized according to\n ``representation.discretization``.\n\n :param s_id: The id... | def stateID2state(self, s_id):
'\n Returns the state vector correponding to a state_id.\n If dimensions are continuous it returns the state representing the\n middle of the bin (each dimension is discretized according to\n ``representation.discretization``.\n\n :param s_id: The id... |
79fdcb93e5b957d3e62236e1451b949140772aa25c9f19c209b02df2b4f730de | def stateInTheMiddleOfGrid(self, s):
'\n Accepts a continuous state *s*, bins it into the discretized domain,\n and returns the state of the nearest gridpoint.\n Essentially, we snap *s* to the nearest gridpoint and return that\n gridpoint state.\n For continuous MDPs this plays a... | Accepts a continuous state *s*, bins it into the discretized domain,
and returns the state of the nearest gridpoint.
Essentially, we snap *s* to the nearest gridpoint and return that
gridpoint state.
For continuous MDPs this plays a major rule in improving the speed
through caching of next samples.
:param s: The given... | rlpy/Representations/Representation.py | stateInTheMiddleOfGrid | okkhoy/rlpy | 265 | python | def stateInTheMiddleOfGrid(self, s):
'\n Accepts a continuous state *s*, bins it into the discretized domain,\n and returns the state of the nearest gridpoint.\n Essentially, we snap *s* to the nearest gridpoint and return that\n gridpoint state.\n For continuous MDPs this plays a... | def stateInTheMiddleOfGrid(self, s):
'\n Accepts a continuous state *s*, bins it into the discretized domain,\n and returns the state of the nearest gridpoint.\n Essentially, we snap *s* to the nearest gridpoint and return that\n gridpoint state.\n For continuous MDPs this plays a... |
76ade592d34dd7a71fdfcbe9fd1914afc8b8f9c0bf5be7bed2221cd6ba8bcd73 | def featureLearningRate(self):
'\n :return: An array or scalar used to adapt the learning rate of each\n feature individually.\n '
return 1.0 | :return: An array or scalar used to adapt the learning rate of each
feature individually. | rlpy/Representations/Representation.py | featureLearningRate | okkhoy/rlpy | 265 | python | def featureLearningRate(self):
'\n :return: An array or scalar used to adapt the learning rate of each\n feature individually.\n '
return 1.0 | def featureLearningRate(self):
'\n :return: An array or scalar used to adapt the learning rate of each\n feature individually.\n '
return 1.0<|docstring|>:return: An array or scalar used to adapt the learning rate of each
feature individually.<|endoftext|> |
5bf30a0fc5daa797742470d031c58193d9d140f5f4b13437e96b5465fc8206cc | def logspace_int(limit, num=50):
'\n Returns integers spaced (approximately) evenly on a log scale.\n\n This means the integers are exponentially separated on a linear scale. The\n restriction to integers means that the spacing is not exactly even on a log\n scale. In particular, the smaller integers ca... | Returns integers spaced (approximately) evenly on a log scale.
This means the integers are exponentially separated on a linear scale. The
restriction to integers means that the spacing is not exactly even on a log
scale. In particular, the smaller integers can grow linearly. This provides
more coverage at the small sc... | buhmm/misc.py | logspace_int | chebee7i/buhmm | 4 | python | def logspace_int(limit, num=50):
'\n Returns integers spaced (approximately) evenly on a log scale.\n\n This means the integers are exponentially separated on a linear scale. The\n restriction to integers means that the spacing is not exactly even on a log\n scale. In particular, the smaller integers ca... | def logspace_int(limit, num=50):
'\n Returns integers spaced (approximately) evenly on a log scale.\n\n This means the integers are exponentially separated on a linear scale. The\n restriction to integers means that the spacing is not exactly even on a log\n scale. In particular, the smaller integers ca... |
69f15870710af9abac7c51888658a4eca1e960b8aba203818e7fde85357b84b1 | def getheaders(self):
'Returns a dictionary of the response headers.'
return self.urllib3_response.getheaders() | Returns a dictionary of the response headers. | src/deutschland/zoll/rest.py | getheaders | t-huyeng/deutschland | 445 | python | def getheaders(self):
return self.urllib3_response.getheaders() | def getheaders(self):
return self.urllib3_response.getheaders()<|docstring|>Returns a dictionary of the response headers.<|endoftext|> |
2716a1f3904f9b40f2821db47cfb8b28e7a243ae1a4b2f5ca91983af0f0f01fd | def getheader(self, name, default=None):
'Returns a given response header.'
return self.urllib3_response.getheader(name, default) | Returns a given response header. | src/deutschland/zoll/rest.py | getheader | t-huyeng/deutschland | 445 | python | def getheader(self, name, default=None):
return self.urllib3_response.getheader(name, default) | def getheader(self, name, default=None):
return self.urllib3_response.getheader(name, default)<|docstring|>Returns a given response header.<|endoftext|> |
b3ee1625909ac5213d92466212649736ecefe59cf05a346ffc3685c3ba5a0fd5 | def request(self, method, url, query_params=None, headers=None, body=None, post_params=None, _preload_content=True, _request_timeout=None):
'Perform requests.\n\n :param method: http request method\n :param url: http request url\n :param query_params: query parameters in the url\n :param... | Perform requests.
:param method: http request method
:param url: http request url
:param query_params: query parameters in the url
:param headers: http request headers
:param body: request json body, for `application/json`
:param post_params: request post parameters,
`application/x-www-form-urlenco... | src/deutschland/zoll/rest.py | request | t-huyeng/deutschland | 445 | python | def request(self, method, url, query_params=None, headers=None, body=None, post_params=None, _preload_content=True, _request_timeout=None):
'Perform requests.\n\n :param method: http request method\n :param url: http request url\n :param query_params: query parameters in the url\n :param... | def request(self, method, url, query_params=None, headers=None, body=None, post_params=None, _preload_content=True, _request_timeout=None):
'Perform requests.\n\n :param method: http request method\n :param url: http request url\n :param query_params: query parameters in the url\n :param... |
da66e060640ba8fb52566d63c658f73a572284dbbbd688b916195de1ecd61ec2 | def add(self, *args):
'Add a new object to this container.\n\n Generally this method should only be used during data loading, since\n adding data during a test can affect the results of other tests.\n '
for obj in args:
if (obj not in self._objects):
self._objects.append... | Add a new object to this container.
Generally this method should only be used during data loading, since
adding data during a test can affect the results of other tests. | openstack_dashboard/test/test_data/utils.py | add | rishavtandon93/horizon | 930 | python | def add(self, *args):
'Add a new object to this container.\n\n Generally this method should only be used during data loading, since\n adding data during a test can affect the results of other tests.\n '
for obj in args:
if (obj not in self._objects):
self._objects.append... | def add(self, *args):
'Add a new object to this container.\n\n Generally this method should only be used during data loading, since\n adding data during a test can affect the results of other tests.\n '
for obj in args:
if (obj not in self._objects):
self._objects.append... |
d870d1fd39ddeedd9b25d2ca843aa4dbc0e39a3345cf1c652d0d094c2148e89c | def list(self):
'Returns a list of all objects in this container.'
return self._objects | Returns a list of all objects in this container. | openstack_dashboard/test/test_data/utils.py | list | rishavtandon93/horizon | 930 | python | def list(self):
return self._objects | def list(self):
return self._objects<|docstring|>Returns a list of all objects in this container.<|endoftext|> |
766ce754eb21f5566d9e0f274d2e301184f12309a50c05d90abf921c472c9824 | def filter(self, filtered=None, **kwargs):
'Returns objects whose attributes match the given kwargs.'
if (filtered is None):
filtered = self._objects
try:
(key, value) = kwargs.popitem()
except KeyError:
return filtered
def get_match(obj):
return (hasattr(obj, key) a... | Returns objects whose attributes match the given kwargs. | openstack_dashboard/test/test_data/utils.py | filter | rishavtandon93/horizon | 930 | python | def filter(self, filtered=None, **kwargs):
if (filtered is None):
filtered = self._objects
try:
(key, value) = kwargs.popitem()
except KeyError:
return filtered
def get_match(obj):
return (hasattr(obj, key) and (getattr(obj, key) == value))
filtered = [obj for o... | def filter(self, filtered=None, **kwargs):
if (filtered is None):
filtered = self._objects
try:
(key, value) = kwargs.popitem()
except KeyError:
return filtered
def get_match(obj):
return (hasattr(obj, key) and (getattr(obj, key) == value))
filtered = [obj for o... |
1563f8375ac9d9b734092966dc8a0cfc999bcc604f44c47ea706cb3bc9b7bbd1 | def get(self, **kwargs):
"Returns a single object whose attributes match the given kwargs.\n\n An error will be raised if the arguments\n provided don't return exactly one match.\n "
matches = self.filter(**kwargs)
if (not matches):
raise Exception('No matches found.')
elif ... | Returns a single object whose attributes match the given kwargs.
An error will be raised if the arguments
provided don't return exactly one match. | openstack_dashboard/test/test_data/utils.py | get | rishavtandon93/horizon | 930 | python | def get(self, **kwargs):
"Returns a single object whose attributes match the given kwargs.\n\n An error will be raised if the arguments\n provided don't return exactly one match.\n "
matches = self.filter(**kwargs)
if (not matches):
raise Exception('No matches found.')
elif ... | def get(self, **kwargs):
"Returns a single object whose attributes match the given kwargs.\n\n An error will be raised if the arguments\n provided don't return exactly one match.\n "
matches = self.filter(**kwargs)
if (not matches):
raise Exception('No matches found.')
elif ... |
86734aa8ecf2ec0d88613dd8d60bfd04fd09cd89a78e27bff05ce58c41c9a541 | def first(self):
'Returns the first object from this container.'
return self._objects[0] | Returns the first object from this container. | openstack_dashboard/test/test_data/utils.py | first | rishavtandon93/horizon | 930 | python | def first(self):
return self._objects[0] | def first(self):
return self._objects[0]<|docstring|>Returns the first object from this container.<|endoftext|> |
d5a75a7344f556f35505b937af1fdf90da2841319a1b8a460183024a6d48e8d4 | def sumofsq(x, axis=0):
'Helper function to calculate sum of squares along first axis'
return np.sum((x ** 2), axis=axis) | Helper function to calculate sum of squares along first axis | statsmodels/tsa/ar_model.py | sumofsq | raamana/statsmodels | 6 | python | def sumofsq(x, axis=0):
return np.sum((x ** 2), axis=axis) | def sumofsq(x, axis=0):
return np.sum((x ** 2), axis=axis)<|docstring|>Helper function to calculate sum of squares along first axis<|endoftext|> |
06765e34a9829e81401ed7c4a2164718b9c1ead7ad11559e47d59fe0cce4f942 | def initialize(self):
'Initialization of the model (no-op).'
pass | Initialization of the model (no-op). | statsmodels/tsa/ar_model.py | initialize | raamana/statsmodels | 6 | python | def initialize(self):
pass | def initialize(self):
pass<|docstring|>Initialization of the model (no-op).<|endoftext|> |
8dac3f32bed1e7266a8afb64b2fb1b3295b9692f4596545ce379a038fb6f0d9f | def _transparams(self, params):
'\n Transforms params to induce stationarity/invertability.\n\n Reference\n ---------\n Jones(1980)\n '
p = self.k_ar
k = self.k_trend
newparams = params.copy()
newparams[k:(k + p)] = _ar_transparams(params[k:(k + p)].copy())
ret... | Transforms params to induce stationarity/invertability.
Reference
---------
Jones(1980) | statsmodels/tsa/ar_model.py | _transparams | raamana/statsmodels | 6 | python | def _transparams(self, params):
'\n Transforms params to induce stationarity/invertability.\n\n Reference\n ---------\n Jones(1980)\n '
p = self.k_ar
k = self.k_trend
newparams = params.copy()
newparams[k:(k + p)] = _ar_transparams(params[k:(k + p)].copy())
ret... | def _transparams(self, params):
'\n Transforms params to induce stationarity/invertability.\n\n Reference\n ---------\n Jones(1980)\n '
p = self.k_ar
k = self.k_trend
newparams = params.copy()
newparams[k:(k + p)] = _ar_transparams(params[k:(k + p)].copy())
ret... |
8a6a26222ebf17109652e21220d7f63c09e6881ccf838264f03ab374674e900b | def _invtransparams(self, start_params):
'\n Inverse of the Jones reparameterization\n '
p = self.k_ar
k = self.k_trend
newparams = start_params.copy()
newparams[k:(k + p)] = _ar_invtransparams(start_params[k:(k + p)].copy())
return newparams | Inverse of the Jones reparameterization | statsmodels/tsa/ar_model.py | _invtransparams | raamana/statsmodels | 6 | python | def _invtransparams(self, start_params):
'\n \n '
p = self.k_ar
k = self.k_trend
newparams = start_params.copy()
newparams[k:(k + p)] = _ar_invtransparams(start_params[k:(k + p)].copy())
return newparams | def _invtransparams(self, start_params):
'\n \n '
p = self.k_ar
k = self.k_trend
newparams = start_params.copy()
newparams[k:(k + p)] = _ar_invtransparams(start_params[k:(k + p)].copy())
return newparams<|docstring|>Inverse of the Jones reparameterization<|endoftext|> |
4eaecfc5856c15f5698e80749ed1ce779c6672e70fdc2debcc266071434acdf4 | def _presample_fit(self, params, start, p, end, y, predictedvalues):
'\n Return the pre-sample predicted values using the Kalman Filter\n\n Notes\n -----\n See predict method for how to use start and p.\n '
k = self.k_trend
T_mat = KalmanFilter.T(params, p, k, p)
R_mat... | Return the pre-sample predicted values using the Kalman Filter
Notes
-----
See predict method for how to use start and p. | statsmodels/tsa/ar_model.py | _presample_fit | raamana/statsmodels | 6 | python | def _presample_fit(self, params, start, p, end, y, predictedvalues):
'\n Return the pre-sample predicted values using the Kalman Filter\n\n Notes\n -----\n See predict method for how to use start and p.\n '
k = self.k_trend
T_mat = KalmanFilter.T(params, p, k, p)
R_mat... | def _presample_fit(self, params, start, p, end, y, predictedvalues):
'\n Return the pre-sample predicted values using the Kalman Filter\n\n Notes\n -----\n See predict method for how to use start and p.\n '
k = self.k_trend
T_mat = KalmanFilter.T(params, p, k, p)
R_mat... |
0f004a6e6fb6cecd395d8b2285fca3a6eda3923a894b796147663ad4d51bc71e | def predict(self, params, start=None, end=None, dynamic=False):
'\n Construct in-sample and out-of-sample prediction.\n\n Parameters\n ----------\n params : array\n The fitted model parameters.\n start : int, str, or datetime\n Zero-indexed observation number... | Construct in-sample and out-of-sample prediction.
Parameters
----------
params : array
The fitted model parameters.
start : int, str, or datetime
Zero-indexed observation number at which to start forecasting, ie.,
the first forecast is start. Can also be a date string to
parse or a datetime type.
end :... | statsmodels/tsa/ar_model.py | predict | raamana/statsmodels | 6 | python | def predict(self, params, start=None, end=None, dynamic=False):
'\n Construct in-sample and out-of-sample prediction.\n\n Parameters\n ----------\n params : array\n The fitted model parameters.\n start : int, str, or datetime\n Zero-indexed observation number... | def predict(self, params, start=None, end=None, dynamic=False):
'\n Construct in-sample and out-of-sample prediction.\n\n Parameters\n ----------\n params : array\n The fitted model parameters.\n start : int, str, or datetime\n Zero-indexed observation number... |
eae0fe8f71bd0993182a4d9679a6c8c4887d49bbacf054365c160868297177c5 | def _presample_varcov(self, params):
'\n Returns the inverse of the presample variance-covariance.\n\n Notes\n -----\n See Hamilton p. 125\n '
k = self.k_trend
p = self.k_ar
params0 = np.r_[((- 1), params[k:])]
Vpinv = np.zeros((p, p), dtype=params.dtype)
for i... | Returns the inverse of the presample variance-covariance.
Notes
-----
See Hamilton p. 125 | statsmodels/tsa/ar_model.py | _presample_varcov | raamana/statsmodels | 6 | python | def _presample_varcov(self, params):
'\n Returns the inverse of the presample variance-covariance.\n\n Notes\n -----\n See Hamilton p. 125\n '
k = self.k_trend
p = self.k_ar
params0 = np.r_[((- 1), params[k:])]
Vpinv = np.zeros((p, p), dtype=params.dtype)
for i... | def _presample_varcov(self, params):
'\n Returns the inverse of the presample variance-covariance.\n\n Notes\n -----\n See Hamilton p. 125\n '
k = self.k_trend
p = self.k_ar
params0 = np.r_[((- 1), params[k:])]
Vpinv = np.zeros((p, p), dtype=params.dtype)
for i... |
d7bc99ff64c7dfdcad221050f0af8e0d832eaa3e7641ae25c4ba020f24e82c5d | def _loglike_css(self, params):
'\n Loglikelihood of AR(p) process using conditional sum of squares\n '
nobs = self.nobs
Y = self.Y
X = self.X
ssr = sumofsq((Y.squeeze() - np.dot(X, params)))
sigma2 = (ssr / nobs)
return (((- nobs) / 2) * ((np.log((2 * np.pi)) + np.log(sigma2))... | Loglikelihood of AR(p) process using conditional sum of squares | statsmodels/tsa/ar_model.py | _loglike_css | raamana/statsmodels | 6 | python | def _loglike_css(self, params):
'\n \n '
nobs = self.nobs
Y = self.Y
X = self.X
ssr = sumofsq((Y.squeeze() - np.dot(X, params)))
sigma2 = (ssr / nobs)
return (((- nobs) / 2) * ((np.log((2 * np.pi)) + np.log(sigma2)) + 1)) | def _loglike_css(self, params):
'\n \n '
nobs = self.nobs
Y = self.Y
X = self.X
ssr = sumofsq((Y.squeeze() - np.dot(X, params)))
sigma2 = (ssr / nobs)
return (((- nobs) / 2) * ((np.log((2 * np.pi)) + np.log(sigma2)) + 1))<|docstring|>Loglikelihood of AR(p) process using conditi... |
08216abc496d84c88dc42a71016358890e4703200d6e9c7ec37b1197e62dc165 | def _loglike_mle(self, params):
'\n Loglikelihood of AR(p) process using exact maximum likelihood\n '
nobs = self.nobs
X = self.X
endog = self.endog
k_ar = self.k_ar
k_trend = self.k_trend
if self.transparams:
params = self._transparams(params)
yp = endog[:k_ar].cop... | Loglikelihood of AR(p) process using exact maximum likelihood | statsmodels/tsa/ar_model.py | _loglike_mle | raamana/statsmodels | 6 | python | def _loglike_mle(self, params):
'\n \n '
nobs = self.nobs
X = self.X
endog = self.endog
k_ar = self.k_ar
k_trend = self.k_trend
if self.transparams:
params = self._transparams(params)
yp = endog[:k_ar].copy()
if k_trend:
c = ([params[0]] * k_ar)
else... | def _loglike_mle(self, params):
'\n \n '
nobs = self.nobs
X = self.X
endog = self.endog
k_ar = self.k_ar
k_trend = self.k_trend
if self.transparams:
params = self._transparams(params)
yp = endog[:k_ar].copy()
if k_trend:
c = ([params[0]] * k_ar)
else... |
e6d1283e24437fe1d7aab9947e953a51b2bc6f5aa11113524201ca47044d81ae | def loglike(self, params):
'\n The loglikelihood of an AR(p) process.\n\n Parameters\n ----------\n params : array\n The fitted parameters of the AR model.\n\n Returns\n -------\n float\n The loglikelihood evaluated at `params`.\n\n Notes... | The loglikelihood of an AR(p) process.
Parameters
----------
params : array
The fitted parameters of the AR model.
Returns
-------
float
The loglikelihood evaluated at `params`.
Notes
-----
Contains constant term. If the model is fit by OLS then this returns
the conditional maximum likelihood.
.. math::
... | statsmodels/tsa/ar_model.py | loglike | raamana/statsmodels | 6 | python | def loglike(self, params):
'\n The loglikelihood of an AR(p) process.\n\n Parameters\n ----------\n params : array\n The fitted parameters of the AR model.\n\n Returns\n -------\n float\n The loglikelihood evaluated at `params`.\n\n Notes... | def loglike(self, params):
'\n The loglikelihood of an AR(p) process.\n\n Parameters\n ----------\n params : array\n The fitted parameters of the AR model.\n\n Returns\n -------\n float\n The loglikelihood evaluated at `params`.\n\n Notes... |
97eca8a6f126ef17d9da39133cab8675616cabb2d9cb4060e1b6ffc450db0633 | def score(self, params):
'\n Compute the gradient of the log-likelihood at params.\n\n Parameters\n ----------\n params : array_like\n The parameter values at which to evaluate the score function.\n\n Returns\n -------\n ndarray\n The gradient c... | Compute the gradient of the log-likelihood at params.
Parameters
----------
params : array_like
The parameter values at which to evaluate the score function.
Returns
-------
ndarray
The gradient computed using numerical methods. | statsmodels/tsa/ar_model.py | score | raamana/statsmodels | 6 | python | def score(self, params):
'\n Compute the gradient of the log-likelihood at params.\n\n Parameters\n ----------\n params : array_like\n The parameter values at which to evaluate the score function.\n\n Returns\n -------\n ndarray\n The gradient c... | def score(self, params):
'\n Compute the gradient of the log-likelihood at params.\n\n Parameters\n ----------\n params : array_like\n The parameter values at which to evaluate the score function.\n\n Returns\n -------\n ndarray\n The gradient c... |
3870ef08385b1f921337fd23fdf902af40d4b8a705358f53da831c1f51fe474a | def information(self, params):
'\n Not implemented.\n\n Parameters\n ----------\n params : ndarray\n The model parameters.\n '
return | Not implemented.
Parameters
----------
params : ndarray
The model parameters. | statsmodels/tsa/ar_model.py | information | raamana/statsmodels | 6 | python | def information(self, params):
'\n Not implemented.\n\n Parameters\n ----------\n params : ndarray\n The model parameters.\n '
return | def information(self, params):
'\n Not implemented.\n\n Parameters\n ----------\n params : ndarray\n The model parameters.\n '
return<|docstring|>Not implemented.
Parameters
----------
params : ndarray
The model parameters.<|endoftext|> |
a0b05073764e948c71fc21cddb269b479bac49587178a1a6e766a0473981bd2b | def hessian(self, params):
'\n Compute the hessian using a numerical approximation.\n\n Parameters\n ----------\n params : ndarray\n The model parameters.\n\n Returns\n -------\n ndarray\n The hessian evaluated at params.\n '
loglike ... | Compute the hessian using a numerical approximation.
Parameters
----------
params : ndarray
The model parameters.
Returns
-------
ndarray
The hessian evaluated at params. | statsmodels/tsa/ar_model.py | hessian | raamana/statsmodels | 6 | python | def hessian(self, params):
'\n Compute the hessian using a numerical approximation.\n\n Parameters\n ----------\n params : ndarray\n The model parameters.\n\n Returns\n -------\n ndarray\n The hessian evaluated at params.\n '
loglike ... | def hessian(self, params):
'\n Compute the hessian using a numerical approximation.\n\n Parameters\n ----------\n params : ndarray\n The model parameters.\n\n Returns\n -------\n ndarray\n The hessian evaluated at params.\n '
loglike ... |
84af7bfe0bb1e2305842bd47d04f464f0d90063911a0608de9221dba3e51a641 | def _stackX(self, k_ar, trend):
'\n Private method to build the RHS matrix for estimation.\n\n Columns are trend terms then lags.\n '
endog = self.endog
X = lagmat(endog, maxlag=k_ar, trim='both')
k_trend = util.get_trendorder(trend)
if k_trend:
X = add_trend(X, prepend=... | Private method to build the RHS matrix for estimation.
Columns are trend terms then lags. | statsmodels/tsa/ar_model.py | _stackX | raamana/statsmodels | 6 | python | def _stackX(self, k_ar, trend):
'\n Private method to build the RHS matrix for estimation.\n\n Columns are trend terms then lags.\n '
endog = self.endog
X = lagmat(endog, maxlag=k_ar, trim='both')
k_trend = util.get_trendorder(trend)
if k_trend:
X = add_trend(X, prepend=... | def _stackX(self, k_ar, trend):
'\n Private method to build the RHS matrix for estimation.\n\n Columns are trend terms then lags.\n '
endog = self.endog
X = lagmat(endog, maxlag=k_ar, trim='both')
k_trend = util.get_trendorder(trend)
if k_trend:
X = add_trend(X, prepend=... |
9dc76f658040eaecc55ec781aecf81816aec1f986311747f1a608088480fb653 | def select_order(self, maxlag, ic, trend='c', method='mle'):
"\n Select the lag order according to the information criterion.\n\n Parameters\n ----------\n maxlag : int\n The highest lag length tried. See `AR.fit`.\n ic : {'aic','bic','hqic','t-stat'}\n Crite... | Select the lag order according to the information criterion.
Parameters
----------
maxlag : int
The highest lag length tried. See `AR.fit`.
ic : {'aic','bic','hqic','t-stat'}
Criterion used for selecting the optimal lag length.
See `AR.fit`.
trend : {'c','nc'}
Whether to include a constant or not. 'c' ... | statsmodels/tsa/ar_model.py | select_order | raamana/statsmodels | 6 | python | def select_order(self, maxlag, ic, trend='c', method='mle'):
"\n Select the lag order according to the information criterion.\n\n Parameters\n ----------\n maxlag : int\n The highest lag length tried. See `AR.fit`.\n ic : {'aic','bic','hqic','t-stat'}\n Crite... | def select_order(self, maxlag, ic, trend='c', method='mle'):
"\n Select the lag order according to the information criterion.\n\n Parameters\n ----------\n maxlag : int\n The highest lag length tried. See `AR.fit`.\n ic : {'aic','bic','hqic','t-stat'}\n Crite... |
b22f6165c648f72332368aba778fda56662acf9e6b7624671f0105df581f0b19 | def fit(self, maxlag=None, method='cmle', ic=None, trend='c', transparams=True, start_params=None, solver='lbfgs', maxiter=35, full_output=1, disp=1, callback=None, **kwargs):
'\n Fit the unconditional maximum likelihood of an AR(p) process.\n\n Parameters\n ----------\n maxlag : int\n ... | Fit the unconditional maximum likelihood of an AR(p) process.
Parameters
----------
maxlag : int
If `ic` is None, then maxlag is the lag length used in fit. If
`ic` is specified then maxlag is the highest lag order used to
select the correct lag order. If maxlag is None, the default is
round(12*(nobs... | statsmodels/tsa/ar_model.py | fit | raamana/statsmodels | 6 | python | def fit(self, maxlag=None, method='cmle', ic=None, trend='c', transparams=True, start_params=None, solver='lbfgs', maxiter=35, full_output=1, disp=1, callback=None, **kwargs):
'\n Fit the unconditional maximum likelihood of an AR(p) process.\n\n Parameters\n ----------\n maxlag : int\n ... | def fit(self, maxlag=None, method='cmle', ic=None, trend='c', transparams=True, start_params=None, solver='lbfgs', maxiter=35, full_output=1, disp=1, callback=None, **kwargs):
'\n Fit the unconditional maximum likelihood of an AR(p) process.\n\n Parameters\n ----------\n maxlag : int\n ... |
a9c64afd5251e32844d5cf5dcf513ddbf016d448e396de140a598d5eedc8b4e9 | @cache_readonly
def bse(self):
"\n The standard errors of the estimated parameters.\n\n If `method` is 'cmle', then the standard errors that are returned are\n the OLS standard errors of the coefficients. If the `method` is 'mle'\n then they are computed using the numerical Hessian.\n ... | The standard errors of the estimated parameters.
If `method` is 'cmle', then the standard errors that are returned are
the OLS standard errors of the coefficients. If the `method` is 'mle'
then they are computed using the numerical Hessian. | statsmodels/tsa/ar_model.py | bse | raamana/statsmodels | 6 | python | @cache_readonly
def bse(self):
"\n The standard errors of the estimated parameters.\n\n If `method` is 'cmle', then the standard errors that are returned are\n the OLS standard errors of the coefficients. If the `method` is 'mle'\n then they are computed using the numerical Hessian.\n ... | @cache_readonly
def bse(self):
"\n The standard errors of the estimated parameters.\n\n If `method` is 'cmle', then the standard errors that are returned are\n the OLS standard errors of the coefficients. If the `method` is 'mle'\n then they are computed using the numerical Hessian.\n ... |
3f8e4a3fcc18bf54bd04739ba1de530cadee16897fba519969245da79b32aabd | @cache_readonly
def pvalues(self):
'The p values associated with the standard errors.'
return (norm.sf(np.abs(self.tvalues)) * 2) | The p values associated with the standard errors. | statsmodels/tsa/ar_model.py | pvalues | raamana/statsmodels | 6 | python | @cache_readonly
def pvalues(self):
return (norm.sf(np.abs(self.tvalues)) * 2) | @cache_readonly
def pvalues(self):
return (norm.sf(np.abs(self.tvalues)) * 2)<|docstring|>The p values associated with the standard errors.<|endoftext|> |
ef2832c7f92f929135e873c976deba7ff6b0f24f53d6dfe488065c5a05e84f42 | @cache_readonly
def aic(self):
"\n Akaike Information Criterion using Lutkephol's definition.\n\n :math:`log(sigma) + 2*(1 + k_ar + k_trend)/nobs`\n "
return (np.log(self.sigma2) + ((2 * (1 + self.df_model)) / self.nobs)) | Akaike Information Criterion using Lutkephol's definition.
:math:`log(sigma) + 2*(1 + k_ar + k_trend)/nobs` | statsmodels/tsa/ar_model.py | aic | raamana/statsmodels | 6 | python | @cache_readonly
def aic(self):
"\n Akaike Information Criterion using Lutkephol's definition.\n\n :math:`log(sigma) + 2*(1 + k_ar + k_trend)/nobs`\n "
return (np.log(self.sigma2) + ((2 * (1 + self.df_model)) / self.nobs)) | @cache_readonly
def aic(self):
"\n Akaike Information Criterion using Lutkephol's definition.\n\n :math:`log(sigma) + 2*(1 + k_ar + k_trend)/nobs`\n "
return (np.log(self.sigma2) + ((2 * (1 + self.df_model)) / self.nobs))<|docstring|>Akaike Information Criterion using Lutkephol's definition... |
48ab5e4d10dfec3d6264f8c9ee3d319c676d20a23f94037276218bf4f0676545 | @cache_readonly
def hqic(self):
'Hannan-Quinn Information Criterion.'
nobs = self.nobs
return (np.log(self.sigma2) + (((2 * np.log(np.log(nobs))) / nobs) * (1 + self.df_model))) | Hannan-Quinn Information Criterion. | statsmodels/tsa/ar_model.py | hqic | raamana/statsmodels | 6 | python | @cache_readonly
def hqic(self):
nobs = self.nobs
return (np.log(self.sigma2) + (((2 * np.log(np.log(nobs))) / nobs) * (1 + self.df_model))) | @cache_readonly
def hqic(self):
nobs = self.nobs
return (np.log(self.sigma2) + (((2 * np.log(np.log(nobs))) / nobs) * (1 + self.df_model)))<|docstring|>Hannan-Quinn Information Criterion.<|endoftext|> |
d60773506b1548c668c9b51b0d5f70bc54f26763e81b696798d58da8166fe410 | @cache_readonly
def fpe(self):
"\n Final prediction error using Lütkepohl's definition.\n\n ((n_totobs+k_trend)/(n_totobs-k_ar-k_trend))*sigma\n "
nobs = self.nobs
df_model = self.df_model
return (((nobs + df_model) / (nobs - df_model)) * self.sigma2) | Final prediction error using Lütkepohl's definition.
((n_totobs+k_trend)/(n_totobs-k_ar-k_trend))*sigma | statsmodels/tsa/ar_model.py | fpe | raamana/statsmodels | 6 | python | @cache_readonly
def fpe(self):
"\n Final prediction error using Lütkepohl's definition.\n\n ((n_totobs+k_trend)/(n_totobs-k_ar-k_trend))*sigma\n "
nobs = self.nobs
df_model = self.df_model
return (((nobs + df_model) / (nobs - df_model)) * self.sigma2) | @cache_readonly
def fpe(self):
"\n Final prediction error using Lütkepohl's definition.\n\n ((n_totobs+k_trend)/(n_totobs-k_ar-k_trend))*sigma\n "
nobs = self.nobs
df_model = self.df_model
return (((nobs + df_model) / (nobs - df_model)) * self.sigma2)<|docstring|>Final prediction er... |
075e9932f47cf43b1aaadd46349104ccd26b984837399a4e819cba40614beeef | @cache_readonly
def bic(self):
'\n Bayes Information Criterion\n\n :math:`\\log(\\sigma) + (1 + k_ar + k_trend)*\\log(nobs)/nobs`\n '
nobs = self.nobs
return (np.log(self.sigma2) + (((1 + self.df_model) * np.log(nobs)) / nobs)) | Bayes Information Criterion
:math:`\log(\sigma) + (1 + k_ar + k_trend)*\log(nobs)/nobs` | statsmodels/tsa/ar_model.py | bic | raamana/statsmodels | 6 | python | @cache_readonly
def bic(self):
'\n Bayes Information Criterion\n\n :math:`\\log(\\sigma) + (1 + k_ar + k_trend)*\\log(nobs)/nobs`\n '
nobs = self.nobs
return (np.log(self.sigma2) + (((1 + self.df_model) * np.log(nobs)) / nobs)) | @cache_readonly
def bic(self):
'\n Bayes Information Criterion\n\n :math:`\\log(\\sigma) + (1 + k_ar + k_trend)*\\log(nobs)/nobs`\n '
nobs = self.nobs
return (np.log(self.sigma2) + (((1 + self.df_model) * np.log(nobs)) / nobs))<|docstring|>Bayes Information Criterion
:math:`\log(\sigm... |
4b4dc1a8a642b4f5b9d6bd286535b5e1ba795e1bd8b13a5f20279cdcf968f7bb | @cache_readonly
def resid(self):
"\n The residuals of the model.\n\n If the model is fit by 'mle' then the pre-sample residuals are\n calculated using fittedvalues from the Kalman Filter.\n "
model = self.model
endog = model.endog.squeeze()
if (model.method == 'cmle'):
... | The residuals of the model.
If the model is fit by 'mle' then the pre-sample residuals are
calculated using fittedvalues from the Kalman Filter. | statsmodels/tsa/ar_model.py | resid | raamana/statsmodels | 6 | python | @cache_readonly
def resid(self):
"\n The residuals of the model.\n\n If the model is fit by 'mle' then the pre-sample residuals are\n calculated using fittedvalues from the Kalman Filter.\n "
model = self.model
endog = model.endog.squeeze()
if (model.method == 'cmle'):
... | @cache_readonly
def resid(self):
"\n The residuals of the model.\n\n If the model is fit by 'mle' then the pre-sample residuals are\n calculated using fittedvalues from the Kalman Filter.\n "
model = self.model
endog = model.endog.squeeze()
if (model.method == 'cmle'):
... |
a218c4e7c48558d1f6b1be62023b4cfd5b68348e140b11deeb8b503e172002d2 | @cache_readonly
def roots(self):
'\n The roots of the AR process.\n\n The roots are the solution to\n (1 - arparams[0]*z - arparams[1]*z**2 -...- arparams[p-1]*z**k_ar) = 0.\n Stability requires that the roots in modulus lie outside the unit\n circle.\n '
k = self.k_tre... | The roots of the AR process.
The roots are the solution to
(1 - arparams[0]*z - arparams[1]*z**2 -...- arparams[p-1]*z**k_ar) = 0.
Stability requires that the roots in modulus lie outside the unit
circle. | statsmodels/tsa/ar_model.py | roots | raamana/statsmodels | 6 | python | @cache_readonly
def roots(self):
'\n The roots of the AR process.\n\n The roots are the solution to\n (1 - arparams[0]*z - arparams[1]*z**2 -...- arparams[p-1]*z**k_ar) = 0.\n Stability requires that the roots in modulus lie outside the unit\n circle.\n '
k = self.k_tre... | @cache_readonly
def roots(self):
'\n The roots of the AR process.\n\n The roots are the solution to\n (1 - arparams[0]*z - arparams[1]*z**2 -...- arparams[p-1]*z**k_ar) = 0.\n Stability requires that the roots in modulus lie outside the unit\n circle.\n '
k = self.k_tre... |
31825a2c4fd88c8ac2711e9f4c05a59b5647cfeeee894d9eda81001f8d779205 | @cache_readonly
def arfreq(self):
'\n Returns the frequency of the AR roots.\n\n This is the solution, x, to z = abs(z)*exp(2j*np.pi*x) where z are the\n roots.\n '
z = self.roots
return (np.arctan2(z.imag, z.real) / (2 * np.pi)) | Returns the frequency of the AR roots.
This is the solution, x, to z = abs(z)*exp(2j*np.pi*x) where z are the
roots. | statsmodels/tsa/ar_model.py | arfreq | raamana/statsmodels | 6 | python | @cache_readonly
def arfreq(self):
'\n Returns the frequency of the AR roots.\n\n This is the solution, x, to z = abs(z)*exp(2j*np.pi*x) where z are the\n roots.\n '
z = self.roots
return (np.arctan2(z.imag, z.real) / (2 * np.pi)) | @cache_readonly
def arfreq(self):
'\n Returns the frequency of the AR roots.\n\n This is the solution, x, to z = abs(z)*exp(2j*np.pi*x) where z are the\n roots.\n '
z = self.roots
return (np.arctan2(z.imag, z.real) / (2 * np.pi))<|docstring|>Returns the frequency of the AR roots.... |
ef4fee17e987ae6dc7298508693cc445763a8c67aec4a2a8b74da6d549ac8063 | @cache_readonly
def fittedvalues(self):
'\n The in-sample predicted values of the fitted AR model.\n\n The `k_ar` initial values are computed via the Kalman Filter if the\n model is fit by `mle`.\n '
return self.model.predict(self.params) | The in-sample predicted values of the fitted AR model.
The `k_ar` initial values are computed via the Kalman Filter if the
model is fit by `mle`. | statsmodels/tsa/ar_model.py | fittedvalues | raamana/statsmodels | 6 | python | @cache_readonly
def fittedvalues(self):
'\n The in-sample predicted values of the fitted AR model.\n\n The `k_ar` initial values are computed via the Kalman Filter if the\n model is fit by `mle`.\n '
return self.model.predict(self.params) | @cache_readonly
def fittedvalues(self):
'\n The in-sample predicted values of the fitted AR model.\n\n The `k_ar` initial values are computed via the Kalman Filter if the\n model is fit by `mle`.\n '
return self.model.predict(self.params)<|docstring|>The in-sample predicted values of... |
56df97556bb7f8a5ff87aac4963de115b243f746f23204b9da5ae831c7aecdbf | def summary(self, alpha=0.05):
'Summarize the Model\n\n Parameters\n ----------\n alpha : float, optional\n Significance level for the confidence intervals.\n\n Returns\n -------\n smry : Summary instance\n This holds the summary table and text, which ... | Summarize the Model
Parameters
----------
alpha : float, optional
Significance level for the confidence intervals.
Returns
-------
smry : Summary instance
This holds the summary table and text, which can be printed or
converted to various output formats.
See Also
--------
statsmodels.iolib.summary.Summar... | statsmodels/tsa/ar_model.py | summary | raamana/statsmodels | 6 | python | def summary(self, alpha=0.05):
'Summarize the Model\n\n Parameters\n ----------\n alpha : float, optional\n Significance level for the confidence intervals.\n\n Returns\n -------\n smry : Summary instance\n This holds the summary table and text, which ... | def summary(self, alpha=0.05):
'Summarize the Model\n\n Parameters\n ----------\n alpha : float, optional\n Significance level for the confidence intervals.\n\n Returns\n -------\n smry : Summary instance\n This holds the summary table and text, which ... |
0ec77d99f57c48a9f56422fe845798d9cb8b8197932616017dca478985fee4b6 | def transform_to_renderer_frame(self, T_view_world):
'\n Args:\n - T_view_world: (batch x 4 x 4) transformation\n in shapenet coordinates (East-Up-South)\n Returns:\n - (batch x 4 x 4) transformation in renderer frame (East-Down-North)\n '
batch_size = T... | Args:
- T_view_world: (batch x 4 x 4) transformation
in shapenet coordinates (East-Up-South)
Returns:
- (batch x 4 x 4) transformation in renderer frame (East-Down-North) | shapenet/modeling/heads/depth_renderer.py | transform_to_renderer_frame | rakeshshrestha31/meshmvs | 6 | python | def transform_to_renderer_frame(self, T_view_world):
'\n Args:\n - T_view_world: (batch x 4 x 4) transformation\n in shapenet coordinates (East-Up-South)\n Returns:\n - (batch x 4 x 4) transformation in renderer frame (East-Down-North)\n '
batch_size = T... | def transform_to_renderer_frame(self, T_view_world):
'\n Args:\n - T_view_world: (batch x 4 x 4) transformation\n in shapenet coordinates (East-Up-South)\n Returns:\n - (batch x 4 x 4) transformation in renderer frame (East-Down-North)\n '
batch_size = T... |
ad39c7ef3fca6fc1128c4e2c1cc0af2ed9ecee6fd0ab060e03f947b78bfc2d4a | def forward(self, coords, faces, extrinsics, image_shape):
'\n Multi-view rendering\n Args:\n - pred_coords: (batch x vertices x 3) tensor\n - faces: (batch x faces x 3) tensor\n - image_shape: shape of the depth image to be rendered\n - extrinsics: (batch x view x 2 x 4 x ... | Multi-view rendering
Args:
- pred_coords: (batch x vertices x 3) tensor
- faces: (batch x faces x 3) tensor
- image_shape: shape of the depth image to be rendered
- extrinsics: (batch x view x 2 x 4 x 4) tensor
Returns:
- depth tensor batch x view x height x width | shapenet/modeling/heads/depth_renderer.py | forward | rakeshshrestha31/meshmvs | 6 | python | def forward(self, coords, faces, extrinsics, image_shape):
'\n Multi-view rendering\n Args:\n - pred_coords: (batch x vertices x 3) tensor\n - faces: (batch x faces x 3) tensor\n - image_shape: shape of the depth image to be rendered\n - extrinsics: (batch x view x 2 x 4 x ... | def forward(self, coords, faces, extrinsics, image_shape):
'\n Multi-view rendering\n Args:\n - pred_coords: (batch x vertices x 3) tensor\n - faces: (batch x faces x 3) tensor\n - image_shape: shape of the depth image to be rendered\n - extrinsics: (batch x view x 2 x 4 x ... |
f8a74ef9f7cd3756d612dc0b4ed2373760f3e648aa12fd56d393481c2dab8bd0 | def render_depth(self, coords, faces, T_view_world, image_shape):
'\n renders a batch of depths\n Args:\n - pred_coords: (batch x vertices x 3) tensor\n - faces: (batch x faces x 3) tensor\n - image_shape shape of the depth image to be rendered\n - T_view_world: (batch x 4 ... | renders a batch of depths
Args:
- pred_coords: (batch x vertices x 3) tensor
- faces: (batch x faces x 3) tensor
- image_shape shape of the depth image to be rendered
- T_view_world: (batch x 4 x 4) transformation
in shapenet coordinates (EUS)
Returns:
- depth tensors of shape (batch x h x w) | shapenet/modeling/heads/depth_renderer.py | render_depth | rakeshshrestha31/meshmvs | 6 | python | def render_depth(self, coords, faces, T_view_world, image_shape):
'\n renders a batch of depths\n Args:\n - pred_coords: (batch x vertices x 3) tensor\n - faces: (batch x faces x 3) tensor\n - image_shape shape of the depth image to be rendered\n - T_view_world: (batch x 4 ... | def render_depth(self, coords, faces, T_view_world, image_shape):
'\n renders a batch of depths\n Args:\n - pred_coords: (batch x vertices x 3) tensor\n - faces: (batch x faces x 3) tensor\n - image_shape shape of the depth image to be rendered\n - T_view_world: (batch x 4 ... |
51be86d16eb1be5fd2f62b4de5f70289d4017b0107668b8410821a7580e3ad4c | def test_erc_681_url_for_L1():
'Test for both native asset and token'
erc681_url = helpers.make_erc_681_url('0xtest1', '10')
assert (erc681_url == 'ethereum:0xtest1?value=10')
erc681_url = helpers.make_erc_681_url('0xtest1', '10', is_token=True, token_address='0xtoken')
assert (erc681_url == 'ethere... | Test for both native asset and token | tests/tokens/test_token_methods.py | test_erc_681_url_for_L1 | mikulas-mrva/pretix-eth-payment-plugin | 1 | python | def test_erc_681_url_for_L1():
erc681_url = helpers.make_erc_681_url('0xtest1', '10')
assert (erc681_url == 'ethereum:0xtest1?value=10')
erc681_url = helpers.make_erc_681_url('0xtest1', '10', is_token=True, token_address='0xtoken')
assert (erc681_url == 'ethereum:0xtoken/transfer?address=0xtest1&ui... | def test_erc_681_url_for_L1():
erc681_url = helpers.make_erc_681_url('0xtest1', '10')
assert (erc681_url == 'ethereum:0xtest1?value=10')
erc681_url = helpers.make_erc_681_url('0xtest1', '10', is_token=True, token_address='0xtoken')
assert (erc681_url == 'ethereum:0xtoken/transfer?address=0xtest1&ui... |
7dd5e5a8f3d27e416ccb94fbac0af9a31089ccdcf01ce0b1a7544d8f27059ff5 | def test_make_erc_681_url_for_L2():
'Test for both native asset and token'
erc681_url = helpers.make_erc_681_url('0xtest1', '10', chain_id=3)
assert (erc681_url == 'ethereum:0xtest1@3?value=10')
erc681_url = helpers.make_erc_681_url('0xtest1', '10', chain_id=3, is_token=True, token_address='0xtoken')
... | Test for both native asset and token | tests/tokens/test_token_methods.py | test_make_erc_681_url_for_L2 | mikulas-mrva/pretix-eth-payment-plugin | 1 | python | def test_make_erc_681_url_for_L2():
erc681_url = helpers.make_erc_681_url('0xtest1', '10', chain_id=3)
assert (erc681_url == 'ethereum:0xtest1@3?value=10')
erc681_url = helpers.make_erc_681_url('0xtest1', '10', chain_id=3, is_token=True, token_address='0xtoken')
assert (erc681_url == 'ethereum:0xto... | def test_make_erc_681_url_for_L2():
erc681_url = helpers.make_erc_681_url('0xtest1', '10', chain_id=3)
assert (erc681_url == 'ethereum:0xtest1@3?value=10')
erc681_url = helpers.make_erc_681_url('0xtest1', '10', chain_id=3, is_token=True, token_address='0xtoken')
assert (erc681_url == 'ethereum:0xto... |
d297cf6b7a014515990cd7325834f1d95bb0540b648a12322d5a25c8e04bdbac | def create_jwt(project_id, private_key_file, algorithm):
"Creates a JWT (https://jwt.io) to establish an MQTT connection.\n Args:\n project_id: The cloud project ID this device belongs to\n private_key_file: A path to a file containing either an RSA256 or\n ES256 private key.\... | Creates a JWT (https://jwt.io) to establish an MQTT connection.
Args:
project_id: The cloud project ID this device belongs to
private_key_file: A path to a file containing either an RSA256 or
ES256 private key.
algorithm: The encryption algorithm to use. Either 'RS256' or 'ES256'
Returns:
A JWT generate... | pyclient/gcpIoTclient.py | create_jwt | lkk688/IoTCloudConnect | 1 | python | def create_jwt(project_id, private_key_file, algorithm):
"Creates a JWT (https://jwt.io) to establish an MQTT connection.\n Args:\n project_id: The cloud project ID this device belongs to\n private_key_file: A path to a file containing either an RSA256 or\n ES256 private key.\... | def create_jwt(project_id, private_key_file, algorithm):
"Creates a JWT (https://jwt.io) to establish an MQTT connection.\n Args:\n project_id: The cloud project ID this device belongs to\n private_key_file: A path to a file containing either an RSA256 or\n ES256 private key.\... |
dc16172cdb1634aff3b530eb77a6348faaa93076e71b14bbfcabf9bb1e387cce | def error_str(rc):
'Convert a Paho error to a human readable string.'
return '{}: {}'.format(rc, mqtt.error_string(rc)) | Convert a Paho error to a human readable string. | pyclient/gcpIoTclient.py | error_str | lkk688/IoTCloudConnect | 1 | python | def error_str(rc):
return '{}: {}'.format(rc, mqtt.error_string(rc)) | def error_str(rc):
return '{}: {}'.format(rc, mqtt.error_string(rc))<|docstring|>Convert a Paho error to a human readable string.<|endoftext|> |
5b4ec1675b10709c94ac987ed69a5cffef826fdc49d83ed69067779417feb3e9 | def on_connect(unused_client, unused_userdata, unused_flags, rc):
'Callback for when a device connects.'
print('on_connect', mqtt.connack_string(rc))
global should_backoff
global minimum_backoff_time
should_backoff = False
minimum_backoff_time = 1 | Callback for when a device connects. | pyclient/gcpIoTclient.py | on_connect | lkk688/IoTCloudConnect | 1 | python | def on_connect(unused_client, unused_userdata, unused_flags, rc):
print('on_connect', mqtt.connack_string(rc))
global should_backoff
global minimum_backoff_time
should_backoff = False
minimum_backoff_time = 1 | def on_connect(unused_client, unused_userdata, unused_flags, rc):
print('on_connect', mqtt.connack_string(rc))
global should_backoff
global minimum_backoff_time
should_backoff = False
minimum_backoff_time = 1<|docstring|>Callback for when a device connects.<|endoftext|> |
69f5df89897bf796bb1d635895fbad794602293078d341c2cf882cef0de310b6 | def on_disconnect(unused_client, unused_userdata, rc):
'Paho callback for when a device disconnects.'
print('on_disconnect', error_str(rc))
global should_backoff
should_backoff = True | Paho callback for when a device disconnects. | pyclient/gcpIoTclient.py | on_disconnect | lkk688/IoTCloudConnect | 1 | python | def on_disconnect(unused_client, unused_userdata, rc):
print('on_disconnect', error_str(rc))
global should_backoff
should_backoff = True | def on_disconnect(unused_client, unused_userdata, rc):
print('on_disconnect', error_str(rc))
global should_backoff
should_backoff = True<|docstring|>Paho callback for when a device disconnects.<|endoftext|> |
f51bbb89ca14a76eb00d0f6d8aca8f5bab66f724adfbce4f45fb00f5a8f4f89d | def on_publish(unused_client, unused_userdata, unused_mid):
'Paho callback when a message is sent to the broker.'
print('on_publish') | Paho callback when a message is sent to the broker. | pyclient/gcpIoTclient.py | on_publish | lkk688/IoTCloudConnect | 1 | python | def on_publish(unused_client, unused_userdata, unused_mid):
print('on_publish') | def on_publish(unused_client, unused_userdata, unused_mid):
print('on_publish')<|docstring|>Paho callback when a message is sent to the broker.<|endoftext|> |
53b0c26c1d7f446544711b415dc903ed43a8b0b671ac942d1590136c7957be43 | def on_message(unused_client, unused_userdata, message):
'Callback when the device receives a message on a subscription.'
payload = str(message.payload.decode('utf-8'))
print("Received message '{}' on topic '{}' with Qos {}".format(payload, message.topic, str(message.qos))) | Callback when the device receives a message on a subscription. | pyclient/gcpIoTclient.py | on_message | lkk688/IoTCloudConnect | 1 | python | def on_message(unused_client, unused_userdata, message):
payload = str(message.payload.decode('utf-8'))
print("Received message '{}' on topic '{}' with Qos {}".format(payload, message.topic, str(message.qos))) | def on_message(unused_client, unused_userdata, message):
payload = str(message.payload.decode('utf-8'))
print("Received message '{}' on topic '{}' with Qos {}".format(payload, message.topic, str(message.qos)))<|docstring|>Callback when the device receives a message on a subscription.<|endoftext|> |
1321eff056db6d54cbffb2f9d43828cea936fe81ec2dd679612d12c061fb2a6f | def get_client(project_id, cloud_region, registry_id, device_id, private_key_file, algorithm, ca_certs, mqtt_bridge_hostname, mqtt_bridge_port):
'Create our MQTT client. The client_id is a unique string that identifies\n this device. For Google Cloud IoT Core, it must be in the format below.'
client_id = 'pr... | Create our MQTT client. The client_id is a unique string that identifies
this device. For Google Cloud IoT Core, it must be in the format below. | pyclient/gcpIoTclient.py | get_client | lkk688/IoTCloudConnect | 1 | python | def get_client(project_id, cloud_region, registry_id, device_id, private_key_file, algorithm, ca_certs, mqtt_bridge_hostname, mqtt_bridge_port):
'Create our MQTT client. The client_id is a unique string that identifies\n this device. For Google Cloud IoT Core, it must be in the format below.'
client_id = 'pr... | def get_client(project_id, cloud_region, registry_id, device_id, private_key_file, algorithm, ca_certs, mqtt_bridge_hostname, mqtt_bridge_port):
'Create our MQTT client. The client_id is a unique string that identifies\n this device. For Google Cloud IoT Core, it must be in the format below.'
client_id = 'pr... |
30e17cdb431112918d624a5cc72fe39e467aa68a06393e1f73832b41926652dd | def mqtt_device_demo(args):
'Connects a device, sends data, and receives data.'
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime.datetim... | Connects a device, sends data, and receives data. | pyclient/gcpIoTclient.py | mqtt_device_demo | lkk688/IoTCloudConnect | 1 | python | def mqtt_device_demo(args):
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime.datetime.utcnow()
jwt_exp_mins = args.jwt_expires_minu... | def mqtt_device_demo(args):
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime.datetime.utcnow()
jwt_exp_mins = args.jwt_expires_minu... |
f52179646135c561b97cecb00462d9f83b29caf4ba3633e57cb6a7d556853eda | def storage_mqtt_device_demo(args):
'Connects a device, sends data, and receives data.'
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime... | Connects a device, sends data, and receives data. | pyclient/gcpIoTclient.py | storage_mqtt_device_demo | lkk688/IoTCloudConnect | 1 | python | def storage_mqtt_device_demo(args):
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime.datetime.utcnow()
jwt_exp_mins = args.jwt_expi... | def storage_mqtt_device_demo(args):
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime.datetime.utcnow()
jwt_exp_mins = args.jwt_expi... |
2e435e2f59461619f40b08bc6afb4c44a7b589c4e3d5dcf1ac6dcd0254aa9b25 | def bigquery_mqtt_device_demo(args):
'Connects a device, sends data, and receives data.'
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetim... | Connects a device, sends data, and receives data. | pyclient/gcpIoTclient.py | bigquery_mqtt_device_demo | lkk688/IoTCloudConnect | 1 | python | def bigquery_mqtt_device_demo(args):
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime.datetime.utcnow()
jwt_exp_mins = args.jwt_exp... | def bigquery_mqtt_device_demo(args):
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime.datetime.utcnow()
jwt_exp_mins = args.jwt_exp... |
49309f3cf6ecf0a6ae2cbe59bf7cb917c7d85b5e53422d9c43de668056ce4595 | def mqtt_device_subdemo(args):
'Connects a device, sends data, and receives data.'
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime.date... | Connects a device, sends data, and receives data. | pyclient/gcpIoTclient.py | mqtt_device_subdemo | lkk688/IoTCloudConnect | 1 | python | def mqtt_device_subdemo(args):
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime.datetime.utcnow()
jwt_exp_mins = args.jwt_expires_m... | def mqtt_device_subdemo(args):
global minimum_backoff_time
global MAXIMUM_BACKOFF_TIME
sub_topic = ('events' if (args.message_type == 'event') else 'state')
mqtt_topic = '/devices/{}/{}'.format(args.device_id, sub_topic)
jwt_iat = datetime.datetime.utcnow()
jwt_exp_mins = args.jwt_expires_m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.