常用的正则化方法:

运行代码:

import tensorflow as tf
print(help(tf.contrib.layers))

得到:

import tensorflow as tf
print(help(tf.contrib.layers))/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.6 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.7return f(*args, **kwds)
Help on package tensorflow.contrib.layers in tensorflow.contrib:NAMEtensorflow.contrib.layers - Ops for building neural network layers, regularizers, summaries, etc.DESCRIPTIONSee the @{$python/contrib.layers} guide.@@avg_pool2d@@avg_pool3d@@batch_norm@@convolution2d@@convolution3d@@conv2d_in_plane@@convolution2d_in_plane@@conv2d_transpose@@convolution2d_transpose@@conv3d_transpose@@convolution3d_transpose@@dense_to_sparse@@dropout@@elu@@embedding_lookup_unique@@flatten@@fully_connected@@GDN@@gdn@@layer_norm@@linear@@max_pool2d@@max_pool3d@@one_hot_encoding@@relu@@relu6@@repeat@@recompute_grad@@RevBlock@@rev_block@@safe_embedding_lookup_sparse@@scale_gradient@@separable_conv2d@@separable_convolution2d@@softmax@@spatial_softmax@@stack@@unit_norm@@bow_encoder@@embed_sequence@@maxout@@apply_regularization@@l1_l2_regularizer@@l1_regularizer@@l2_regularizer@@sum_regularizer@@xavier_initializer@@xavier_initializer_conv2d@@variance_scaling_initializer@@optimize_loss@@summarize_activation@@summarize_tensor@@summarize_tensors@@summarize_collection@@summarize_activations@@bucketized_column@@check_feature_columns@@create_feature_spec_for_parsing@@crossed_column@@embedding_column@@scattered_embedding_column@@input_from_feature_columns@@transform_features@@joint_weighted_sum_from_feature_columns@@make_place_holder_tensors_for_base_features@@multi_class_target@@one_hot_column@@parse_feature_columns_from_examples@@parse_feature_columns_from_sequence_examples@@real_valued_column@@shared_embedding_columns@@sparse_column_with_hash_bucket@@sparse_column_with_integerized_feature@@sparse_column_with_keys@@sparse_column_with_vocabulary_file@@weighted_sparse_column@@weighted_sum_from_feature_columns@@infer_real_valued_columns@@sequence_input_from_feature_columns@@instance_normPACKAGE CONTENTSops (package)python (package)SUBMODULESfeature_columnsummariesDATAOPTIMIZER_CLS_NAMES = {'Adagrad': <class 'tensorflow.python.training.a...OPTIMIZER_SUMMARIES = ['learning_rate', 'loss', 'gradients', 'gradient...SPARSE_FEATURE_CROSS_DEFAULT_HASH_KEY = 956888297470elu = functools.partial(<function add_arg_scope.<local...58>, activati...legacy_linear = functools.partial(<function legacy_fully_connected at ...legacy_relu = functools.partial(<function legacy_fully_connect...0>, a...linear = functools.partial(<function add_arg_scope.<local...nc_with_ar...relu = functools.partial(<function add_arg_scope.<local...8>, activati...relu6 = functools.partial(<function add_arg_scope.<local...>, activati...scale_gradient = <tensorflow.python.framework.function._OverloadedFunc...FILE/usr/local/lib/python3.7/site-packages/tensorflow/contrib/layers/__init__.pyNone
[Finished in 5.2s]

最常用的是

@@l1_regularizer
    @@l2_regularizer

来看看l2正则化是什么意思:

import tensorflow as tf
print(help(tf.contrib.layers.l2_regularizer))/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.6 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.7return f(*args, **kwds)
Help on function l2_regularizer in module tensorflow.contrib.layers.python.layers.regularizers:l2_regularizer(scale, scope=None)Returns a function that can be used to apply L2 regularization to weights.
阻止过拟合用的    Small values of L2 can help prevent overfitting the training data.Args:scale: A scalar multiplier `Tensor`. 0.0 disables the regularizer.scope: An optional scope name.Returns:A function with signature `l2(weights)` that applies L2 regularization.Raises:ValueError: If scale is negative or if scale is not a float.None
[Finished in 2.3s]

再来看看l1正则化:

import tensorflow as tf
print(help(tf.contrib.layers.l1_regularizer))/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: compiletime version 3.6 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.7return f(*args, **kwds)
Help on function l1_regularizer in module tensorflow.contrib.layers.python.layers.regularizers:l1_regularizer(scale, scope=None)Returns a function that can be used to apply L1 regularization to weights.L1 regularization encourages sparsity.让矩阵更稀疏导致某一维的权重为0 ,产生稀疏权重矩阵Args:scale: A scalar multiplier `Tensor`. 0.0 disables the regularizer.scope: An optional scope name.Returns:A function with signature `l1(weights)` that apply L1 regularization.Raises:ValueError: If scale is negative or if scale is not a float.None
[Finished in 2.4s]

认识你是我们的缘分,同学,等等,学习人工智能,记得关注我。

微信扫一扫
关注该公众号

《湾区人工智能》

常用的正则化方法总结相关推荐

  1. 人工智能算法模型必会之——正则化方法综述

    https://www.toutiao.com/a6718749367164994055/ 什么是正则化? 首先英文原文为regularization,直译应为规则化,简单来说就是对模型加入规则,加入 ...

  2. 正则化方法/防止过拟合提高泛化能力的方法:L1和L2 regularization、数据集扩增、dropout

    转载自:http://blog.csdn.net/u012162613/article/details/44261657 本文是<Neural networks and deep learnin ...

  3. 正则化方法:数据增强、regularization、dropout

    文章目录 过拟合 overfitting 数据增强 正则化项 范数 norm L1 正则 Lasso regularizer L2 正则 Ridge Regularizer / Weight Deca ...

  4. python正则_正则化方法及Python实现

    正则化有助于克服过度拟合模型的问题.过度拟合是偏差和方差平衡的概念.如果过度拟合,机器学习模型将具有较低的准确性.当我们的机器学习模型试图从数据中学习更多属性时,就会添加来自训练数据的噪声.这里的噪声 ...

  5. python正则化函数_正则化方法及Python实现

    正则化有助于克服过度拟合模型的问题.过度拟合是偏差和方差平衡的概念.如果过度拟合,机器学习模型将具有较低的准确性.当我们的机器学习模型试图从数据中学习更多属性时,就会添加来自训练数据的噪声.这里的噪声 ...

  6. 数据维度爆炸怎么办?详解5大常用的特征选择方法

    ↑↑↑关注后"星标"Datawhale 每日干货 & 每月组队学习,不错过 Datawhale干货 作者:Edwin Jarvis,cnblog博客整理 在许多机器学习相关 ...

  7. 数据维度爆炸怎么办?详解 5 大常用的特征选择方法

    点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 在许多机器学习相关的书里,很难找到关于特征选择的内容,因为特征选择 ...

  8. 常用特征工程方法总结

    点击上方"小白学视觉",选择加"星标"或"置顶" 重磅干货,第一时间送达 摘要:对于数据挖掘项目,本文将学习应该从哪些角度做特征工程?从哪些 ...

  9. 常用的 Normalization 方法:BN、LN、IN、GN(附代码&链接)

    来源:知乎 本文约2700字,建议阅读8分钟. 本文带你了解并区分常用的Normalization. 常用的Normalization方法主要有: Batch Normalization(BN,201 ...

最新文章

  1. Bagging和Boosting 概念及区别
  2. 京东的热点key探测系统发布,单机 QPS 提升至 37 万
  3. IBM DW上关于SOA的规范归纳
  4. Git之深入解析在没有合适的网络或者可共享仓库情况下的git bundle打包操作
  5. Ubuntu 15.04 安装 boost-python
  6. Neo4j导入:java.lang.IllegalStateException:不支持在单个导入中混合指定和未指定的组所有物...
  7. java11+osgi_错误学习:Java + OSGi
  8. LeetCode 三数之和 — 优化解法
  9. 大数据时代--windows下spark的安装与配置教程
  10. Spring的入门学习笔记 (注解)
  11. Android两次按返回键退出应用程序
  12. 三角网导线平差实例_附合导线平差教程
  13. 查询ISBN号验证ISBN号调用api接口查询书籍信息
  14. mkv文件怎么无损转成mp4?
  15. 自抗扰控制ADRC之反馈控制律(NLSEF)
  16. 国税局发票查验中英文验证码识别最新版,识别率99.9%
  17. Python3,10行代码,制作艺术签名,从此走上人生巅峰。
  18. python 实现文件的批量压缩为.zip格式+.zip格式文件的解析
  19. 企业IT项目开发之七宗罪(下篇)
  20. 108K加湿器开发方案 单片机 NY8A051F 单片机开发设计开发

热门文章

  1. 微信小程序|开发实战篇之request请求(单个、多个参数,json对象,header)
  2. JavaScript中使用“var me=this”的总结
  3. FBI树-数据结构(二叉树)
  4. MVC公司架构介绍——自运行任务
  5. 《深入分析Linux内核源代码》读书、私藏笔记大放送
  6. jquery ajax提交表单数据的两种方式
  7. Ubuntu下超实用的命令
  8. DROP TABLE ** CASCADE CONSTRAINTS PURGE删除表的时候级联删除从表外键
  9. android 多点
  10. Angular4.x+Ionic3 踩坑之路之打包时出现JAVASCRIPT HEAP OUT OF MEMORY的几种解决办法