void SetUp() {
    shared_ptr<table::column_table> nn_table(new table::column_table);
    shared_ptr<nearest_neighbor_base> nn_engine(new NearestNeighborMethod(
        typename NearestNeighborMethod::config(), nn_table, ID));
    light_lof_.reset(new light_lof(light_lof::config(), ID, nn_engine));

    mtr_ = jubatus::util::math::random::mtrand(SEED);
  }
Example #2
0
TYPED_TEST_P(lof_test, config_validation) {
  shared_ptr<TypeParam> nn_engine(new TypeParam);
  shared_ptr<lof> l;
  lof_storage::config c;

  c.reverse_nearest_neighbor_num = 10;

  // nearest_neighbor_num <= 2
  c.nearest_neighbor_num = 1;
  ASSERT_THROW(l.reset(new lof(c, nn_engine)), common::invalid_parameter);

  c.nearest_neighbor_num = 2;
  ASSERT_NO_THROW(l.reset(new lof(c, nn_engine)));

  c.nearest_neighbor_num = 3;
  ASSERT_NO_THROW(l.reset(new lof(c, nn_engine)));

  // nearest_neighbor_num <= reverse_nearest_neighbor_num
  c.reverse_nearest_neighbor_num = 2;
  ASSERT_THROW(l.reset(new lof(c, nn_engine)), common::invalid_parameter);

  c.reverse_nearest_neighbor_num = 3;
  ASSERT_NO_THROW(l.reset(new lof(c, nn_engine)));
}