Reference
spector.indices
A sparse boolean array, i.e., set of indices.
Provides a memory efficient set interface, with optimized conversion between numpy arrays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
Iterable
|
optional iterable of keys |
required |
__doc__ = 'A sparse boolean array, i.e., set of indices.\n\n Provides a memory efficient set interface, with optimized conversion between numpy arrays.\n\n Args:\n keys (Iterable): optional iterable of keys\n '
class
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.
__pyx_vtable__ = <capsule object NULL at 0x7fa1bb847e70>
class
Capsule objects let you wrap a C "void *" pointer in a Python object. They're a way of passing data through the Python interpreter without creating your own custom type.
Capsules are used for communication between extension modules. They provide a way for an extension module to export a C interface to other extension modules, so that extension modules can use the Python import mechanism to link to one another.
__array__(dtype=int64, copy=None)
method descriptor
Return keys as numpy array.
__contains__(key)
method descriptor
Return bool(key in self).
__eq__(value)
method descriptor
Return self==value.
__ge__(value)
method descriptor
Return self>=value.
__gt__(value)
method descriptor
Return self>value.
__init__(*args, **kwargs)
method descriptor
Initialize self. See help(type(self)) for accurate signature.
__ior__(value)
method descriptor
Return self|=value.
__isub__(value)
method descriptor
Return self-=value.
__iter__()
method descriptor
Implement iter(self).
__ixor__(value)
method descriptor
Return self^=value.
__le__(value)
method descriptor
Return self<=value.
__len__()
method descriptor
Return len(self).
__lt__(value)
method descriptor
Return self<value.
__matmul__(object)
method descriptor
Return binary dot product, i.e., intersection count.
__ne__(value)
method descriptor
Return self!=value.
__new__(*args, **kwargs)
builtin
Create and return a new object. See help(type) for accurate signature.
__rand__(value)
method descriptor
Return value&self.
__repr__()
method descriptor
Return repr(self).
__rmatmul__(value)
method descriptor
Return value@self.
__ror__(value)
method descriptor
Return value|self.
__rsub__(value)
method descriptor
Return value-self.
__rxor__(value)
method descriptor
Return value^self.
add(key)
method descriptor
Add an index key.
clear()
method descriptor
Remove all indices.
difference(*others)
method descriptor
Return the difference of sets as a new set.
discard(key)
method descriptor
Remove an index key, if present.
dot(*others)
method descriptor
Return the intersection count of sets.
fromdense(values)
classmethod
Return indices from a dense array representation.
intersection(*others)
method descriptor
Return the intersection of sets as a new set.
isdisjoint(other)
method descriptor
Return whether two indices have a null intersection.
todense(minlength=0, dtype=bool)
method descriptor
Return a dense array representation of indices.
union(*others)
method descriptor
Return the union of sets as a new set.
update(*others)
method descriptor
Update from indices, arrays, or iterables.
spector.vector.vector
A sparse array of index keys mapped to numeric values.
Provides a memory efficient Counter interface, with optimized conversion between numpy arrays.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
Iterable[int]
|
optional iterable of keys |
required |
values
|
optional scalar or iterable of values |
required |
__doc__ = 'A sparse array of index keys mapped to numeric values.\n\n Provides a memory efficient Counter interface, with optimized conversion between numpy arrays.\n\n Args:\n keys (Iterable[int]): optional iterable of keys\n values: optional scalar or iterable of values\n '
class
str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to 'utf-8'. errors defaults to 'strict'.
__pyx_vtable__ = <capsule object NULL at 0x7fa1bb977ab0>
class
Capsule objects let you wrap a C "void *" pointer in a Python object. They're a way of passing data through the Python interpreter without creating your own custom type.
Capsules are used for communication between extension modules. They provide a way for an extension module to export a C interface to other extension modules, so that extension modules can use the Python import mechanism to link to one another.
__abs__()
method descriptor
abs(self)
__contains__(key)
method descriptor
Return bool(key in self).
__delitem__(key)
method descriptor
Delete self[key].
__eq__(value)
method descriptor
Return self==value.
__ge__(value)
method descriptor
Return self>=value.
__getitem__(key)
method descriptor
Return self[key].
__gt__(value)
method descriptor
Return self>value.
__iadd__(value)
method descriptor
Return self+=value.
__imul__(value)
method descriptor
Return self*=value.
__init__(*args, **kwargs)
method descriptor
Initialize self. See help(type(self)) for accurate signature.
__ior__(value)
method descriptor
Return self|=value.
__ipow__(value)
method descriptor
Return self**=value.
__isub__(value)
method descriptor
Return self-=value.
__iter__()
method descriptor
Implement iter(self).
__itruediv__(value)
method descriptor
Return self/=value.
__ixor__(value)
method descriptor
Return self^=value.
__le__(value)
method descriptor
Return self<=value.
__len__()
method descriptor
Return len(self).
__lt__(value)
method descriptor
Return self<value.
__matmul__(object)
method descriptor
Return vector dot product.
__ne__(value)
method descriptor
Return self!=value.
__neg__()
method descriptor
-self
__new__(*args, **kwargs)
builtin
Create and return a new object. See help(type) for accurate signature.
__pow__(value, mod=None)
method descriptor
Return pow(self, value, mod).
__rand__(value)
method descriptor
Return value&self.
__repr__()
method descriptor
Return repr(self).
__rmatmul__(value)
method descriptor
Return value@self.
__ror__(value)
method descriptor
Return value|self.
__rpow__(value, mod=None)
method descriptor
Return pow(value, self, mod).
__rxor__(value)
method descriptor
Return value^self.
__setitem__(key, value)
method descriptor
Set self[key] to value.
argmax(**kwargs)
method descriptor
Return key with maximum value.
argmin(**kwargs)
method descriptor
Return key with minimum value.
argpartition(kth, **kwargs)
method descriptor
Return keys partitioned by values.
argsort(**kwargs)
method descriptor
Return keys sorted by values.
clear()
method descriptor
Remove all items.
difference(*others)
method descriptor
Provisional set difference; return vector without keys.
equal(other)
method descriptor
Return whether vectors are equal as scalar bool; == is element-wise.
filter(ufunc, *args, **kwargs)
method descriptor
Return element-wise array of keys from applying predicate across vectors.
fromdense(values)
classmethod
Return vector from a dense array representation.
items()
method descriptor
Return zipped keys and values.
keys()
method descriptor
Return keys as numpy array.
map(ufunc, *args, **kwargs)
method descriptor
Return element-wise array of values from applying function across vectors.
max(initial=None, **kwargs)
method descriptor
Return maximum value.
maximum(value)
method descriptor
Return element-wise maximum vector.
min(initial=None, **kwargs)
method descriptor
Return minimum value.
minimum(value)
method descriptor
Return element-wise minimum vector.
sum(initial=0.0, dtype=float, **kwargs)
method descriptor
Return sum of values.
todense(minlength=0, dtype=float)
method descriptor
Return a dense array representation of vector.
update(keys, values=1.0)
method descriptor
Update from vector, arrays, mapping, or keys with scalar.
values(dtype=float)
method descriptor
Return values as numpy array.
spector.matrix.matrix
Bases: defaultdict
A sparse vector of vectors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Iterable
|
|
()
|
Source code in spector/matrix.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
col
property
COO format column index array of the matrix
data
property
COO format data array of the matrix
row
property
COO format row index array of the matrix
filter(func, *args, **kwargs)
Return matrix with function applies across vectors.
Source code in spector/matrix.py
113 114 115 |
|
fromcoo(row, col, data)
classmethod
Return matrix from COOrdinate format arrays.
Source code in spector/matrix.py
117 118 119 120 |
|
map(func, *args, **kwargs)
Return matrix with function applies across vectors.
Source code in spector/matrix.py
106 107 108 109 110 111 |
|
sum(axis=None)
Return sum of matrix elements across axis, by default both.
Source code in spector/matrix.py
96 97 98 99 100 101 102 103 104 |
|
transpose()
Return matrix with reversed dimensions.
Source code in spector/matrix.py
122 123 124 |
|
update(data)
Update from mapping or iterable.
Source code in spector/matrix.py
61 62 63 64 65 66 67 68 |
|
spector.groupby(keys, *arrays)
Generate unique keys with associated groups.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
keys
|
Iterable
|
|
required |
*arrays
|
Iterable
|
|
()
|
Source code in spector/matrix.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|