- Advanced Machine Learning with R
- Cory Lesmeister Dr. Sunil Kumar Chinnamgari
- 453字
- 2021-06-24 14:24:45
Keras and TensorFlow background
I mentioned earlier that Keras is an API, a frontend if you will, for several deep learning backends. It was originally available only for Python but has been available in R since, mid-2017. It is important to spend some time reviewing its capabilities at its documentation source: https://keras.io/why-use-keras/.
I must confess my colleagues brought me into Keras and using TensorFlow kicking and screaming. If I can get this to work, I would say that you certainly can. I must thank them, as it is very powerful, even though I have a slight bias toward MXNet. As the old saying goes, it is tough to teach old dogs new tricks!
The backend of choice, of course, is TensorFlow. We must now take a few sentences to put in plain English what a tensor is, and what TensorFlow is. A tensor is an n-dimensional array. Thus, a vector is a one-dimensional tensor, a matrix is a two-dimensional tensor and so forth. Let's say you have a multivariate time series, which would consist of a three-dimensional tensor: one dimension is the observations or length of your data, another dimension is the features, and another the timesteps or, more concretely, the lagged values. TensorFlow as a backend is an open source platform, created by Google, that uses tensors, of course, for high-performance and scalable computation. The base frontend for TensorFlow is Python. Therefore, to use Keras and R as the frontend, you must install Python, in particular the Python platform Anaconda: https://www.anaconda.com/.
So, if installing Anaconda becomes an issue, then the following exercise will require you to use a different backend, which is outside the scope of this discussion. Let's look at how to get this up and running. Keep in mind that I'm using a Windows-based computer:
# Install reticulate package as it allows R to call python
> install.packages("reticulate")
> install.packages("keras")
> keras::install_keras() # loads the necessary python packages and may take some time to complete
> library(keras)
> library(reticulate)
That was the code that worked for me on this laptop. Again, your results may vary. Also, note that I've run into a number of issues that required me to run install_keras() again to get it working properly.
Assuming all is well, let's get our data loaded.
- Arduino入門基礎教程
- Aftershot Pro:Non-destructive photo editing and management
- 用“芯”探核:龍芯派開發實戰
- Creating Dynamic UI with Android Fragments
- 電腦組裝、維護、維修全能一本通(全彩版)
- 電腦常見故障現場處理
- Svelte 3 Up and Running
- Machine Learning with Go Quick Start Guide
- 固態存儲:原理、架構與數據安全
- Spring Cloud微服務和分布式系統實踐
- 電腦橫機使用與維修
- Arduino項目開發:智能生活
- The Deep Learning with PyTorch Workshop
- 微服務架構基礎(Spring Boot+Spring Cloud+Docker)
- 筆記本電腦的結構、原理與維修