banner



How To Install Keras In Python Windows 10

An easy guide to get started with machine learning

Photo by Ahmad Dirini on Unsplash

Purpose: To install a Python based environment for machine learning.

          The following set of instructions were compiled from across the web and written for a Windows x Bone.             Terminal tested on 02/09/2019.        

Overview

When I first got into machine learning it took me a few hours to figure how to properly set my Python environment. Out of frustration, I decided to write this post to help anyone going through the process. Nosotros volition start by installing Anaconda Navigator which volition allow u.s. to create independent environments, this will come really handy. Additionally, with Anaconda nosotros can hands install compatible Python modules with very unproblematic commands. Finally, we tin can use Anaconda to get Spyder — a scientific Python development environment. If you follow the step-past-pace procedure shown below, you will have installed Tensorflow, Keras, and Scikit-acquire in no time.

Getting Anaconda

In order to start building your motorcar learning (ML) models with Python, we will start by installing Anaconda Navigator. Anaconda provides an efficient and easy way to install Python modules on your machine. So let'southward get started.

  1. Download and install the latest version of Anaconda Navigator for your operating system.

2. Go on with the installation wizard but skip the step where yous demand to download and install VS, we volition practice this after. Additionally, make sure to install Anaconda Navigator for a unmarried user — installing Anaconda for All Users might atomic number 82 to problems. For example, you won't exist able to install whatsoever modules because Anaconda won't have the necessary privileges.

Brand certain you install Anaconda to the current user else you might face up problems downward the road.

Skip this step. Nosotros will go it done in a chip.

iii. Launch Anaconda Navigator and select the Home Tab, it should exist selected by default. Observe the VS Code Panel and click on the Install push button. This will accept a minute or two.

Later on you install VS Code, you will be able to see a Launch push under the VS Code console.

Intalling Keras and Tensorflow

Now that we have installed Anaconda, permit's go Keras and Tensorflow in our machine.

four. Close Anaconda Navigator and launch Anaconda Prompt. Launch Anaconda prompt by searching for it in the windows search bar. The following terminal should open. Notice that this will open up on the base Anaconda surroundings.

5. Downgrade Python to a Keras & Tensorflow uniform version. Anaconda volition start to look for all the compatible modules for Python 3.6. This might accept a few minutes. To downgrade to Python 3.vi use the post-obit command:

conda install python=3.6

After the environment is resolved, Anaconda volition testify you all the packages that will exist downloaded. Currently, Tensorflow offers compatiblity with Python 3.5–3.eight.

6. Create a new conda surround where nosotros will install our modules to congenital our models using the GPU. To do so, execute the following control:

conda create --name PythonGPU

Note: Ensure that you accept a NVIDIA graphics menu. If you don't, install the CPU version of Keras.

If you want to use your CPU instead, execute the following command:

conda create --name PythonCPU

Follow the instructions displayed on the terminal. Conda environments give the user the liberty to install very specific modules that are independent habitats. Personally, I created ii environments. One where I tin congenital my models using the CPU and the other where I tin can congenital my models using the GPU. For more information about conda environments, I advise you take a expect at the official documentation.

7. To activate the conda surround that was just created utilize:

activate PythonGPU or activate PythonCPU

To deactivate the surround employ:

conda conciliate

Do non conciliate the environment yet, we are virtually to install all the good stuff.

8. To install Keras & Tensorflow GPU versions, the modules that are necessary to create our models with our GPU, execute the post-obit control:

conda install -c anaconda keras-gpu

If y'all want to use your CPU to congenital models, execute the following command instead:

conda install -c anaconda keras

A lot of computer stuff will showtime happening. Once the madness stops, we tin motion on. Don't close anything yet.

Getting Spyder and other Python Packages for Machine Learning / Deep Learning

Now you might want some piece of software to write and execute your Python scrips. You can always use Vim to write and edit your Python scrips and have some other terminal open to execute them. However, you will exist missing out on all the absurd features Spyder haves to offering.

9. Install Spyder.

conda install spyder

ten. Install Pandas. Pandas is a library that is extremely powerful and allows you to hands read, manipulate, and visualize data.

conda install -c anaconda pandas

If you want to read Excel files with Pandas, execute the following commands:

conda install -c anaconda xlrd

conda install -c anaconda xlwt

xi. Install the Seaborn library. Seaborn is an amazing library that allows you to easily visualize your data.

conda install -c anaconda seaborn

12. To install scikit-learn.

conda install -c anaconda scikit-learn

thirteen. Install Pillow to handle images

conda install pillow

Adding Missing Modules

Past now you should feel comfortable installing modules using the conda command. If you need a specific module, merely Google something along the following lines:

Anaconda LibraryNameYouWant Install

If yous meet any problems search the web. Is most likely that you lot're not the outset person to meet a given error.

Launching Spyder and Checking That All Modules Were Installed Correctly

To launch Spyder, first activate the conda environment you want (PythonCPU or PythonGPU) and execute the following control:

spyder

To ensure everything was installed correctly, execute the following lines of code on the python console:

          import numpy equally np # For numerical fast numerical calculations
import matplotlib.pyplot as plt # For making plots
import pandas every bit pd # Deals with data
import seaborn as sns # Makes beautiful plots
from sklearn.preprocessing import StandardScaler # Testing sklearn
import tensorflow # Imports tensorflow
import keras # Imports keras

If y'all encounter no ModuleImport errors, yous're now fix to beginning building machine learning based models using Keras, Tensorflow, and Scikit-Learn.

You can detect me in LinkedIn or visit my personal blog.

Source: https://towardsdatascience.com/installing-keras-tensorflow-using-anaconda-for-machine-learning-44ab28ff39cb

Posted by: terwilligerbervicad.blogspot.com

0 Response to "How To Install Keras In Python Windows 10"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel