repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
burnash/gspread
gspread/models.py
Worksheet.update_cells
def update_cells(self, cell_list, value_input_option='RAW'): """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...
python
def update_cells(self, cell_list, value_input_option='RAW'): """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...
[ "def", "update_cells", "(", "self", ",", "cell_list", ",", "value_input_option", "=", "'RAW'", ")", ":", "values_rect", "=", "cell_list_to_rect", "(", "cell_list", ")", "start", "=", "rowcol_to_a1", "(", "min", "(", "c", ".", "row", "for", "c", "in", "cell...
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 ...
[ "Updates", "many", "cells", "at", "once", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L750-L791
train
Updates many cells at once.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/models.py
Worksheet.resize
def resize(self, rows=None, cols=None): """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 """ grid_properties = {} if row...
python
def resize(self, rows=None, cols=None): """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 """ grid_properties = {} if row...
[ "def", "resize", "(", "self", ",", "rows", "=", "None", ",", "cols", "=", "None", ")", ":", "grid_properties", "=", "{", "}", "if", "rows", "is", "not", "None", ":", "grid_properties", "[", "'rowCount'", "]", "=", "rows", "if", "cols", "is", "not", ...
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
[ "Resizes", "the", "worksheet", ".", "Specify", "one", "of", "rows", "or", "cols", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L793-L828
train
Resizes the worksheet. Specify one of rows or cols.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/models.py
Worksheet.update_title
def update_title(self, title): """Renames the worksheet. :param title: A new title. :type title: str """ body = { 'requests': [{ 'updateSheetProperties': { 'properties': { 'sheetId': self.id, ...
python
def update_title(self, title): """Renames the worksheet. :param title: A new title. :type title: str """ body = { 'requests': [{ 'updateSheetProperties': { 'properties': { 'sheetId': self.id, ...
[ "def", "update_title", "(", "self", ",", "title", ")", ":", "body", "=", "{", "'requests'", ":", "[", "{", "'updateSheetProperties'", ":", "{", "'properties'", ":", "{", "'sheetId'", ":", "self", ".", "id", ",", "'title'", ":", "title", "}", ",", "'fie...
Renames the worksheet. :param title: A new title. :type title: str
[ "Renames", "the", "worksheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L830-L852
train
Renames the worksheet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/models.py
Worksheet.append_row
def append_row(self, values, value_input_option='RAW'): """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...
python
def append_row(self, values, value_input_option='RAW'): """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...
[ "def", "append_row", "(", "self", ",", "values", ",", "value_input_option", "=", "'RAW'", ")", ":", "params", "=", "{", "'valueInputOption'", ":", "value_input_option", "}", "body", "=", "{", "'values'", ":", "[", "values", "]", "}", "return", "self", ".",...
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", "and", "populates", "it", "with", "values", ".", "Widens", "the", "worksheet", "if", "there", "are", "more", "values", "than", "columns", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L872-L893
train
Adds a row to the worksheet and populates it with values.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/models.py
Worksheet.insert_row
def insert_row( self, values, index=1, value_input_option='RAW' ): """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 n...
python
def insert_row( self, values, index=1, value_input_option='RAW' ): """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 n...
[ "def", "insert_row", "(", "self", ",", "values", ",", "index", "=", "1", ",", "value_input_option", "=", "'RAW'", ")", ":", "body", "=", "{", "\"requests\"", ":", "[", "{", "\"insertDimension\"", ":", "{", "\"range\"", ":", "{", "\"sheetId\"", ":", "self...
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...
[ "Adds", "a", "row", "to", "the", "worksheet", "at", "the", "specified", "index", "and", "populates", "it", "with", "values", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L895-L945
train
Adds a row to the worksheet at the specified index and populates it with values.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/models.py
Worksheet.delete_row
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 """ body = { "requests": [{ "deleteDimension": { "range": { ...
python
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 """ body = { "requests": [{ "deleteDimension": { "range": { ...
[ "def", "delete_row", "(", "self", ",", "index", ")", ":", "body", "=", "{", "\"requests\"", ":", "[", "{", "\"deleteDimension\"", ":", "{", "\"range\"", ":", "{", "\"sheetId\"", ":", "self", ".", "id", ",", "\"dimension\"", ":", "\"ROWS\"", ",", "\"start...
Deletes the row from the worksheet at the specified index. :param index: Index of a row for deletion. :type index: int
[ "Deletes", "the", "row", "from", "the", "worksheet", "at", "the", "specified", "index", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L947-L966
train
Deletes the row from the worksheet at the specified index.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/models.py
Worksheet.find
def find(self, query): """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` """ try: return self._finder(finditem, query) except StopIteration: ...
python
def find(self, query): """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` """ try: return self._finder(finditem, query) except StopIteration: ...
[ "def", "find", "(", "self", ",", "query", ")", ":", "try", ":", "return", "self", ".", "_finder", "(", "finditem", ",", "query", ")", "except", "StopIteration", ":", "raise", "CellNotFound", "(", "query", ")" ]
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`
[ "Finds", "the", "first", "cell", "matching", "the", "query", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L994-L1004
train
Finds the first cell matching the query.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/models.py
Worksheet.duplicate
def duplicate( self, insert_sheet_index=None, new_sheet_id=None, new_sheet_name=None ): """Duplicate the sheet. :param int insert_sheet_index: (optional) The zero-based index where the new sheet should be inserted. ...
python
def duplicate( self, insert_sheet_index=None, new_sheet_id=None, new_sheet_name=None ): """Duplicate the sheet. :param int insert_sheet_index: (optional) The zero-based index where the new sheet should be inserted. ...
[ "def", "duplicate", "(", "self", ",", "insert_sheet_index", "=", "None", ",", "new_sheet_id", "=", "None", ",", "new_sheet_name", "=", "None", ")", ":", "return", "self", ".", "spreadsheet", ".", "duplicate_sheet", "(", "self", ".", "id", ",", "insert_sheet_...
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...
[ "Duplicate", "the", "sheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/models.py#L1028-L1057
train
Duplicate the current entry in the current worksheet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/utils.py
numericise
def numericise(value, empty2zero=False, default_blank="", allow_underscores_in_numeric_literals=False): """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 empty...
python
def numericise(value, empty2zero=False, default_blank="", allow_underscores_in_numeric_literals=False): """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 empty...
[ "def", "numericise", "(", "value", ",", "empty2zero", "=", "False", ",", "default_blank", "=", "\"\"", ",", "allow_underscores_in_numeric_literals", "=", "False", ")", ":", "if", "value", "is", "not", "None", ":", "if", "\"_\"", "in", "value", "and", "not", ...
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", "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", "...
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L40-L87
train
Returns a value that depends on the input string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/utils.py
numericise_all
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 input]
python
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 input]
[ "def", "numericise_all", "(", "input", ",", "empty2zero", "=", "False", ",", "default_blank", "=", "\"\"", ",", "allow_underscores_in_numeric_literals", "=", "False", ")", ":", "return", "[", "numericise", "(", "s", ",", "empty2zero", ",", "default_blank", ",", ...
Returns a list of numericised values from strings
[ "Returns", "a", "list", "of", "numericised", "values", "from", "strings" ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L90-L92
train
Returns a list of numericised values from strings
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/utils.py
rowcol_to_a1
def rowcol_to_a1(row, col): """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 ro...
python
def rowcol_to_a1(row, col): """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 ro...
[ "def", "rowcol_to_a1", "(", "row", ",", "col", ")", ":", "row", "=", "int", "(", "row", ")", "col", "=", "int", "(", "col", ")", "if", "row", "<", "1", "or", "col", "<", "1", ":", "raise", "IncorrectCellLabel", "(", "'(%s, %s)'", "%", "(", "row",...
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", "row", "and", "column", "cell", "address", "to", "A1", "notation", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L95-L132
train
Translates a row and column cell address to A1 notation.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/utils.py
a1_to_rowcol
def a1_to_rowcol(label): """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 (on...
python
def a1_to_rowcol(label): """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 (on...
[ "def", "a1_to_rowcol", "(", "label", ")", ":", "m", "=", "CELL_ADDR_RE", ".", "match", "(", "label", ")", "if", "m", ":", "column_label", "=", "m", ".", "group", "(", "1", ")", ".", "upper", "(", ")", "row", "=", "int", "(", "m", ".", "group", ...
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...
[ "Translates", "a", "cell", "s", "address", "in", "A1", "notation", "to", "a", "tuple", "of", "integers", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L135-L162
train
Translates a cell s address in A1 notation to a tuple of integers.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/utils.py
cast_to_a1_notation
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): int(args[0]) # Convert to A1 notation range...
python
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): int(args[0]) # Convert to A1 notation range...
[ "def", "cast_to_a1_notation", "(", "method", ")", ":", "@", "wraps", "(", "method", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "if", "len", "(", "args", ")", ":", "int", "(", "args", "[", ...
Decorator function casts wrapped arguments to A1 notation in range method calls.
[ "Decorator", "function", "casts", "wrapped", "arguments", "to", "A1", "notation", "in", "range", "method", "calls", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L165-L187
train
Decorator function casts wrapped arguments to A1 notation in range method calls.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/utils.py
wid_to_gid
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)
python
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)
[ "def", "wid_to_gid", "(", "wid", ")", ":", "widval", "=", "wid", "[", "1", ":", "]", "if", "len", "(", "wid", ")", ">", "3", "else", "wid", "xorval", "=", "474", "if", "len", "(", "wid", ")", ">", "3", "else", "31578", "return", "str", "(", "...
Calculate gid of a worksheet from its wid.
[ "Calculate", "gid", "of", "a", "worksheet", "from", "its", "wid", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/utils.py#L202-L206
train
Calculate gid of a worksheet from its wid.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/client.py
Client.login
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) self.session.headers.u...
python
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) self.session.headers.u...
[ "def", "login", "(", "self", ")", ":", "if", "not", "self", ".", "auth", ".", "access_token", "or", "(", "hasattr", "(", "self", ".", "auth", ",", "'access_token_expired'", ")", "and", "self", ".", "auth", ".", "access_token_expired", ")", ":", "import",...
Authorize client.
[ "Authorize", "client", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L44-L55
train
Authorize client.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/client.py
Client.open
def open(self, title): """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 gsprea...
python
def open(self, title): """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 gsprea...
[ "def", "open", "(", "self", ",", "title", ")", ":", "try", ":", "properties", "=", "finditem", "(", "lambda", "x", ":", "x", "[", "'name'", "]", "==", "title", ",", "self", ".", "list_spreadsheet_files", "(", ")", ")", "# Drive uses different terminology",...
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", "a", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L102-L131
train
Opens a spreadsheet with the specified title.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/client.py
Client.openall
def openall(self, title=None): """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. """ spreads...
python
def openall(self, title=None): """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. """ spreads...
[ "def", "openall", "(", "self", ",", "title", "=", "None", ")", ":", "spreadsheet_files", "=", "self", ".", "list_spreadsheet_files", "(", ")", "return", "[", "Spreadsheet", "(", "self", ",", "dict", "(", "title", "=", "x", "[", "'name'", "]", ",", "*",...
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.
[ "Opens", "all", "available", "spreadsheets", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L164-L179
train
Opens all available spreadsheets.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/client.py
Client.create
def create(self, title): """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...
python
def create(self, title): """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...
[ "def", "create", "(", "self", ",", "title", ")", ":", "payload", "=", "{", "'title'", ":", "title", ",", "'mimeType'", ":", "'application/vnd.google-apps.spreadsheet'", "}", "r", "=", "self", ".", "request", "(", "'post'", ",", "DRIVE_FILES_API_V2_URL", ",", ...
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...
[ "Creates", "a", "new", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L181-L215
train
Creates a new spreadsheet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/client.py
Client.copy
def copy(self, file_id, title=None, copy_permissions=False): """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...
python
def copy(self, file_id, title=None, copy_permissions=False): """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...
[ "def", "copy", "(", "self", ",", "file_id", ",", "title", "=", "None", ",", "copy_permissions", "=", "False", ")", ":", "url", "=", "'{0}/{1}/copy'", ".", "format", "(", "DRIVE_FILES_API_V2_URL", ",", "file_id", ")", "payload", "=", "{", "'title'", ":", ...
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...
[ "Copies", "a", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L217-L286
train
Copies a spreadsheet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/client.py
Client.del_spreadsheet
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( DRIVE_FILES_API_V2_URL, file_id ) self.request('delete', url)
python
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( DRIVE_FILES_API_V2_URL, file_id ) self.request('delete', url)
[ "def", "del_spreadsheet", "(", "self", ",", "file_id", ")", ":", "url", "=", "'{0}/{1}'", ".", "format", "(", "DRIVE_FILES_API_V2_URL", ",", "file_id", ")", "self", ".", "request", "(", "'delete'", ",", "url", ")" ]
Deletes a spreadsheet. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str
[ "Deletes", "a", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L288-L299
train
Deletes a single spreadsheet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/client.py
Client.import_csv
def import_csv(self, file_id, data): """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(spreadsh...
python
def import_csv(self, file_id, data): """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(spreadsh...
[ "def", "import_csv", "(", "self", ",", "file_id", ",", "data", ")", ":", "headers", "=", "{", "'Content-Type'", ":", "'text/csv'", "}", "url", "=", "'{0}/{1}'", ".", "format", "(", "DRIVE_FILES_UPLOAD_API_V2_URL", ",", "file_id", ")", "self", ".", "request",...
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:: ...
[ "Imports", "data", "into", "the", "first", "page", "of", "the", "spreadsheet", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L301-L333
train
Imports data into the first page of the spreadsheet.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/client.py
Client.list_permissions
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 """ url = '{0}/{1}/permissions'.format(DRIVE_FILES_API_V2_URL, file_id) r = self.request('get', url) return r.j...
python
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 """ url = '{0}/{1}/permissions'.format(DRIVE_FILES_API_V2_URL, file_id) r = self.request('get', url) return r.j...
[ "def", "list_permissions", "(", "self", ",", "file_id", ")", ":", "url", "=", "'{0}/{1}/permissions'", ".", "format", "(", "DRIVE_FILES_API_V2_URL", ",", "file_id", ")", "r", "=", "self", ".", "request", "(", "'get'", ",", "url", ")", "return", "r", ".", ...
Retrieve a list of permissions for a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str
[ "Retrieve", "a", "list", "of", "permissions", "for", "a", "file", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L335-L345
train
Retrieve a list of permissions for a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/client.py
Client.insert_permission
def insert_permission( self, file_id, value, perm_type, role, notify=True, email_message=None, with_link=False ): """Creates a new permission for a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str ...
python
def insert_permission( self, file_id, value, perm_type, role, notify=True, email_message=None, with_link=False ): """Creates a new permission for a file. :param file_id: a spreadsheet ID (aka file ID.) :type file_id: str ...
[ "def", "insert_permission", "(", "self", ",", "file_id", ",", "value", ",", "perm_type", ",", "role", ",", "notify", "=", "True", ",", "email_message", "=", "None", ",", "with_link", "=", "False", ")", ":", "url", "=", "'{0}/{1}/permissions'", ".", "format...
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....
[ "Creates", "a", "new", "permission", "for", "a", "file", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L347-L421
train
Inserts a permission for a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
burnash/gspread
gspread/client.py
Client.remove_permission
def remove_permission(self, file_id, permission_id): """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 """ url = '{0}/{1}/permissions/{2...
python
def remove_permission(self, file_id, permission_id): """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 """ url = '{0}/{1}/permissions/{2...
[ "def", "remove_permission", "(", "self", ",", "file_id", ",", "permission_id", ")", ":", "url", "=", "'{0}/{1}/permissions/{2}'", ".", "format", "(", "DRIVE_FILES_API_V2_URL", ",", "file_id", ",", "permission_id", ")", "self", ".", "request", "(", "'delete'", ",...
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
[ "Deletes", "a", "permission", "from", "a", "file", "." ]
0e8debe208095aeed3e3e7136c2fa5cd74090946
https://github.com/burnash/gspread/blob/0e8debe208095aeed3e3e7136c2fa5cd74090946/gspread/client.py#L423-L437
train
Deletes a permission from a file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/utils.py
tau_rand_int
def tau_rand_int(state): """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 """ state[0] = (((state[0] & 4294967294) << 12) & 0xffffffff) ^ ( ...
python
def tau_rand_int(state): """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 """ state[0] = (((state[0] & 4294967294) << 12) & 0xffffffff) ^ ( ...
[ "def", "tau_rand_int", "(", "state", ")", ":", "state", "[", "0", "]", "=", "(", "(", "(", "state", "[", "0", "]", "&", "4294967294", ")", "<<", "12", ")", "&", "0xffffffff", ")", "^", "(", "(", "(", "(", "state", "[", "0", "]", "<<", "13", ...
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
[ "A", "fast", "(", "pseudo", ")", "-", "random", "number", "generator", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L12-L34
train
A fast ( pseudo - ) random number generator.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/utils.py
norm
def norm(vec): """Compute the (standard l2) norm of a vector. Parameters ---------- vec: array of shape (dim,) Returns ------- The l2 norm of vec. """ result = 0.0 for i in range(vec.shape[0]): result += vec[i] ** 2 return np.sqrt(result)
python
def norm(vec): """Compute the (standard l2) norm of a vector. Parameters ---------- vec: array of shape (dim,) Returns ------- The l2 norm of vec. """ result = 0.0 for i in range(vec.shape[0]): result += vec[i] ** 2 return np.sqrt(result)
[ "def", "norm", "(", "vec", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "vec", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "vec", "[", "i", "]", "**", "2", "return", "np", ".", "sqrt", "(", "result", ")" ]
Compute the (standard l2) norm of a vector. Parameters ---------- vec: array of shape (dim,) Returns ------- The l2 norm of vec.
[ "Compute", "the", "(", "standard", "l2", ")", "norm", "of", "a", "vector", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L55-L69
train
Compute the standard l2 norm of a vector.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/utils.py
rejection_sample
def rejection_sample(n_samples, pool_size, rng_state): """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 sele...
python
def rejection_sample(n_samples, pool_size, rng_state): """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 sele...
[ "def", "rejection_sample", "(", "n_samples", ",", "pool_size", ",", "rng_state", ")", ":", "result", "=", "np", ".", "empty", "(", "n_samples", ",", "dtype", "=", "np", ".", "int64", ")", "for", "i", "in", "range", "(", "n_samples", ")", ":", "reject_s...
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...
[ "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", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L73-L105
train
Generate n_samples many integers from 0 to pool_size such that no noCOOKIE integer is selected twice.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/utils.py
make_heap
def make_heap(n_points, size): """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 sto...
python
def make_heap(n_points, size): """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 sto...
[ "def", "make_heap", "(", "n_points", ",", "size", ")", ":", "result", "=", "np", ".", "zeros", "(", "(", "3", ",", "int", "(", "n_points", ")", ",", "int", "(", "size", ")", ")", ",", "dtype", "=", "np", ".", "float64", ")", "result", "[", "0",...
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...
[ "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", ".", ...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L109-L136
train
This is a helper function that creates a numba enabled heap object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/utils.py
siftdown
def siftdown(heap1, heap2, elt): """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.""" while elt * 2 + 1 < heap1.shape[0]: left_child = elt * 2 + 1 ...
python
def siftdown(heap1, heap2, elt): """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.""" while elt * 2 + 1 < heap1.shape[0]: left_child = elt * 2 + 1 ...
[ "def", "siftdown", "(", "heap1", ",", "heap2", ",", "elt", ")", ":", "while", "elt", "*", "2", "+", "1", "<", "heap1", ".", "shape", "[", "0", "]", ":", "left_child", "=", "elt", "*", "2", "+", "1", "right_child", "=", "left_child", "+", "1", "...
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.
[ "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", "...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L302-L322
train
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.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/utils.py
deheap_sort
def deheap_sort(heap): """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...
python
def deheap_sort(heap): """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...
[ "def", "deheap_sort", "(", "heap", ")", ":", "indices", "=", "heap", "[", "0", "]", "weights", "=", "heap", "[", "1", "]", "for", "i", "in", "range", "(", "indices", ".", "shape", "[", "0", "]", ")", ":", "ind_heap", "=", "indices", "[", "i", "...
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 -------...
[ "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",...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L326-L366
train
This function takes an array of heaps of indices and weights and sorts them into a single list of indices and weights.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/utils.py
smallest_flagged
def smallest_flagged(heap, row): """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 T...
python
def smallest_flagged(heap, row): """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 T...
[ "def", "smallest_flagged", "(", "heap", ",", "row", ")", ":", "ind", "=", "heap", "[", "0", ",", "row", "]", "dist", "=", "heap", "[", "1", ",", "row", "]", "flag", "=", "heap", "[", "2", ",", "row", "]", "min_dist", "=", "np", ".", "inf", "r...
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...
[ "Search", "the", "heap", "for", "the", "smallest", "element", "that", "is", "still", "flagged", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L370-L405
train
Search the heap for the smallest flagged element that is in the row.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/utils.py
build_candidates
def build_candidates(current_graph, n_vertices, n_neighbors, max_candidates, rng_state): """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. Param...
python
def build_candidates(current_graph, n_vertices, n_neighbors, max_candidates, rng_state): """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. Param...
[ "def", "build_candidates", "(", "current_graph", ",", "n_vertices", ",", "n_neighbors", ",", "max_candidates", ",", "rng_state", ")", ":", "candidate_neighbors", "=", "make_heap", "(", "n_vertices", ",", "max_candidates", ")", "for", "i", "in", "range", "(", "n_...
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",...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L409-L448
train
Builds a heap of candidate neighbors for nearest neighbor descent.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/utils.py
new_build_candidates
def new_build_candidates( current_graph, n_vertices, n_neighbors, max_candidates, rng_state, rho=0.5 ): # pragma: no cover """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...
python
def new_build_candidates( current_graph, n_vertices, n_neighbors, max_candidates, rng_state, rho=0.5 ): # pragma: no cover """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...
[ "def", "new_build_candidates", "(", "current_graph", ",", "n_vertices", ",", "n_neighbors", ",", "max_candidates", ",", "rng_state", ",", "rho", "=", "0.5", ")", ":", "# pragma: no cover", "new_candidate_neighbors", "=", "make_heap", "(", "n_vertices", ",", "max_can...
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",...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L452-L503
train
Builds a heap of candidate neighbors for nearest neighbor descent.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/utils.py
submatrix
def submatrix(dmat, indices_col, n_neighbors): """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 consist...
python
def submatrix(dmat, indices_col, n_neighbors): """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 consist...
[ "def", "submatrix", "(", "dmat", ",", "indices_col", ",", "n_neighbors", ")", ":", "n_samples_transform", ",", "n_samples_fit", "=", "dmat", ".", "shape", "submat", "=", "np", ".", "zeros", "(", "(", "n_samples_transform", ",", "n_neighbors", ")", ",", "dtyp...
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...
[ "Return", "a", "submatrix", "given", "an", "orginal", "matrix", "and", "the", "indices", "to", "keep", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/utils.py#L507-L531
train
Return a submatrix given an orginal matrix and the indices to keep.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/distances.py
euclidean
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(result)
python
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(result)
[ "def", "euclidean", "(", "x", ",", "y", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "(", "x", "[", "i", "]", "-", "y", "[", "i", "]", ")", "**", "2", "return"...
Standard euclidean distance. ..math:: D(x, y) = \sqrt{\sum_i (x_i - y_i)^2}
[ "Standard", "euclidean", "distance", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/distances.py#L12-L21
train
Standard euclidean distance.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/distances.py
standardised_euclidean
def standardised_euclidean(x, y, sigma=_mock_ones): """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}} """ result = 0.0 for i in range(x.shape[0]): result += ((x[i] - y[i]) ** 2) ...
python
def standardised_euclidean(x, y, sigma=_mock_ones): """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}} """ result = 0.0 for i in range(x.shape[0]): result += ((x[i] - y[i]) ** 2) ...
[ "def", "standardised_euclidean", "(", "x", ",", "y", ",", "sigma", "=", "_mock_ones", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "(", "(", "x", "[", "i", "]", "-",...
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}}
[ "Euclidean", "distance", "standardised", "against", "a", "vector", "of", "standard", "deviations", "per", "coordinate", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/distances.py#L25-L36
train
Euclidean distance standardised against a vector of standardised deviations per coordinate.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/distances.py
manhattan
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
python
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
[ "def", "manhattan", "(", "x", ",", "y", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "np", ".", "abs", "(", "x", "[", "i", "]", "-", "y", "[", "i", "]", ")", ...
Manhatten, taxicab, or l1 distance. ..math:: D(x, y) = \sum_i |x_i - y_i|
[ "Manhatten", "taxicab", "or", "l1", "distance", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/distances.py#L40-L50
train
Manhatten taxicab or l1 distance.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/distances.py
chebyshev
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 result
python
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 result
[ "def", "chebyshev", "(", "x", ",", "y", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "=", "max", "(", "result", ",", "np", ".", "abs", "(", "x", "[", "i", "]", "-", ...
Chebyshev or l-infinity distance. ..math:: D(x, y) = \max_i |x_i - y_i|
[ "Chebyshev", "or", "l", "-", "infinity", "distance", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/distances.py#L54-L64
train
Chebyshev or l - infinity distance.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/distances.py
minkowski
def minkowski(x, y, p=2): """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 be...
python
def minkowski(x, y, p=2): """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 be...
[ "def", "minkowski", "(", "x", ",", "y", ",", "p", "=", "2", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "(", "np", ".", "abs", "(", "x", "[", "i", "]", "-", ...
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...
[ "Minkowski", "distance", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/distances.py#L68-L83
train
Minkowski distance.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/nndescent.py
make_nn_descent
def make_nn_descent(dist, dist_args): """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. ...
python
def make_nn_descent(dist, dist_args): """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. ...
[ "def", "make_nn_descent", "(", "dist", ",", "dist_args", ")", ":", "@", "numba", ".", "njit", "(", "parallel", "=", "True", ")", "def", "nn_descent", "(", "data", ",", "n_neighbors", ",", "rng_state", ",", "max_candidates", "=", "50", ",", "n_iters", "="...
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...
[ "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", ...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/nndescent.py#L24-L119
train
Create a numba accelerated version of nearest neighbor descent for a given distance metric and metric arguments.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/spectral.py
component_layout
def component_layout( data, n_components, component_labels, dim, metric="euclidean", metric_kwds={} ): """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 ----...
python
def component_layout( data, n_components, component_labels, dim, metric="euclidean", metric_kwds={} ): """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 ----...
[ "def", "component_layout", "(", "data", ",", "n_components", ",", "component_labels", ",", "dim", ",", "metric", "=", "\"euclidean\"", ",", "metric_kwds", "=", "{", "}", ")", ":", "component_centroids", "=", "np", ".", "empty", "(", "(", "n_components", ",",...
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...
[ "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", "....
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/spectral.py#L11-L62
train
This function takes a set of data points and returns a spectral embedding of the components.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/spectral.py
multi_component_layout
def multi_component_layout( data, graph, n_components, component_labels, dim, random_state, metric="euclidean", metric_kwds={}, ): """Specialised layout algorithm for dealing with graphs with many connected components. This will first fid relative positions for the components by ...
python
def multi_component_layout( data, graph, n_components, component_labels, dim, random_state, metric="euclidean", metric_kwds={}, ): """Specialised layout algorithm for dealing with graphs with many connected components. This will first fid relative positions for the components by ...
[ "def", "multi_component_layout", "(", "data", ",", "graph", ",", "n_components", ",", "component_labels", ",", "dim", ",", "random_state", ",", "metric", "=", "\"euclidean\"", ",", "metric_kwds", "=", "{", "}", ",", ")", ":", "result", "=", "np", ".", "emp...
Specialised layout algorithm for dealing with graphs with many connected components. This will first fid relative positions for the components by spectrally embedding their centroids, then spectrally embed each individual connected component positioning them according to the centroid embeddings. This provid...
[ "Specialised", "layout", "algorithm", "for", "dealing", "with", "graphs", "with", "many", "connected", "components", ".", "This", "will", "first", "fid", "relative", "positions", "for", "the", "components", "by", "spectrally", "embedding", "their", "centroids", "t...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/spectral.py#L65-L196
train
This function is used to generate a multi - component embedding for a single connected component. This is a specialised algorithm for dealing with graphs with many connected components.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/spectral.py
spectral_layout
def spectral_layout(data, graph, dim, random_state, metric="euclidean", metric_kwds={}): """Given a graph compute the spectral embedding of the graph. This is simply the eigenvectors of the laplacian of the graph. Here we use the normalized laplacian. Parameters ---------- data: array of shape ...
python
def spectral_layout(data, graph, dim, random_state, metric="euclidean", metric_kwds={}): """Given a graph compute the spectral embedding of the graph. This is simply the eigenvectors of the laplacian of the graph. Here we use the normalized laplacian. Parameters ---------- data: array of shape ...
[ "def", "spectral_layout", "(", "data", ",", "graph", ",", "dim", ",", "random_state", ",", "metric", "=", "\"euclidean\"", ",", "metric_kwds", "=", "{", "}", ")", ":", "n_samples", "=", "graph", ".", "shape", "[", "0", "]", "n_components", ",", "labels",...
Given a graph compute the spectral embedding of the graph. This is simply the eigenvectors of the laplacian of the graph. Here we use the normalized laplacian. Parameters ---------- data: array of shape (n_samples, n_features) The source data graph: sparse matrix The (weighted)...
[ "Given", "a", "graph", "compute", "the", "spectral", "embedding", "of", "the", "graph", ".", "This", "is", "simply", "the", "eigenvectors", "of", "the", "laplacian", "of", "the", "graph", ".", "Here", "we", "use", "the", "normalized", "laplacian", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/spectral.py#L199-L283
train
Compute the spectral embedding of a graph.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/rp_tree.py
sparse_angular_random_projection_split
def sparse_angular_random_projection_split(inds, indptr, data, indices, rng_state): """Given a set of ``indices`` for data points from a sparse data set presented in csr sparse format as inds, indptr and data, create a random hyperplane to split the data, returning two arrays indices that fall on either...
python
def sparse_angular_random_projection_split(inds, indptr, data, indices, rng_state): """Given a set of ``indices`` for data points from a sparse data set presented in csr sparse format as inds, indptr and data, create a random hyperplane to split the data, returning two arrays indices that fall on either...
[ "def", "sparse_angular_random_projection_split", "(", "inds", ",", "indptr", ",", "data", ",", "indices", ",", "rng_state", ")", ":", "# Select two random points, set the hyperplane between them", "left_index", "=", "tau_rand_int", "(", "rng_state", ")", "%", "indices", ...
Given a set of ``indices`` for data points from a sparse data set presented in csr sparse format as inds, indptr and data, create a random hyperplane to split the data, returning two arrays indices that fall on either side of the hyperplane. This is the basis for a random projection tree, which simply u...
[ "Given", "a", "set", "of", "indices", "for", "data", "points", "from", "a", "sparse", "data", "set", "presented", "in", "csr", "sparse", "format", "as", "inds", "indptr", "and", "data", "create", "a", "random", "hyperplane", "to", "split", "the", "data", ...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/rp_tree.py#L224-L338
train
Given a set of indices for data points from a csr sparse format as inds indptr and data return two arrays indices_left and indices_right.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/rp_tree.py
sparse_euclidean_random_projection_split
def sparse_euclidean_random_projection_split(inds, indptr, data, indices, rng_state): """Given a set of ``indices`` for data points from a sparse data set presented in csr sparse format as inds, indptr and data, create a random hyperplane to split the data, returning two arrays indices that fall on eith...
python
def sparse_euclidean_random_projection_split(inds, indptr, data, indices, rng_state): """Given a set of ``indices`` for data points from a sparse data set presented in csr sparse format as inds, indptr and data, create a random hyperplane to split the data, returning two arrays indices that fall on eith...
[ "def", "sparse_euclidean_random_projection_split", "(", "inds", ",", "indptr", ",", "data", ",", "indices", ",", "rng_state", ")", ":", "# Select two random points, set the hyperplane between them", "left_index", "=", "tau_rand_int", "(", "rng_state", ")", "%", "indices",...
Given a set of ``indices`` for data points from a sparse data set presented in csr sparse format as inds, indptr and data, create a random hyperplane to split the data, returning two arrays indices that fall on either side of the hyperplane. This is the basis for a random projection tree, which simply u...
[ "Given", "a", "set", "of", "indices", "for", "data", "points", "from", "a", "sparse", "data", "set", "presented", "in", "csr", "sparse", "format", "as", "inds", "indptr", "and", "data", "create", "a", "random", "hyperplane", "to", "split", "the", "data", ...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/rp_tree.py#L342-L447
train
This function splits a set of data points from a sparse data set and returns two arrays indices_left and indices_right.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/rp_tree.py
make_tree
def make_tree(data, rng_state, leaf_size=30, angular=False): """Construct a random projection tree based on ``data`` with leaves of size at most ``leaf_size``. Parameters ---------- data: array of shape (n_samples, n_features) The original data to be split rng_state: array of int64, shap...
python
def make_tree(data, rng_state, leaf_size=30, angular=False): """Construct a random projection tree based on ``data`` with leaves of size at most ``leaf_size``. Parameters ---------- data: array of shape (n_samples, n_features) The original data to be split rng_state: array of int64, shap...
[ "def", "make_tree", "(", "data", ",", "rng_state", ",", "leaf_size", "=", "30", ",", "angular", "=", "False", ")", ":", "is_sparse", "=", "scipy", ".", "sparse", ".", "isspmatrix_csr", "(", "data", ")", "indices", "=", "np", ".", "arange", "(", "data",...
Construct a random projection tree based on ``data`` with leaves of size at most ``leaf_size``. Parameters ---------- data: array of shape (n_samples, n_features) The original data to be split rng_state: array of int64, shape (3,) The internal state of the rng leaf_size: int (opt...
[ "Construct", "a", "random", "projection", "tree", "based", "on", "data", "with", "leaves", "of", "size", "at", "most", "leaf_size", ".", "Parameters", "----------", "data", ":", "array", "of", "shape", "(", "n_samples", "n_features", ")", "The", "original", ...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/rp_tree.py#L534-L577
train
Construct a random projection tree based on data with leaves at most leaf_size.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/rp_tree.py
num_nodes
def num_nodes(tree): """Determine the number of nodes in a tree""" if tree.is_leaf: return 1 else: return 1 + num_nodes(tree.left_child) + num_nodes(tree.right_child)
python
def num_nodes(tree): """Determine the number of nodes in a tree""" if tree.is_leaf: return 1 else: return 1 + num_nodes(tree.left_child) + num_nodes(tree.right_child)
[ "def", "num_nodes", "(", "tree", ")", ":", "if", "tree", ".", "is_leaf", ":", "return", "1", "else", ":", "return", "1", "+", "num_nodes", "(", "tree", ".", "left_child", ")", "+", "num_nodes", "(", "tree", ".", "right_child", ")" ]
Determine the number of nodes in a tree
[ "Determine", "the", "number", "of", "nodes", "in", "a", "tree" ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/rp_tree.py#L580-L585
train
Determine the number of nodes in a tree
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/rp_tree.py
num_leaves
def num_leaves(tree): """Determine the number of leaves in a tree""" if tree.is_leaf: return 1 else: return num_leaves(tree.left_child) + num_leaves(tree.right_child)
python
def num_leaves(tree): """Determine the number of leaves in a tree""" if tree.is_leaf: return 1 else: return num_leaves(tree.left_child) + num_leaves(tree.right_child)
[ "def", "num_leaves", "(", "tree", ")", ":", "if", "tree", ".", "is_leaf", ":", "return", "1", "else", ":", "return", "num_leaves", "(", "tree", ".", "left_child", ")", "+", "num_leaves", "(", "tree", ".", "right_child", ")" ]
Determine the number of leaves in a tree
[ "Determine", "the", "number", "of", "leaves", "in", "a", "tree" ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/rp_tree.py#L588-L593
train
Determine the number of leaves in a tree
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/rp_tree.py
max_sparse_hyperplane_size
def max_sparse_hyperplane_size(tree): """Determine the most number on non zeros in a hyperplane entry""" if tree.is_leaf: return 0 else: return max( tree.hyperplane.shape[1], max_sparse_hyperplane_size(tree.left_child), max_sparse_hyperplane_size(tree.righ...
python
def max_sparse_hyperplane_size(tree): """Determine the most number on non zeros in a hyperplane entry""" if tree.is_leaf: return 0 else: return max( tree.hyperplane.shape[1], max_sparse_hyperplane_size(tree.left_child), max_sparse_hyperplane_size(tree.righ...
[ "def", "max_sparse_hyperplane_size", "(", "tree", ")", ":", "if", "tree", ".", "is_leaf", ":", "return", "0", "else", ":", "return", "max", "(", "tree", ".", "hyperplane", ".", "shape", "[", "1", "]", ",", "max_sparse_hyperplane_size", "(", "tree", ".", ...
Determine the most number on non zeros in a hyperplane entry
[ "Determine", "the", "most", "number", "on", "non", "zeros", "in", "a", "hyperplane", "entry" ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/rp_tree.py#L596-L605
train
Determine the maximum number of non zeros in a hyperplane entry
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/rp_tree.py
make_forest
def make_forest(data, n_neighbors, n_trees, rng_state, angular=False): """Build a random projection forest with ``n_trees``. Parameters ---------- data n_neighbors n_trees rng_state angular Returns ------- forest: list A list of random projection trees. """ ...
python
def make_forest(data, n_neighbors, n_trees, rng_state, angular=False): """Build a random projection forest with ``n_trees``. Parameters ---------- data n_neighbors n_trees rng_state angular Returns ------- forest: list A list of random projection trees. """ ...
[ "def", "make_forest", "(", "data", ",", "n_neighbors", ",", "n_trees", ",", "rng_state", ",", "angular", "=", "False", ")", ":", "result", "=", "[", "]", "leaf_size", "=", "max", "(", "10", ",", "n_neighbors", ")", "try", ":", "result", "=", "[", "fl...
Build a random projection forest with ``n_trees``. Parameters ---------- data n_neighbors n_trees rng_state angular Returns ------- forest: list A list of random projection trees.
[ "Build", "a", "random", "projection", "forest", "with", "n_trees", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/rp_tree.py#L698-L728
train
Build a random projection forest with n_trees.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/rp_tree.py
rptree_leaf_array
def rptree_leaf_array(rp_forest): """Generate an array of sets of candidate nearest neighbors by constructing a random projection forest and taking the leaves of all the trees. Any given tree has leaves that are a set of potential nearest neighbors. Given enough trees the set of all such leaves gives a ...
python
def rptree_leaf_array(rp_forest): """Generate an array of sets of candidate nearest neighbors by constructing a random projection forest and taking the leaves of all the trees. Any given tree has leaves that are a set of potential nearest neighbors. Given enough trees the set of all such leaves gives a ...
[ "def", "rptree_leaf_array", "(", "rp_forest", ")", ":", "if", "len", "(", "rp_forest", ")", ">", "0", ":", "leaf_array", "=", "np", ".", "vstack", "(", "[", "tree", ".", "indices", "for", "tree", "in", "rp_forest", "]", ")", "else", ":", "leaf_array", ...
Generate an array of sets of candidate nearest neighbors by constructing a random projection forest and taking the leaves of all the trees. Any given tree has leaves that are a set of potential nearest neighbors. Given enough trees the set of all such leaves gives a good likelihood of getting a good set...
[ "Generate", "an", "array", "of", "sets", "of", "candidate", "nearest", "neighbors", "by", "constructing", "a", "random", "projection", "forest", "and", "taking", "the", "leaves", "of", "all", "the", "trees", ".", "Any", "given", "tree", "has", "leaves", "tha...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/rp_tree.py#L731-L764
train
Generates an array of indices for each leaf of a random projection tree.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
smooth_knn_dist
def smooth_knn_dist(distances, k, n_iter=64, local_connectivity=1.0, bandwidth=1.0): """Compute a continuous version of the distance to the kth nearest neighbor. That is, this is similar to knn-distance but allows continuous k values rather than requiring an integral k. In esscence we are simply computi...
python
def smooth_knn_dist(distances, k, n_iter=64, local_connectivity=1.0, bandwidth=1.0): """Compute a continuous version of the distance to the kth nearest neighbor. That is, this is similar to knn-distance but allows continuous k values rather than requiring an integral k. In esscence we are simply computi...
[ "def", "smooth_knn_dist", "(", "distances", ",", "k", ",", "n_iter", "=", "64", ",", "local_connectivity", "=", "1.0", ",", "bandwidth", "=", "1.0", ")", ":", "target", "=", "np", ".", "log2", "(", "k", ")", "*", "bandwidth", "rho", "=", "np", ".", ...
Compute a continuous version of the distance to the kth nearest neighbor. That is, this is similar to knn-distance but allows continuous k values rather than requiring an integral k. In esscence we are simply computing the distance such that the cardinality of fuzzy set we generate is k. Parameters...
[ "Compute", "a", "continuous", "version", "of", "the", "distance", "to", "the", "kth", "nearest", "neighbor", ".", "That", "is", "this", "is", "similar", "to", "knn", "-", "distance", "but", "allows", "continuous", "k", "values", "rather", "than", "requiring"...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L49-L146
train
This function is used to compute a continuous version of the distance to the kth nearest neighbor neighbor. This is similar to the knn - distance but allows continuous version of the distance to the kth nearest neighbor neighbor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
nearest_neighbors
def nearest_neighbors( X, n_neighbors, metric, metric_kwds, angular, random_state, verbose=False ): """Compute the ``n_neighbors`` nearest points for each data point in ``X`` under ``metric``. This may be exact, but more likely is approximated via nearest neighbor descent. Parameters ----------...
python
def nearest_neighbors( X, n_neighbors, metric, metric_kwds, angular, random_state, verbose=False ): """Compute the ``n_neighbors`` nearest points for each data point in ``X`` under ``metric``. This may be exact, but more likely is approximated via nearest neighbor descent. Parameters ----------...
[ "def", "nearest_neighbors", "(", "X", ",", "n_neighbors", ",", "metric", ",", "metric_kwds", ",", "angular", ",", "random_state", ",", "verbose", "=", "False", ")", ":", "if", "verbose", ":", "print", "(", "ts", "(", ")", ",", "\"Finding Nearest Neighbors\""...
Compute the ``n_neighbors`` nearest points for each data point in ``X`` under ``metric``. This may be exact, but more likely is approximated via nearest neighbor descent. Parameters ---------- X: array of shape (n_samples, n_features) The input data to compute the k-neighbor graph of. ...
[ "Compute", "the", "n_neighbors", "nearest", "points", "for", "each", "data", "point", "in", "X", "under", "metric", ".", "This", "may", "be", "exact", "but", "more", "likely", "is", "approximated", "via", "nearest", "neighbor", "descent", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L149-L282
train
Compute the n_neighbors nearest points for each data point in X under the specified metric.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
compute_membership_strengths
def compute_membership_strengths(knn_indices, knn_dists, sigmas, rhos): """Construct the membership strength data for the 1-skeleton of each local fuzzy simplicial set -- this is formed as a sparse matrix where each row is a local fuzzy simplicial set, with a membership strength for the 1-simplex to eac...
python
def compute_membership_strengths(knn_indices, knn_dists, sigmas, rhos): """Construct the membership strength data for the 1-skeleton of each local fuzzy simplicial set -- this is formed as a sparse matrix where each row is a local fuzzy simplicial set, with a membership strength for the 1-simplex to eac...
[ "def", "compute_membership_strengths", "(", "knn_indices", ",", "knn_dists", ",", "sigmas", ",", "rhos", ")", ":", "n_samples", "=", "knn_indices", ".", "shape", "[", "0", "]", "n_neighbors", "=", "knn_indices", ".", "shape", "[", "1", "]", "rows", "=", "n...
Construct the membership strength data for the 1-skeleton of each local fuzzy simplicial set -- this is formed as a sparse matrix where each row is a local fuzzy simplicial set, with a membership strength for the 1-simplex to each other data point. Parameters ---------- knn_indices: array of sh...
[ "Construct", "the", "membership", "strength", "data", "for", "the", "1", "-", "skeleton", "of", "each", "local", "fuzzy", "simplicial", "set", "--", "this", "is", "formed", "as", "a", "sparse", "matrix", "where", "each", "row", "is", "a", "local", "fuzzy",...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L286-L339
train
Compute the membership strength data for the local fuzzy simplicial set.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
fuzzy_simplicial_set
def fuzzy_simplicial_set( X, n_neighbors, random_state, metric, metric_kwds={}, knn_indices=None, knn_dists=None, angular=False, set_op_mix_ratio=1.0, local_connectivity=1.0, verbose=False, ): """Given a set of data X, a neighborhood size, and a measure of distance co...
python
def fuzzy_simplicial_set( X, n_neighbors, random_state, metric, metric_kwds={}, knn_indices=None, knn_dists=None, angular=False, set_op_mix_ratio=1.0, local_connectivity=1.0, verbose=False, ): """Given a set of data X, a neighborhood size, and a measure of distance co...
[ "def", "fuzzy_simplicial_set", "(", "X", ",", "n_neighbors", ",", "random_state", ",", "metric", ",", "metric_kwds", "=", "{", "}", ",", "knn_indices", "=", "None", ",", "knn_dists", "=", "None", ",", "angular", "=", "False", ",", "set_op_mix_ratio", "=", ...
Given a set of data X, a neighborhood size, and a measure of distance compute the fuzzy simplicial set (here represented as a fuzzy graph in the form of a sparse matrix) associated to the data. This is done by locally approximating geodesic distance at each point, creating a fuzzy simplicial set for eac...
[ "Given", "a", "set", "of", "data", "X", "a", "neighborhood", "size", "and", "a", "measure", "of", "distance", "compute", "the", "fuzzy", "simplicial", "set", "(", "here", "represented", "as", "a", "fuzzy", "graph", "in", "the", "form", "of", "a", "sparse...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L343-L488
train
This function computes the fuzzy simplicial set for a set of data X.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
fast_intersection
def fast_intersection(rows, cols, values, target, unknown_dist=1.0, far_dist=5.0): """Under the assumption of categorical distance for the intersecting simplicial set perform a fast intersection. Parameters ---------- rows: array An array of the row of each non-zero in the sparse matrix ...
python
def fast_intersection(rows, cols, values, target, unknown_dist=1.0, far_dist=5.0): """Under the assumption of categorical distance for the intersecting simplicial set perform a fast intersection. Parameters ---------- rows: array An array of the row of each non-zero in the sparse matrix ...
[ "def", "fast_intersection", "(", "rows", ",", "cols", ",", "values", ",", "target", ",", "unknown_dist", "=", "1.0", ",", "far_dist", "=", "5.0", ")", ":", "for", "nz", "in", "range", "(", "rows", ".", "shape", "[", "0", "]", ")", ":", "i", "=", ...
Under the assumption of categorical distance for the intersecting simplicial set perform a fast intersection. Parameters ---------- rows: array An array of the row of each non-zero in the sparse matrix representation. cols: array An array of the column of each non-zero in t...
[ "Under", "the", "assumption", "of", "categorical", "distance", "for", "the", "intersecting", "simplicial", "set", "perform", "a", "fast", "intersection", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L492-L531
train
Perform a fast intersection of two sets of categorical labels.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
reset_local_connectivity
def reset_local_connectivity(simplicial_set): """Reset the local connectivity requirement -- each data sample should have complete confidence in at least one 1-simplex in the simplicial set. We can enforce this by locally rescaling confidences, and then remerging the different local simplicial sets toge...
python
def reset_local_connectivity(simplicial_set): """Reset the local connectivity requirement -- each data sample should have complete confidence in at least one 1-simplex in the simplicial set. We can enforce this by locally rescaling confidences, and then remerging the different local simplicial sets toge...
[ "def", "reset_local_connectivity", "(", "simplicial_set", ")", ":", "simplicial_set", "=", "normalize", "(", "simplicial_set", ",", "norm", "=", "\"max\"", ")", "transpose", "=", "simplicial_set", ".", "transpose", "(", ")", "prod_matrix", "=", "simplicial_set", "...
Reset the local connectivity requirement -- each data sample should have complete confidence in at least one 1-simplex in the simplicial set. We can enforce this by locally rescaling confidences, and then remerging the different local simplicial sets together. Parameters ---------- simplicial_s...
[ "Reset", "the", "local", "connectivity", "requirement", "--", "each", "data", "sample", "should", "have", "complete", "confidence", "in", "at", "least", "one", "1", "-", "simplex", "in", "the", "simplicial", "set", ".", "We", "can", "enforce", "this", "by", ...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L535-L559
train
Resets the local connectivity requirement for each data sample to the initial value of 1.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
categorical_simplicial_set_intersection
def categorical_simplicial_set_intersection( simplicial_set, target, unknown_dist=1.0, far_dist=5.0 ): """Combine a fuzzy simplicial set with another fuzzy simplicial set generated from categorical data using categorical distances. The target data is assumed to be categorical label data (a vector of lab...
python
def categorical_simplicial_set_intersection( simplicial_set, target, unknown_dist=1.0, far_dist=5.0 ): """Combine a fuzzy simplicial set with another fuzzy simplicial set generated from categorical data using categorical distances. The target data is assumed to be categorical label data (a vector of lab...
[ "def", "categorical_simplicial_set_intersection", "(", "simplicial_set", ",", "target", ",", "unknown_dist", "=", "1.0", ",", "far_dist", "=", "5.0", ")", ":", "simplicial_set", "=", "simplicial_set", ".", "tocoo", "(", ")", "fast_intersection", "(", "simplicial_set...
Combine a fuzzy simplicial set with another fuzzy simplicial set generated from categorical data using categorical distances. The target data is assumed to be categorical label data (a vector of labels), and this will update the fuzzy simplicial set to respect that label data. TODO: optional category c...
[ "Combine", "a", "fuzzy", "simplicial", "set", "with", "another", "fuzzy", "simplicial", "set", "generated", "from", "categorical", "data", "using", "categorical", "distances", ".", "The", "target", "data", "is", "assumed", "to", "be", "categorical", "label", "da...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L563-L605
train
Combine a fuzzy simplicial set with another categorical set.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
make_epochs_per_sample
def make_epochs_per_sample(weights, n_epochs): """Given a set of weights and number of epochs generate the number of epochs per sample for each weight. Parameters ---------- weights: array of shape (n_1_simplices) The weights ofhow much we wish to sample each 1-simplex. n_epochs: int ...
python
def make_epochs_per_sample(weights, n_epochs): """Given a set of weights and number of epochs generate the number of epochs per sample for each weight. Parameters ---------- weights: array of shape (n_1_simplices) The weights ofhow much we wish to sample each 1-simplex. n_epochs: int ...
[ "def", "make_epochs_per_sample", "(", "weights", ",", "n_epochs", ")", ":", "result", "=", "-", "1.0", "*", "np", ".", "ones", "(", "weights", ".", "shape", "[", "0", "]", ",", "dtype", "=", "np", ".", "float64", ")", "n_samples", "=", "n_epochs", "*...
Given a set of weights and number of epochs generate the number of epochs per sample for each weight. Parameters ---------- weights: array of shape (n_1_simplices) The weights ofhow much we wish to sample each 1-simplex. n_epochs: int The total number of epochs we want to train for...
[ "Given", "a", "set", "of", "weights", "and", "number", "of", "epochs", "generate", "the", "number", "of", "epochs", "per", "sample", "for", "each", "weight", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L632-L651
train
Generates the number of epochs per sample for each weight.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
rdist
def rdist(x, y): """Reduced Euclidean distance. Parameters ---------- x: array of shape (embedding_dim,) y: array of shape (embedding_dim,) Returns ------- The squared euclidean distance between x and y """ result = 0.0 for i in range(x.shape[0]): result += (x[i] - ...
python
def rdist(x, y): """Reduced Euclidean distance. Parameters ---------- x: array of shape (embedding_dim,) y: array of shape (embedding_dim,) Returns ------- The squared euclidean distance between x and y """ result = 0.0 for i in range(x.shape[0]): result += (x[i] - ...
[ "def", "rdist", "(", "x", ",", "y", ")", ":", "result", "=", "0.0", "for", "i", "in", "range", "(", "x", ".", "shape", "[", "0", "]", ")", ":", "result", "+=", "(", "x", "[", "i", "]", "-", "y", "[", "i", "]", ")", "**", "2", "return", ...
Reduced Euclidean distance. Parameters ---------- x: array of shape (embedding_dim,) y: array of shape (embedding_dim,) Returns ------- The squared euclidean distance between x and y
[ "Reduced", "Euclidean", "distance", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L677-L693
train
Reduced Euclidean distance.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
optimize_layout
def optimize_layout( head_embedding, tail_embedding, head, tail, n_epochs, n_vertices, epochs_per_sample, a, b, rng_state, gamma=1.0, initial_alpha=1.0, negative_sample_rate=5.0, verbose=False, ): """Improve an embedding using stochastic gradient descent to mi...
python
def optimize_layout( head_embedding, tail_embedding, head, tail, n_epochs, n_vertices, epochs_per_sample, a, b, rng_state, gamma=1.0, initial_alpha=1.0, negative_sample_rate=5.0, verbose=False, ): """Improve an embedding using stochastic gradient descent to mi...
[ "def", "optimize_layout", "(", "head_embedding", ",", "tail_embedding", ",", "head", ",", "tail", ",", "n_epochs", ",", "n_vertices", ",", "epochs_per_sample", ",", "a", ",", "b", ",", "rng_state", ",", "gamma", "=", "1.0", ",", "initial_alpha", "=", "1.0", ...
Improve an embedding using stochastic gradient descent to minimize the fuzzy set cross entropy between the 1-skeletons of the high dimensional and low dimensional fuzzy simplicial sets. In practice this is done by sampling edges based on their membership strength (with the (1-p) terms coming from negati...
[ "Improve", "an", "embedding", "using", "stochastic", "gradient", "descent", "to", "minimize", "the", "fuzzy", "set", "cross", "entropy", "between", "the", "1", "-", "skeletons", "of", "the", "high", "dimensional", "and", "low", "dimensional", "fuzzy", "simplicia...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L697-L844
train
Improve an embedding using stochastic gradient descent to minimize the fuzzy set cross entropy between the two words.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
simplicial_set_embedding
def simplicial_set_embedding( data, graph, n_components, initial_alpha, a, b, gamma, negative_sample_rate, n_epochs, init, random_state, metric, metric_kwds, verbose, ): """Perform a fuzzy simplicial set embedding, using a specified initialisation method a...
python
def simplicial_set_embedding( data, graph, n_components, initial_alpha, a, b, gamma, negative_sample_rate, n_epochs, init, random_state, metric, metric_kwds, verbose, ): """Perform a fuzzy simplicial set embedding, using a specified initialisation method a...
[ "def", "simplicial_set_embedding", "(", "data", ",", "graph", ",", "n_components", ",", "initial_alpha", ",", "a", ",", "b", ",", "gamma", ",", "negative_sample_rate", ",", "n_epochs", ",", "init", ",", "random_state", ",", "metric", ",", "metric_kwds", ",", ...
Perform a fuzzy simplicial set embedding, using a specified initialisation method and then minimizing the fuzzy set cross entropy between the 1-skeletons of the high and low dimensional fuzzy simplicial sets. Parameters ---------- data: array of shape (n_samples, n_features) The source ...
[ "Perform", "a", "fuzzy", "simplicial", "set", "embedding", "using", "a", "specified", "initialisation", "method", "and", "then", "minimizing", "the", "fuzzy", "set", "cross", "entropy", "between", "the", "1", "-", "skeletons", "of", "the", "high", "and", "low"...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L847-L1003
train
Perform a fuzzy simplicial set embedding on the given data.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
init_transform
def init_transform(indices, weights, embedding): """Given indices and weights and an original embeddings initialize the positions of new points relative to the indices and weights (of their neighbors in the source data). Parameters ---------- indices: array of shape (n_new_samples, n_neighbors)...
python
def init_transform(indices, weights, embedding): """Given indices and weights and an original embeddings initialize the positions of new points relative to the indices and weights (of their neighbors in the source data). Parameters ---------- indices: array of shape (n_new_samples, n_neighbors)...
[ "def", "init_transform", "(", "indices", ",", "weights", ",", "embedding", ")", ":", "result", "=", "np", ".", "zeros", "(", "(", "indices", ".", "shape", "[", "0", "]", ",", "embedding", ".", "shape", "[", "1", "]", ")", ",", "dtype", "=", "np", ...
Given indices and weights and an original embeddings initialize the positions of new points relative to the indices and weights (of their neighbors in the source data). Parameters ---------- indices: array of shape (n_new_samples, n_neighbors) The indices of the neighbors of each new sample...
[ "Given", "indices", "and", "weights", "and", "an", "original", "embeddings", "initialize", "the", "positions", "of", "new", "points", "relative", "to", "the", "indices", "and", "weights", "(", "of", "their", "neighbors", "in", "the", "source", "data", ")", "...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L1007-L1036
train
Initialize the positions of new points relative to the indices and weights of the neighbors of each new sample.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
find_ab_params
def find_ab_params(spread, min_dist): """Fit a, b params for the differentiable curve used in lower dimensional fuzzy simplicial complex construction. We want the smooth curve (from a pre-defined family with simple gradient) that best matches an offset exponential decay. """ def curve(x, a, b):...
python
def find_ab_params(spread, min_dist): """Fit a, b params for the differentiable curve used in lower dimensional fuzzy simplicial complex construction. We want the smooth curve (from a pre-defined family with simple gradient) that best matches an offset exponential decay. """ def curve(x, a, b):...
[ "def", "find_ab_params", "(", "spread", ",", "min_dist", ")", ":", "def", "curve", "(", "x", ",", "a", ",", "b", ")", ":", "return", "1.0", "/", "(", "1.0", "+", "a", "*", "x", "**", "(", "2", "*", "b", ")", ")", "xv", "=", "np", ".", "lins...
Fit a, b params for the differentiable curve used in lower dimensional fuzzy simplicial complex construction. We want the smooth curve (from a pre-defined family with simple gradient) that best matches an offset exponential decay.
[ "Fit", "a", "b", "params", "for", "the", "differentiable", "curve", "used", "in", "lower", "dimensional", "fuzzy", "simplicial", "complex", "construction", ".", "We", "want", "the", "smooth", "curve", "(", "from", "a", "pre", "-", "defined", "family", "with"...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L1039-L1054
train
Fit a b params for the differentiable curve used in lower dimensional fuzzy simplicial complex construction.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
UMAP.fit
def fit(self, X, y=None): """Fit X into an embedded space. Optionally use y for supervised dimension reduction. Parameters ---------- X : array, shape (n_samples, n_features) or (n_samples, n_samples) If the metric is 'precomputed' X must be a square distance ...
python
def fit(self, X, y=None): """Fit X into an embedded space. Optionally use y for supervised dimension reduction. Parameters ---------- X : array, shape (n_samples, n_features) or (n_samples, n_samples) If the metric is 'precomputed' X must be a square distance ...
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ")", ":", "X", "=", "check_array", "(", "X", ",", "dtype", "=", "np", ".", "float32", ",", "accept_sparse", "=", "\"csr\"", ")", "self", ".", "_raw_data", "=", "X", "# Handle all the optiona...
Fit X into an embedded space. Optionally use y for supervised dimension reduction. Parameters ---------- X : array, shape (n_samples, n_features) or (n_samples, n_samples) If the metric is 'precomputed' X must be a square distance matrix. Otherwise it contains a...
[ "Fit", "X", "into", "an", "embedded", "space", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L1319-L1566
train
Fit the UMAP to X.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
UMAP.fit_transform
def fit_transform(self, X, y=None): """Fit X into an embedded space and return that transformed output. Parameters ---------- X : array, shape (n_samples, n_features) or (n_samples, n_samples) If the metric is 'precomputed' X must be a square distance mat...
python
def fit_transform(self, X, y=None): """Fit X into an embedded space and return that transformed output. Parameters ---------- X : array, shape (n_samples, n_features) or (n_samples, n_samples) If the metric is 'precomputed' X must be a square distance mat...
[ "def", "fit_transform", "(", "self", ",", "X", ",", "y", "=", "None", ")", ":", "self", ".", "fit", "(", "X", ",", "y", ")", "return", "self", ".", "embedding_" ]
Fit X into an embedded space and return that transformed output. Parameters ---------- X : array, shape (n_samples, n_features) or (n_samples, n_samples) If the metric is 'precomputed' X must be a square distance matrix. Otherwise it contains a sample per row. ...
[ "Fit", "X", "into", "an", "embedded", "space", "and", "return", "that", "transformed", "output", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L1568-L1590
train
Fit X into an embedded space and return that transformed output.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/umap_.py
UMAP.transform
def transform(self, X): """Transform X into the existing embedded space and return that transformed output. Parameters ---------- X : array, shape (n_samples, n_features) New data to be transformed. Returns ------- X_new : array, shape (n_sam...
python
def transform(self, X): """Transform X into the existing embedded space and return that transformed output. Parameters ---------- X : array, shape (n_samples, n_features) New data to be transformed. Returns ------- X_new : array, shape (n_sam...
[ "def", "transform", "(", "self", ",", "X", ")", ":", "# If we fit just a single instance then error", "if", "self", ".", "embedding_", ".", "shape", "[", "0", "]", "==", "1", ":", "raise", "ValueError", "(", "'Transform unavailable when model was fit with'", "'only ...
Transform X into the existing embedded space and return that transformed output. Parameters ---------- X : array, shape (n_samples, n_features) New data to be transformed. Returns ------- X_new : array, shape (n_samples, n_components) Emb...
[ "Transform", "X", "into", "the", "existing", "embedded", "space", "and", "return", "that", "transformed", "output", "." ]
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/umap_.py#L1592-L1712
train
Transform X into the existing embedded space and return X_new.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
lmcinnes/umap
umap/sparse.py
make_sparse_nn_descent
def make_sparse_nn_descent(sparse_dist, dist_args): """Create a numba accelerated version of nearest neighbor descent specialised for the given distance metric and metric arguments on sparse matrix data provided in CSR ind, indptr and data format. Numba doesn't support higher order functions directly, b...
python
def make_sparse_nn_descent(sparse_dist, dist_args): """Create a numba accelerated version of nearest neighbor descent specialised for the given distance metric and metric arguments on sparse matrix data provided in CSR ind, indptr and data format. Numba doesn't support higher order functions directly, b...
[ "def", "make_sparse_nn_descent", "(", "sparse_dist", ",", "dist_args", ")", ":", "@", "numba", ".", "njit", "(", "parallel", "=", "True", ")", "def", "nn_descent", "(", "inds", ",", "indptr", ",", "data", ",", "n_vertices", ",", "n_neighbors", ",", "rng_st...
Create a numba accelerated version of nearest neighbor descent specialised for the given distance metric and metric arguments on sparse matrix data provided in CSR ind, indptr and data format. Numba doesn't support higher order functions directly, but we can instead JIT compile the version of NN-descent...
[ "Create", "a", "numba", "accelerated", "version", "of", "nearest", "neighbor", "descent", "specialised", "for", "the", "given", "distance", "metric", "and", "metric", "arguments", "on", "sparse", "matrix", "data", "provided", "in", "CSR", "ind", "indptr", "and",...
bbb01c03ba49f7bff8f77fd662d00e50d6686c77
https://github.com/lmcinnes/umap/blob/bbb01c03ba49f7bff8f77fd662d00e50d6686c77/umap/sparse.py#L152-L283
train
Create a numba accelerated version of nearest neighbor descent for a given distance metric and metric arguments on the given CSR ind indptr and data format.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/bin/benchmark_observe.py
interface_options
def interface_options(score=False, raw=False, features=None, rgb=None): """Get an InterfaceOptions for the config.""" interface = sc_pb.InterfaceOptions() interface.score = score interface.raw = raw if features: interface.feature_layer.width = 24 interface.feature_layer.resolution.x = features int...
python
def interface_options(score=False, raw=False, features=None, rgb=None): """Get an InterfaceOptions for the config.""" interface = sc_pb.InterfaceOptions() interface.score = score interface.raw = raw if features: interface.feature_layer.width = 24 interface.feature_layer.resolution.x = features int...
[ "def", "interface_options", "(", "score", "=", "False", ",", "raw", "=", "False", ",", "features", "=", "None", ",", "rgb", "=", "None", ")", ":", "interface", "=", "sc_pb", ".", "InterfaceOptions", "(", ")", "interface", ".", "score", "=", "score", "i...
Get an InterfaceOptions for the config.
[ "Get", "an", "InterfaceOptions", "for", "the", "config", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/bin/benchmark_observe.py#L39-L55
train
Return an InterfaceOptions object for the config.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/point_flag.py
DEFINE_point
def DEFINE_point(name, default, help): # pylint: disable=invalid-name,redefined-builtin """Registers a flag whose value parses as a point.""" flags.DEFINE(PointParser(), name, default, help)
python
def DEFINE_point(name, default, help): # pylint: disable=invalid-name,redefined-builtin """Registers a flag whose value parses as a point.""" flags.DEFINE(PointParser(), name, default, help)
[ "def", "DEFINE_point", "(", "name", ",", "default", ",", "help", ")", ":", "# pylint: disable=invalid-name,redefined-builtin", "flags", ".", "DEFINE", "(", "PointParser", "(", ")", ",", "name", ",", "default", ",", "help", ")" ]
Registers a flag whose value parses as a point.
[ "Registers", "a", "flag", "whose", "value", "parses", "as", "a", "point", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/point_flag.py#L56-L58
train
Registers a flag whose value parses as a point.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
spatial
def spatial(action, action_space): """Choose the action space for the action proto.""" if action_space == ActionSpace.FEATURES: return action.action_feature_layer elif action_space == ActionSpace.RGB: return action.action_render else: raise ValueError("Unexpected value for action_space: %s" % action...
python
def spatial(action, action_space): """Choose the action space for the action proto.""" if action_space == ActionSpace.FEATURES: return action.action_feature_layer elif action_space == ActionSpace.RGB: return action.action_render else: raise ValueError("Unexpected value for action_space: %s" % action...
[ "def", "spatial", "(", "action", ",", "action_space", ")", ":", "if", "action_space", "==", "ActionSpace", ".", "FEATURES", ":", "return", "action", ".", "action_feature_layer", "elif", "action_space", "==", "ActionSpace", ".", "RGB", ":", "return", "action", ...
Choose the action space for the action proto.
[ "Choose", "the", "action", "space", "for", "the", "action", "proto", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L36-L43
train
Choose the spatial layer for the action proto.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
move_camera
def move_camera(action, action_space, minimap): """Move the camera.""" minimap.assign_to(spatial(action, action_space).camera_move.center_minimap)
python
def move_camera(action, action_space, minimap): """Move the camera.""" minimap.assign_to(spatial(action, action_space).camera_move.center_minimap)
[ "def", "move_camera", "(", "action", ",", "action_space", ",", "minimap", ")", ":", "minimap", ".", "assign_to", "(", "spatial", "(", "action", ",", "action_space", ")", ".", "camera_move", ".", "center_minimap", ")" ]
Move the camera.
[ "Move", "the", "camera", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L50-L52
train
Move the camera.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
select_point
def select_point(action, action_space, select_point_act, screen): """Select a unit at a point.""" select = spatial(action, action_space).unit_selection_point screen.assign_to(select.selection_screen_coord) select.type = select_point_act
python
def select_point(action, action_space, select_point_act, screen): """Select a unit at a point.""" select = spatial(action, action_space).unit_selection_point screen.assign_to(select.selection_screen_coord) select.type = select_point_act
[ "def", "select_point", "(", "action", ",", "action_space", ",", "select_point_act", ",", "screen", ")", ":", "select", "=", "spatial", "(", "action", ",", "action_space", ")", ".", "unit_selection_point", "screen", ".", "assign_to", "(", "select", ".", "select...
Select a unit at a point.
[ "Select", "a", "unit", "at", "a", "point", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L55-L59
train
Select a unit at a point.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
select_rect
def select_rect(action, action_space, select_add, screen, screen2): """Select units within a rectangle.""" select = spatial(action, action_space).unit_selection_rect out_rect = select.selection_screen_coord.add() screen_rect = point.Rect(screen, screen2) screen_rect.tl.assign_to(out_rect.p0) screen_rect.br....
python
def select_rect(action, action_space, select_add, screen, screen2): """Select units within a rectangle.""" select = spatial(action, action_space).unit_selection_rect out_rect = select.selection_screen_coord.add() screen_rect = point.Rect(screen, screen2) screen_rect.tl.assign_to(out_rect.p0) screen_rect.br....
[ "def", "select_rect", "(", "action", ",", "action_space", ",", "select_add", ",", "screen", ",", "screen2", ")", ":", "select", "=", "spatial", "(", "action", ",", "action_space", ")", ".", "unit_selection_rect", "out_rect", "=", "select", ".", "selection_scre...
Select units within a rectangle.
[ "Select", "units", "within", "a", "rectangle", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L62-L69
train
Select units within a rectangle.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
select_idle_worker
def select_idle_worker(action, action_space, select_worker): """Select an idle worker.""" del action_space action.action_ui.select_idle_worker.type = select_worker
python
def select_idle_worker(action, action_space, select_worker): """Select an idle worker.""" del action_space action.action_ui.select_idle_worker.type = select_worker
[ "def", "select_idle_worker", "(", "action", ",", "action_space", ",", "select_worker", ")", ":", "del", "action_space", "action", ".", "action_ui", ".", "select_idle_worker", ".", "type", "=", "select_worker" ]
Select an idle worker.
[ "Select", "an", "idle", "worker", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L72-L75
train
Select an idle worker.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
select_army
def select_army(action, action_space, select_add): """Select the entire army.""" del action_space action.action_ui.select_army.selection_add = select_add
python
def select_army(action, action_space, select_add): """Select the entire army.""" del action_space action.action_ui.select_army.selection_add = select_add
[ "def", "select_army", "(", "action", ",", "action_space", ",", "select_add", ")", ":", "del", "action_space", "action", ".", "action_ui", ".", "select_army", ".", "selection_add", "=", "select_add" ]
Select the entire army.
[ "Select", "the", "entire", "army", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L78-L81
train
Select the entire army.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
select_warp_gates
def select_warp_gates(action, action_space, select_add): """Select all warp gates.""" del action_space action.action_ui.select_warp_gates.selection_add = select_add
python
def select_warp_gates(action, action_space, select_add): """Select all warp gates.""" del action_space action.action_ui.select_warp_gates.selection_add = select_add
[ "def", "select_warp_gates", "(", "action", ",", "action_space", ",", "select_add", ")", ":", "del", "action_space", "action", ".", "action_ui", ".", "select_warp_gates", ".", "selection_add", "=", "select_add" ]
Select all warp gates.
[ "Select", "all", "warp", "gates", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L84-L87
train
Select all warp gates.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
select_unit
def select_unit(action, action_space, select_unit_act, select_unit_id): """Select a specific unit from the multi-unit selection.""" del action_space select = action.action_ui.multi_panel select.type = select_unit_act select.unit_index = select_unit_id
python
def select_unit(action, action_space, select_unit_act, select_unit_id): """Select a specific unit from the multi-unit selection.""" del action_space select = action.action_ui.multi_panel select.type = select_unit_act select.unit_index = select_unit_id
[ "def", "select_unit", "(", "action", ",", "action_space", ",", "select_unit_act", ",", "select_unit_id", ")", ":", "del", "action_space", "select", "=", "action", ".", "action_ui", ".", "multi_panel", "select", ".", "type", "=", "select_unit_act", "select", ".",...
Select a specific unit from the multi-unit selection.
[ "Select", "a", "specific", "unit", "from", "the", "multi", "-", "unit", "selection", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L96-L101
train
Select a specific unit from the multi - unit selection.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
control_group
def control_group(action, action_space, control_group_act, control_group_id): """Act on a control group, selecting, setting, etc.""" del action_space select = action.action_ui.control_group select.action = control_group_act select.control_group_index = control_group_id
python
def control_group(action, action_space, control_group_act, control_group_id): """Act on a control group, selecting, setting, etc.""" del action_space select = action.action_ui.control_group select.action = control_group_act select.control_group_index = control_group_id
[ "def", "control_group", "(", "action", ",", "action_space", ",", "control_group_act", ",", "control_group_id", ")", ":", "del", "action_space", "select", "=", "action", ".", "action_ui", ".", "control_group", "select", ".", "action", "=", "control_group_act", "sel...
Act on a control group, selecting, setting, etc.
[ "Act", "on", "a", "control", "group", "selecting", "setting", "etc", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L104-L109
train
Act on a control group selecting setting etc.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
unload
def unload(action, action_space, unload_id): """Unload a unit from a transport/bunker/nydus/etc.""" del action_space action.action_ui.cargo_panel.unit_index = unload_id
python
def unload(action, action_space, unload_id): """Unload a unit from a transport/bunker/nydus/etc.""" del action_space action.action_ui.cargo_panel.unit_index = unload_id
[ "def", "unload", "(", "action", ",", "action_space", ",", "unload_id", ")", ":", "del", "action_space", "action", ".", "action_ui", ".", "cargo_panel", ".", "unit_index", "=", "unload_id" ]
Unload a unit from a transport/bunker/nydus/etc.
[ "Unload", "a", "unit", "from", "a", "transport", "/", "bunker", "/", "nydus", "/", "etc", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L112-L115
train
Unload a unit from a transport
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
build_queue
def build_queue(action, action_space, build_queue_id): """Cancel a unit in the build queue.""" del action_space action.action_ui.production_panel.unit_index = build_queue_id
python
def build_queue(action, action_space, build_queue_id): """Cancel a unit in the build queue.""" del action_space action.action_ui.production_panel.unit_index = build_queue_id
[ "def", "build_queue", "(", "action", ",", "action_space", ",", "build_queue_id", ")", ":", "del", "action_space", "action", ".", "action_ui", ".", "production_panel", ".", "unit_index", "=", "build_queue_id" ]
Cancel a unit in the build queue.
[ "Cancel", "a", "unit", "in", "the", "build", "queue", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L118-L121
train
Cancel a unit in the build queue.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
cmd_quick
def cmd_quick(action, action_space, ability_id, queued): """Do a quick command like 'Stop' or 'Stim'.""" action_cmd = spatial(action, action_space).unit_command action_cmd.ability_id = ability_id action_cmd.queue_command = queued
python
def cmd_quick(action, action_space, ability_id, queued): """Do a quick command like 'Stop' or 'Stim'.""" action_cmd = spatial(action, action_space).unit_command action_cmd.ability_id = ability_id action_cmd.queue_command = queued
[ "def", "cmd_quick", "(", "action", ",", "action_space", ",", "ability_id", ",", "queued", ")", ":", "action_cmd", "=", "spatial", "(", "action", ",", "action_space", ")", ".", "unit_command", "action_cmd", ".", "ability_id", "=", "ability_id", "action_cmd", "....
Do a quick command like 'Stop' or 'Stim'.
[ "Do", "a", "quick", "command", "like", "Stop", "or", "Stim", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L124-L128
train
Do a quick command like Stop or Stim.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
cmd_screen
def cmd_screen(action, action_space, ability_id, queued, screen): """Do a command that needs a point on the screen.""" action_cmd = spatial(action, action_space).unit_command action_cmd.ability_id = ability_id action_cmd.queue_command = queued screen.assign_to(action_cmd.target_screen_coord)
python
def cmd_screen(action, action_space, ability_id, queued, screen): """Do a command that needs a point on the screen.""" action_cmd = spatial(action, action_space).unit_command action_cmd.ability_id = ability_id action_cmd.queue_command = queued screen.assign_to(action_cmd.target_screen_coord)
[ "def", "cmd_screen", "(", "action", ",", "action_space", ",", "ability_id", ",", "queued", ",", "screen", ")", ":", "action_cmd", "=", "spatial", "(", "action", ",", "action_space", ")", ".", "unit_command", "action_cmd", ".", "ability_id", "=", "ability_id", ...
Do a command that needs a point on the screen.
[ "Do", "a", "command", "that", "needs", "a", "point", "on", "the", "screen", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L131-L136
train
Do a command that needs a point on the screen.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
cmd_minimap
def cmd_minimap(action, action_space, ability_id, queued, minimap): """Do a command that needs a point on the minimap.""" action_cmd = spatial(action, action_space).unit_command action_cmd.ability_id = ability_id action_cmd.queue_command = queued minimap.assign_to(action_cmd.target_minimap_coord)
python
def cmd_minimap(action, action_space, ability_id, queued, minimap): """Do a command that needs a point on the minimap.""" action_cmd = spatial(action, action_space).unit_command action_cmd.ability_id = ability_id action_cmd.queue_command = queued minimap.assign_to(action_cmd.target_minimap_coord)
[ "def", "cmd_minimap", "(", "action", ",", "action_space", ",", "ability_id", ",", "queued", ",", "minimap", ")", ":", "action_cmd", "=", "spatial", "(", "action", ",", "action_space", ")", ".", "unit_command", "action_cmd", ".", "ability_id", "=", "ability_id"...
Do a command that needs a point on the minimap.
[ "Do", "a", "command", "that", "needs", "a", "point", "on", "the", "minimap", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L139-L144
train
Do a command that needs a point on the minimap.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
autocast
def autocast(action, action_space, ability_id): """Toggle autocast.""" del action_space action.action_ui.toggle_autocast.ability_id = ability_id
python
def autocast(action, action_space, ability_id): """Toggle autocast.""" del action_space action.action_ui.toggle_autocast.ability_id = ability_id
[ "def", "autocast", "(", "action", ",", "action_space", ",", "ability_id", ")", ":", "del", "action_space", "action", ".", "action_ui", ".", "toggle_autocast", ".", "ability_id", "=", "ability_id" ]
Toggle autocast.
[ "Toggle", "autocast", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L147-L150
train
Toggle autocast.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
ArgumentType.enum
def enum(cls, options, values): """Create an ArgumentType where you choose one of a set of known values.""" names, real = zip(*options) del names # unused def factory(i, name): return cls(i, name, (len(real),), lambda a: real[a[0]], values) return factory
python
def enum(cls, options, values): """Create an ArgumentType where you choose one of a set of known values.""" names, real = zip(*options) del names # unused def factory(i, name): return cls(i, name, (len(real),), lambda a: real[a[0]], values) return factory
[ "def", "enum", "(", "cls", ",", "options", ",", "values", ")", ":", "names", ",", "real", "=", "zip", "(", "*", "options", ")", "del", "names", "# unused", "def", "factory", "(", "i", ",", "name", ")", ":", "return", "cls", "(", "i", ",", "name",...
Create an ArgumentType where you choose one of a set of known values.
[ "Create", "an", "ArgumentType", "where", "you", "choose", "one", "of", "a", "set", "of", "known", "values", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L175-L182
train
Create an ArgumentType where you choose one of a set of known values.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
ArgumentType.scalar
def scalar(cls, value): """Create an ArgumentType with a single scalar in range(value).""" return lambda i, name: cls(i, name, (value,), lambda a: a[0], None)
python
def scalar(cls, value): """Create an ArgumentType with a single scalar in range(value).""" return lambda i, name: cls(i, name, (value,), lambda a: a[0], None)
[ "def", "scalar", "(", "cls", ",", "value", ")", ":", "return", "lambda", "i", ",", "name", ":", "cls", "(", "i", ",", "name", ",", "(", "value", ",", ")", ",", "lambda", "a", ":", "a", "[", "0", "]", ",", "None", ")" ]
Create an ArgumentType with a single scalar in range(value).
[ "Create", "an", "ArgumentType", "with", "a", "single", "scalar", "in", "range", "(", "value", ")", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L185-L187
train
Create an ArgumentType with a single scalar in range value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
ArgumentType.point
def point(cls): # No range because it's unknown at this time. """Create an ArgumentType that is represented by a point.Point.""" def factory(i, name): return cls(i, name, (0, 0), lambda a: point.Point(*a).floor(), None) return factory
python
def point(cls): # No range because it's unknown at this time. """Create an ArgumentType that is represented by a point.Point.""" def factory(i, name): return cls(i, name, (0, 0), lambda a: point.Point(*a).floor(), None) return factory
[ "def", "point", "(", "cls", ")", ":", "# No range because it's unknown at this time.", "def", "factory", "(", "i", ",", "name", ")", ":", "return", "cls", "(", "i", ",", "name", ",", "(", "0", ",", "0", ")", ",", "lambda", "a", ":", "point", ".", "Po...
Create an ArgumentType that is represented by a point.Point.
[ "Create", "an", "ArgumentType", "that", "is", "represented", "by", "a", "point", ".", "Point", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L190-L194
train
Create an ArgumentType that is represented by a point. Point.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
Arguments.types
def types(cls, **kwargs): """Create an Arguments of the possible Types.""" named = {name: factory(Arguments._fields.index(name), name) for name, factory in six.iteritems(kwargs)} return cls(**named)
python
def types(cls, **kwargs): """Create an Arguments of the possible Types.""" named = {name: factory(Arguments._fields.index(name), name) for name, factory in six.iteritems(kwargs)} return cls(**named)
[ "def", "types", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "named", "=", "{", "name", ":", "factory", "(", "Arguments", ".", "_fields", ".", "index", "(", "name", ")", ",", "name", ")", "for", "name", ",", "factory", "in", "six", ".", "iterit...
Create an Arguments of the possible Types.
[ "Create", "an", "Arguments", "of", "the", "possible", "Types", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L229-L233
train
Create an Arguments of the possible Types.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
Function.ui_func
def ui_func(cls, id_, name, function_type, avail_fn=always): """Define a function representing a ui action.""" return cls(id_, name, 0, 0, function_type, FUNCTION_TYPES[function_type], avail_fn)
python
def ui_func(cls, id_, name, function_type, avail_fn=always): """Define a function representing a ui action.""" return cls(id_, name, 0, 0, function_type, FUNCTION_TYPES[function_type], avail_fn)
[ "def", "ui_func", "(", "cls", ",", "id_", ",", "name", ",", "function_type", ",", "avail_fn", "=", "always", ")", ":", "return", "cls", "(", "id_", ",", "name", ",", "0", ",", "0", ",", "function_type", ",", "FUNCTION_TYPES", "[", "function_type", "]",...
Define a function representing a ui action.
[ "Define", "a", "function", "representing", "a", "ui", "action", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L366-L369
train
Define a function representing a ui action.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
Function.ability
def ability(cls, id_, name, function_type, ability_id, general_id=0): """Define a function represented as a game ability.""" assert function_type in ABILITY_FUNCTIONS return cls(id_, name, ability_id, general_id, function_type, FUNCTION_TYPES[function_type], None)
python
def ability(cls, id_, name, function_type, ability_id, general_id=0): """Define a function represented as a game ability.""" assert function_type in ABILITY_FUNCTIONS return cls(id_, name, ability_id, general_id, function_type, FUNCTION_TYPES[function_type], None)
[ "def", "ability", "(", "cls", ",", "id_", ",", "name", ",", "function_type", ",", "ability_id", ",", "general_id", "=", "0", ")", ":", "assert", "function_type", "in", "ABILITY_FUNCTIONS", "return", "cls", "(", "id_", ",", "name", ",", "ability_id", ",", ...
Define a function represented as a game ability.
[ "Define", "a", "function", "represented", "as", "a", "game", "ability", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L372-L376
train
Define a function represented as a game ability.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
Function.str
def str(self, space=False): """String version. Set space=True to line them all up nicely.""" return "%s/%s (%s)" % (str(int(self.id)).rjust(space and 4), self.name.ljust(space and 50), "; ".join(str(a) for a in self.args))
python
def str(self, space=False): """String version. Set space=True to line them all up nicely.""" return "%s/%s (%s)" % (str(int(self.id)).rjust(space and 4), self.name.ljust(space and 50), "; ".join(str(a) for a in self.args))
[ "def", "str", "(", "self", ",", "space", "=", "False", ")", ":", "return", "\"%s/%s (%s)\"", "%", "(", "str", "(", "int", "(", "self", ".", "id", ")", ")", ".", "rjust", "(", "space", "and", "4", ")", ",", "self", ".", "name", ".", "ljust", "("...
String version. Set space=True to line them all up nicely.
[ "String", "version", ".", "Set", "space", "=", "True", "to", "line", "them", "all", "up", "nicely", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L396-L400
train
String version of the object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
FunctionCall.init_with_validation
def init_with_validation(cls, function, arguments): """Return a `FunctionCall` given some validation for the function and args. Args: function: A function name or id, to be converted into a function id enum. arguments: An iterable of function arguments. Arguments that are enum types can b...
python
def init_with_validation(cls, function, arguments): """Return a `FunctionCall` given some validation for the function and args. Args: function: A function name or id, to be converted into a function id enum. arguments: An iterable of function arguments. Arguments that are enum types can b...
[ "def", "init_with_validation", "(", "cls", ",", "function", ",", "arguments", ")", ":", "func", "=", "FUNCTIONS", "[", "function", "]", "args", "=", "[", "]", "for", "arg", ",", "arg_type", "in", "zip", "(", "arguments", ",", "func", ".", "args", ")", ...
Return a `FunctionCall` given some validation for the function and args. Args: function: A function name or id, to be converted into a function id enum. arguments: An iterable of function arguments. Arguments that are enum types can be passed by name. Arguments that only take one value (ie ...
[ "Return", "a", "FunctionCall", "given", "some", "validation", "for", "the", "function", "and", "args", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L1039-L1077
train
Initialize a new FunctionCall instance with some validation for the function and arguments.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/actions.py
FunctionCall.all_arguments
def all_arguments(cls, function, arguments): """Helper function for creating `FunctionCall`s with `Arguments`. Args: function: The value to store for the action function. arguments: The values to store for the arguments of the action. Can either be an `Arguments` object, a `dict`, or an ite...
python
def all_arguments(cls, function, arguments): """Helper function for creating `FunctionCall`s with `Arguments`. Args: function: The value to store for the action function. arguments: The values to store for the arguments of the action. Can either be an `Arguments` object, a `dict`, or an ite...
[ "def", "all_arguments", "(", "cls", ",", "function", ",", "arguments", ")", ":", "if", "isinstance", "(", "arguments", ",", "dict", ")", ":", "arguments", "=", "Arguments", "(", "*", "*", "arguments", ")", "elif", "not", "isinstance", "(", "arguments", "...
Helper function for creating `FunctionCall`s with `Arguments`. Args: function: The value to store for the action function. arguments: The values to store for the arguments of the action. Can either be an `Arguments` object, a `dict`, or an iterable. If a `dict` or an iterable is provide...
[ "Helper", "function", "for", "creating", "FunctionCall", "s", "with", "Arguments", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/actions.py#L1080-L1097
train
Helper function for creating FunctionCall s with Arguments.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/bin/valid_actions.py
main
def main(unused_argv): """Print the valid actions.""" feats = features.Features( # Actually irrelevant whether it's feature or rgb size. features.AgentInterfaceFormat( feature_dimensions=features.Dimensions( screen=FLAGS.screen_size, minimap=FLAGS.minimap_size))) ...
python
def main(unused_argv): """Print the valid actions.""" feats = features.Features( # Actually irrelevant whether it's feature or rgb size. features.AgentInterfaceFormat( feature_dimensions=features.Dimensions( screen=FLAGS.screen_size, minimap=FLAGS.minimap_size))) ...
[ "def", "main", "(", "unused_argv", ")", ":", "feats", "=", "features", ".", "Features", "(", "# Actually irrelevant whether it's feature or rgb size.", "features", ".", "AgentInterfaceFormat", "(", "feature_dimensions", "=", "features", ".", "Dimensions", "(", "screen",...
Print the valid actions.
[ "Print", "the", "valid", "actions", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/bin/valid_actions.py#L34-L56
train
Print the valid actions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/portspicker.py
pick_unused_ports
def pick_unused_ports(num_ports, retry_interval_secs=3, retry_attempts=5): """Reserves and returns a list of `num_ports` unused ports.""" ports = set() for _ in range(retry_attempts): ports.update( portpicker.pick_unused_port() for _ in range(num_ports - len(ports))) ports.discard(None) # portpic...
python
def pick_unused_ports(num_ports, retry_interval_secs=3, retry_attempts=5): """Reserves and returns a list of `num_ports` unused ports.""" ports = set() for _ in range(retry_attempts): ports.update( portpicker.pick_unused_port() for _ in range(num_ports - len(ports))) ports.discard(None) # portpic...
[ "def", "pick_unused_ports", "(", "num_ports", ",", "retry_interval_secs", "=", "3", ",", "retry_attempts", "=", "5", ")", ":", "ports", "=", "set", "(", ")", "for", "_", "in", "range", "(", "retry_attempts", ")", ":", "ports", ".", "update", "(", "portpi...
Reserves and returns a list of `num_ports` unused ports.
[ "Reserves", "and", "returns", "a", "list", "of", "num_ports", "unused", "ports", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/portspicker.py#L24-L40
train
Reserves and returns a list of num_ports unused ports.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/portspicker.py
pick_contiguous_unused_ports
def pick_contiguous_unused_ports( num_ports, retry_interval_secs=3, retry_attempts=5): """Reserves and returns a list of `num_ports` contiguous unused ports.""" for _ in range(retry_attempts): start_port = portpicker.pick_unused_port() if start_port is not None: ports = [start_port + p for...
python
def pick_contiguous_unused_ports( num_ports, retry_interval_secs=3, retry_attempts=5): """Reserves and returns a list of `num_ports` contiguous unused ports.""" for _ in range(retry_attempts): start_port = portpicker.pick_unused_port() if start_port is not None: ports = [start_port + p for...
[ "def", "pick_contiguous_unused_ports", "(", "num_ports", ",", "retry_interval_secs", "=", "3", ",", "retry_attempts", "=", "5", ")", ":", "for", "_", "in", "range", "(", "retry_attempts", ")", ":", "start_port", "=", "portpicker", ".", "pick_unused_port", "(", ...
Reserves and returns a list of `num_ports` contiguous unused ports.
[ "Reserves", "and", "returns", "a", "list", "of", "num_ports", "contiguous", "unused", "ports", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/portspicker.py#L43-L59
train
Reserves and returns a list of num_ports contiguous unused ports.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/bin/agent.py
run_thread
def run_thread(agent_classes, players, map_name, visualize): """Run one thread worth of the environment with agents.""" with sc2_env.SC2Env( map_name=map_name, players=players, agent_interface_format=sc2_env.parse_agent_interface_format( feature_screen=FLAGS.feature_screen_size, ...
python
def run_thread(agent_classes, players, map_name, visualize): """Run one thread worth of the environment with agents.""" with sc2_env.SC2Env( map_name=map_name, players=players, agent_interface_format=sc2_env.parse_agent_interface_format( feature_screen=FLAGS.feature_screen_size, ...
[ "def", "run_thread", "(", "agent_classes", ",", "players", ",", "map_name", ",", "visualize", ")", ":", "with", "sc2_env", ".", "SC2Env", "(", "map_name", "=", "map_name", ",", "players", "=", "players", ",", "agent_interface_format", "=", "sc2_env", ".", "p...
Run one thread worth of the environment with agents.
[ "Run", "one", "thread", "worth", "of", "the", "environment", "with", "agents", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/bin/agent.py#L83-L103
train
Runs one thread worth of the environment with agents.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/bin/agent.py
main
def main(unused_argv): """Run an agent.""" stopwatch.sw.enabled = FLAGS.profile or FLAGS.trace stopwatch.sw.trace = FLAGS.trace map_inst = maps.get(FLAGS.map) agent_classes = [] players = [] agent_module, agent_name = FLAGS.agent.rsplit(".", 1) agent_cls = getattr(importlib.import_module(agent_module...
python
def main(unused_argv): """Run an agent.""" stopwatch.sw.enabled = FLAGS.profile or FLAGS.trace stopwatch.sw.trace = FLAGS.trace map_inst = maps.get(FLAGS.map) agent_classes = [] players = [] agent_module, agent_name = FLAGS.agent.rsplit(".", 1) agent_cls = getattr(importlib.import_module(agent_module...
[ "def", "main", "(", "unused_argv", ")", ":", "stopwatch", ".", "sw", ".", "enabled", "=", "FLAGS", ".", "profile", "or", "FLAGS", ".", "trace", "stopwatch", ".", "sw", ".", "trace", "=", "FLAGS", ".", "trace", "map_inst", "=", "maps", ".", "get", "("...
Run an agent.
[ "Run", "an", "agent", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/bin/agent.py#L106-L146
train
Run an agent.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
deepmind/pysc2
pysc2/lib/remote_controller.py
check_error
def check_error(res, error_enum): """Raise if the result has an error, otherwise return the result.""" if res.HasField("error"): enum_name = error_enum.DESCRIPTOR.full_name error_name = error_enum.Name(res.error) details = getattr(res, "error_details", "<none>") raise RequestError("%s.%s: '%s'" % (e...
python
def check_error(res, error_enum): """Raise if the result has an error, otherwise return the result.""" if res.HasField("error"): enum_name = error_enum.DESCRIPTOR.full_name error_name = error_enum.Name(res.error) details = getattr(res, "error_details", "<none>") raise RequestError("%s.%s: '%s'" % (e...
[ "def", "check_error", "(", "res", ",", "error_enum", ")", ":", "if", "res", ".", "HasField", "(", "\"error\"", ")", ":", "enum_name", "=", "error_enum", ".", "DESCRIPTOR", ".", "full_name", "error_name", "=", "error_enum", ".", "Name", "(", "res", ".", "...
Raise if the result has an error, otherwise return the result.
[ "Raise", "if", "the", "result", "has", "an", "error", "otherwise", "return", "the", "result", "." ]
df4cc4b00f07a2242be9ba153d4a7f4ad2017897
https://github.com/deepmind/pysc2/blob/df4cc4b00f07a2242be9ba153d4a7f4ad2017897/pysc2/lib/remote_controller.py#L56-L63
train
Raise if the result has an error otherwise return the result.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...