1 Star 0 Fork 0

scabiosa/DenoisingAutoEncoder

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
demo.py 997 Bytes
一键复制 编辑 原始数据 按行查看 历史
import utils
from SDA_layers import StackedDA
def demo():
X,y = utils.load_mnist()
y = utils.makeMultiClass(y)
# building the SDA
sDA = StackedDA([100])
# pre-trainning the SDA
sDA.pre_train(X[:100], noise_rate=0.3, epochs=1)
# saving a PNG representation of the first layer
W = sDA.Layers[0].W.T[:, 1:]
utils.saveTiles(W, img_shape= (28,28), tile_shape=(10,10), filename="results/res_dA.png")
# adding the final layer
sDA.finalLayer(X[:37500], y[:37500], epochs=2)
# trainning the whole network
sDA.fine_tune(X[:37500], y[:37500], epochs=2)
# predicting using the SDA
pred = sDA.predict(X[37500:]).argmax(1)
# let's see how the network did
y = y[37500:].argmax(1)
e = 0.0
for i in range(len(y)):
e += y[i]==pred[i]
# printing the result, this structure should result in 80% accuracy
print "accuracy: %2.2f%%"%(100*e/len(y))
return sDA
if __name__ == '__main__':
demo()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/scabiosa/DenoisingAutoEncoder.git
git@gitee.com:scabiosa/DenoisingAutoEncoder.git
scabiosa
DenoisingAutoEncoder
DenoisingAutoEncoder
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385