Skip to content

Commit

Permalink
Merge pull request #50 from ndphillips/order_fix
Browse files Browse the repository at this point in the history
Created version 1..6.1
  • Loading branch information
ndphillips authored Oct 24, 2021
2 parents 2444c3b + c3e32e6 commit d688578
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 34 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: FFTrees
Type: Package
Title: Generate, Visualise, and Evaluate Fast-and-Frugal Decision Trees
Version: 1.6.0
Date: 2020-11-10
Version: 1.6.1
Date: 2021-10-24
Authors@R: c(person("Nathaniel", "Phillips", role = c("aut", "cre"),
email = "Nathaniel.D.Phillips.is@gmail.com"),
person("Hansjoerg", "Neth", role = "aut"),
Expand Down
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# FFTrees Development
# FFTrees 1.6

## 1.6.1

* `plot.FFTrees` no longer saves graphic params changed in `par()`
* `plot.FFTRrees`: When `test = 'best.test'` and no test data are provided, the information text is no returned with `message()` rather than `print()`
* Deprecation notes in `plot.FFTrees` are now returned as warnings, not messages


# FFTrees 1.5

## 1.5.7
Expand Down
12 changes: 9 additions & 3 deletions R/fftrees_threshold_factor_grid.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ testthat::expect_true(!any(is.na(cue_v)))
results <- cbind(results, Add_Stats(results,
sens.w = sens.w,
cost.outcomes = cost.outcomes))
results <- results[order(-results[goal.threshold]),]

# Order by goal.threshold and change column order
ord_new <- order(results[, goal.threshold], decreasing = TRUE)

results <- results[ord_new, ]

# Loop 2 over cumulative thresholds
# C++
Expand Down Expand Up @@ -128,10 +132,12 @@ testthat::expect_true(!any(is.na(cue_v)))
# Add accuracy statistics
results <- cbind(results, new_stats)


# Order by goal.threshold and change column order
results <- results[order(-results[goal.threshold]), c("threshold", "direction", "n", "hi", "fa", "mi", "cr", "sens", "spec", "ppv", "npv", "bacc", "acc", "wacc", "cost_decisions", "cost")]
ord_new <- order(results[,goal.threshold], decreasing = TRUE)

results <- results[ord_new, c("threshold", "direction", "n", "hi", "fa", "mi", "cr",
"sens", "spec", "ppv", "npv", "bacc", "acc", "wacc",
"cost_decisions", "cost")]

# Remove invalid directions
results[results$direction %in% directions, ]
Expand Down
8 changes: 6 additions & 2 deletions R/fftrees_threshold_numeric_grid.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ fftrees_threshold_numeric_grid <- function(thresholds,

results <- rbind(results_gt, results_lt)

}

}

new_stats <- Add_Stats(results,
sens.w = sens.w,
Expand All @@ -93,7 +93,11 @@ fftrees_threshold_numeric_grid <- function(thresholds,
results <- cbind(results, new_stats)

# Order by goal.threshold and change column order
results <- results[order(-results[goal.threshold]), c("threshold", "direction", "n", "hi", "fa", "mi", "cr", "sens", "spec", "ppv", "npv", "bacc", "acc", "wacc", "cost_decisions", "cost")]
ord_new <- order(results[,goal.threshold], decreasing = TRUE)

results <- results[ord_new, c("threshold", "direction", "n", "hi", "fa", "mi", "cr",
"sens", "spec", "ppv", "npv", "bacc", "acc", "wacc",
"cost_decisions", "cost")]

# Remove invalid directions
results[results$direction %in% directions, ]
Expand Down
7 changes: 5 additions & 2 deletions R/showcues_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ if(nrow(cue.df) < top) {top <- nrow(cue.df)}

cue.df$rank <- rank(-cue.df$wacc, ties.method = "first")

cue.df <- cue.df[order(cue.df$rank),]

# Order by goal.threshold and change column order
ord_new <- order(cue.df$rank)

cue.df <- cue.df[ord_new, ]

cue.df$col <- rep(palette, length.out = nrow(cue.df))

Expand All @@ -88,7 +92,6 @@ if(is.null(main)) {
main <- "Individual Cue Accuracies"
} else {main <- x$params$main}


}

plot(1, xlim = c(0, 1), ylim = c(0, 1), type = "n",
Expand Down
47 changes: 23 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[![Build
Status](https://travis-ci.org/ndphillips/FFTrees.svg?branch=master)](https://travis-ci.org/ndphillips/FFTrees)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/FFTrees)](https://CRAN.R-project.org/package=FFTrees)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/FFTrees)](https://CRAN.R-project.org/package=FFTrees)
[![Rdoc](https://www.rdocumentation.org/badges/version/FFTrees)](https://www.rdocumentation.org/packages/FFTrees)
[![Downloads](https://cranlogs.r-pkg.org/badges/FFTrees?color=brightgreen)](https://www.r-pkg.org/pkg/FFTrees)

Expand Down Expand Up @@ -39,16 +39,16 @@ library(FFTrees)
#> / \
#> F O
#> / \
#> F Trees 1.6.0
#> F Trees 1.6.1
#>
#> Email: Nathaniel.D.Phillips.is@gmail.com
#> LinkedIn: linkedin.com/in/nathanieldphillips/
#> FFTrees.guide() opens the main guide.
```

Let’s create a fast-and-frugal tree predicting heart disease status
(“Healthy” vs. “Diseased”) based on a `heart.train` dataset, and test
it on `heart.test` a testing dataset.
(“Healthy” vs. “Diseased”) based on a `heart.train` dataset, and test it
on `heart.test` a testing dataset.

Here are the first new rows and columns of our datasets. The key column
is `diagnosis`, a logical column (TRUE and FALSE) which indicate, for
Expand Down Expand Up @@ -150,25 +150,24 @@ plot(heart.fft,
<img src="man/figures/README-example-1.png" width="80%" />

``` r

# Compare results across algorithms in test data
heart.fft$competition$test
#> algorithm n hi fa mi cr sens spec far ppv npv
#> 1 fftrees 153 64 19 9 61 0.8767123 0.7625 0.2375 0.7710843 0.8714286
#> 2 lr 153 55 13 18 67 0.7534247 0.8375 0.1625 0.8088235 0.7882353
#> 3 cart 153 50 19 23 61 0.6849315 0.7625 0.2375 0.7246377 0.7261905
#> 4 rf 153 58 6 15 74 0.7945205 0.9250 0.0750 0.9062500 0.8314607
#> 4 rf 153 56 6 17 74 0.7671233 0.9250 0.0750 0.9032258 0.8131868
#> 5 svm 153 55 7 18 73 0.7534247 0.9125 0.0875 0.8870968 0.8021978
#> acc bacc cost cost_decisions cost_cues
#> 1 0.8169935 0.8196062 0.1830065 0.1830065 0
#> 2 0.7973856 0.7954623 0.2026144 0.2026144 NA
#> 3 0.7254902 0.7237158 0.2745098 0.2745098 NA
#> 4 0.8627451 0.8597603 0.1372549 0.1372549 NA
#> 4 0.8496732 0.8460616 0.1503268 0.1503268 NA
#> 5 0.8366013 0.8329623 0.1633987 0.1633987 NA
```

Because fast-and-frugal trees are so simple, you can create one ‘from
words’ and apply it to data\!
words’ and apply it to data!

``` r
# Create your own custom FFT 'in words' and apply it to data
Expand Down Expand Up @@ -204,7 +203,7 @@ Phillips, Nathaniel D., Neth, Hansjoerg, Woike, Jan K., & Gaissmaier, W.
fast-and-frugal decision trees. *Judgment and Decision Making*, 12(4),
344-368.

We had a lot of fun creating FFTrees and hope you like it too\! We have
We had a lot of fun creating FFTrees and hope you like it too! We have
an article introducing the `FFTrees` package in the journal Judgment and
Decision Making titled FFTrees: [A toolbox to create, visualize,and
evaluate fast-and-frugal decision
Expand All @@ -219,29 +218,29 @@ Here are some example publications that have used FFTrees (find the full
list at [Google
Scholar](https://scholar.google.com/scholar?oi=bibs&hl=en&cites=205528310591558601))

- [Lötsch, J., Haehner, A., & Hummel, T. (2020).
- [Lötsch, J., Haehner, A., & Hummel, T. (2020).
Machine-learning-derived rules set excludes risk of Parkinson’s
disease in patients with olfactory or gustatory symptoms with high
accuracy. Journal of
Neurology, 267(2), 469-478.](https://link.springer.com/article/10.1007/s00415-019-09604-6)
- [Kagan, R., Parlee, L., Beckett, B., Hayden, J. B., Gundle, K. R., &
accuracy. Journal of Neurology, 267(2),
469-478.](https://link.springer.com/article/10.1007/s00415-019-09604-6)
- [Kagan, R., Parlee, L., Beckett, B., Hayden, J. B., Gundle, K. R., &
Doung, Y. C. (2020). Radiographic parameter-driven decision tree
reliably predicts aseptic mechanical failure of compressive
osseointegration fixation. Acta
Orthopaedica, 91(2), 171-176.](https://www.tandfonline.com/doi/full/10.1080/17453674.2020.1716295)
- [Klement, R. J., Sonke, J. J., Allgäuer, M., Andratschke, N.,
osseointegration fixation. Acta Orthopaedica, 91(2),
171-176.](https://www.tandfonline.com/doi/full/10.1080/17453674.2020.1716295)
- [Klement, R. J., Sonke, J. J., Allgäuer, M., Andratschke, N.,
Appold, S., Belderbos, J., … & Mantel, F. (2020). Correlating dose
variables with local tumor control in stereotactic body radiotherapy
for early stage non-small cell lung cancer: A modelling study
on 1500 individual treatments. International Journal of Radiation
for early stage non-small cell lung cancer: A modelling study on
1500 individual treatments. International Journal of Radiation
Oncology\* Biology\*
Physics.](https://www.sciencedirect.com/science/article/pii/S036030162030897X)
- [Nobre, G. G., Hunink, J. E., Baruth, B., Aerts, J. C., & Ward, P.
- [Nobre, G. G., Hunink, J. E., Baruth, B., Aerts, J. C., & Ward, P.
J. (2019). Translating large-scale climate variability into crop
production forecast in Europe. Scientific
reports, 9(1), 1-13.](https://www.nature.com/articles/s41598-018-38091-4)
- [Buchinsky, F. J., Valentino, W. L., Ruszkay, N., Powell, E.,
production forecast in Europe. Scientific reports, 9(1),
1-13.](https://www.nature.com/articles/s41598-018-38091-4)
- [Buchinsky, F. J., Valentino, W. L., Ruszkay, N., Powell, E.,
Derkay, C. S., Seedat, R. Y., … & Mortelliti, A. J. (2019). Age at
diagnosis, but not HPV type, is strongly associated with clinical
course in recurrent respiratory papillomatosis. PloS
one, 14(6).](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6563955/)
course in recurrent respiratory papillomatosis. PloS one,
14(6).](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6563955/)
Binary file modified man/figures/README-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-unnamed-chunk-5-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed tests/testthat/Rplots.pdf
Binary file not shown.

0 comments on commit d688578

Please sign in to comment.