Skip to content

Commit

Permalink
Cloneable model
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski authored and jjhbw committed Nov 1, 2020
1 parent 82baf6b commit 291c118
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/classifier/lab_boosted_classifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
use super::Score;
use crate::feat::LabBoostedFeatureMap;

#[derive(Clone)]
pub struct LabBoostedClassifier {
features: Vec<(i32, i32)>,
base_classifiers: Vec<BaseClassifier>,
}

#[derive(Clone)]
struct BaseClassifier {
weights: Vec<f32>,
thresh: f32,
Expand Down
1 change: 1 addition & 0 deletions src/classifier/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ impl Score {
}
}

#[derive(Clone)]
pub enum Classifier {
SurfMlp(SurfMlpClassifier),
LabBoosted(LabBoostedClassifier),
Expand Down
2 changes: 2 additions & 0 deletions src/classifier/surf_mlp_classifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ impl SurfMlpBuffers {
}
}

#[derive(Clone)]
pub struct SurfMlpClassifier {
feature_ids: Vec<i32>,
thresh: f32,
Expand Down Expand Up @@ -156,6 +157,7 @@ impl SurfMlpClassifier {
}
}

#[derive(Clone)]
struct Layer {
input_dim: usize,
output_dim: usize,
Expand Down
1 change: 1 addition & 0 deletions src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use std::io;
use crate::classifier::{Classifier, ClassifierKind, LabBoostedClassifier, SurfMlpClassifier};
use byteorder::{LittleEndian, ReadBytesExt};

#[derive(Clone)]
pub struct Model {
classifiers: Vec<Classifier>,
wnd_src_id: Vec<Vec<i32>>,
Expand Down

0 comments on commit 291c118

Please sign in to comment.