Options

Can I get the full procedure to install the Keras extension in Rapid Miner?

Rj_ChinRj_Chin Member Posts: 2 Newbie
edited January 2019 in Help
Can I get the full procedure to install the Keras extension in Rapid Miner? Thank you

Answers

  • Options
    M_MartinM_Martin RapidMiner Certified Analyst, Member Posts: 125 Unicorn
    Hi Rj_Chin:

    There was a thread in the community re: setting up Keras, but it seems to no longer be no on-line.  I dug up most of a post I wrote last year that describes setting up the Keras extension in detail, which I hope will be useful to you.

    NOTE: Some things have changed since this post was written last year.  You will see that in my post from last year below, I mention installing Tensorboard as a separate step. The installation of Tensorboard is now included when you install Tensorflow.  I would also recommend setting up a Python 3.5 and 3.6 environment and see which one works best.  As I understand it, the RapidMiner Keras extension were authored with a dependency on Python 3.5 - and in fact my Keras setup uses Python 3.5, even though 3.5 is not the most current version of Python, so you may want to stay with Python 3.5.   

    Caveat: my setup below is within Windows, not the Mac OS.  

    Good luck - my set-up checklist starts below:

     ------------------------

    As far as setting up Keras in RapidMiner (and other related Python packages Keras needs), here's what seems to be working for me on several Dev boxes in my shop (caveat: all boxes are running Windows 7 64 bit, with SP1 - all machines have either 16 or 32 GB of RAM and I7 processors).

     1. Install the Keras extension from the Rapid Miner Extensions Marketplace into RapidMiner Studio

    2. Download and install Anaconda 3 (https://www.anaconda.com/)  Get the appropriate version (64 or 32 bit).

    3. Run the Anaconda Navigator (should now be in your Windows Program Group)

    4. Create a new environment using the Anaconda Navigator.  The Navigator (as of this writing) will suggest using Python 3.6, but there is also an option for Python 3.5,  Tick on Python 3.5 as I understand that the RapidMiner Keras extension was developed using Python 3.5.  I named my Environment py35.

    5.  After Anaconda creates the environment, open up the Anaconda Prompt (should be listed as a shortcut from the Start Menu, or within the Anaconda program group.  Though I didn't have to, you could left click on the icon for the Anaconda prompt and select "Run as Administrator"

    6. You neeed to activate the new environment you just created.  From the prompt type: activate <environment name>.  If you named your environment py35, you would type: activate py35.   Then hit Enter/Return.  After a few seconds, the Anaconda prompt will return, and the environment will be active.  The new environment name should now be part of the Anaconda prompt.

    7. To see a list of existing Python packages in your new environment, type conda list and then Enter/Return.  You should see a short list of packages.

    8. You now need to install a few more Python packages.  Type conda install pandas and then Enter.  After a few seconds, you will be asked to confirm that you want to do the installation.  Type y and the downloading and installation of pandas (and other dependent packages) will begin. When the installation has finished, you'll be returned to the Anaconda prompt for your environment.

    9.  Type conda install scikit-learn and then Enter.  Confim that you want to do the install, and then it should start.  When the install is done, you'll be returned to the prompt for your Anaconda environment.

    10.  You now need to install a package named Graphviz which requires some extra steps.  Go to http://www.graphviz.org/ and download graphviz-238.msi.  Then run the msi file you have downloaded to install graphviz (which is a Windows Forms application).

    11. Then open the Windows Control Panel, select the System App, and then Advanced System Settings  --> Environment Variables.  Add the path to the Graphviz executable to (at the least) the PATH environment variable for your user account.  The value to append to your existing PATH is C:\Program Files (x86)\Graphviz2.38\bin   Type in a semicolon in front of C:\Program Files (x86)\Graphviz2.38\bin in order to seperate it from the previous entry in your PATH statement.   For good measure (though it may not be strictly neccessary, I also added the following directories to my path statement:

     C:\Users\YourUserName\Anaconda3\envs\py35;C:\Users\YourUserNamel\Anaconda3\Scripts;C:\Users\YourUserName\Anaconda3\envs\py35\Lib\site-packages  (remember to type in a semicolon after C:\Program Files (x86)\Graphviz2.38\bin before typing in another entry).

     Substitue your Windows User Account name for the YourUserName directly above.

     11.  To confirm that your PATH environment variable value has been updated, open a Command Window and type path and then enter.  The value of your PATH environment variable will echo to the screen.  If what you see doesn't include the entries you just added, you'll need to re-boot your system and check again.  

    12.  Assuming your PATH has been updated, you can install graphviz (from within the Anaconda prompt for your environment - which should now also show up as a shortcut from the Start Menu or from within the anaconda Program Group) by typing conda install graphviz and then Enter.

    13.  Then install the pydot package by typing pip install pydot and then Enter

    14.  Last but not least, install Keras (recently updated to version 2.0.6) by typing conda install -c conda-forge keras and then Enter.   After confirming that you want to do the install, Keras and numerous dependent packages will be installed, and you'll be back at the Anaconda prompt for your environment.

    15.  If you want to use Tensorboard to visualize your models install the latest version of Tensorflow and Tensorboard by typing

               pip install --ignore-installed --upgrade tensorflow   

    and then Enter.  Quite a few packages will be installed, and you'll be back at the Anaconda prompt.   

     For info re: Tensorflow and Tensorboard, visit https://www.tensorflow.org

     If you type conda list and then Enter, you will see that your environment now contains many more packages.

     The last configuration step needs to occur within RapidMiner Studio by selecting Settings -> Preferences and telling RapidMiner Studio where python.exe is within your Python environment.  By default, the complete path should be:

     C:\Users\YourUserName\Anaconda3\envs\YourEnvironmentName\python.exe  

     Click on the disk icon to the left of the Test command button and navigate to python.exe within your environment twice - once for the "Keras" option and once for the "Python Scripting" option in the Preferences dialog.  Be sure to click on the "Test" button both times.  If there are no errors, you'll get a message box stating that Python has been detected within Anaconda.  On all my Dev boxes, there were no errors, hopefully there will be no errors on your system.

     Some or all of the set up commands above may not work with Windows 10, but Windows 10 does allow you to set compatibility mode to run various programs, so perhaps experimenting with compatibility settings would help.

     The installation described above is a CPU installation as opposed to a GPU installation.  GPU installtions will run keras models quicker, but have hardware requirements and the install is tricky.  For more info on this subject visit https://www.google.ca/search?q=keras+gpu+installation&oq=keras+gpu+installation&aqs=chrome..69i57j69...

     You should (hopefully) now be able to run the Keras samples provided with RapidMiner which are in the repository under the entry Keras Samples.

    Using Tensorboard to visualize Deep Learning outputs in a browser is a whole other subject, but again, hopefully these notes will allow you to run the Keras samples and facilitate your own development work.

    -------------------------------------------

     

     

     

     



  • Options
    sgenzersgenzer Administrator, Moderator, Employee, RapidMiner Certified Analyst, Community Manager, Member, University Professor, PM Moderator Posts: 2,959 Community Manager
    wow thank you @M_Martin! I was just about to re-post this:

    my apologies. The Keras Knowledge Base article that is normally here on the community is currently offline. Please be patient while we get this back up. Thank you!
Sign In or Register to comment.