Import dataset from JSON
As tree-garden data sets are nothing complex - just arrays of simple objects. You can import them as JSON files directly with a typescript.
For that you need to enable it in tsconfig.json:
{
"compilerOptions": {
"resolveJsonModule": true,
"..": "..."
}
}
Suppose I have json file, named dataSet.json, with content:
[
{"_class": "a","color": "blue"},
{"_class": "a","color": "green"},
{"_class": "b","color": "yellow"},
{"_class": "b","color": "black"}
]
This can be easily imported by typescript like that:
import { buildAlgorithmConfiguration } from 'tree-garden';
// json as dataset
import myDataSet from './dataSet.json';
myDataSet.forEach((sample) => console.log(sample));
const algConfig = buildAlgorithmConfiguration(myDataSet, {});
console.log('see mom, I have algorithm config from json dataset!');
console.log(algConfig);