-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.rmd
More file actions
53 lines (39 loc) · 1.27 KB
/
README.rmd
File metadata and controls
53 lines (39 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
title: "README.rmd"
author: "Jake S. Rhodes"
date: "2/9/2022"
output: rmarkdown::github_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# RF-GAP
## Random Forest Geometry- and Accuracy-Preserving proximities
This is the official repository for the papr "Random Forest- Geometry- and Accuracy-Preserving Proximities" (https://arxiv.org/abs/2201.12682). In the paper we show that random forest (RF) predictions can be exactly determined by using RF-GAP proximities as weights in a weighted-sum regressor or weighted-majority vote classifier. This repo provides the base code to generate the various proximity definitions described in the paper. We provide some examples below.
## Generate RF-GAP proximities:
```{r rfgap}
library(rfgap)
x <- iris[, 1:4]
y <- iris[, 5]
prox <- get_proximities(x, y, type = 'rfgap')
```
## Create 2-dimensional MDS embedding and plot
```{r}
x <- iris[, 1:4]
y <- iris[, 5]
mds <- rf_mds(x, y, type = 'rfgap')
plot(mds, y)
```
## Impute missing data
```{r}
x <- airquality[, -4]
y <- airquality[, 4]
imputed_data <- rf_impute(x, y, type = 'rfgap')
```
## Run Outlier Detection
```{r}
x <- mtcars[, -c(1, 2)]
y <- as.factor(mtcars[, 2])
outlier_scores <- rf_outliers(x, y, type = 'rfgap')
plot(outlier_scores, x, y)
```