Description Usage Arguments Value Examples
Top Terms Function
1 2 |
x |
the input matrix of terms to be selected. |
w |
optional argument. the input matrix of structured data to not be selected. |
y |
the response variable |
alpha |
the glmnet alpha |
lambda |
the glmnet lambda |
k |
the k top terms |
wordcloud |
set TRUE to plot the wordcloud |
max.words |
the maximum number of words in the wordcloud |
scale |
the wordcloud size. |
rot.per |
wordcloud proportion 90 degree terms |
family |
glmnet family |
the top k terms and the corresponding wordcloud.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | set.seed(1)
data("stock_data")
data("news_data")
y=as.matrix(stock_data[,2])
w=as.matrix(stock_data[,3])
data("news_data")
X=news_data[,2:ncol(news_data)]
x=as.matrix(X)
grid_alphas=seq(by=0.05,to=0.95,from=0.05)
cont_folds=TRUE
t=length(y)
optimal_alphas=optimal_alphas(x[1:(t-1),],w[1:(t-1),],
y[2:t],grid_alphas,TRUE,"gaussian")
top_trms<- top_terms(x[1:(t-1),],w[1:(t-1),],y[2:t],
optimal_alphas[[1]], optimal_alphas[[2]],10,TRUE,
10,c(2,0.3),.15,"gaussian")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.