text stringlengths 81 112k |
|---|
Performs a keyboard key release (without the press down beforehand).
Args:
key (str): The key to be released up. The valid names are listed in
pyautogui.KEY_NAMES.
Returns:
None
def _keyUp(key):
"""Performs a keyboard key release (without the press down beforehand).
Args:
key... |
Return dict: {'window title' : window handle} for all visible windows
def getWindows(): #https://sjohannes.wordpress.com/2012/03/23/win32-python-getting-all-window-titles/
"""Return dict: {'window title' : window handle} for all visible windows"""
titles = {}
def foreach_window(hwnd, lparam):
i... |
Return Window object if 'title' or its part found in visible windows titles, else return None
Return only 1 window found first
Args:
title: unicode string
exact (bool): True if search only exact match
def getWindow(title, exact=False):
"""Return Window object if 'title' or its part found i... |
Set window top-left corner position and size
def set_position(self, x, y, width, height):
"""Set window top-left corner position and size"""
SetWindowPos(self._hwnd, None, x, y, width, height, ctypes.c_uint(0)) |
Move window top-left corner to position
def move(self, x, y):
"""Move window top-left corner to position"""
SetWindowPos(self._hwnd, None, x, y, 0, 0, SWP_NOSIZE) |
Change window size
def resize(self, width, height):
"""Change window size"""
SetWindowPos(self._hwnd, None, 0, 0, width, height, SWP_NOMOVE) |
Returns tuple of 4 numbers: (x, y)s of top-left and bottom-right corners
def get_position(self):
"""Returns tuple of 4 numbers: (x, y)s of top-left and bottom-right corners"""
rect = _Rect()
GetWindowRect(self._hwnd, ctypes.pointer(rect))
return rect.left, rect.top, rect.right, rect.bot... |
Returns the (x, y) tuple of the point that has progressed a proportion
n along the line defined by the two x, y coordinates.
Copied from pytweening module.
def getPointOnLine(x1, y1, x2, y2, n):
"""Returns the (x, y) tuple of the point that has progressed a proportion
n along the line defined by the t... |
If x is a sequence and y is None, returns x[0], y[0]. Else, returns x, y.
On functions that receive a pair of x,y coordinates, they can be passed as
separate arguments, or as a single two-element sequence.
def _unpackXY(x, y):
"""If x is a sequence and y is None, returns x[0], y[0]. Else, returns x, y.
... |
Returns the current xy coordinates of the mouse cursor as a two-integer
tuple.
Args:
x (int, None, optional) - If not None, this argument overrides the x in
the return value.
y (int, None, optional) - If not None, this argument overrides the y in
the return value.
Returns:
... |
Returns whether the given xy coordinates are on the screen or not.
Args:
Either the arguments are two separate values, first arg for x and second
for y, or there is a single argument of a sequence with two values, the
first x and the second y.
Example: onScreen(x, y) or onScreen([x, y... |
Performs releasing a mouse button up (but not down beforehand).
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.
Args:
... |
Performs pressing a mouse button down and then immediately releasing it.
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.
... |
Performs a right mouse button click.
This is a wrapper function for click('right', x, y).
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge o... |
Performs a double click.
This is a wrapper function for click('left', x, y, 2, interval).
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge o... |
Performs a scroll of the mouse scroll wheel.
Whether this is a vertical or horizontal scroll depends on the underlying
operating system.
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the bo... |
Performs an explicitly horizontal scroll of the mouse scroll wheel,
if this is supported by the operating system. (Currently just Linux.)
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the bounda... |
Performs an explicitly vertical scroll of the mouse scroll wheel,
if this is supported by the operating system. (Currently just Linux.)
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundari... |
Moves the mouse cursor to a point on the screen.
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
screen.
Args:
x (int, flo... |
Moves the mouse cursor to a point on the screen, relative to its current
position.
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge of the
... |
Performs a mouse drag (mouse movement while a button is held down) to a
point on the screen.
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the screen, the event happens at edge... |
Performs a mouse drag (mouse movement while a button is held down) to a
point on the screen, relative to its current position.
The x and y parameters detail where the mouse event happens. If None, the
current mouse position is used. If a float value, it is rounded down. If
outside the boundaries of the... |
Handles the actual move or drag event, since different platforms
implement them differently.
On Windows & Linux, a drag is a normal mouse move while a mouse button is
held down. On OS X, a distinct "drag" event must be used instead.
The code for moving and dragging the mouse is similar, so this functi... |
Performs a keyboard key press without the release. This will put that
key in a held down state.
NOTE: For some reason, this does not seem to cause key repeats like would
happen if a keyboard key was held down on a text field.
Args:
key (str): The key to be pressed down. The valid names are liste... |
Performs a keyboard key release (without the press down beforehand).
Args:
key (str): The key to be released up. The valid names are listed in
KEYBOARD_KEYS.
Returns:
None
def keyUp(key, pause=None, _pause=True):
"""Performs a keyboard key release (without the press down beforehand).
... |
Performs a keyboard key press down, followed by a release.
Args:
key (str, list): The key to be pressed. The valid names are listed in
KEYBOARD_KEYS. Can also be a list of such strings.
presses (integer, optiional): the number of press repetition
1 by default, for just one press
inter... |
Performs a keyboard key press down, followed by a release, for each of
the characters in message.
The message argument can also be list of strings, in which case any valid
keyboard name can be used.
Since this performs a sequence of keyboard presses and does not hold down
keys, it cannot be used t... |
Performs key down presses on the arguments passed in order, then performs
key releases in reverse order.
The effect is that calling hotkey('ctrl', 'shift', 'c') would perform a
"Ctrl-Shift-C" hotkey/keyboard shortcut press.
Args:
key(s) (str): The series of keys to press, in order. This can also... |
This function is meant to be run from the command line. It will
automatically display the location and RGB of the mouse cursor.
def displayMousePosition(xOffset=0, yOffset=0):
"""This function is meant to be run from the command line. It will
automatically display the location and RGB of the mouse cursor."... |
Performs a keyboard key press without the release. This will put that
key in a held down state.
NOTE: For some reason, this does not seem to cause key repeats like would
happen if a keyboard key was held down on a text field.
Args:
key (str): The key to be pressed down. The valid names are liste... |
Returns the current xy coordinates of the mouse cursor as a two-integer
tuple by calling the GetCursorPos() win32 function.
Returns:
(x, y) tuple of the current xy coordinates of the mouse cursor.
def _position():
"""Returns the current xy coordinates of the mouse cursor as a two-integer
tuple b... |
Send the mouse down event to Windows by calling the mouse_event() win32
function.
Args:
x (int): The x position of the mouse event.
y (int): The y position of the mouse event.
button (str): The mouse button, either 'left', 'middle', or 'right'
Returns:
None
def _mouseDown(x, y, bu... |
Send the mouse up event to Windows by calling the mouse_event() win32
function.
Args:
x (int): The x position of the mouse event.
y (int): The y position of the mouse event.
button (str): The mouse button, either 'left', 'middle', or 'right'
Returns:
None
def _mouseUp(x, y, button... |
Send the mouse click event to Windows by calling the mouse_event() win32
function.
Args:
button (str): The mouse button, either 'left', 'middle', or 'right'
x (int): The x position of the mouse event.
y (int): The y position of the mouse event.
Returns:
None
def _click(x, y, butto... |
The helper function that actually makes the call to the mouse_event()
win32 function.
Args:
ev (int): The win32 code for the mouse event. Use one of the MOUSEEVENTF_*
constants for this argument.
x (int): The x position of the mouse event.
y (int): The y position of the mouse event.
... |
Send the mouse vertical scroll event to Windows by calling the
mouse_event() win32 function.
Args:
clicks (int): The amount of scrolling to do. A positive value is the mouse
wheel moving forward (scrolling up), a negative value is backwards (down).
x (int): The x position of the mouse event.
... |
Login to Google API using OAuth2 credentials.
This is a shortcut function which
instantiates :class:`gspread.client.Client`
and performs login right away.
:returns: :class:`gspread.Client` instance.
def authorize(credentials, client_class=Client):
"""Login to Google API using OAuth2 credentials.
... |
Spreadsheet title.
def title(self):
"""Spreadsheet title."""
try:
return self._properties['title']
except KeyError:
metadata = self.fetch_sheet_metadata()
self._properties.update(metadata['properties'])
return self._properties['title'] |
Lower-level method that directly calls `spreadsheets.batchUpdate <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate>`_.
:param dict body: `Request body <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate#request-body>`_.
:returns: `Resp... |
Lower-level method that directly calls `spreadsheets.values.append <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/append>`_.
:param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`_
of a range to searc... |
Lower-level method that directly calls `spreadsheets.values.clear <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/clear>`_.
:param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`_ of the values to clear.
:returns: `Resp... |
Lower-level method that directly calls `spreadsheets.values.get <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get>`_.
:param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`_ of the values to retrieve.
:param dict para... |
Lower-level method that directly calls `spreadsheets.values.update <https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update>`_.
:param str range: The `A1 notation <https://developers.google.com/sheets/api/guides/concepts#a1_notation>`_ of the values to update.
:param dict ... |
Returns a worksheet with specified `index`.
:param index: An index of a worksheet. Indexes start from zero.
:type index: int
:returns: an instance of :class:`gsperad.models.Worksheet`
or `None` if the worksheet is not found.
Example. To get first worksheet of a sprea... |
Returns a list of all :class:`worksheets <gsperad.models.Worksheet>`
in a spreadsheet.
def worksheets(self):
"""Returns a list of all :class:`worksheets <gsperad.models.Worksheet>`
in a spreadsheet.
"""
sheet_data = self.fetch_sheet_metadata()
return [Worksheet(self, x[... |
Returns a worksheet with specified `title`.
:param title: A title of a worksheet. If there're multiple
worksheets with the same title, first one will
be returned.
:type title: int
:returns: an instance of :class:`gsperad.models.Worksheet`.
E... |
Adds a new worksheet to a spreadsheet.
:param title: A title of a new worksheet.
:type title: str
:param rows: Number of rows.
:type rows: int
:param cols: Number of columns.
:type cols: int
:returns: a newly created :class:`worksheets <gsperad.models.Worksheet>... |
Duplicates the contents of a sheet.
:param int source_sheet_id: The sheet ID to duplicate.
:param int insert_sheet_index: (optional) The zero-based index
where the new sheet should be inserted.
The index of all sheets after t... |
Share the spreadsheet with other accounts.
:param value: user or group e-mail address, domain name
or None for 'default' type.
:type value: str, None
:param perm_type: The account type.
Allowed values are: ``user``, ``group``, ``domain``,
``an... |
Remove permissions from a user or domain.
:param value: User or domain to remove permissions from
:type value: str
:param role: (optional) Permission to remove. Defaults to all
permissions.
:type role: str
Example::
# Remove Otto's write permis... |
Returns an instance of a :class:`gspread.models.Cell`.
:param label: Cell label in A1 notation
Letter case is ignored.
:type label: str
:param value_render_option: (optional) Determines how values should be
rendered in the the output. Se... |
Returns an instance of a :class:`gspread.models.Cell` located at
`row` and `col` column.
:param row: Row number.
:type row: int
:param col: Column number.
:type col: int
:param value_render_option: (optional) Determines how values should be
... |
Returns a list of :class:`Cell` objects from a specified range.
:param name: A string with range value in A1 notation, e.g. 'A1:A5'.
:type name: str
Alternatively, you may specify numeric boundaries. All values
index from 1 (one):
:param first_row: Row number
:type fir... |
Returns a list of lists containing all cells' values as strings.
.. note::
Empty trailing rows and columns will not be included.
def get_all_values(self):
"""Returns a list of lists containing all cells' values as strings.
.. note::
Empty trailing rows and columns wi... |
Returns a list of dictionaries, all of them having the contents
of the spreadsheet with the head row as keys and each of these
dictionaries holding the contents of subsequent rows of cells
as values.
Cell values are numericised (strings that can be read as ints
... |
Returns a list of all values in a `row`.
Empty cells in this list will be rendered as :const:`None`.
:param row: Row number.
:type row: int
:param value_render_option: (optional) Determines how values should be
rendered in the the output. See
... |
Returns a list of all values in column `col`.
Empty cells in this list will be rendered as :const:`None`.
:param col: Column number.
:type col: int
:param value_render_option: (optional) Determines how values should be
rendered in the the output. See... |
Updates the value of a cell.
:param label: Cell label in A1 notation.
Letter case is ignored.
:type label: str
:param value: New value.
Example::
worksheet.update_acell('A1', '42')
def update_acell(self, label, value):
"""Updates the value of... |
Updates the value of a cell.
:param row: Row number.
:type row: int
:param col: Column number.
:type col: int
:param value: New value.
Example::
worksheet.update_cell(1, 1, '42')
def update_cell(self, row, col, value):
"""Updates the value of a cel... |
Updates many cells at once.
:param cell_list: List of :class:`Cell` objects to update.
:param value_input_option: (optional) Determines how input data should
be interpreted. See `ValueInputOption`_ in
the Sheets API.
:type ... |
Resizes the worksheet. Specify one of ``rows`` or ``cols``.
:param rows: (optional) New number of rows.
:type rows: int
:param cols: (optional) New number columns.
:type cols: int
def resize(self, rows=None, cols=None):
"""Resizes the worksheet. Specify one of ``rows`` or ``col... |
Renames the worksheet.
:param title: A new title.
:type title: str
def update_title(self, title):
"""Renames the worksheet.
:param title: A new title.
:type title: str
"""
body = {
'requests': [{
'updateSheetProperties': {
... |
Adds a row to the worksheet and populates it with values.
Widens the worksheet if there are more values than columns.
:param values: List of values for the new row.
:param value_input_option: (optional) Determines how input data should
be interpreted. See `Va... |
Adds a row to the worksheet at the specified index
and populates it with values.
Widens the worksheet if there are more values than columns.
:param values: List of values for the new row.
:param index: (optional) Offset for the newly inserted row.
:type index: int
:para... |
Deletes the row from the worksheet at the specified index.
:param index: Index of a row for deletion.
:type index: int
def delete_row(self, index):
""""Deletes the row from the worksheet at the specified index.
:param index: Index of a row for deletion.
:type index: int
... |
Finds the first cell matching the query.
:param query: A literal string to match or compiled regular expression.
:type query: str, :py:class:`re.RegexObject`
def find(self, query):
"""Finds the first cell matching the query.
:param query: A literal string to match or compiled regular ... |
Duplicate the sheet.
:param int insert_sheet_index: (optional) The zero-based index
where the new sheet should be inserted.
The index of all sheets after this are
incremented.
:param int... |
Returns a value that depends on the input string:
- Float if input can be converted to Float
- Integer if input can be converted to integer
- Zero if the input string is empty and empty2zero flag is set
- The same input string, empty or not, otherwise.
Executable examples:
>>> ... |
Returns a list of numericised values from strings
def numericise_all(input, empty2zero=False, default_blank="", allow_underscores_in_numeric_literals=False):
"""Returns a list of numericised values from strings"""
return [numericise(s, empty2zero, default_blank, allow_underscores_in_numeric_literals) for s in ... |
Translates a row and column cell address to A1 notation.
:param row: The row of the cell to be converted.
Rows start at index 1.
:type row: int, str
:param col: The column of the cell to be converted.
Columns start at index 1.
:type row: int, str
:returns: a string... |
Translates a cell's address in A1 notation to a tuple of integers.
:param label: A cell label in A1 notation, e.g. 'B1'.
Letter case is ignored.
:type label: str
:returns: a tuple containing `row` and `column` numbers. Both indexed
from 1 (one).
Example:
>>> a1_to... |
Decorator function casts wrapped arguments to A1 notation
in range method calls.
def cast_to_a1_notation(method):
"""
Decorator function casts wrapped arguments to A1 notation
in range method calls.
"""
@wraps(method)
def wrapper(self, *args, **kwargs):
try:
if len(args)... |
Calculate gid of a worksheet from its wid.
def wid_to_gid(wid):
"""Calculate gid of a worksheet from its wid."""
widval = wid[1:] if len(wid) > 3 else wid
xorval = 474 if len(wid) > 3 else 31578
return str(int(widval, 36) ^ xorval) |
Authorize client.
def login(self):
"""Authorize client."""
if not self.auth.access_token or \
(hasattr(self.auth, 'access_token_expired') and self.auth.access_token_expired):
import httplib2
http = httplib2.Http()
self.auth.refresh(http)
sel... |
Opens a spreadsheet.
:param title: A title of a spreadsheet.
:type title: str
:returns: a :class:`~gspread.models.Spreadsheet` instance.
If there's more than one spreadsheet with same title the first one
will be opened.
:raises gspread.SpreadsheetNotFound: if no sprea... |
Opens all available spreadsheets.
:param title: (optional) If specified can be used to filter
spreadsheets by title.
:type title: str
:returns: a list of :class:`~gspread.models.Spreadsheet` instances.
def openall(self, title=None):
"""Opens all available spreads... |
Creates a new spreadsheet.
:param title: A title of a new spreadsheet.
:type title: str
:returns: a :class:`~gspread.models.Spreadsheet` instance.
.. note::
In order to use this method, you need to add
``https://www.googleapis.com/auth/drive`` to your oAuth scop... |
Copies a spreadsheet.
:param file_id: A key of a spreadsheet to copy.
:type title: str
:param title: (optional) A title for the new spreadsheet.
:type title: str
:param copy_permissions: (optional) If True, copy permissions from
original spreadsheet to new sprea... |
Deletes a spreadsheet.
:param file_id: a spreadsheet ID (aka file ID.)
:type file_id: str
def del_spreadsheet(self, file_id):
"""Deletes a spreadsheet.
:param file_id: a spreadsheet ID (aka file ID.)
:type file_id: str
"""
url = '{0}/{1}'.format(
DR... |
Imports data into the first page of the spreadsheet.
:param str data: A CSV string of data.
Example:
.. code::
# Read CSV file contents
content = open('file_to_import.csv', 'r').read()
gc.import_csv(spreadsheet.id, content)
.. note::
... |
Retrieve a list of permissions for a file.
:param file_id: a spreadsheet ID (aka file ID.)
:type file_id: str
def list_permissions(self, file_id):
"""Retrieve a list of permissions for a file.
:param file_id: a spreadsheet ID (aka file ID.)
:type file_id: str
"""
... |
Creates a new permission for a file.
:param file_id: a spreadsheet ID (aka file ID.)
:type file_id: str
:param value: user or group e-mail address, domain name
or None for 'default' type.
:type value: str, None
:param perm_type: (optional) The account type.... |
Deletes a permission from a file.
:param file_id: a spreadsheet ID (aka file ID.)
:type file_id: str
:param permission_id: an ID for the permission.
:type permission_id: str
def remove_permission(self, file_id, permission_id):
"""Deletes a permission from a file.
:para... |
A fast (pseudo)-random number generator.
Parameters
----------
state: array of int64, shape (3,)
The internal state of the rng
Returns
-------
A (pseudo)-random int32 value
def tau_rand_int(state):
"""A fast (pseudo)-random number generator.
Parameters
----------
stat... |
Compute the (standard l2) norm of a vector.
Parameters
----------
vec: array of shape (dim,)
Returns
-------
The l2 norm of vec.
def norm(vec):
"""Compute the (standard l2) norm of a vector.
Parameters
----------
vec: array of shape (dim,)
Returns
-------
The l2 ... |
Generate n_samples many integers from 0 to pool_size such that no
integer is selected twice. The duplication constraint is achieved via
rejection sampling.
Parameters
----------
n_samples: int
The number of random samples to select from the pool
pool_size: int
The size of the t... |
Constructor for the numba enabled heap objects. The heaps are used
for approximate nearest neighbor search, maintaining a list of potential
neighbors sorted by their distance. We also flag if potential neighbors
are newly added to the list or not. Internally this is stored as
a single ndarray; the first... |
Restore the heap property for a heap with an out of place element
at position ``elt``. This works with a heap pair where heap1 carries
the weights and heap2 holds the corresponding elements.
def siftdown(heap1, heap2, elt):
"""Restore the heap property for a heap with an out of place element
at positio... |
Given an array of heaps (of indices and weights), unpack the heap
out to give and array of sorted lists of indices and weights by increasing
weight. This is effectively just the second half of heap sort (the first
half not being required since we already have the data in a heap).
Parameters
-------... |
Search the heap for the smallest element that is
still flagged.
Parameters
----------
heap: array of shape (3, n_samples, n_neighbors)
The heaps to search
row: int
Which of the heaps to search
Returns
-------
index: int
The index of the smallest flagged element... |
Build a heap of candidate neighbors for nearest neighbor descent. For
each vertex the candidate neighbors are any current neighbors, and any
vertices that have the vertex as one of their nearest neighbors.
Parameters
----------
current_graph: heap
The current state of the graph for nearest ... |
Build a heap of candidate neighbors for nearest neighbor descent. For
each vertex the candidate neighbors are any current neighbors, and any
vertices that have the vertex as one of their nearest neighbors.
Parameters
----------
current_graph: heap
The current state of the graph for nearest ... |
Return a submatrix given an orginal matrix and the indices to keep.
Parameters
----------
mat: array, shape (n_samples, n_samples)
Original matrix.
indices_col: array, shape (n_samples, n_neighbors)
Indices to keep. Each row consists of the indices of the columns.
n_neighbors: int... |
Standard euclidean distance.
..math::
D(x, y) = \sqrt{\sum_i (x_i - y_i)^2}
def euclidean(x, y):
"""Standard euclidean distance.
..math::
D(x, y) = \sqrt{\sum_i (x_i - y_i)^2}
"""
result = 0.0
for i in range(x.shape[0]):
result += (x[i] - y[i]) ** 2
return np.sqrt(... |
Euclidean distance standardised against a vector of standard
deviations per coordinate.
..math::
D(x, y) = \sqrt{\sum_i \frac{(x_i - y_i)**2}{v_i}}
def standardised_euclidean(x, y, sigma=_mock_ones):
"""Euclidean distance standardised against a vector of standard
deviations per coordinate.
... |
Manhatten, taxicab, or l1 distance.
..math::
D(x, y) = \sum_i |x_i - y_i|
def manhattan(x, y):
"""Manhatten, taxicab, or l1 distance.
..math::
D(x, y) = \sum_i |x_i - y_i|
"""
result = 0.0
for i in range(x.shape[0]):
result += np.abs(x[i] - y[i])
return result |
Chebyshev or l-infinity distance.
..math::
D(x, y) = \max_i |x_i - y_i|
def chebyshev(x, y):
"""Chebyshev or l-infinity distance.
..math::
D(x, y) = \max_i |x_i - y_i|
"""
result = 0.0
for i in range(x.shape[0]):
result = max(result, np.abs(x[i] - y[i]))
return re... |
Minkowski distance.
..math::
D(x, y) = \left(\sum_i |x_i - y_i|^p\right)^{\frac{1}{p}}
This is a general distance. For p=1 it is equivalent to
manhattan distance, for p=2 it is Euclidean distance, and
for p=infinity it is Chebyshev distance. In general it is better
to use the more speciali... |
Create a numba accelerated version of nearest neighbor descent
specialised for the given distance metric and metric arguments. Numba
doesn't support higher order functions directly, but we can instead JIT
compile the version of NN-descent for any given metric.
Parameters
----------
dist: functi... |
Provide a layout relating the separate connected components. This is done
by taking the centroid of each component and then performing a spectral embedding
of the centroids.
Parameters
----------
data: array of shape (n_samples, n_features)
The source data -- required so we can generate cen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.