tree traversal like the Python implementation#3
Open
dcolazin wants to merge 1 commit intojaren:masterfrom
Open
tree traversal like the Python implementation#3dcolazin wants to merge 1 commit intojaren:masterfrom
dcolazin wants to merge 1 commit intojaren:masterfrom
Conversation
I tried to replicate the first example in the paper, in the following way:
```
public static void main(String[] args) {
//generates the data
int n = 730;
int A = 50;
int center = 100;
int phi = 30;
double T = 2*Math.PI/100;
double[] sin = new double[n];
for (int i = 0; i < n; i++)
sin[i] = i >= 235 && i < 255 ? 80 : A*Math.sin(T*i-phi*T) + center;
//creates forest of empty trees with suitable shingle
int num_trees = 40;
int shingle_size = 4;
int tree_size = 256;
ShingledForest forest = new ShingledForest(shingle_size,num_trees,tree_size);
//calculates the codisp
double[] avg_codisp = new double[n];
for (int i = 0; i < n; i++) {
avg_codisp[i] = forest.addPoint(sin[i]);
System.out.println(i + " " + avg_codisp[i] + " " + sin[i]);
}
}
```
Yet, the JavaRRCF stops at i = 103 with
```
Exception in thread "main" java.lang.ClassCastException: class rrcf.Leaf cannot be cast to class rrcf.Branch (rrcf.Leaf and rrcf.Branch are in unnamed module of loader 'app')
at rrcf.Tree.insertPoint(Tree.java:288)
at rrcf.Forest.addPoint(Forest.java:55)
at rrcf.ShingledForest.addPoint(ShingledForest.java:60)
```
Using
```
c.value <= bbox[0][c.dim]
```
throws the same exception at i = 108.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I tried to replicate the first example in the paper, in the following way:
Yet, the JavaRRCF stops at i = 103 with
Using
throws the same exception at i = 108.