Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Jun 10, 2021
1 parent 501b06e commit ab72f40
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 6 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Authors@R:
role = "aut",
email = "wouter.saelens@gmail.com",
comment = c(ORCID = "0000-0002-7114-6248", github = "zouter")))
Description: Calculating feature importance scores from trajectories using the random forests algorithm and more.
Description: Calculating feature importance scores from trajectories using the random forests algorithm and more. Saelens and Cannoodt et
al. (2019) <doi:10.1038/s41587-019-0071-9>.
License: GPL-3
Encoding: UTF-8
Imports:
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Initial release of dynfeature on CRAN.

* MINOR CHANGE: Support sparse matrices.

* DOCUMENTATION: Add examples.
* DOCUMENTATION: Add examples and returns.

# dynfeature 0.2.0 (25-10-2018)

Expand Down
9 changes: 9 additions & 0 deletions R/calculate_feature_importances.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
#' @param Y A data frame of predictor variables, with `nrow(Y) == nrow(X)`.
#' @param fi_method A feature importance method. Default: `fi_ranger_rf_lite()`. Check `?fi_methods` for a full list of available feature importance methods.
#' @param verbose Whether to print out extra information.
#'
#' @returns A data frame with three columns, `predictor_id`, `feature_id`, and `importance`. `predictor_id` is a column in `Y`, while `feature_id` is a column in `X`.
#'
#' @examples
#' X <- data.frame(matrix(runif(25*10), ncol = 10))
#' Y <- data.frame(matrix(runif(25*2), ncol = 2))
#'
#' # don't run since this function is not exported
#' # calculate_feature_importances(X, Y)
calculate_feature_importances <- function(
X,
Y,
Expand Down
2 changes: 2 additions & 0 deletions R/calculate_overall_feature_importance.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#' @param milestones_oi The milestone(s) for which to calculate feature importance
#' @param waypoints The waypoints, optional
#'
#' @returns A data frame with two or more columns, `feature_id`, and `importance`. `feature_id` is a column in the trajectory expression matrix. Additional columns may be available depending on the function called.
#'
#' @inheritParams calculate_feature_importances
#'
#' @importFrom reshape2 acast
Expand Down
4 changes: 3 additions & 1 deletion R/fi_methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ apply_function_params <- function(params, nrow, ncol) {
#' @param num_variables_per_split (fi_ranger_rf_lite) The number of variables to sample per split
#' @param num_samples_per_tree (fi_ranger_rf_lite) The number of samples to bootstrap per split
#' @param min_node_size (fi_ranger_rf_lite) The minimum node size, no split will be made if the node size is less than this value.
#' @param ... Extra parameters to pass onto the underlying feature importnce function.
#' @param ... Extra parameters to pass onto the underlying feature importance function.
#'
#' @returns A list containing a helper function for calling a feature importance function.
#'
#' @rdname fi_methods
#'
Expand Down
8 changes: 6 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Initial release of dynfeature on CRAN.

* MINOR CHANGE: Support sparse matrices.

* DOCUMENTATION: Add examples.
* DOCUMENTATION: Add examples and returns.

## Test environments
* local Fedora install, R 4.0
Expand All @@ -17,6 +17,10 @@ Initial release of dynfeature on CRAN.

```
── R CMD check results ─────────────────────────────────── dynfeature 1.0.0 ────
...
Duration: 3m 0.1s
0 errors ✓ | 0 warnings ✓ | 0 notes ✓
R CMD check succeeded
```

10 changes: 10 additions & 0 deletions man/calculate_feature_importances.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/calculate_overall_feature_importance.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/fi_methods.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ab72f40

Please sign in to comment.