pub struct FeatureVector {
pub entity_id: EntityId,
pub features: HashMap<String, f64>,
pub normalized_features: HashMap<String, f64>,
pub metadata: HashMap<String, Value>,
pub refactoring_suggestions: Vec<RefactoringSuggestion>,
}Expand description
Container for an entity’s computed feature vector.
Fields§
§entity_id: EntityIdUnique identifier for the entity
features: HashMap<String, f64>Raw feature values as computed by extractors
normalized_features: HashMap<String, f64>Normalized feature values (after scoring pipeline)
metadata: HashMap<String, Value>Additional metadata about the entity or extraction process
refactoring_suggestions: Vec<RefactoringSuggestion>Refactoring suggestions generated during analysis
Implementations§
Source§impl FeatureVector
Factory, mutation, and analysis methods for FeatureVector.
impl FeatureVector
Factory, mutation, and analysis methods for FeatureVector.
Sourcepub fn new(entity_id: impl Into<EntityId>) -> Self
pub fn new(entity_id: impl Into<EntityId>) -> Self
Create a new empty feature vector for an entity
Sourcepub fn add_feature(&mut self, name: impl Into<String>, value: f64) -> &mut Self
pub fn add_feature(&mut self, name: impl Into<String>, value: f64) -> &mut Self
Add a feature value to the vector
Sourcepub fn get_feature(&self, name: &str) -> Option<f64>
pub fn get_feature(&self, name: &str) -> Option<f64>
Get a feature value by name
Sourcepub fn get_normalized_feature(&self, name: &str) -> Option<f64>
pub fn get_normalized_feature(&self, name: &str) -> Option<f64>
Get a normalized feature value by name
Sourcepub fn add_metadata(
&mut self,
key: impl Into<String>,
value: Value,
) -> &mut Self
pub fn add_metadata( &mut self, key: impl Into<String>, value: Value, ) -> &mut Self
Add metadata for the entity
Sourcepub fn add_suggestion(&mut self, suggestion: RefactoringSuggestion) -> &mut Self
pub fn add_suggestion(&mut self, suggestion: RefactoringSuggestion) -> &mut Self
Add a refactoring suggestion
Sourcepub fn feature_count(&self) -> usize
pub fn feature_count(&self) -> usize
Get the number of features in this vector
Sourcepub fn has_feature(&self, name: &str) -> bool
pub fn has_feature(&self, name: &str) -> bool
Check if the vector contains a specific feature
Sourcepub fn feature_names(&self) -> impl Iterator<Item = &String>
pub fn feature_names(&self) -> impl Iterator<Item = &String>
Get all feature names
Sourcepub fn cosine_similarity(&self, other: &Self) -> f64
pub fn cosine_similarity(&self, other: &Self) -> f64
Compute cosine similarity with another feature vector
Trait Implementations§
Source§impl Clone for FeatureVector
impl Clone for FeatureVector
Source§fn clone(&self) -> FeatureVector
fn clone(&self) -> FeatureVector
Returns a duplicate of the value. Read more
1.0.0 · 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 FeatureVector
impl Debug for FeatureVector
Source§impl<'de> Deserialize<'de> for FeatureVector
impl<'de> Deserialize<'de> for FeatureVector
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for FeatureVector
impl RefUnwindSafe for FeatureVector
impl Send for FeatureVector
impl Sync for FeatureVector
impl Unpin for FeatureVector
impl UnwindSafe for FeatureVector
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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