pub struct RandomProjectionCodec {
pub seed: u64,
pub reduction: RandomProjectionReduction,
pub projection: RandomProjectionKind,
pub version: StaticCodecVersion<0, 1, 0>,
}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 \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.
Fields§
§seed: u64Seed for generating the random projection matrix
reduction: RandomProjectionReductionMethod with which the reduced dimensionality $K$ is selected
projection: RandomProjectionKindProjection kind that is used to generate the random projection matrix
version: StaticCodecVersion<0, 1, 0>The codec’s encoding format version. Do not provide this parameter explicitly.
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
Source§fn inline_schema() -> bool
fn 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
configuration.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 UnsafeUnpin 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§impl<T> DynCodec for Twhere
T: StaticCodec,
impl<T> DynCodec for Twhere
T: StaticCodec,
Source§type Type = StaticCodecType<T>
type Type = StaticCodecType<T>
Source§fn get_config<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn get_config<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more