numcodecs_wasm_random_projection
Classes:
-
RandomProjection–Codec that uses random projections to reduce the dimensionality of high-
RandomProjection
RandomProjection(
projection,
reduction,
seed,
_version="0.1.0",
density=None,
epsilon=None,
k=None,
**kwargs,
)
Codec that uses random projections to reduce the dimensionality of high- dimensional data to compress it.
A two-dimensional array of shape \(N \times D\) is encoded as n array of shape \(N \times K\), where \(K\) is either set explicitly or chosen using the the Johnson-Lindenstrauss lemma. For \(K\) to be smaller than \(D\), \(D\) must be quite large. Therefore, this codec should only applied on large datasets as it otherwise significantly inflates the data size instead of reducing it.
Choosing a lower distortion rate epsilon will improve the quality of the
lossy compression, i.e. reduce the compression error, at the cost of
increasing \(K\).
This codec only supports finite floating point data.
| Parameters: |
|
|---|
Methods:
-
decode–Decode the data in
buf. -
encode–Encode the data in
buf. -
from_config–Instantiate the codec from a configuration
dict. -
get_config–Returns the configuration of the codec.
codec_id
class-attribute
instance-attribute
codec_id = 'random-projection.rs'
decode
decode(buf, out=None)
Decode the data in buf.
| Parameters: |
|
|---|
| Returns: |
|
|---|
encode
encode(buf)
Encode the data in buf.
| Parameters: |
|
|---|
| Returns: |
|
|---|
from_config
classmethod
from_config(config)
get_config
get_config()
Returns the configuration of the codec.
numcodecs.registry.get_codec(config)
can be used to reconstruct this codec from the returned config.
| Returns: |
|
|---|