Skip to content

Commit 68982ee

Browse files
committed
update readme with DOI
1 parent c199322 commit 68982ee

File tree

1 file changed

+53
-9
lines changed

1 file changed

+53
-9
lines changed

README.md

Lines changed: 53 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![CI](https://github.com/JuliaAI/DecisionTree.jl/workflows/CI/badge.svg)](https://github.com/JuliaAI/DecisionTree.jl/actions?query=workflow%3ACI)
44
[![Codecov](https://codecov.io/gh/JuliaAI/DecisionTree.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaAI/DecisionTree.jl)
55
[![Docs Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliahub.com/docs/DecisionTree/pEDeB/0.10.11/)
6+
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7359268.svg)](https://doi.org/10.5281/zenodo.7359268)
67

78
Julia implementation of Decision Tree (CART) and Random Forest algorithms
89

@@ -44,11 +45,15 @@ Available models: `DecisionTreeClassifier, DecisionTreeRegressor, RandomForestCl
4445
See each model's help (eg. `?DecisionTreeRegressor` at the REPL) for more information
4546

4647
### Classification Example
48+
4749
Load DecisionTree package
50+
4851
```julia
4952
using DecisionTree
5053
```
54+
5155
Separate Fisher's Iris dataset features and labels
56+
5257
```julia
5358
features, labels = load_data("iris") # also see "adult" and "digits" datasets
5459

@@ -57,7 +62,9 @@ features, labels = load_data("iris") # also see "adult" and "digits" datasets
5762
features = float.(features)
5863
labels = string.(labels)
5964
```
65+
6066
Pruned Tree Classifier
67+
6168
```julia
6269
# train depth-truncated classifier
6370
model = DecisionTreeClassifier(max_depth=2)
@@ -78,8 +85,11 @@ accuracy = cross_val_score(model, features, labels, cv=3)
7885
Also, have a look at these [classification](https://github.com/cstjean/ScikitLearn.jl/blob/master/examples/Classifier_Comparison_Julia.ipynb) and [regression](https://github.com/cstjean/ScikitLearn.jl/blob/master/examples/Decision_Tree_Regression_Julia.ipynb) notebooks.
7986

8087
## Native API
88+
8189
### Classification Example
90+
8291
Decision Tree Classifier
92+
8393
```julia
8494
# train full-tree classifier
8595
model = build_tree(labels, features)
@@ -129,6 +139,7 @@ accuracy = nfoldCV_tree(labels, features,
129139
rng = seed)
130140
```
131141
Random Forest Classifier
142+
132143
```julia
133144
# train random forest classifier
134145
# using 2 random features, 10 trees, 0.5 portion of samples per tree, and a maximum tree depth of 6
@@ -176,7 +187,9 @@ accuracy = nfoldCV_forest(labels, features,
176187
verbose = true,
177188
rng = seed)
178189
```
190+
179191
Adaptive-Boosted Decision Stumps Classifier
192+
180193
```julia
181194
# train adaptive-boosted stumps, using 7 iterations
182195
model, coeffs = build_adaboost_stumps(labels, features, 7);
@@ -193,13 +206,15 @@ accuracy = nfoldCV_stumps(labels, features,
193206
```
194207

195208
### Regression Example
209+
196210
```julia
197211
n, m = 10^3, 5
198212
features = randn(n, m)
199213
weights = rand(-2:2, m)
200214
labels = features * weights
201215
```
202216
Regression Tree
217+
203218
```julia
204219
# train regression tree
205220
model = build_tree(labels, features)
@@ -238,7 +253,9 @@ r2 = nfoldCV_tree(labels, features,
238253
verbose = true,
239254
rng = seed)
240255
```
256+
241257
Regression Random Forest
258+
242259
```julia
243260
# train regression forest, using 2 random features, 10 trees,
244261
# averaging of 5 samples per leaf, and 0.7 portion of samples per tree
@@ -285,6 +302,14 @@ r2 = nfoldCV_forest(labels, features,
285302
rng = seed)
286303
```
287304

305+
## Saving Models
306+
Models can be saved to disk and loaded back with the use of the [JLD2.jl](https://github.com/JuliaIO/JLD2.jl) package.
307+
```julia
308+
using JLD2
309+
@save "model_file.jld2" model
310+
```
311+
Note that even though features and labels of type `Array{Any}` are supported, it is highly recommended that data be cast to explicit types (ie with `float.(), string.()`, etc). This significantly improves model training and prediction execution times, and also drastically reduces the size of saved models.
312+
288313
## MLJ.jl API
289314

290315
To use DecsionTree.jl models in
@@ -318,15 +343,6 @@ The following methods provide measures of feature importance for all models:
318343
`impurity_importance`, `split_importance`, `permutation_importance`. Query the document
319344
strings for details.
320345

321-
322-
## Saving Models
323-
Models can be saved to disk and loaded back with the use of the [JLD2.jl](https://github.com/JuliaIO/JLD2.jl) package.
324-
```julia
325-
using JLD2
326-
@save "model_file.jld2" model
327-
```
328-
Note that even though features and labels of type `Array{Any}` are supported, it is highly recommended that data be cast to explicit types (ie with `float.(), string.()`, etc). This significantly improves model training and prediction execution times, and also drastically reduces the size of saved models.
329-
330346
## Visualization
331347
A `DecisionTree` model can be visualized using the `print_tree`-function of its native interface
332348
(for an example see above in section 'Classification Example').
@@ -335,3 +351,31 @@ In addition, an abstraction layer using `AbstractTrees.jl` has been implemented
335351

336352
Apart from this, `AbstractTrees.jl` brings its own implementation of `print_tree`.
337353

354+
355+
## Citing the package in publications
356+
357+
DOI: [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7359268.svg)](https://doi.org/10.5281/zenodo.7359268).
358+
359+
BibTeX entry:
360+
361+
```
362+
@software{ben_sadeghi_2022_7359268,
363+
author = {Ben Sadeghi and
364+
Poom Chiarawongse and
365+
Kevin Squire and
366+
Daniel C. Jones and
367+
Cédric St-Jean and
368+
Rik Huijzer and
369+
Ian Butterworth and
370+
Anthony Blaom},
371+
title = {{DecisionTree.jl - A Julia implementation of the
372+
CART Decision Tree and Random Forest algorithms}},
373+
month = nov,
374+
year = 2022,
375+
publisher = {Zenodo},
376+
version = {0.11.3},
377+
doi = {10.5281/zenodo.7359268},
378+
url = {https://doi.org/10.5281/zenodo.7359268}
379+
}
380+
```
381+
>

0 commit comments

Comments
 (0)