RangeFilter

Struct RangeFilter 

Source
pub struct RangeFilter { /* private fields */ }
Expand description

Thread-safe range filter for location-based species filtering

Implementations§

Source§

impl RangeFilter

Source

pub const fn builder() -> RangeFilterBuilder

Create a new range filter builder

Source

pub fn predict( &self, latitude: f32, longitude: f32, month: u32, day: u32, ) -> Result<Vec<LocationScore>>

Get species probability scores for given location and date

§Arguments
  • latitude - Latitude in degrees (-90 to 90)
  • longitude - Longitude in degrees (-180 to 180)
  • month - Month number (1-12)
  • day - Day of month (1-31)
§Returns

Vector of LocationScore sorted by score (descending)

§Errors

Returns error if:

  • Coordinates are invalid (latitude not in [-90, 90] or longitude not in [-180, 180])
  • Date parameters are invalid (month not in [1, 12] or day not in [1, 31])
  • Session lock is poisoned
  • ONNX inference fails
Source

pub fn filter_predictions( &self, predictions: &[Prediction], location_scores: &[LocationScore], rerank: bool, ) -> Vec<Prediction>

Filter predictions based on location scores from meta model

§Arguments
  • predictions - Original predictions from audio analysis
  • location_scores - Location-based species scores (from predict)
  • rerank - Whether to rerank by multiplying confidence by location score
§Returns

Filtered predictions, optionally reranked by location score

§Example
// Get location scores for a specific place and time
let location_scores = filter.predict(45.0, -122.0, 6, 15)?;

// Filter predictions to only include species likely at this location
let filtered = filter.filter_predictions(&predictions, &location_scores, false);
Source

pub fn filter_batch_predictions( &self, predictions_batch: Vec<Vec<Prediction>>, location_scores: &[LocationScore], rerank: bool, ) -> Vec<Vec<Prediction>>

Filter multiple prediction sets using location scores.

This is a convenience method for batch processing multiple audio files from the same location. Predict location scores once, then apply to multiple prediction sets.

§Arguments
  • predictions_batch - Vector of prediction vectors to filter
  • location_scores - Location scores from predict()
  • rerank - Whether to rerank each prediction set
§Returns

Vector of filtered prediction vectors

§Example
let location_scores = range_filter.predict(lat, lon, month, day)?;

let mut predictions_batch = Vec::new();
for segment in audio_segments {
    let result = classifier.predict(&segment)?;
    predictions_batch.push(result.predictions);
}

let filtered_batch = range_filter.filter_batch_predictions(
    predictions_batch,
    &location_scores,
    rerank,
);

Trait Implementations§

Source§

impl Clone for RangeFilter

Source§

fn clone(&self) -> RangeFilter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RangeFilter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more