Export to GitHub

jbirch - How_to_run_JBIRCH.wiki


Please take a look at the TestX.java files, which should give you a good idea on how to run JBIRCH.

I get this question a lot: "what is the format of the dataset?"

The short answer is: whatever format you like, as long as in the end you translate each object into a pattern vector of Doubles.

For example, you can read a space-separated dataset as follows:

``` BufferedReader in = new BufferedReader(new FileReader(datasetFile)); String line = null; while((line=in.readLine())!=null) { String[] tmp = line.split("\s");

                    double[] x = new double[tmp.length];
                    for(int i=0; i<x.length; i++) {
                            x[i] = Double.parseDouble(tmp[i]);
                    }

                    // training birch, one instance at a time...
                    boolean inserted = birchTree.insertEntry(x);
                    if(!inserted) {
                            System.err.println("ERROR: NOT INSERTED!");
                            System.exit(1);
                    }
            }
            in.close();
            birchTree.finishedInsertingData();

```