Skip to content

Commit

Permalink
Updated RCF to 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Feb 5, 2024
1 parent f7e20ae commit 54bc352
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 59 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 0.2.0 (unreleased)

- Updated RCF to 4.0.0

## 0.1.1 (2022-11-06)

- Added support for parameters
Expand Down
53 changes: 10 additions & 43 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -12,7 +12,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
rcf = { git = "https://github.com/aws/random-cut-forest-by-aws" }
rcf = { git = "https://github.com/aws/random-cut-forest-by-aws", tag = "4.0.0-java" }

[lib]
name = "rcf"
Expand Down
34 changes: 19 additions & 15 deletions src/lib.rs
@@ -1,6 +1,6 @@
#![allow(clippy::missing_safety_doc)]

use rcflib::rcf::{create_rcf, RCF};
use rcflib::rcf::{RCFBuilder, RCFOptionsBuilder, RCF};
use std::ffi::{c_char, c_int, CStr};
use std::slice;

Expand All @@ -25,20 +25,24 @@ unsafe fn ensure_forest(forest: *mut rcf_forest) {
let initial_accept_fraction = 1.0;
let bounding_box_cache_fraction = 1.0;

(*forest).rcf = Some(create_rcf(
(*forest).dimensions,
(*forest).shingle_size,
(*forest).sample_size,
(*forest).number_of_trees,
(*forest).random_seed,
store_attributes,
(*forest).parallel,
internal_shingling,
internal_rotation,
time_decay,
initial_accept_fraction,
bounding_box_cache_fraction,
));
(*forest).rcf = Some(
RCFBuilder::<u64, u64>::new(
(*forest).dimensions / (*forest).shingle_size,
(*forest).shingle_size,
)
.tree_capacity((*forest).sample_size)
.number_of_trees((*forest).number_of_trees)
.random_seed((*forest).random_seed)
.store_attributes(store_attributes)
.parallel_enabled((*forest).parallel)
.internal_shingling(internal_shingling)
.internal_rotation(internal_rotation)
.time_decay(time_decay)
.initial_accept_fraction(initial_accept_fraction)
.bounding_box_cache_fraction(bounding_box_cache_fraction)
.build_default()
.unwrap(),
);
}
}

Expand Down

0 comments on commit 54bc352

Please sign in to comment.