pub struct OneHotEncoder {
pub output_sparse: bool,
pub handle_unknown: i32,
pub category_type: Option<CategoryType>,
}Expand description
Transforms a categorical feature into an array. The array will be all zeros expect a single entry of one.
Each categorical value will map to an index, this mapping is given by
either the stringCategories parameter or the int64Categories
parameter.
Fields§
§output_sparse: boolOutput can be a dictionary with only one entry, instead of an array.
handle_unknown: i32§category_type: Option<CategoryType>Mapping to be used for the encoding. The position of the category in the below vector determines where the single one entry will be in the output.
Implementations§
Source§impl OneHotEncoder
impl OneHotEncoder
Sourcepub fn handle_unknown(&self) -> HandleUnknown
pub fn handle_unknown(&self) -> HandleUnknown
Returns the enum value of handle_unknown, or the default if the field is set to an invalid enum value.
Sourcepub fn set_handle_unknown(&mut self, value: HandleUnknown)
pub fn set_handle_unknown(&mut self, value: HandleUnknown)
Sets handle_unknown to the provided enum value.
Trait Implementations§
Source§impl Clone for OneHotEncoder
impl Clone for OneHotEncoder
Source§fn clone(&self) -> OneHotEncoder
fn clone(&self) -> OneHotEncoder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OneHotEncoder
impl Debug for OneHotEncoder
Source§impl Default for OneHotEncoder
impl Default for OneHotEncoder
Source§impl Hash for OneHotEncoder
impl Hash for OneHotEncoder
Source§impl Message for OneHotEncoder
impl Message for OneHotEncoder
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message to a buffer. Read more
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Encodes the message with a length-delimiter to a buffer. Read more
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes an instance of the message from a buffer. Read more
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Decodes a length-delimited instance of the message from the buffer.
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes an instance of the message from a buffer, and merges it into
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
Decodes a length-delimited instance of the message from buffer, and
merges it into
self.Source§impl PartialEq for OneHotEncoder
impl PartialEq for OneHotEncoder
Source§fn eq(&self, other: &OneHotEncoder) -> bool
fn eq(&self, other: &OneHotEncoder) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for OneHotEncoder
impl StructuralPartialEq for OneHotEncoder
Auto Trait Implementations§
impl Freeze for OneHotEncoder
impl RefUnwindSafe for OneHotEncoder
impl Send for OneHotEncoder
impl Sync for OneHotEncoder
impl Unpin for OneHotEncoder
impl UnsafeUnpin for OneHotEncoder
impl UnwindSafe for OneHotEncoder
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
Mutably borrows from an owned value. Read more