TensorFlow - TFLearn安装

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

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

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

pip install tflearn

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

无涯教程网

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])

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

技术教程推荐

重学前端 -〔程劭非(winter)〕

ZooKeeper实战与源码剖析 -〔么敬国〕

性能工程高手课 -〔庄振运〕

人人都用得上的写作课 -〔涵柏〕

陈天 · Rust 编程第一课 -〔陈天〕

编程高手必学的内存知识 -〔海纳〕

超级访谈:对话毕玄 -〔毕玄〕

零基础GPT应用入门课 -〔林健(键盘)〕

深入拆解消息队列47讲 -〔许文强〕

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