Mastering Numerical Computing with NumPy
eBook - ePub

Mastering Numerical Computing with NumPy

Master scientific computing and perform complex operations with ease

Umit Mert Cakmak, Mert Cuhadaroglu

Condividi libro
  1. 248 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Mastering Numerical Computing with NumPy

Master scientific computing and perform complex operations with ease

Umit Mert Cakmak, Mert Cuhadaroglu

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

Enhance the power of NumPy and start boosting your scientific computing capabilitiesAbout This Book• Grasp all aspects of numerical computing and understand NumPy• Explore examples to learn exploratory data analysis (EDA), regression, and clustering• Access NumPy libraries and use performance benchmarking to select the right toolWho This Book Is ForMastering Numerical Computing with NumPy is for you if you are a Python programmer, data analyst, data engineer, or a data science enthusiast, who wants to master the intricacies of NumPy and build solutions for your numeric and scientific computational problems. You are expected to have familiarity with mathematics to get the most out of this book.What You Will Learn• Perform vector and matrix operations using NumPy• Perform exploratory data analysis (EDA) on US housing data• Develop a predictive model using simple and multiple linear regression• Understand unsupervised learning and clustering algorithms with practical use cases• Write better NumPy code and implement the algorithms from scratch• Perform benchmark tests to choose the best configuration for your systemIn DetailNumPy is one of the most important scientific computing libraries available for Python. Mastering Numerical Computing with NumPy teaches you how to achieve expert level competency to perform complex operations, with in-depth coverage of advanced concepts.Beginning with NumPy's arrays and functions, you will familiarize yourself with linear algebra concepts to perform vector and matrix math operations. You will thoroughly understand and practice data processing, exploratory data analysis (EDA), and predictive modeling. You will then move on to working on practical examples which will teach you how to use NumPy statistics in order to explore US housing data and develop a predictive model using simple and multiple linear regression techniques. Once you have got to grips with the basics, you will explore unsupervised learning and clustering algorithms, followed by understanding how to write better NumPy code while keeping advanced considerations in mind. The book also demonstrates the use of different high-performance numerical computing libraries and their relationship with NumPy. You will study how to benchmark the performance of different configurations and choose the best for your system.By the end of this book, you will have become an expert in handling and performing complex data manipulations.Style and approachThis mastering guide will help you master your skills required to perform a complex numerical computation. The book contains the right mixture of theory and practical examples that will help you in dealing with the advanced NumPy and build solutions for your numeric and scientific computational problems

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Mastering Numerical Computing with NumPy è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Mastering Numerical Computing with NumPy di Umit Mert Cakmak, Mert Cuhadaroglu in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Ciencia de la computación e Tratamiento de datos. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2018
ISBN
9781788996846

Linear Algebra with NumPy

One of the major divisions of mathematics is algebra, and linear algebra in particular, focuses on linear equations and mapping linear spaces, namely vector spaces. When we create a linear map between vector spaces, we are actually creating a data structure called a matrix. The main usage of linear algebra is to solve simultaneous linear equations, but it can also be used for approximations for non-linear systems. Imagine a complex model or system that you are trying to understand, think of it as a non-linear model. In such cases, you can reduce the complex, non-linear characteristics of the problem into simultaneous linear equations, and you can solve them with the help of linear algebra.
In computer science, linear algebra is heavily used in machine learning (ML) applications. In ML applications, you deal with high-dimensional arrays, which can easily be turned into linear equations where you can analyze the interaction of features in a given space. Imagine a case where you are working on an image recognition project and your task is to detect a tumor in the brain from MRI images. Technically, your algorithm should act like a doctor, where it scans the given input and detects the tumor in the brain. A doctor has the advantage of being able to spot anomalies; the human brain has been evolving through thousands of years to interpret visual input. Without much effort, a human can capture anomalies intuitively. However, for an algorithm to perform a similar task, you should think about this process in as much detail as possible to understand how you can formally express it so that the machines can understand.
First, you should think about how MRI data is stored in a computer, which processes only 0s and 1s. The computer actually stores pixel intensities in structures, called matrices. In other words, you will convert an MRI as a vector of dimensions, N2, where each element consists of pixel values. If this MRI has a 512 x 512 dimension, each pixel will be one point in 262,144 in pixels. Therefore, any computational manipulation that you will do in this Matrix would most likely use Linear Algebra principles. If this example is not enough to demonstrate the importance of Linear Algebra in ML, then let's look at a popular example in deep learning. In a nutshell, deep learning is an algorithm that uses neural network structure to learn the desired output (label) by continuously updating the weights of neuron connections between layers. A graphical representation of a simple deep learning algorithm is as follows:
Neural networks store weights between layers and bias values in matrices. As these are the parameters that you try to tune in to your deep learning model in order to minimize your loss function, you continuously make computations and update them. In general, ML models require heavy calculations and need to be trained for big datasets to provide efficient results. This is why linear algebra is a fundamental part of ML.
In this chapter, we will use numpy library but note that most linear algebra functions are also imported by scipy and they are more properly belong to it. Ideally, in most cases, you import both of these libraries and perform computations. One important feature of scipy is to have fully-featured versions of the linear algebra modules. We highly encourage you to review scipy documentation and practice using same operations with scipy throughout this chapter. Here's the link for linear algebra module of scipy: https://docs.scipy.org/doc/scipy/reference/linalg.html.
In this chapter, we will cover the following topics:
  • Vector and matrix mathematics
  • What's an eigenvalue and how do we compute it?
  • Computing the norm and determinant
  • Solving linear equations
  • Computing gradient

Vector and matrix mathematics

In the previous chapter, you practiced introductory operations with vectors and matrices. In this section, you will practice more advanced vector and matrix operations that are heavily used in linear algebra. Let's remember the dot product perspective on matrix manipulation and how it can be done with different methods when you have 2-D arrays. The following code block shows alternative ways of performing dot product calculation:
In [1]: import numpy as np 
a = np.arange(12).reshape(3,2)
b = np.arange(15).reshape(2,5)
print(a)
print(b)
Out[1]:
[[ 0 1]
[ 2 3]
[ 4 5]]
[[ 0 1 2 3 4]
[ 5 6 7 8 9]
In [2]: np.dot(a,b)
Out[2]: array([[ 5, 6, 7, 8, 9],
[15, 20, 25, 30, 35],
[25, 34, 43, 52, 61]])
In [3]: np.matmul(a,b)
Out[3]: array([[ 5, 6, 7, 8, 9],
[15, 20, 25, 30, 35],
[25, 34, 43, 52, 61]])
In [4]: a@b
Out[4]: array([[ 5, 6...

Indice dei contenuti