Practical overview
When it fits
Use rrcf when implementing Robust Random Cut Forest outlier detection for streaming data or when you need the documented RCTree operations.
Who it is for
- Developers building streaming-data anomaly detection workflows.
- Users who need direct operations for inserting, querying or scoring points in an RCTree.
Documented uses
- Insert points into a tree and calculate displacement-based scores.
- Query a tree for the nearest leaf or check whether a point is a duplicate.
- Serialize an RCTree to a nested dictionary and restore it later.
Requirements & limits
- The documented RCTree methods include point insertion and deletion, nearest-leaf queries, duplicate checks, bounding-box calculation and displacement scores.
- The documentation describes serialization through nested dictionaries, with JSON shown as an example.
- The project description identifies ensemble and batch anomaly-detection workflows, while the supplied API page focuses on individual RCTree operations.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Insert a point and compute its collusive displacement
Add a point to an RCTree and obtain its collusive displacement score.
Before you start
- An
rrcf.RCTreeinstance. - A point represented as a NumPy array with shape 1 × d.
- A hashable identifier for the new leaf.
Steps
Create an RCTree, optionally initialized with data.
Insert the point using
tree.insert_point(point, index=identifier).Compute the score with
tree.codisp(identifier).
Expected outcome
The point is stored as a leaf, and `codisp` returns its collusive displacement as a float.
Guide limitations
- The documentation does not specify score thresholds or how to interpret a score as an anomaly decision.
- Insertion accepts a tolerance for duplicate-point handling, but its default behavior is not further described.
Serialize an RCTree and restore it from a dictionary
Save an RCTree as a nested dictionary and create a new tree from that representation.
Before you start
- An
rrcf.RCTreeinstance to serialize. - A nested dictionary representing an RCTree to restore; the documentation shows JSON as one way to write and read the dictionary.
Steps
Call
tree.to_dict()to obtain the nested dictionary.Write the dictionary to a file with JSON, as shown in the API example, if file storage is needed.
Read the dictionary back from the file if applicable.
Call
rrcf.RCTree.from_dict(obj)to create a new RCTree from the dictionary.
Expected outcome
A new RCTree instance is created from the serialized tree representation.
Guide limitations
- The API documentation does not describe compatibility or validation requirements for serialized dictionaries.
- Using
load_dict(obj)instead offrom_dict(obj)replaces all data in the current RCTree.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 7 November 2026
- Original website title
- rrcf 🌲🌲🌲 | rrcf · Official homepage title · retained in its source language

