Skip to content

Instantly share code, notes, and snippets.

@securetorobert
Created July 15, 2018 21:45
Show Gist options
  • Save securetorobert/886c99220cac67581b3d29ff00cda806 to your computer and use it in GitHub Desktop.
Save securetorobert/886c99220cac67581b3d29ff00cda806 to your computer and use it in GitHub Desktop.
Training a model with l1 Regularization in TensorFlow
optimizer = tf.train.FtrlOptimizer(learning_rate=0.01, l1_regularization_strength=0.1)
estimator = tf.estimator.LinearRegressor(feature_columns=feature_columns, optimizer=optimizer)
estimator.train(input_fn= lambda: input_fn(X_train, y_train), steps=20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment