pub struct RandomProjectionCodec {
pub seed: u64,
pub reduction: RandomProjectionReduction,
pub projection: RandomProjectionKind,
}
Expand description
Codec that uses random projections to reduce the dimensionality of high- dimensional data to compress it.
A two-dimensional array of shape N x D
is encoded as n array of shape
N x 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.
Fields§
§seed: u64
Seed for generating the random projection matrix
reduction: RandomProjectionReduction
Method with which the reduced dimensionality K
is selected
projection: RandomProjectionKind
Projection kind that is used to generate the random projection matrix
Trait Implementations§
Source§impl Clone for RandomProjectionCodec
impl Clone for RandomProjectionCodec
Source§fn clone(&self) -> RandomProjectionCodec
fn clone(&self) -> RandomProjectionCodec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Codec for RandomProjectionCodec
impl Codec for RandomProjectionCodec
Source§fn encode(&self, data: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
fn encode(&self, data: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
data
and returns the result. Read moreSource§fn decode(&self, encoded: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
fn decode(&self, encoded: AnyCowArray<'_>) -> Result<AnyArray, Self::Error>
encoded
data and returns the result. Read moreSource§fn decode_into(
&self,
encoded: AnyArrayView<'_>,
decoded: AnyArrayViewMut<'_>,
) -> Result<(), Self::Error>
fn decode_into( &self, encoded: AnyArrayView<'_>, decoded: AnyArrayViewMut<'_>, ) -> Result<(), Self::Error>
Source§impl<'de> Deserialize<'de> for RandomProjectionCodec
impl<'de> Deserialize<'de> for RandomProjectionCodec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for RandomProjectionCodec
impl JsonSchema for RandomProjectionCodec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
§fn always_inline_schema() -> bool
fn always_inline_schema() -> bool
$ref
keyword. Read moreSource§impl Serialize for RandomProjectionCodec
impl Serialize for RandomProjectionCodec
Source§impl StaticCodec for RandomProjectionCodec
impl StaticCodec for RandomProjectionCodec
Source§type Config<'de> = RandomProjectionCodec
type Config<'de> = RandomProjectionCodec
Source§fn from_config(config: Self::Config<'_>) -> Self
fn from_config(config: Self::Config<'_>) -> Self
config
uration.Source§fn get_config(&self) -> StaticCodecConfig<'_, Self>
fn get_config(&self) -> StaticCodecConfig<'_, Self>
Auto Trait Implementations§
impl Freeze for RandomProjectionCodec
impl RefUnwindSafe for RandomProjectionCodec
impl Send for RandomProjectionCodec
impl Sync for RandomProjectionCodec
impl Unpin for RandomProjectionCodec
impl UnwindSafe for RandomProjectionCodec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)