Implement lasso regression using TensorFlow

I want to run a Lasso regression using TensorFlow. Since the Lasso regression simply adds the L1 norm to the cost, I'm going to define my cost factor as

cost = RSS + tf.nn.l1_norm(Weight) or
cost = RSS + tf.reduce_sum(tf.abs(Weight))
train = tf.train.GradientDescentOptimizer(cost)

Does this code work like Lasso regression? One of my questions is if I can use gradient descent in this case. Regression Lasso has an undifferentiated point and coordinate descent, which is widely used in the TensorFlow library.

+4
source share

Source: https://habr.com/ru/post/1656503/


All Articles