In this example, we will train a multilayer perceptron on the adult census dataset that we just prepared. This example is included to introduce the syntax of the package and to show that a basic exercise can be completed without an excessive amount of code:
If you have multiple versions of Python installed on your system, then this can become an issue. Use the reticulate package and the use_python() function to define the path to the Python instance that you would like to use; for example, use_python(usr/local/bin/python3). You can also use RETICULATE_PYTHON within your .Rprofile file to set the path to the Python instance that R should use.
- To begin, we will load the tensorflow and keras libraries, as shown:
library(tensorflow) ...