|
a |
|
b/pamr.train.R |
|
|
1 |
pamr.train <- |
|
|
2 |
function (data, n.threshold = 30, offset.percent = 50, remove.zeros = TRUE) |
|
|
3 |
{ |
|
|
4 |
this.call <- match.call() |
|
|
5 |
if (!is.null(data$y)) { |
|
|
6 |
problem.type <- "class" |
|
|
7 |
} |
|
|
8 |
|
|
|
9 |
y <- as.factor(data$y) |
|
|
10 |
|
|
|
11 |
ytest <- NULL |
|
|
12 |
xtest <- NULL |
|
|
13 |
|
|
|
14 |
prior <- table(y)/length(y) |
|
|
15 |
|
|
|
16 |
junk <- nsc(data$x, y = y, offset.percent = offset.percent, n.threshold = n.threshold, prior = prior, |
|
|
17 |
remove.zeros = remove.zeros) |
|
|
18 |
|
|
|
19 |
junk$call <- this.call |
|
|
20 |
junk$problem.type <- problem.type |
|
|
21 |
class(junk) = "pamrtrained" |
|
|
22 |
junk |
|
|
23 |
} |