We use cookies to distinguish you from other users and to provide you with a better experience on our websites. Close this message to accept cookies or find out how to manage your cookie settings.
To save content items to your account,
please confirm that you agree to abide by our usage policies.
If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account.
Find out more about saving content to .
To save content items to your Kindle, first ensure no-reply@cambridge.org
is added to your Approved Personal Document E-mail List under your Personal Document Settings
on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part
of your Kindle email address below.
Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations.
‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi.
‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
The economic reforms of China in 1978 and Vietnam in 1986 have spurred the emergence of privately owned enterprises, leading to increased competition across state-owned and privately owned enterprises under communist authoritarian regimes. Upon joining the World Trade Organization (WTO), both countries faced unavoidable international competition, particularly excelling in labor-intensive manufacturing industries due to low labor costs. China’s pragmatic approach to market-oriented forces has resulted in a growth gap favoring China over Vietnam. Despite this, both nations have made significant economic strides, transitioning to fast-growing middle-income countries and reducing global inequality. The onset of the US–China trade war in 2018 has seen Vietnam emerge as a major beneficiary, challenging China’s dominance in labor-intensive manufacturing industries. This shift highlights the potential for hegemonic transitions in competition dynamics. Additionally, this chapter illuminates pre-reform competition in both countries, where shortages of goods led to resource competition among citizens – an aspect often overlooked in existing literature focused on market competition post-reform.
• To understand the need for importing libraries like NumPy, Pandas, Matplotlib, Scikit–Learn.
• To learn the steps to import dataset.
• To understand the process for handling missing values.
• To discuss the steps for handling categorical data.
• To understand the need and process of splitting the dataset into training and testing datasets.
• To discuss the steps to perform feature scaling by using normalization and standardization.
Machine learning (ML) algorithms work on cleaned data. Usually, the data we collect for building ML models suffers from noise, missing values, inconsistent data types, and different data scales. This makes pre-processing of data a very important phase in preparing the data for building ML models. Pre-processing is when we apply transformations over the data before feeding it to the ML algorithm. In short, data pre-processing symbolizes a set of procedures applied to the data to make it fit for ML algorithms. It generally involves the following steps:
Step 1—Importing libraries: It involves importing the necessary libraries that are required to carry out the subsequent data manipulation and cleaning tasks.
Step 2—Loading the dataset: The dataset that needs to be pre-processed must be loaded.
Step 3—Handling the missing values: Dataset often contains missing or null values; these values need to be handled appropriately.
Step 4—Handling the categorical data: In the data pre-processing phase, it is crucial to address categorical attributes that often contain multiple categories. Handling categorical data becomes an important step to ensure proper treatment and transformation of these attributes.
Step 5—Splitting the dataset into training and testing datasets: Training and testing is the most important part of ML; thus, we need to split the dataset into training and testing subsets before building the ML models.
Step 6—Feature scaling: In datasets, the range of data often varies, or data is often of different scales. Thus, feature scaling needs to be done to ensure uniformity in results.
It is important to note that it is not necessary to apply all of these steps to pre-process the data. However, based on the nature of the dataset, some of these steps may be skipped for building the model. In the coming sections, we will discuss the importance or need of these steps and discuss how to perform these steps in Python.
In the nineteenth century, physicists applied classical electromagnetic theory to explain the experimental results of black body radiation but were unable to provide an adequate explanation. This was a major problem to the physicists as classical theory predicted an infinite amount of energy of the radiation emitted from a black body. This gross disagreement was called the “ultraviolet catastrophe”. Max Planck presented a paper on December 14, 1900, in which he guessed the answer to this problem of black body radiation. This guess marked the very beginning of quantum mechanics.
The electromagnetic radiation inside a black body chamber exists as patterns of standing waves or modes. A single mode is like a standing wave on a guitar string and is characterized by a frequency. Planck made a bold hypothesis that the energy of such a mode is quantized, ithat is, only certain energies of these oscillation modes are allowed. Thus, the energy ð¸ð of ðth mode is given by ð¸ð = (ð + 12 ) âð = (ð + 12 ) âð, where ð is the oscillation frequency, â is Planck's constant, and ð is an integer starting with 0. Thus, each oscillation mode can exist in any one of an infinite number of energy states whose energies are equally separated by the energy âð. In the discussion of the properties of the photon gas, for the time being, we shall ignore 12 in the expression for ð¸ð as it has no effect on the results we seek. Therefore, we take ð¸ð = ðâð as the energy of the ðth mode whose (angular) frequency is ð. When the energy of a mode is ð¸ð, we say that there are ð photons in the mode. Each photon has energy equal to âð. Thus, according to the prescription of Max Planck, a black body radiation chamber consists of a number of photons in various energy states with different amounts of energy.
• To discuss the relationship between neural networks and the human brain.
• To learn the way to extend artificial neural network (ANN) to recurrent neural network (RNN).
• To know the limitations of feed-forward networks.
• To understand the working principle of RNNs.
• To understand the mathematical modeling of RNN.
• To know the limitations of RNNs.
• To get familiar with issues of vanishing and exploding gradients.
• To comprehend the concept of long short-term memory (LSTM).
• To understand the differences between RNN cells and LSTM cells.
• To understand the role of the input gate, forget gate, cell state, and output gate in the working of LSTM.
• To learn about the applications of RNN and LSTM.
20.1 Neural Networks and Human Brain
The inspiration to build artificial neural networks (ANNs) has come from the deep desire to simulate the working of the human brain. As our understanding of the human brain is getting enriched and improved daily due to the ongoing research on this topic, researchers are also improving the ANNs accordingly. One such recent addition is the recurrent neural networks (RNNs) and the long short-term memory (LSTM). In this chapter, we will discuss these developments in a simplified manner so that our readers can understand this amazing technology and use it for their development projects.
Sections 20.1 and 20.2 draw their inspiration from the blog titled “The Ultimate Guide to Recurrent Neural Networks (RNN)” published by SuperDataScience Team. Most of the figures used in these sections are adapted from this blog.
For detailed information on the blog, please refer to the “Additional Resources” section of this chapter.
Research on the human brain gives us the idea that the human brain has three main parts: cerebrum, cerebellum, and brainstem, as shown in Figure 20.1. Let us briefly discuss the main functions of these parts and their components to understand the association between neural networks and the human brain.
Cerebrum
From Figure 20.1, we can understand that the cerebrum has four lobes. These are as follows.
Little is known about how competitive attitudes differ between refugees and their host citizens. Study 1 investigated the relationship between refugee background and competitive attitudes, alongside demographic characteristics, social comparison concerns, and exposure to competition, using data from 190 North Korean refugees (NKRs) and 445 South Koreans (SKs). Refugee background and social comparison concerns had significantly more effect on competitive attitudes compared to other demographic characteristics and the ranking variable. In Study 2, cultural scores based on Hofstede’s theory were examined, alongside demographic factors, refugee background, and social comparison concerns. Refugee background and social comparison concerns showed stronger associations with competitive attitudes than cultural scores. Study 3 divided the sample into NKRs and SKs, revealing social comparison concerns’ predominant influence on competitive attitudes in both groups. However, the impact of the ranking variable varied between NKRs and SKs. These findings underscore the importance of understanding the experiences of refugees in shaping their competitive attitudes, from migration to resettlement.
In this ever-evolving era of technology, the field of machine learning (ML) stands at the forefront of innovation, promising unprecedented insights and solutions to complex problems. This textbook provides a comprehensive understanding of the theoretical foundations of ML algorithms, coupled with practical implementation using Python, designed to be a companion for both beginners venturing into the field and seasoned practitioners seeking to deepen their understanding.
Why Machine Learning?
ML is not just a technical endeavor; it is a transformational force shaping the future of how we interact with data. From enhancing search engines and revolutionizing social media to powering self-driving cars and advancing artificial intelligence (AI), the applications of ML are boundless. ML has paved the way for developing sophisticated chatbots, generative AI models, and AI copilots. This book aims to demystify the intricate concepts of ML, making them accessible to learners of all backgrounds.
What This Book Offers
- Foundations: We begin with the fundamentals, laying a solid groundwork to help you grasp the core concepts of ML.
- “Learning by Doing” Approach: This book adopts a “learning by doing” approach, offering step-by-step coding instructions for various ML techniques. The aim is to empower you with the knowledge and skills to implement these principles effectively.
- Real-World Applications: Understanding theory is essential, but applying it to real-world scenarios is where the true power of ML unfolds. This book bridges theory and application, ensuring a holistic learning experience.
For Whom This Book Is Intended
Whether you are a student exploring the realms of ML for the first time, a data professional aiming to expand your skill set, or a business leader seeking insights into how ML can elevate your organization, this book is crafted with you in mind.
How to Use This Book
Feel free to navigate the chapters based on your familiarity with the subject. If you’re a beginner, start from the beginning, and if you’re seeking advanced knowledge, dive into specific sections of interest. Explore GitHub resources that provide access to datasets, sample code, and examples used in this book for hands-on learning. For enhanced visual understanding, this book is complemented by an online video course available at learncompscience.com, allowing you to reinforce your knowledge through engaging video sessions.
Using the World Value Survey from Wave 2 (1989–1993) to Wave 7 (2017–2020), Study 1 demonstrates that individuals in individualistic regions exhibit more anti-competition attitudes compared to those in collectivist regions. Additionally, individuals in authoritarian, socialist, and collectivist Asian regions show the highest level of pro-competition attitudes, followed by those in democratic, capitalist, and individualistic Western regions and those in democratic, capitalist, and collectivist Asian regions. Study 2 reveals that competition is more likely to be endorsed by individuals who prioritize the individual’s responsibility over the government’s responsibility, value private ownership of businesses over government ownership of businesses, emphasize hard work for success, and prefer income incentives over income equality. Moreover, individuals with higher levels of materialism and self-determination are also inclined to endorse competition. Notably, variations exist in the relationship between individual difference variables and attitudes toward competition among the regions.
• To build various image classifiers by using the convolutional neural network (CNN).
• To perform image augmentation for extending the dataset.
• To import keras library and packages.
• To initialize the CNN model.
• To add convolution layer, pooling, flattening, and full connection operations to build the CNN.
• To perform a compilation of the CNN model.
• To get the predictions from the trained model.
• To improve the accuracy of the model by adding more convolutional and max pooling layers.
19.1 Building Image Classifier with CNN
The convolutional neural network (CNN) is the perfect choice for building an image classifier system. In this chapter, we will implement various CNN classifiers in Python by considering various case studies.
19.2 Dog–Cat Classifier
Consider an image classification problem that involves identifying photos as either containing a cat or dog. Our task is to develop a CNN model that can identify the object in the image as a dog or cat. The CNN model will be trained on a dataset of images containing a dog or cat, and then this trained model will be used for classification. Once the model is built, it can be used as a template to build other models for predicting the class of any image on the trained dataset. It means we can use the same model to classify the tumors by training them on medical images.
Preparing the Dataset
To build a dog–cat classifier, we will use 11000 manually annotated photos of dogs and cats, where 5500 photos are of dogs, and the remaining ones are of cats. This is the partial dataset that has been created from the dogs-vs-cats dataset available at Kaggle. The link for this dataset is given below.
This full dataset contains 37500 images (24000 in the train and 13500 in the test folders), which must be manually segregated into dog and cat folders. Since the dataset is huge and segregation is time-consuming, we took 10000 images (5000 images of dogs and 5000 images of cats) in the train folder and 1000 images in the test folder (500 images of dogs and 500 images of cats).
• To define clustering, explain its applications and features.
• To explain various proximity measures for data clustering.
• To discuss various clustering techniques.
• To explain the working principle of the k-means clustering algorithm.
• To discuss hierarchical clustering and its types.
• To discuss agglomerative and divisive clustering techniques.
• To describe the concept of the DBSCAN algorithm.
12.1 Introduction to Clustering
In machine learning (ML), labeling the data is one of the crucial tasks. But sometimes, we do not have the labeled data. Even though the data is not labeled, we can still analyze it using clustering techniques. As you know, algorithms in ML are broadly classified as supervised and unsupervised techniques. In the case of supervised learning, the input data points/examples are labeled, while in unsupervised learning, the input data points/examples are not labeled. Cluster analysis, also called clustering, comes under unsupervised learning. Here, the input data points are not labeled. Clustering is the most popular technique in unsupervised learning.
Clustering is defined as grouping the input data points into various clusters/groups based on their similarity.
A cluster contains objects that are more similar to each other. In other words, during cluster analysis, the data is grouped into classes or clusters, so that records within a cluster (intra-cluster) have high similarity with one another but have high dissimilarities in comparison to objects in other clusters (inter-cluster).
The clustering algorithm aims to minimize the intra-cluster distance and maximize the inter-cluster distance, as shown in Figure 12.1.
An example of clustering is shown in Figure 12.2. Here, records in the input have different shapes. Here, we only have the input data without any label of shape. After applying the clustering algorithm, they were classified into three types of clusters. Here, the clustering algorithm considers the dimensions of the object and its color as the input features. Records whose features are highly similar are gathered to form a single cluster. In this case, we get three clusters representing three types of records, i.e., it clusters rhombus, circle, and triangle separately, as shown in Figure 12.2.
My futile attempts to fit the elementary quantum of action somehow into the classical theory continued for a number of years and they cost me a great deal of effort. Many of my colleagues saw in this something bordering on tragedy. But I feel differently about it. For the thorough enlightenment I thus received was all the more valuable. I now knew for a fact that the elementary quantum of action played a far more significant part in physics than I had originally been inclined to suspect and this recognition made me see clearly the need for the introduction of totally new methods of analysis and reasoning in the treatment of atomic problems.
Max Planck
Learning Outcomes
After reading this chapter, the reader will be able to
Understand the distribution of energy density in a black body radiation as a function of wavelength and temperature
Derive classical laws of black body radiation such as Wien distribution law and Rayleigh–Jeans law
Get an idea about the development of quantum theory of radiation
Understand Planck's quanta postulates and explain the black body radiation spectrum
Derive Planck's law of black body radiation
Verify Planck's law of black body radiation experimentally
Derive Wien distribution law and Rayleigh–Jeans law and explain ultraviolet catastrophe from Planck's law of black body radiation
Determine the temperature of cosmic microwave background radiation using Planck's law of black body radiation
Solve numerical problems and multiple choice questions on black body Radiation
11.1 Introduction
Figure 11.1 The whole electromagnetic spectrum. Thermal radiation ranges in frequency from the shortest infrared rays through the visible-light spectrum to the longest ultraviolet rays.
Radiation emitted from the surface of a heated source is known as thermal radiation. In this process, thermal energy is spread out in all directions in the form of electromagnetic radiation and travels directly to its point of absorption at the speed of light. It does not require an intervening medium for its propagation. The wavelength of thermal radiation ranges from the longest infrared rays through the visible-light spectrum to the shortest ultraviolet rays. Such electromagnetic spectrum is shown in Figure 11.1 as a function of frequency. The distribution of radiant energy with their corresponding intensities within various ranges of wavelengths is governed by the temperature of the emitting surface .
This chapter seeks to strengthen the account of the Principle of Multispecies Legality offered in the previous chapter by responding to potential queries and concerns around the proposal’s structure, scope, and feasibility. The outlined concerns are as follows: that the PML is an attempt to redefine legal personhood; that a focus on interests is too inclusive, in that in opening the doors of legal inclusion to a relatively wide range of beings and entities it would put undesirable constraints on human activity; that a focus on interests is too limited in that it doesn’t capture the full scope of animals’ capabilities; that the PML will result in the equal treatment of humans and all other animals; that we shouldn’t base a being’s worth on their possession of a particular characteristic; and that the PML will be too unfeasible to implement.
The concluding chapter reiterates the goal of the book: to offer a solution to animals’ lack of legal inclusion by offering a new foundation of legal subjectivity. The Principle of Multispecies Legality provides such a foundation for animals and, indeed, all those beings and entities with interests. By contrast with the present paradigm of legal personhood, the PML is not premised on a vision of the ‘archetypal’ human which serves to exclude not only animals but also many vulnerable human groups. The PML is also an improvement over the rights of nature, in that it more straightforwardly recognises the interests and worth of individual animals and does not maintain the ontological barrier between humans and all other nature. Finally, we are reminded that making change takes a multispecies village: that the PML is only as good as those who are willing to implement it. In order to ensure real change for animals and other interested beings, we need to work to encourage greater respect for the non-human world.
• To know the limitations of traditional neural networks for image recognition.
• To understand the working principles of convolutional neural network (CNN).
• To understand the architecture of CNN.
• To know the importance of convolution layer, max pooling, flattening, and full connection layer of CNN model.
• To understand the process of training a CNN model.
• To decide the optimal number of epochs to train a neural network.
18.1 Image Recognition
Using a convolutional neural network (CNN), technological development in image recognition has revolutionized far beyond our imagination. Let us consider the comic scene shown in Figure 18.1, as it provides interesting insights into the development of image recognition and depicts a decade-back possible scenario. Here, a manager asks his computer programmer to “Develop an app which can check whether the user is in a national park or not, when he clicks some photo!” Being an easy and feasible task, the computer programmer responds that the task is merely of few hours. But, the manager's curiosity goes up, and he asks the programmer further to check whether the image is of a bird or not? Surprisingly, the programmer responds, “I need a research team and five years for this task.”
This surprised the manager as he expected it to be an easy task. But the programmer who has a knack in the field knows that it is one of the complex problems to be addressed in computer science.
In the last decade, we have provided solutions to many complex problems in the field of computers. But, for the last 50 years, we have been struggling to solve the problems in image recognition. However, thanks to the efforts of researchers and computer scientists across the globe, we can solve these problems now. Even a three-year-old child can identify a bird's photo, but identifying a way by which computers can do the same task was not a cake-walk; hence, it took almost 50 years!
We have finally found a promising approach for object recognition using deep CNN in recent years. In this chapter, we will discuss the working principle and concepts of CNN, a deep neural network approach to solving the problem of image recognition.
Very often, the term “chemical potential” is not well understood by the students. After studying thermal physics and statistical mechanics for several times, students are still in a lot of confusion about the meaning of the term “chemical potential”. This quantity is represented by the letter ð. Typically, students learn the definition of ð, its properties, its derivation in some simple cases, and its consequences, and work out numerical problems on it. Still, students ask the question: “What is the chemical potential?” and “What does it actually mean?” Attempts are made in this appendix to clarify the meaning of this physical quantity ð with some simple examples.
The concept of chemical potential has appeared first in the classical works of J. W. Gibbs. Since then, it has become actually a subtle concept in thermodynamics and statistical mechanics. It is not easy to grasp the meaning and significance of chemical potential ð, like thermodynamic concepts such as temperature ð , internal energy ð¸, or even entropy ð. In fact, chemical potential ð has acquired a reputation as a concept not easy to grasp even for the experienced physicist. Chemical potential was introduced by Gibbs within the context of an extensive exposition on the foundations of statistical mechanics. In his exposition, Gibbs considered a grand canonical ensemble of systems in which the exchange of particles occurs with the surroundings. In this description, the chemical potential ð appears as a constant required for a necessary closure to the corresponding set of equations. Thus, a fundamental connection with thermodynamics is achieved by observing that the unknown constant ð is indeed related to standard thermodynamic functions like the Helmholtz free energy ð¹ = ð â ð ð or the Gibbs thermodynamic potential ðº = ð¹ + ð ð through their first derivatives. ð, in fact, appeared as a conjugate variable to volume V. 4A.1 Comments about chemical potential
We are familiar with the term potential used in mechanical and electrical system. A capacity factor is associated with each potential term. For example, in a mechanical system, mass is the capacity factor associated with the gravitational potential ð(â2 â â1), where â1 and â2 are the corresponding heights, and the gravitational work done is given by ðð(â2 â â1).