Skip to content

Commit

Permalink
refactor(projectors): remove project_base from AdaptiveProjector
Browse files Browse the repository at this point in the history
  • Loading branch information
tspooner committed Apr 27, 2018
1 parent 15da5c2 commit 8ce8723
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
19 changes: 1 addition & 18 deletions src/projectors/adaptive/ifdd.rs
Expand Up @@ -94,7 +94,7 @@ impl<P: Projector<[f64]>> Space for IFDD<P> {

impl<P: Projector<[f64]>> Projector<[f64]> for IFDD<P> {
fn project(&self, input: &[f64]) -> Projection {
let mut p = self.project_base(input);
let mut p = self.base.project(input);
let np: Vec<usize> = (self.base.dim()..self.dim()).filter_map(|i| {

let f = &self.features[i];
Expand Down Expand Up @@ -149,10 +149,6 @@ impl<P: Projector<[f64]>> AdaptiveProjector<[f64]> for IFDD<P> {

Some(mapping)
}

fn project_base(&self, input: &[f64]) -> Projection {
self.base.project(input)
}
}


Expand Down Expand Up @@ -212,17 +208,4 @@ mod tests {
parent_indices: [0, 3].iter().cloned().collect(),
});
}

#[test]
fn test_project_base() {
let b = TileCoding::new(SHBuilder::default(), 8, 100);
let f = IFDD::new(b.clone(), 100.0);

assert_eq!(b.project(&vec![0.0, 1.0]), f.project_base(&vec![0.0, 1.0]));

let b = BaseProjector;
let f = IFDD::new(b.clone(), 100.0);

assert_eq!(b.project(&vec![0.0, 1.0]), f.project_base(&vec![0.0, 1.0]));
}
}
2 changes: 0 additions & 2 deletions src/projectors/mod.rs
Expand Up @@ -32,8 +32,6 @@ pub trait Projector<I: ?Sized>: Space<Value = Projection> {
pub trait AdaptiveProjector<I: ?Sized>: Projector<I> {
fn discover(&mut self, input: &I, error: f64) -> Option<HashMap<usize, IndexSet>>;
fn add_feature(&mut self, feature: CandidateFeature) -> Option<(usize, IndexSet)>;

fn project_base(&self, input: &I) -> Projection;
}

impl<P: Projector<[f64]>> Projector<Vec<f64>> for P {
Expand Down

0 comments on commit 8ce8723

Please sign in to comment.