Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.0%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: theogrost
- License: other
- Language: R
- Default Branch: master
- Size: 179 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
MLmorph
MLmorph integrates morphological modeling with machine learning (random forests) to support structured decision-making. The package enumerates a morphospace—the set of feasible configurations across selected variables—and estimates class probabilities over that space. It includes:
- utilities for factorizing inputs into analysis-ready factors,
- a wrapper to train random forest classifiers and report validation performance,
- construction of morphospaces with predicted probabilities and a flag for purely simulated combinations,
- a Shiny app for interactive scenario exploration.
Installation
```r
install.packages("devtools")
devtools::install_github("theogrost/MLmorph") ```
Quick start
```r library(MLmorph)
set.seed(1) n <- 120 y <- factor(sample(letters[1:3], n, TRUE)) x1 <- factorizenumericvector(runif(n, 10, 20), breaksno = 3) x2 <- factorizenumericvector(runif(n, 1, 2), breaksno = 4) df <- data.frame(y, x1, x2)
1) Train a random forest and validate on a holdout
fit <- createrfmodel(df, dependent = "y", ntree = 100, trainvalidatesplit = 0.75) fit$model # randomForest object head(fit$variablesimportance) # importance per predictor fit$modelperformanceontest # caret::confusionMatrix ```
Morphospace: predicted probabilities over all configurations
```r ms <- create_morphospace(df, fit$model)
str(ms$morphospace)
Columns: predictors (x1, x2), '' (class label), 'calculated' (probability),
'purely_simulated' (TRUE if configuration not observed in df)
Example: top 10 configurations by predicted probability
head(ms$morphospace[order(ms$morphospace$calculated, decreasing = TRUE), ], 10)
Probability mass per class (sums to 1 for each unique predictor combination)
aggregate(calculated ~ x1 + x2, data = ms$morphospace, sum) ```
Factorization helpers
```r
Numeric → ordered factor via equal-frequency bins (default)
z <- runif(12) fz <- factorizenumericvector(z, breaks_no = 3)
Logical → factor with labeled levels
fb <- factorizebinaryvector(c(TRUE, FALSE, TRUE))
Character → factor with stable, numbered labels
fc <- factorizecharactervector(c("alpha", "beta", "alpha"))
Apply heuristics column-wise
df2 <- factorizenicelydataframe(data.frame( a = runif(20), b = c(TRUE, FALSE), c = c("x","y","x","z") )) str(df2) ```
Loading data from files
```r
CSV
tmpcsv <- tempfile(fileext = ".csv") utils::write.csv(data.frame(a = 1:3, b = c("x","y","z")), tmpcsv, row.names = FALSE) datcsv <- loaddata(tmp_csv)
JSON
tmpjson <- tempfile(fileext = ".json") jsonlite::writejson(list(a = 1:2, b = c("u","v")), tmpjson, autounbox = TRUE) datjson <- loaddata(tmp_json)
XLSX
tmpxlsx <- tempfile(fileext = ".xlsx") openxlsx::write.xlsx(data.frame(a = 1:2, b = c("m","n")), tmpxlsx) datxlsx <- loaddata(tmp_xlsx) ```
Shiny app
```r
Launch the interactive app from the installed package
(opens in browser; not run during automated checks)
MLmorph()
```
Reproducibility and citation
To ensure reproducibility, record:
- the variable set and factorization (binning method and parameters),
- model hyperparameters (e.g., ntree),
- the random seed and train/validate split.
If you use MLmorph in research or consulting reports, please cite the package and your model specification.
License
MIT © Oskar Kosch. See LICENSE.md for details.
Issues
Please report bugs or feature requests at this repository's Issues page.
Owner
- Login: theogrost
- Kind: user
- Repositories: 1
- Profile: https://github.com/theogrost
GitHub Events
Total
- Push event: 3
Last Year
- Push event: 3
Packages
- Total packages: 1
- Total downloads: unknown
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 1
cran.r-project.org: MLmorph
Integrating Morphological Modeling and Machine Learning for Decision Support
- Homepage: https://github.com/theogrost/MLmorph
- Documentation: http://cran.r-project.org/web/packages/MLmorph/MLmorph.pdf
- License: MIT + file LICENSE
-
Latest release: 0.1.0
published 10 months ago
Rankings
Maintainers (1)
Dependencies
- R >= 4.3.0 depends
- caret >= 6.0.94 imports
- jsonlite >= 1.8.8 imports
- magrittr * imports
- openxlsx >= 4.2.5.2 imports
- randomForest >= 4.7.1.1 imports
- shiny >= 1.10.0 imports
- stats >= 4.3.0 imports
- tidyr >= 1.3.1 imports
- utils >= 4.3.0 imports
- testthat >= 3.0.0 suggests