Train

Share:

Description

trains the parameters

Usage

1
Train(y, param = TRUE, const, initial)

Arguments

y

A matrix, the training set.

param

A logical scalar, if TRUE, the model is in parametric version, otherwise, a non-parametric one.

const

A numeric vector, specifies the value of all global variables, if param = T, then const = c(N,n,d,rh,r,K,alpha); if param=FALSE, then const = c(N,n,d,rh,r,K,sigma_sqare).

initial

A numeric vector, specifies the initial value of parameters over the continuous domain, if param = T, initial = c(pi_1,mean_1,cov_1, ..., pi_K, mean_K,cov_K), if param = F, initial = c(q1,q2, ..., qK).

Value

List of all parameters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
##parametric model test
initial=matrix(c(0.5,0,0,1,0,0,1,0.5,1,1,1,0,0,1),nrow=1)
const = c(0,1,2,0.1,0.1,2,2)
param=TRUE
y=matrix(c(1,3,1,0,1,1),nrow=2)
smart = Train(y,param,const,initial)$smart
hellingerScore = Train(y,param,const,initial)$HellingerScore
logLoss = Train(y,param,const,initial)$LogLoss
const[1] = Train(y,param,const,initial)$N

##non-parametric model test
param=FALSE
const = c(0,1,2,0.1,0.1,2,1)
initial = matrix(c(0,0,1,1),nrow=1)
y=matrix(c(1,3,1,0,1,1),nrow=2)
smart = Train(y,param,const,initial)$smart
hellingerScore = Train(y,param,const,initial)$HellingerScore
logLoss = Train(y,param,const,initial)$LogLoss
const[1] = Train(y,param,const,initial)$N