R语言中也可以使用TensorFlow了 |神经网络案例
Posted R语言数据分析与实践
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了R语言中也可以使用TensorFlow了 |神经网络案例相关的知识,希望对你有一定的参考价值。
TensorFlow是一个通用处理数据流和可微程式的开源方法库,用于在神经网络等机器学习的应用。TensorFlow由Google Brain团队在2015年9月开源。
R,TensorFlow,张量
TensorFlow

TensorFlow
TensorFlow是一个开源方法库,通过智能的数据流图实现对数值的计算。由于TensorFlow的特性,密集流量数据借助API调用,会简化项目的复杂度。
硬件环境
TensorFlow可运行在以下平台:
CPU
GPU
TPU
R提供了TensorFlow的接口,不需要将所有的数据集存放在RAM中,因此可以计算大型数据集。
2
关于tensor张量
张量实际上是一个高维(多维)数组【见文末推荐阅读,往期内容】

多维数组对应的Robject

实际应用

3阶张量
时间序列数组

4阶张量
样本、颜色通道(RGB+Alpha)、高度、宽度
TensorFlow应用
TensorFlow除了深度学习DeepLearning, 还可以用于一些经典的分类问题、机器学习等:
图片分类image classification
时间序列预测Time Series Forecasting
肿瘤免疫治疗中的多肽分类classify peptides for cancer immunotheraphy
信用卡欺诈侦测credit card fraud detection using an auto-encoder
对问答网站的问题进行分类/标签
预测客户流失predicting customer churn
在R中搭建TensorFlow

TensorFlow原理
TensorFlow与RScript的运行机制不同。在TensorFlow中实际上是创建了一个数据流向图。其中tensor是数据集,flow是有向图,通过节点(node)构成一些单元(unit)进行计算。实际上,Google试图将你所构思的模型、算法通过图来表达,并且运行速度接近于C++。
图Graph:组合并优化
节点Node:计算过程
-
数据Tensor:在节点与图之间循环
Keras
当你在R中搭建TensorFlow时,需要借助Keras,因为你不能直接对图进行编辑。keras允许代码在CPU或GPU上无缝运行。

载入TensorFlow支持库
2
图片识别案例







手写图片识别
推荐阅读
R语言数据分析与实践
思想常新者,以数据为其探寻之源
以上是关于R语言中也可以使用TensorFlow了 |神经网络案例的主要内容,如果未能解决你的问题,请参考以下文章
资源 | R语言也能使用TensorFlow了!RStudio发布全新接口
作为TensorFlow的底层语言,你会用C++构建深度神经网络吗?