Skip to content

Commit

Permalink
add example describing one-hot encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
slowkow committed May 15, 2024
1 parent c3f933d commit ae1ca3a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions vignettes/articles/examples.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@ each position:
a$onehot[1:5,1:25]
```

What is a one-hot encoded matrix?
Here is a simple example to demonstrate the idea:

```{r}
dat <- data.frame(
V1 = c("A", "A", "B"),
V2 = c("B", "B", "B"),
V3 = c("C", "B", "B"),
stringsAsFactors = TRUE
)
dat
predict(onehot::onehot(dat), dat)
```

# Convert genotypes to a dosage matrix

Suppose we have some individuals with the following genotypes:
Expand Down

0 comments on commit ae1ca3a

Please sign in to comment.