pub struct MLService { /* private fields */ }Expand description
Machine Learning Service
Implementations§
Source§impl MLService
impl MLService
Sourcepub fn initialize(
&mut self,
features_dim: usize,
model_version: &str,
) -> AnyaResult<()>
pub fn initialize( &mut self, features_dim: usize, model_version: &str, ) -> AnyaResult<()>
Initialize the ML service with a specific model
Sourcepub fn analyze_proposal(
&self,
proposal: &Proposal,
) -> AnyaResult<HashMap<String, f64>>
pub fn analyze_proposal( &self, proposal: &Proposal, ) -> AnyaResult<HashMap<String, f64>>
Analyze a DAO proposal and return metrics
Sourcepub async fn train(
&mut self,
features: Vec<f64>,
labels: Vec<f64>,
) -> AnyaResult<()>
pub async fn train( &mut self, features: Vec<f64>, labels: Vec<f64>, ) -> AnyaResult<()>
Train the model with new data
Sourcepub async fn apply_federated_update(
&mut self,
weights: Vec<f64>,
) -> AnyaResult<()>
pub async fn apply_federated_update( &mut self, weights: Vec<f64>, ) -> AnyaResult<()>
Apply federated learning update
Sourcepub async fn predict_proposal_metrics(
&self,
proposal: &Proposal,
) -> AnyaResult<ProposalMetrics>
pub async fn predict_proposal_metrics( &self, proposal: &Proposal, ) -> AnyaResult<ProposalMetrics>
[AIR-3][AIS-3][BPC-3][RES-3] Predict proposal metrics based on proposal data This follows official Bitcoin Improvement Proposals (BIPs) standards for ML predictions
Sourcepub fn export_model(&self) -> AnyaResult<Vec<u8>>
pub fn export_model(&self) -> AnyaResult<Vec<u8>>
Export model to bytes for sharing
Sourcepub fn import_model(&mut self, bytes: &[u8]) -> AnyaResult<()>
pub fn import_model(&mut self, bytes: &[u8]) -> AnyaResult<()>
Import model from bytes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MLService
impl RefUnwindSafe for MLService
impl Send for MLService
impl Sync for MLService
impl Unpin for MLService
impl UnwindSafe for MLService
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> 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