Full Chapter A Tour of Data Science Learn R and Python in Parallel Nailong Zhang PDF
Full Chapter A Tour of Data Science Learn R and Python in Parallel Nailong Zhang PDF
https://textbookfull.com/product/a-python-data-analysts-toolkit-
learn-python-and-python-based-libraries-with-applications-in-
data-analysis-and-statistics-gayathri-rajagopalan/
https://textbookfull.com/product/practical-data-science-cookbook-
data-pre-processing-analysis-and-visualization-using-r-and-
python-prabhanjan-tattar/
https://textbookfull.com/product/python-for-teenagers-learn-to-
program-like-a-superhero-james-r-payne/
https://textbookfull.com/product/hands-on-scikit-learn-for-
machine-learning-applications-data-science-fundamentals-with-
python-david-paper/
Graph Data Science with Neo4j: Learn how to use Neo4j 5
with Graph Data Science library 2.0 and its Python
driver for your project Scifo
https://textbookfull.com/product/graph-data-science-with-
neo4j-learn-how-to-use-neo4j-5-with-graph-data-science-
library-2-0-and-its-python-driver-for-your-project-scifo/
https://textbookfull.com/product/data-science-with-python-1st-
edition-coll/
https://textbookfull.com/product/learn-data-science-using-sas-
studio-a-quick-start-guide-engy-fouda/
https://textbookfull.com/product/learn-python-in-one-day-and-
learn-it-well-2nd-edition-jamie-chan/
https://textbookfull.com/product/a-tour-of-c-stroustrup/
A Tour of Data Science
Chapman & Hall/CRC Big Data Series
Series Editor: Sanjay Ranka
Smart Data
State-of-the-Art Perspectives in Computing and Applications
Kuan-Ching Li, Qingchen Zhang, Laurence T. Yang, Beniamino Di Martino
Nailong Zhang
First edition published 2021
by CRC Press
6000 Broken Sound Parkway NW, Suite 300, Boca Raton, FL 33487-2742
Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot as
sume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have
attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders
if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please
write and let us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or
utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including pho
tocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission
from the publishers.
For permission to photocopy or use material electronically from this work, access www. copyright.com or contact the
Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. For works that are
not available on CCC please contact [email protected]
Trademark notice: Product or corporate names may be trademarks or registered trademarks and are used only for
identification and explanation without intent to infringe.
Preface ix
0.1 ASSUMPTIONS ABOUT THE READER’S BACKGROUND ix
0.2 BOOK OVERVIEW ix
1.1 CALCULATOR 1
1.2 VARIABLE AND TYPE 3
1.3 FUNCTIONS 4
1.4 CONTROL FLOWS 6
1.5 SOME BUILT-IN DATA STRUCTURES 9
1.6 REVISIT OF VARIABLES 21
1.7 OBJECT-ORIENTED PROGRAMMING (OOP) IN R/PYTHON 30
1.8 MISCELLANEOUS 35
3.1 SQL 71
3.2 GET STARTED WITH DATA.TABLE AND PANDAS 74
vii
viii • Contents
Bibliography 203
Index 205
Preface
ix
x • Preface
programming. Mastering these topics will greatly help with coding skills. Like the first
chapter, in this chapter, I try to emphasize the differences between R and Python
with coding examples.
Chapter 3: data.table and pandas - In the first two chapters, we focus on
general-purpose programming techniques. In this chapter, we introduce the very ba
sics of data science, i.e., data manipulation. For the audience with little experience
in data science, we start from a brief introduction to SQL. The major part of this
chapter focuses on the two widely used data.frame packages, i.e., data.table in R and
pandas in Python. Side-by-side examples using the two packages not only enables the
audience to learn basic usages of these tools but also can be used as a quick reference
manual.
Chapter 4: Random Variables, Distributions & Linear Regression - In
this chapter, we focus on statistics and linear regression, which is the foundation of
data science. To better follow this chapter, I recommend any introductory level statis
tics course as a prerequisite. The topics of this chapter include random variable sam
pling methods, distribution fitting, joint distribution/copula simulation, confidence
interval calculation, and hypothesis testing. In later sections, we also talk about lin
ear regression models from scratch. Many textbooks introduce the theories behind
linear regressions but still don’t help much on the implementation. We will see how
the linear regression is implemented as a toy example in both R and Python with the
help of linear algebra. I will also show how the basic linear regression model can be
used for L2 penalized linear regression, i.e., ridge regression.
Chapter 5: Optimization in Practice - Most machine learning models rely
on optimization algorithms. In this chapter, we give a brief introduction to optimiza
tion. Specifically, we will talk about convexity, gradient descent, general-purpose op
timization tools in R and Python, linear programming and metaheuristic algorithms,
etc. Based on these techniques, we will see coding examples about maximum likeli
hood estimation, linear regression, logistic regression, portfolio construction, traveling
salesman problem.
Chapter 6: Machine Learning – A gentle introduction - Machine learning
is a huge topic. In this chapter, I try to give a very short and gentle introduction to
machine learning. It starts with a brief introduction of supervised learning, unsuper
vised learning and reinforcement learning, respectively. For supervised learning, we
will see the gradient boosting regression with a pure Python implementation from
scratch, from which the audience could learn the translation from the mathematical
models to object-oriented programs. For unsupervised learning, the finite Gaussian
mixture model and PCA are discussed. And for reinforcement learning, we will also
use a simple game as an example to show the usage of deep Q-networks. The goal
of this chapter is two-fold. First, I would like to give the audience an impression of
what machine learning looks like. Second, reading the code snippets in this chapter
could help the audience review/recap the topics in previous chapters.
CHAPTER 1
Introduction to R/Python
Programming
1.1 CALCULATOR
R and Python are general-purpose programming languages that can be used for
writing softwares in a variety of domains. But for now, let us start with using them
as basic calculators. The first thing is to have them installed. R1 and Python2 can be
downloaded from their official website. In this book, I will be using R 3.5 and Python
3.7.
To use R/Python as basic calculators, let’s get familiar with the interactive mode.
After the installation, we can type R or Python (it is case insensitive so we can also
type r/python) to invoke the interactive mode. Since Python 2 is installed by default
on many machines, in order to avoid invoking Python 2 we type python3.7 instead.
2 ~ $R
3
4 R version 3.5.1 (2018 −07 −02) −− " Feather Sp\ footnoteray "
5 Copyright (C) 2018 The R Foundation for Statistical Computing
6 Platform : x86_64−apple−darwin15 .6.0 (64− bit)
7
1
https://www.r-project.org
2
https://www.python.org
1
2 • A Tour of Data Science: Learn R and Python in Parallel
22 >
Python
1 ~ $python3 .7
2 Python 3.7.1 (default , Nov 6 2018 , 18:45:35)
3 [ Clang 10.0.0 (clang − 1000.11.45.5)] on darwin
4 Type "help", " copyright ", " credits " or " license " for more
information .
5 >>>
The messages displayed by invoking the interactive mode depend on both the
version of R/Python installed and the machine. Thus, you may see different messages
on your local machine. As the messages said, to quit R we can type q(). There are 3
options prompted by asking the user if the workspace should be saved or not. Since
we just want to use R as a basic calculator, we quit without saving workspace.
To quit Python, we can simply type exit().
1 > q()
2 Save workspace image ? [y/n/c]: n
3 ~ $
Once we are inside the interactive mode, we can use R/Python as a calculator.
1 > 1+1
2 [1] 2
3 > 2 ∗ 3+5
4 [1] 11
5 > log (2)
Introduction to R/Python Programming • 3
6 [1] 0.6931472
7 > exp (0)
8 [1] 1
Python
1 >>> 1+1
2 2
3 >>> 2 ∗ 3+5
4 11
5 >>> log (2)
6 Traceback (most recent call last):
7 File "<stdin >", line 1, in <module >
8 NameError : name ’log ’ is not defined
9 >>> exp (0)
10 Traceback (most recent call last):
11 File "<stdin >", line 1, in <module >
12 NameError : name ’exp ’ is not defined
Python
R Python
R Python
1.3 FUNCTIONS
We have seen two functions log and exp when we use R/Python as calculators.
A function is a block of code which performs a specific task. A major purpose of
wrapping a block of code into a function is to reuse the code.
It is simple to define functions in R/Python.
R Python
Here, we defined a function fun1 in R/Python. This function takes x as input and
returns the square of x. When we call a function, we simply type the function name
Introduction to R/Python Programming • 5
followed by the input argument inside a pair of parentheses. It is worth noting that
input or output are not required to define a function. For example, we can define a
function fun2 to print Hello World! without input and output.
One major difference between R and Python codes is that Python codes are
structured with indentation. Each logical line of R/Python code belongs to a certain
group. In R, we use {} to determine the grouping of statements. However, in Python
we use leading whitespace (spaces and tabs) at the beginning of a logical line to
compute the indentation level of the line, which is used to determine the statements’
grouping. Let’s see what happens if we remove the leading whitespace in the Python
function above.
Python
R Python
1 > fun2= function (){print(’ 1 >>> def fun2 (): print (’Hello
Hello World!’)} World !’)
2 > fun2 () 2 ...
3 [1] " Hello World !" 3 >>> fun2 ()
4 Hello World !
Let’s go back to fun1 and have a closer look at the return. In Python, if we
want to return something we have to use the keyword return explicitly. return in
R is a function but it is not a function in Python and that is why no parenthesis
follows return in Python. In R, return is not required even though we need to return
something from the function. Instead, we can just put the variables to return in the
last line of the function defined in R. That being said, we can define fun1 as follows.
R Python
6 • A Tour of Data Science: Learn R and Python in Parallel
In Python we have to put the arguments with default values at the end, which
is not required in R. However, from a readability perspective, it is always better to
put them at the end. You may have noticed the error message above about positional
argument. In Python there are two types of arguments, i.e., positional arguments
and keyword arguments. Simply speaking, a keyword argument must be preceded
by an identifier, e.g., base in the example above. And positional arguments refer to
non-keyword arguments.
1.4.1 If/else
Let’s define a function to return the absolute value of input.
R Python
The code snippet above shows how to use if/else in R/Python. The subtle
Introduction to R/Python Programming • 7
difference between R and Python is that the condition after if must be embraced by
parenthesis in R but it is optional in Python.
We can also put if after else. But in Python, we use elif as a shortcut.
R Python
R Python
There is something more interesting than the for loop itself in the snippets above.
In the R code, the expression 1:3 creates a vector with elements 1, 2 and 3. In the
Python code, we use the range() function for the first time. Let’s have a look at
them.
R Python
sequence of numbers. range() function can take three arguments, i.e., range(start,
stop, step). However, start and step are both optional. It’s critical to keep in mind
that the stop argument that defines the upper limit of the sequence is exclusive. And
that is why in order to loop through 1 to 3 we have to pass 4 as the stop argument
to range() function. The step argument specifies how much to increase from one
number to the next. The default values of start and step are 0 and 1, respectively.
R Python
You may have noticed that in Python we can do i+=1 to add 1 to i, which is not
feasible in R by default. Both for loop and while loop can be nested.
1.4.4 Break/continue
Break/continue helps if we want to break the for/while loop earlier, or to skip a
specific iteration. In R, the keyword for continue is called next, in contrast to continue
in Python. The difference between break and continue is that calling break would
exit the innermost loop (when there are nested loops, only the innermost loop is
affected); while calling continue would just skip the current iteration and continue
the loop if not finished.
R Python
R Python
In the code snippet above, the first element in the variable z in R is coerced from
1 (numeric) to "1" (character) since the elements must have the same type.
To access a specific element from a vector or list, we could use []. In R, sequence
types are indexed beginning with the one subscript. In contrast, sequence types in
Python are indexed beginning with the zero subscript.
R Python
R Python
In Python, negative index number means indexing from the end of the list. Thus,
x[−1] points to the last element and x[−2] points to the second-last element of
the list. But R doesn’t support indexing with negative numbers in the same way as
Python. Specifically, in R x[−index] returns a new vector with x[index] excluded.
When we try to access with an index out of boundary, Python would throw an
IndexError. The behavior of R when indexing out of boundary is more interesting.
First, when we try to access x[0] in R we get a numeric(0) whose length is also
0. Since its length is 0, numeric(0) can be interpreted as an empty numeric vector.
When we try to access x[length(x)+1] we get an NA. In R, there are also NaN and
NULL.
NaN means "Not A Number" and it can be verified by checking its type - "double".
0/0 would result in an NaN in R. NA in R generally represents missing values. And
NULL represents a NULL (empty) object. To check if a value is NA, NaN or NULL, we
can use is.na(), is.nan() or is.null, respectively.
R Python
R Python
R Python
When we use the ∗ operator to make replicates of a list, there is one caveat - if
the element inside the list is mutable then the replicated elements point to the same
memory address. As a consequence, if one element is mutated other elements are also
affected.
Python
9 >>> y
10 [[−1], [−1], 2, [−1], [−1]]
11 >>> x
12 [−1]
How to get a list with replicated elements but pointing to different memory ad
dresses?
Python
1 >>> x=[0]
2 >>> y=[x[:] for _ in range (5)] # [:] makes a copy of the list x;
another solution is [list(x) for _ in range (5)]
3 >>> y
4 [[0] , [0], [0] , [0] , [0]]
5 >>> y [0][0]=2
6 >>> y
7 [[2] , [0], [0] , [0] , [0]]
Python
The code snippet above uses hash character # for comments in both R and
Python. Everything after # on the same line would be treated as comment (not
executable). In the R code, we also used the function seq() to create a vector.
When I see a function that I haven’t seen before, I might either google it or
use the built-in helper mechanism. Specifically, in R use ? and in Python use
help().
R Python
• Condition-based
Condition-based slicing means to select a subset of the elements which satisfy
certain conditions. In R, it is quite straightforward by using a boolean vector
whose length is the same as the vector to be sliced.
Python
We can also use if statement with list comprehension to filter a list to achieve
list slicing.
Python
14 • A Tour of Data Science: Learn R and Python in Parallel
Python
The example above shows the power of list comprehension. To use if with list
comprehension, the if statement should be placed in the end after the for loop
statement; but to use if/else with list comprehension, the if/else statement
should be placed before the for loop statement.
R Python
R Python
As the list structure in Python is mutable, there are many things we can do with
list.
Introduction to R/Python Programming • 15
Python
I like the list structure in Python much more than the vector structure in R. list
in Python has a lot more useful features which can be found from the python official
documentation4 .
1.5.2 Array
Array is one of the most important data structures in scientific programming. In R,
there is also an object type "matrix", but according to my own experience, we can
almost ignore its existence and use array instead. We can definitely use list as array
in Python, but lots of linear algebra operations are not supported for the list type.
Fortunately, there is a Python package numpy off the shelf.
1 > x=1:12
2 > array1 =array (x, c(4 ,3)) # convert vector x to a 4 rows ∗ 3
cols array
3 > array1
4 [,1] [ ,2] [ ,3]
5 [1,] 1 5 9
6 [2,] 2 6 10
7 [3,] 3 7 11
8 [4,] 4 8 12
9 > y=1:6
10 > array2 =array (y, c(3 ,2)) # convert vector y to a 3 rows ∗ 2
cols array
11 > array2
12 [,1] [ ,2]
4
https://docs.python.org/3/tutorial/datastructures.html
16 • A Tour of Data Science: Learn R and Python in Parallel
13 [1,] 1 4
14 [2,] 2 5
15 [3,] 3 6
16 > array3 = array1 % ∗ % array2 # % ∗ % is the matrix multiplication
operator
17 > array3
18 [,1] [ ,2]
19 [1,] 38 83
20 [2,] 44 98
21 [3,] 50 113
22 [4,] 56 128
23 > dim( array3 ) # get the dimension of array3
24 [1] 4 2
Python
You may have noticed that the results of the R code snippet and Python code
snippet are different. The reason is that in R the conversion from a vector to an array
Introduction to R/Python Programming • 17
Python
1 >>> array1 =np. reshape (list(range (1 ,13)) ,(4 ,3) ,order =’F’) # use
order =’F’
2 >>> array1
3 array ([[ 1, 5, 9],
4 [ 2, 6, 10] ,
5 [ 3, 7, 11] ,
6 [ 4, 8, 12]])
7 >>> array2 =np. reshape (list(range (1 ,7)) ,(2 ,3)).T # use .T t o
transpose an array
8 >>> array2
9 array ([[1 , 4],
10 [2, 5],
11 [3, 6]])
12 >>> np.dot(array1 , array2 ) # now we get the same result as using
R
13 array ([[ 38, 83],
14 [ 44, 98] ,
15 [ 50, 113] ,
16 [ 56, 128]])
To learn more about numpy, the official website5 has great documentation/tutori
als.
The term broadcasting describes how arrays with different shapes are handled
during arithmetic operations. A simple example of broadcasting is given below.
R Python
However, the broadcasting rules in R and Python are not exactly the same.
R Python
From the R code, we see the broadcasting in R is like recycling along with the
column. In Python, when the two arrays have different dimensions, the one with fewer
dimensions is padded with ones on its leading side. According to this rule, when we
do x ∗ y, the dimension of x is (3, 2) but the dimension of y is 3. Thus, the dimension
of y is padded to (1, 3), which explains what happens when x ∗ y.
6 [[2]]
7 [1] " hello world !"
8
9 > x[[1]]
10 [1] 1
11 > x[[2]]
12 [1] " hello world !"
13 > length (x)
14 [1] 2
Another random document with
no related content on Scribd:
If the analysis of the relation of the individual to society is correct,
we are justified in claiming that any adequate statement of the aim of
education must point unmistakably to the idea of the common good.
Education aims so to adjust the individual to the group that the
welfare of society as a whole may be advanced. This adjustment can
be brought about only through participation in social activities, and
thus the aim is constantly realized in the process.
In our democratic society, which makes possible free education for
all of its members, there can be no question of the right of society to
demand that education aim to develop men and women who work
for the common good. It is necessary, then, to analyze this aim of
social efficiency in terms of our society. The equality of opportunity
which we profess to offer is to be thought of in terms of possible
service which may be rendered.
In any community the contribution to the general welfare which
may be made by any one of its members is conditioned by the
interests which the individual has in the general good. The unsocial
individual, the one who seldom responds to the needs of the group,
is out of sympathy with social problems, and contributes little to
social welfare.
But it is not enough that the individual be interested in the common
welfare. Interest may lead him to do that which is harmful rather than
helpful, or it may be that his interest may have no result except to
give him certain pleasurable emotions. There must be added to
sympathy, knowledge. Interest or sympathy in the welfare of society
may furnish the propelling force, but knowledge is necessary for
effective action. The world is full of men and women with the best
intentions who hinder rather than advance the common good.
Since each is responsible not only for his own conduct, but also for
the welfare of the whole group, it is necessary that our education
provide opportunity for growth in intelligence. Our schools have
always emphasized this element in education. We have often
defined the aim of education in terms of the development of
citizenship. Usually the chief qualification of the citizen has been
interpreted to be that knowledge which would enable him to exercise
the right of suffrage with intelligence. We do well, however, to
remember that intelligence must be exercised in all of the activities of
life. Our education must strive constantly to develop men and
women who will be rational at all times. But we may not forget that
our schools have been so much concerned with the intellectual side
of education that they have tended to neglect other elements which
are equally significant from the standpoint of social welfare.
There is still another element which must be added, the habit of
acting on behalf of the group. We all know people who know just
what is demanded in a given social situation; they profess to be
interested in the welfare of the group; but they never act. When their
own private interests are involved they are quick to seize the
opportunity for improving their condition; but in social matters they
are inactive. It is in this particular, rather than in any other, that our
schools fall short. We do much to arouse the sympathy of children in
the general welfare; we give them the knowledge by which their
action may be guided; but we give them little opportunity to form the
habit of social service. This is due to the fact that we so often think of
adult social activities as the only ones that are worth while, forgetting
that for the child the important thing is social activity now and in his
society, that the only way to prepare for adult social effectiveness is
to secure social efficiency on the part of the child.
These questions still remain: how can we, through education,
produce the individual who, because of social sympathy, knowledge,
and activity, will tend to advance the welfare of all; and what kinds of
education meet the demands of the aim which we have set up.
First of all, we must endeavor to produce the individual who is
sound physically. Modern education recognizes the fact that a man’s
usefulness is conditioned by his bodily condition, and is also coming
to find that physical activity is not without its effect on the mental
development and life of the individual. There is, therefore, one large
division of our work which we may call physical education.
On the side of mental development, education consists in
preserving and stimulating the child’s interest in the materials and
processes with which he may come in contact. Intellectual training
aims to develop the man or woman who is mentally alert, active in
investigation, and controlled by reason. It is to this intellectual
education that our schools have devoted the larger part of their time.
The school is the agency set aside by society for transmitting culture,
and the teacher must always concern herself largely with the
intellectual life of children.
Our modern view of education is leading us to stress, along with
physical and intellectual education, a kind of training which aims to
develop the individual whose moral standards are positive rather
than negative. Moral-social education should establish ideals of
social service as well as standards of individual righteousness.
Along with physical, moral-social, and intellectual-cultural
education, there is need for that type of training which will enable
each individual to do some particular work with a high degree of
efficiency. This type of education we commonly call vocational. It is
only recently that we have come to realize that it is not enough to
train an individual with respect to general intelligence and morality,
but that it is also just as fundamental that our education provide the
training necessary for success in the particular calling which each
individual is to enter. For the preparation of clergymen, doctors,
lawyers, teachers, and engineers, whose vocations require a
maximum of intellectual achievement, it is true that we have long had
our vocational schools. We are coming now to appreciate the fact
that equality of opportunity demands that special training be given to
those who are to enter the industries. Indeed, our vocational schools
must multiply until there is training offered for each and every calling
before we can claim to provide that training which is essential for
social efficiency.
Another problem is that of the training for leisure. In society as at
present constituted, it is possible for many individuals, and it should
ultimately be possible for all, to have a considerable amount of
leisure time. The contribution of each individual in his special line of
work, and his general interest in the whole community, will depend in
a considerable degree upon the proper use of leisure time. Our
education must, therefore, attempt to equip men with interests and
ideals which make for the nobler enjoyments.
Keeping in mind the sympathetic, wise, active social individual,
made so by the process of acquiring experience or making of
adjustments, both physical and mental, we have yet to reduce our
aim to the terms of schoolroom practice. What can a teacher hope to
do in this hour, with this group of children to work with?
First of all the teacher can work for the formation of habits which
are socially desirable and for the inhibition of those which are
undesirable. “Education is for behavior, and habits are the stuff of
which behavior consists.”[1] The school may be a very important
factor in the formation of habits in each of the fields of education
mentioned above. If the school is organized on a rational social
basis, it must continually present opportunities for actions which
should become habitual, and the future efficiency of the learner
depends upon gaining such control of much of the knowledge which
we teach that the response desired becomes habitual. The social
virtues of promptness, regularity, helpfulness, industry, fidelity,
honesty, truthfulness, cleanliness, both physical and mental,
patriotism, and the like, should be made habitual in connection with
the situations which demand their exercise. The physical habits
acquired in childhood are of the utmost significance throughout life.
Much of arithmetic, spelling, writing, geography, history, and even of
literature and art, will be significant in proportion as we have reduced
our knowledge to the automatic basis of habit. One cannot stop to
reason everything out; life is too short. We gain time and energy for
the higher activities of life in proportion as we reduce the responses
which occur frequently to the basis of habits. In vocational schools
one of the chief aims is the formation of habits of skill. Later we shall
want to discuss in detail the methodology of habit formation.
Every teacher recognizes that one of the ends which must be
achieved by the school is knowledge. We shall not here enter into
the discussion of the problem of what knowledge is of most worth,
since for the teacher this choice is usually made and prescribed in
the course of study. One cannot, however, refrain from suggesting
that much that is taught would be eliminated, if we kept constantly in
mind the end for which we strive. The following criteria, proposed by
Professor Frank M. McMurry, will be suggestive from the standpoint
of teaching, whether the teacher determines the curriculum or not.
“We hold to the following propositions in the rejection of subject
matter.[2]
“1. Whatever cannot be shown to have a plain relation to some
real need of life, whether æsthetic, ethical, or utilitarian in the
narrower sense, must be dropped.
“2. Whatever is not reasonably within the child’s comprehension.
“3. Whatever is unlikely to appeal to his interest; unless it is
positively demanded for the first very weighty reason.
“4. Whatever topics and details are so isolated or irrelevant that
they fail to be a part of any series or chain of ideas, and therefore fail
to be necessary for the appreciation of any large point. This
standard, however, not to apply to the three R’s and spelling.”
These criteria indicate clearly that knowledge can never be in itself
an end of teaching. It is not that the child may have knowledge
merely, but that he shall have knowledge which will function. This
knowledge which we seek to have the child master will concern his
physical life, his social relationships, his vocation; and in each field
the knowledge he possesses will limit his intellectual activity.
The school must keep alive, or, in some cases, awaken those
interests which are socially desirable. It is not enough that habits
have been formed and knowledge acquired. Much of the usefulness
of the individual after he leaves school will depend on his interests
which lead him to acquire new knowledge, or to attempt some new
activity. It has sometimes been asserted that the school, as at
present organized, tends to kill rather than to preserve those
interests which are common to little children. It is probable that the
passing interests in things due to curiosity must disappear,
regardless of the education which we give; but it is a poor sort of
education which leaves the child without abiding interests which will
help him not only in making a living, but also in enjoying his life.
Here, as elsewhere in education, we may be satisfied with the result
only when we get the corresponding action. That child has an
interest in good literature who reads good literature. We can be sure
that the boy is interested in natural phenomena when he is willing to
spend his leisure time finding out more about nature’s ways. The
only test that we have of an abiding interest in the welfare of others
is the fact that the child is now active on behalf of others. In like
manner are we to judge of our success in arousing and maintaining
those other interests which are desirable.
Judgments of fact are called for constantly in acquiring knowledge
and in our everyday activity; but no less important in the life of
individuals are judgments of worth. Education must concern itself
with the ideals, purposes, and standards which should be acquired
by children. There is no field in which greater skill is demanded in
teaching than in bringing children to appreciate those things which
are good, true, and beautiful. Ideals, or, for those who do not agree
with them, prejudices, will always be of tremendous importance.
They determine the course of action a man will take. Because of
their ideals men have been willing to labor incessantly for a cause
which they considered just, to give up personal good in the
pursuance of public duty, to lose all, if they might but retain their
honor, yes, even to lose their lives because they felt that this
extreme service was demanded of them. The awakening and
nurturing of ideals of work (or industry), of honor, of duty, of purity, of
service is the greatest contribution of the best teacher.
There is one other aim which the teacher should have constantly
in mind, included possibly in the above, but which needs to be stated
separately for the sake of emphasis, i.e. that children should be
taught how to work independently. The best teacher is the one who
is constantly striving to render her services unnecessary. There is
nothing that the school can do which will take the place of giving the
child knowledge of the most economical means to be employed in
achieving desirable ends. Is it a matter of knowledge, the child
should be made conscious of the methods whereby truth may be
established; is it the need of establishing a new habit, or the
breaking up of the old one, we should make available for the pupil
the principles of habit formation so that he may apply them to his
own case; in matters of right and wrong, the school should have
supplied standards of reference which will help in the difficult
situation. Possibly the great weakness of many teachers in imparting
this knowledge of methods of work is best illustrated by citing the
well-known fact that children of high school, or even college age, are
found very frequently who do not know how to read a book, or study
a lesson assigned. This problem will be treated in considerable detail
when we come to consider the study lesson.
Pupils at work forming habits of thought, feeling, and action;
acquiring knowledge of nature and of society; forming ideals which
make for social well-being; and learning in all of this work to act
independently, to function in the society of which they are a part: this
is education, and these are the goals which we should strive to
achieve every day and every hour that we teach.
Exercises.
1. How would you hope to contribute to the realization of the aim of education in
the teaching of English, arithmetic, cooking, geography, or other school subjects?
2. How would you determine whether or not the children in your grade are
socially efficient?
3. What are the most important subjects, or parts of subjects, which you teach?
Why?
4. How would an application of the aim of education as discussed in this chapter
modify the work commonly done in arithmetic? In nature study?
5. It has been claimed that education should provide for the harmonious
development of all of the powers. Criticize this statement of aim.
6. Could you defend the statement that “the aim of education is to produce
socially efficient men and women,” and at the same time deny that the greatest
individual good comes from working for the general welfare?
7. Why should education be free in a democracy?
8. Is society justified in offering special education to the deficient and the
delinquent? To the especially capable? Why?
9. Is the excessive rivalry which we sometimes foster in our schools compatible
with the aim of social efficiency?
10. Of the several types of education, physical, intellectual, moral-social,
vocational, and education for leisure, which is most neglected?
11. How do you account for the fact that many children cease to inquire, to
investigate, or even to ask questions, although they are regularly taught in our
schools?
12. Why do you teach school? What do you hope to accomplish?
13. Can you name specific instances of changes brought about in children under
your instruction which justify you in believing that you have fulfilled the aim of
education in your teaching?
14. What justification is there for music, drawing, or literature in the curriculum?
15. State briefly the aim of education.
CHAPTER II
T H E FA C T O R S C O N D I T I O N I N G T H E T E A C H I N G P R O C E S S