Anaconda Library Setup

In this article, we will briefly get to know the libraries that we will use in future projects and see how to download Anacondafrom the package manager.

Numpy Library

Numpy is a python library that allows us to perform linear algebra operations more easily and faster, which is very important for machine learning. Performance is very important for us at this point because we usually process big data in the field of artificial intelligence. First, after downloading the numpy library, let's compare the pure python array with the numpy array with an example. We can download libraries in two different ways. We can download it from the Anaconda Navigator interface or CLI (code line interface). Let's first look at its download via Anaconda Navigator. After opening Anaconda Navigator, we click on the Environments tab on the next. Then we write numpy in the search section by selecting the installed part above. We select Numpy and press apply. For the download, the Anaconda package manager will detect and download other packages that the Numpy library depends on, and we press apply again in the window that appears.

anaconda
Install Numpy

Another download option is from the CLI. In the search section of our computer, we search and open Anaconda Prompt and complete the download process by entering the command "conda install numpy" in the resulting terminal. You can download whichever process is easier for you. In the following code example, you can see the speed comparison between numpy and python for the collection of 2 10 million elemental arrays.

import numpy as np
import time

dizi_boyutu = 10000000

def saf_python_dizisi():
    # We're starting our time
    t1 = time.time()
    # We're creating 2 series with 10 million employees
    X = range(dizi_boyutu)
    Y = range(dizi_boyutu)
    # performs aggregation between two arrays and has a new 1 million elements 
    # We get a series
    Z = [X[i] + Y[i] for i in range(len(X))]
    # We're taking the end time.
    t2 = time.time()
    
# We calculate the total time spent.
    return t2 - t1

def numpy_dizisi():
    t1 = time.time()
    We're creating two numpy sequences with 10 million employees.
    X = np.arange(dizi_boyutu)
    Y = np.arange(dizi_boyutu)
    # We're collecting these two series and writing them into a new numpy series.
    Z = X + Y
    t2 = time.time()
    
return t2 - t1

python_zamani = saf_python_dizisi()
numpy_zamani = numpy_dizisi()

print(python_zamani, numpy_zamani)
print("In this example, numpy " + str(python_zamani / numpy_zamani) + " times faster.")   
anaconda
Numpy array vs. Python array speed

Pandas Library

Pandas library is a python library used for data analysis and data preprocessing. We can define data analysis as extracting useful information from data, examining data, and preprocessing data to bring the data we will use to the appropriate form before introducing it into machine learning algorithms. If you wish, you can download the library again via Anaconda Navigator or via CLI by typing "conda install pandas" as below.

anaconda
Installing Pandas

Matplotlib Library

The Matplotlib library is a library for data visualization. Data visualization organizes complex data, making it easier for us to better understand data, identify outliers on data, and observe ups and downs on data. You can download the library according to your preference via Anaconda Navigator or by typing "conda install matplotlib" via CLI.

anaconda
Installing Matplotlib

Tensorflow and Keras Libraries

Tensorflow is a library where we can train machine learning algorithms. Keras is a deep learning library. Keras uses Tensorflow in the background, which means that the Keras codes we write are translated into Tensorflow codes in the background. Since coding on Keras is easier than Tensorflow says, people who have just started working in this field can easily use Keras. After searching for Tensorflow on anaconda Navigator, you can select both Keras and Tensorflow to perform the download by selecting the download process or by running the command "conda install -c conda-forge keras" via CLI. Since the Keras library is already dependent on Tensorflow, Tensorflow will also be installed automatically when we run this command.

anaconda
Tensorflow and Keras installation

In our future articles, we will install the libraries that we will use as much as necessary, and you can download the libraries you want to use with your preferred method.