zoukankan      html  css  js  c++  java
  • 增加正则项Regularization to Prevent Overfitting

    1,

    model_l1 = tf.estimator.LinearClassifier(
    feature_columns=base_columns + crossed_columns,
    optimizer=tf.train.FtrlOptimizer(
    learning_rate=0.1,
    l1_regularization_strength=10.0,
    l2_regularization_strength=0.0))

    model_l1.train(train_inpf)

    results = model_l1.evaluate(test_inpf)
    clear_output()
    for key in sorted(results):
    print('%s: %0.2f' % (key, results[key]))

    2,

    model_l2 = tf.estimator.LinearClassifier(
    feature_columns=base_columns + crossed_columns,
    optimizer=tf.train.FtrlOptimizer(
    learning_rate=0.1,
    l1_regularization_strength=0.0,
    l2_regularization_strength=10.0))

    model_l2.train(train_inpf)

    results = model_l2.evaluate(test_inpf)
    clear_output()
    for key in sorted(results):
    print('%s: %0.2f' % (key, results[key]))

  • 相关阅读:
    合并两个有序链表
    有效括号方法二
    有效括号
    es6 中的模块化
    XMLHttpRequest 对象
    AST
    php读写文件方式
    vue开发中遇到的问题
    sublime操作
    cmd命令
  • 原文地址:https://www.cnblogs.com/augustone/p/10506117.html
Copyright © 2011-2022 走看看