深度学习Keras框架笔记之AutoEncoder类

  深度学习Keras框架笔记之AutoEncoder类使用笔记   

1
keras.layers.core.AutoEncoder(encoder, decoder,output_reconstruction=True, weights=None)

  

这是一个用于构建很常见的自动编码模型。如果参数output_reconstruction=True,那么dim(input)=dim(output);否则dim(output)=dim(hidden)。

       inputshape: 取决于encoder的定义

       outputshape:取决于decoder的定义

       参数:

  •        encoder:编码器,是一个layer类型或layer容器类型。
  •        decoder:解码器,是一个layer类型或layer容器类型。
  •        output_reconstruction:boolean。值为False时,调用predict()函数时,输出是经过最深隐层的激活函数。Otherwise, the output of thefinal decoder layer is presented. Be sure your validation data conforms to thislogic if you decide to use any.(这一块还不太了解,待以后了解了再补充)
  •        weights:用于初始化权值的numpy arrays组成的list。这个List至少有1个元素,其shape为(input_dim, output_dim)。

       举例:

1
2
3
4
5
6
7
8
from keras.layers import containers 
   
 # input shape: (nb_samples, 32) 
encoder =containers.Sequential([Dense(16, input_dim=32), Dense(8)]) 
decoder =containers.Sequential([Dense(16, input_dim=8), Dense(32)]) 
    
autoencoder =Sequential() 
autoencoder.add(AutoEncoder(encoder=encoder, decoder=decoder,output_reconstruction=False)) 

  顺便再打个小广告,欢迎访问自己的网站:圆柱模板

posted @   圆柱模板  阅读(967)  评论(0编辑  收藏  举报
编辑推荐:
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示