elasticnet()

Read(3150) Label: elastic net, model, prediction,

Description:

Build models and performs predictions using the elastic net regression method.

Syntax:

elasticnet(X, Y, learning_rate, iterations, l1, l2)

The function fits together matrix X and vector Y using the elastic net regression method and returns model information that includes coefficient matrix and and intercept. The model information can act as parameter F in elasticnet (X’, F) to perform a fitting computation

elasticnet(X’, F)

The function fits together two matices that have same number of columns – that is, perform predicitions on another matrix X’ using model F, and returns a vector

Note:

External library function (See External Library Guide).

It builds models and performs predictions using the elastic net regression method.

Parameter:

X

A matrix

Y

A vector having the same number of rows as matrix X

learning_rate

Learning rate that is a decimal between 0 and 1; default value is 0.01

iterations

Number of iterations; default is 1000

l1

Coefficient 11; default is 0.9

l2

Coefficient 12; default is 0.1

X’

A matrix that has same number of columns as matrix X

F

The return result of elasticnet(X, Y, learning_rate, iterations, l1, l2)

Return value:

Matrix/Vector

Example:

 

A

 

1

[[1.1,1.1],[1.4,1.5],[1.7,1.8],[1.7,1.7],[1.8,1.9],[1.8,1.8],[1.9,1.8],[2.0,2.1],[2.3,2.4],[2.4,2.5]]

 

2

[16.3,16.8,19.2,18,19.5,20.9,21.1,20.9,20.3,22]

 

3

=elasticnet(A1,A2,0.01,10000,0.9,0.1)

Fit A1 and A2 together using elastic net regression method and return coefficient matrix A3(1) and intercept A3(2).

4

=elasticnet(A1,A3)

Perform prediction on A1 using model A3; the result can be compared with actual values in A2.