top_terms {TextForecast} | R Documentation |
Top Terms Function
Description
Top Terms Function
Usage
top_terms(
x,
w,
y,
alpha,
lambda,
k,
wordcloud,
max.words,
scale,
rot.per,
family
)
Arguments
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 |
Value
the top k terms and the corresponding wordcloud.
Examples
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")
[Package TextForecast version 0.1.3 Index]