TensorFlow - TFLearn安装

TensorFlow - TFLearn安装 首页 / TensorFlow入门教程 / TensorFlow - TFLearn安装

TFLearn可定义为TensorFlow框架使用模块化且透明的深度学习,TFLearn的主要功能是为TensorFlow提供更高级别的API,以促进和展示新的实验。

通过执行以下命令来安装TFLearn-

pip install tflearn

执行以上代码后,将生成以下输出-

链接:https://www.learnfk.comhttps://www.learnfk.com/tensorflow/tensorflow-tflearn-its-installation.html

来源:LearnFk无涯教程网

Install TFLearn

下图显示了带有随机森林分类器的TFLearn的实现-

from __future__ import division, print_function, absolute_import

#TFLearn 模块实现
import tflearn
from tflearn.estimators import RandomForestClassifier

# 关于数据集的数据加载和预处理
import tflearn.datasets.mnist as mnist
X, Y, testX, testY = mnist.load_data(one_hot = False)

m = RandomForestClassifier(n_estimators = 100, max_nodes = 1000)
m.fit(X, Y, batch_size = 10000, display_step = 10)

print("Compute the accuracy on train data:")
print(m.evaluate(X, Y, tflearn.accuracy_op))

print("Compute the accuracy on test set:")
print(m.evaluate(testX, testY, tflearn.accuracy_op))

print("Digits for test images id 0 to 5:")
print(m.predict(testX[:5]))

print("True digits:")
print(testY[:5])

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

Java性能调优实战 -〔刘超〕

OpenResty从入门到实战 -〔温铭〕

Elasticsearch核心技术与实战 -〔阮一鸣〕

编译原理之美 -〔宫文学〕

Netty源码剖析与实战 -〔傅健〕

Electron开发实战 -〔邓耀龙〕

手把手带你搭建秒杀系统 -〔佘志东〕

PyTorch深度学习实战 -〔方远〕

手把手带你搭建推荐系统 -〔黄鸿波〕

好记忆不如烂笔头。留下您的足迹吧 :)