Author Archives: Dr. Darrin

Dendrogram with D3.js

Dendrogram is a type of hierarchical visualization commonly used in data science with hierarchical clustering. In d3.js, the dendrogram looks slightly different in that the root is in the center and the nodes branch out from there. This idea continues for every parent child relationship in the data.

In this post, we will make a simple dendrogram with d3.js using   a simple json file shown below.

{

  "name": "President",

          "children": [

        { "name": "VP of Academics",

        "children":[

          {"name":"Dean of Psych"},

          {"name":"Dean of Ed"}

        ] },

       { "name": "VP of Finance" },

        { "name": "VP of Students" }

      ]

    }

You will need to save the code above as a json file if you want to make this example. In the code, this json example is called “university.json”

Making the Dendrogram

We will begin by setting up the basic svg limit as found in lines 1-19 below.
1.png

In lines 20-26, the radius of the nodes is set and added to the svg element. The clusters are set with the creation of the cluster variable. Below is the code.

1.png

In lines 27-37, we set the position of the nodes and links as well as diagonals for the path.

1

Lines 49-80, have three main blocks of code.

The first block creates a variable called nodesGroups. This code provides a place to hold the nodes and the text that we are going to create.

The second block of code is adding circles to the nodeGroups with  additional settings for the color and radius size. Lastly, the third block of code adds texts to the nodesGroups.

1.png

When all the steps have been taken, you will see the following when you run the code.

1.png

You can see how things worked. The center is the president with the vp of academics of to the right. The president has three people under him (all VPs) while the VP of academics has two people under him (deans). The colors for the path and the circle are all set in the last block of code that was discussed.

Conclusion

Dendrograms allow you to communicate insights about data in a distinctly creative way. This example was simplistic but serves the purpose of exposing you to another way  of using d3.js

Advertisements

Postmodern Teacher

During the last half of the 20th century the philosophical school of post-modernism arose. Just as with existentialism, post-modernism is a school of thought that is anti-definition and anti-organized. As such, it is hard to pinned down exactly what post-modernist believe and stand for in a way that this could be done for older philosophies. In many, ways, as we get closer to the present era the ideas and tenets of the current philosophies become almost invisible  perhaps because we are living directly under their effect rather than looking at their influence in the past.
1
Background

Post-modernism, like almost all philosophies it seems, is a reaction  to modernism.  Modernism primary tenet was to understand the world through the use of reason. Modernist believed that the world had fixed laws that could be observed and understood. Science was the way to understand reality and attain truth. There was also this sense of continuous progress, which is something that is still repeated in the media today.

However, modernism did not solve all problems and lead to a Utopian existence. Instead, throughout the late 19th and 20th century there were consequences of scientific and social progress from pollution, to atomic destruction, wars, famine, disease, etc. It seemed as if every time science solved one problem it eventually led to more problems that were not anticipated.

The foundation for post-modernism was laid by Friedrich Nietzsche who claimed that truth and God are dead. This shifted knowledge from something that was absolute to something that was human generated.

Pragmatism and existentialism further laid the groundwork for post-modernism with pragmatism’s position that knowledge was provisional and constantly changing. Existentialism simply reinforces Nietzsche’s position that knowledge is constructed rather than discovered.

Perhaps one of the strongest influences on post-modernism is Marxism. Karl Marx was focused on class struggles from an economic perspective. Within Postmodernism this was extended to other aspects of society including feminism, racism, sexism, LGBT,  weightism, or generally any minority group who is crying out against the perceived “privilege” of the majority.

Philosophical Implications

Postmodernists essential question everything and it almost seems as if they tear down everything with no real replace for what they are tearing down. It is permissible to have opinions about anything but there is no truth except for the truth that there is no truth because they say so.

An example of questioning reality itself  is in the work of Jacques Derrida and his work on deconstructionism. According to Derrida, language has blocked us from understanding reality because we are using words to describe this reality. This means that whenever we read or examine text we have to unpack or deconstruct the assumptions that the author of the text had in terms of their word choices and context. This is critical because the dominant group writes in a way that excludes the minorities and those without power. Of course, you would need to support Derrida’s words even though they may not be representative of reality either

Other postmodern philosophers suggest that reality is socially constructed by those who have power. Those in power shape reality to benefit themselves. There are examples of this in history, as people in power normally portray the powerless negatively. This has even happened in the world of science where views on bloodletting and even the consumption of cocaine.

After identifying these injustices, the postmodernist is not content to identify problems but to push change. The marginal groups need to rise up from the shackles of their oppressors. Pragmatism push change slightly but postmodernism can almost be revolutionary in its language for transformation. Everything is viewed with an eye towards suspicions that begets change except for the idea of viewing everything with skepticism that leads to change.

When everything is viewed as oppression eventually everything is overturned. Whoever gains power will then be viewed as oppressive until they too are overthrown. Eventually, there is nothing left. The problem with postmodernism is not that it identifies problems but that they have no solution beyond tearing everything down over and over again.

In Education

A postmodern teacher is going to be skeptical of absolute truth. They will stress the idea of doubting the text and trying to identify the inconsistencies in an author’s argument. There will be a focus on minority groups and how they are oppressed by those who are privileged.

With deconstructionism, students are trained to be sensitive to language and its use. This is perhaps one reason why such terms as politically correct are used today. People have been trained to be sensitive to language that does not fit the narrative and to identify hurtful language as almost dangerous.

All opinions are expected to be embraced and appreciated no matter how much they lack in validity and credibility unless they are defined as insensitive. Students will never be called upon to store and share the knowledge of the past. Rather, students are change agents who are called to overthrow the social injustice of the planet. This is not revolution as Marx saw it but rather reconstruction of what was deconstructed.

The curriculum is a process and not based on content. The teacher is also a social justice warrior. What is needed is people who challenge the status quo rather than work within it. Therefore, postmodernist thought is much more people in the softer sciences rather than in STEM fields. STEM requires stability in order to expand technology and make discoveries and money. Unfortunately, social stability is not required as much for a sociology or liberal arts major.  The idealistic nature of postmodernism denies the reality that life has never been fair ever in the entire history of humanity.

Tree Diagram with D3.js

Tree diagrams are used for showing hierarchical relationships in data. This post will explain how to make a tree diagram using d3.js.

The Data

We are going to use a simple json file. Below is the code inside the json file.

{

"name": "President",

"children": [

{ "name": "VP of Academics",

"children":[

{"name":"Dean of Psych"},

{"name":"Dean of Ed"}

] },

{ "name": "VP of Finance" },

{ "name": "VP of Students" }

]

}

The code above is json file that models relationships among different positions you would find at a university. The root node is “president”. Under president, there are three children which are “VP of academics”, “VP of Finance”, and “VP of students”.

VP of academics also has two children which are “Dean of Psych” and “Dean of Ed.” You need to save this code on your computer somewhere as a json file for use in the d3.js code.

Below is a picture of what the final visual looks like.

1

The code is too long to post in its entirety here. Rather, you can download the code at the link here.

The code is explained below.

Code Description

Lines 1-26 setup the general documents, loads the data, adds an svg element to the body, and a g element to the svg element. Below is the code.

1.png

Lines 27-34 creates the actual tree and creates variables for the nodes and links that will be used later.

1.png

Lines 36-50 creates the diagonals and the nodes for the diagram. The diagonal is created using the .projection() method. Attributes are set for the diagonal as well under the .selectAll() method and includes the stroke color, width of the stroke, and the fill. The code is below.

1.png

Lines 52-66 create the circles for each node. This involves appending information in the element as well as setting colors for the circles.

1.png

Finally, lines 68-85 involve the text from the json file. The first method calls the text, the second method deals with position, and the last method also addresses position somewhat.

1

A lot of work but can be valuable in certain situations.

Conclusion

Making tree diagrams is another visualization available using d3.js. If the nature of the data is hierarchical this may be a useful approach to consider when make visualizations.

Pragmatic Teacher

In this post, we will take a look at pragmatism. This philosophy has played a critical role in shaping ideas about education for a long time. In particular, we will look at the characteristics of pragmatism, its philosophical implications, and how it may manifest it’s self in the classroom.

Background

Pragmatism is a uniquely American 19th century contribution to philosophy with some of the primary influences in this school being such people Charles Perce, William James, and John Dewey. The era in which pragmatism was developed was the industrial revolution and an era of great change. Science was gravitating towards the idea of evolution, which at the time was astounding and even the religious world was in turmoil with people speaking of the end of the world. This environment of rapid change was deeply influencing the thoughts of many people.

With all the chaos swirling throughout the world pragmatism came to the point that there were no ideals or principles to look for. Rather, the focus was on what works and benefits the most than on conforming to an external standard.  This position has had a profound impact on education through the work of the progressives as we shall see.

Philosophical Implications

There are no absolutes with a pragmatist. If there is some form of ultimate reality there is no way to know it here. In other words, while Plato bemoaned the cave and Socrates stated that the cave is all there is, a pragmatist may say that the world of forms is possible but since all we know for sure is the cave we should try to make it as nice as comfortable as possible.

One of the sources of argument that pragmatist make about the constant state of change implying a total lack of absolute truth is changes in science. Examples include, moving from a geocentric worldview to a heliocentric one, or moving from a creationist account of life to an evolutionary one. Since these ideas have changed there must not be any absolute truths to hold on to even though the realm of science is notorious for constant changed.

With all the chaos of the world, pragmatist has decided that truth is what works. Knowledge is based on experience. Through trial and error people learn how to deal with various problems. It is this active process of constructing knowledge through experience that knowledge is constructed. Knowledge is not external or outside the person, instead it is created through interaction with the world. This is a major shift in thinking from pass viewpoint and requires that the individual be an active rather than passive learner because they must interact with the world.

There is a separation in the mind of the pragmatist between knowledge and belief. Beliefs are private while knowledge is publicly available., which means it can be observed and verified by others. True knowledge or truth is relative because of the unstable and changing world that we live in.

Since truth is relative morals and values are relative as well. Local societies decide for themselves what is right and wrong and not an external standard. However, this does not mean anything goes. Stealing is disdained in most societies because it does not work as it tends to encourage crime and chaos. The same for murder. This does not mean to the pragmatist that there are universal moral laws, instead it is simply an indication that different groups of people have had similar experiences with stealing and murder and have made the same conclusion that this does not work.

Pragmatism and Education

A unique belief of pragmatism about students is that they need to be active learners. Students need to experience the world around them through learning activities. School is not preparation but is rather part of life it’s self. Therefore, life long learning is to be expected and not just a temporary period of life in which it is needed for studying.

The  teacher is an expert guide who helps the students. They  are a guide because the world changes too quickly to just dictate material to students. This means that the teacher is learning as well with the advantage of more experience living in a world of flux. Since truth is changing, there is no fix curriculum from yesteryear. Instead, the student’s interests are the center of how  the curriculum is built.

With the focus on the environment, the pragmatic teacher is focused heavily on having students impact the world. This means that an emphasis on social action is a part of the pragmatist classroom. In some classroom social change and attaining social goals (ie social justice warrior) is the entire purpose of education. Other philosophies were trying to maintain the status quo but pragmatism is trying to overturn it if it works.

Conclusion

Pragmatism, like most new movements of their time, is simply a reaction to what came before in response to the challenges of the current context. Pragmatist reject absolute truth except for the absolute truth that there is no absolute truth. The world was truly changing quickly when this school of thought was born. However, unlike Plato, who was also experiencing rapid change and decide to search for absolutes in order to find comfort, the pragmatist reject absolute truth for the comfort of constant change. Instead of trying to preserve knowledge it was better to go with the flow as long as it worked.

Existentialist Teacher

This post will examine the mysterious position of existentialism,  which is basic a school of thought that denies that it is a school of thought.  We will look at the origins of existentialism, the characteristics, and its role in education.

Background

Existentialism is all about the individual. In an interesting paradox, existentialism is so individualistic that they do not see themselves as a group with set of beliefs as other philosophies do. There is a rejection of any unified body of beliefs, thoughts, or system.

Early proponents of existentialism include Soren Kierkegaard and Friedrich Nietzsche. These two 19th century philosophers were reacting to the nature of Christianity during their time. Kierkegaard focused on emphasizing the responsibility of the individual believer and their choices within religion. Nietzsche went in a different direction and became convince that there was no God and that man was responsible for his actions alone. This conclusion  eventually drove Nietzsche crazy in a literal manner.

Between the extremes of Kierkegaard and  Nietzsche is where most beliefs of existentialism are. Primarily, existentialism is trying to regain the lost of the individual. This sense of lost may have come from more and more people living in cities to work for others along with the growth of the  government in providing services. The existentialist longed for the day when people were independent and could do what they wanted in returned for the responsibility for their actions.

Philosophical Implications

According to existentialism,  a person must define who they are. Defining who you are is not left to an Absolute Self or Natural Law but to the person who existence. Reality is found within the individual person. This is a major shift from idealism view that reality is beyond this world and realism’s belief that reality is in the physical world.

Truth is based on a person’s choice. People believe what they want because  they want to. This seems confusing but it is laying the foundation for post-modernism min the near future with its view of relative truth. Now, the individual is the source of authority and not any other code.

With a lack of external authority existentialism has to determine right and wrong with no source of authority. This source of freedom has been called a slavery to freedom by some. Slavery is bad but paradoxically too much freedom can be burdensome as well since there is no guidance in terms of how to act. Most people want some freedom but perhaps nobody wants complete freedom as this would be injurious to themselves and others if they could truly do whatever they wanted.

Existentialism and Education

A teacher with an existentialist perspective would be surprised at how students are taught. They would see it as oppressive and even with tendency towards being a form of propaganda. Students would need much more choice and responsibility for their own actions since the current form of teaching destroys individualism.

The existentialist teacher is not the center of the instruction but rather a facilitator. The goal is to help students better understand who they are as individuals. This also means that the student should have a choice in what they learn and that the curriculum needs to be somewhat flexible. The goal is the development of the individual and not the society as the society does not care for the ultimate development of the individual.

Conclusion

Existentialism is a system of thought that claims not to be a system because everyone within the system wants total freedom.  This is contradictory yet considered consistent among existentialist. The reaction they have towards the growing power of large society gives this philosophy a romantic longing for almost a wild pre-industrialization world. However, though many people may not agree with some of the tenets of this group many do wish that they could have at least a little more personal freedom and individuality.

Neo-scholastic Teacher

Scholasticism and Neo-Scholasticism is a philosophy that has had a stronger influence in Christian education rather than in secular circles. This post will explore the characteristics of these philosophies as well as their role in education.

Background

Neo-Scholasticism began as simply scholasticism and was simultaneously a movement and a philosophy that sprang up during the medieval time period in Europe somewhere between 1050 and 1350 originating in the early universities. This was primarily a movement within the Catholic church as they controlled higher education at this time in Europe. The scholars of this movement were not as concern about discovery new truth as it was with proving and establishing the validity of existing truth. In other words, Neo-Scholasticism was primarily reactionary in nature.

The reason for the reactionary nature of Neo-Scholasticism was the rediscovery of the writings of Aristotle. These writings had been lost for centuries but had been preserved in the Islamic nations. Through interactions with the Muslim world through trade and war Aristotle’s writings were translated from Arabic into Latin. Aristotle’s realistic views were a challenge to the Platonic/idealistic views of the Christian church.

Scholars, for whatever reason, were convinced that church teachings had to be harmonized with the writings of Aristotle. Why religious teachings and beliefs had to bow to the influence of one Greek philosopher is subject of debate but perhaps the status of Aristotle compelled the church to merge his ideas with their own in order to maintain intellectual leadership of Europe.

The leader of this merger of faith and reason was Thomas Aquinas. He proposed that people should learn as much as they can through human reason and have faith in matters that cannot be reasoned about. Therefore, at the heart of scholasticism was human reason which in many ways had displaced faith.

Neo-Scholasticism is the modern equivalent of Scholasticism.  The primary difference is that Neo-Scholasticism has religious and secular branch whereas Scholasticism had only one main branch or school of thought.

Philosophical Implications

Scholasticism focus was on accommodating the philosophy of Aristotle with christian thought. Therefore, many of Aristotle’s beliefs are reinterpreted as much as possible to be consistent with Christianity. For example, Aristotle spoke of the Unmoved Mover, which he stated was the first cause of all other causes in the universe. Aquinas equated the Unmoved Mover with God.

Reality had a dualistic nature to it for the scholastic. The natural world was understood through reasoning while the supernatural world was available through revelation and intuition. Truth could be self-evident such as “2+2 = 4” or it can depend on observed experience such as “The average life expectancy is 72 years.” The greatest truth are the unchanging self-evident such as those found in mathematics rather than observed experiential truth.

Morality is governed by reason. There is an assumption that people are rational at their core. The more rational the higher moral quality a person should have.

Neo-Scholasticism and Education

The teacher’s role from a Neo-Scholastic perspective is to help rational students develop their reasoning, will power, and memory. The teacher is the center of the education process and works with students to transfer information. The subject matter takes precedent over the students’ interest.

With  its religious roots, Neo-Scholasticism see the teacher as a spiritual leader. This involves discipleship and even discipline at times. Only through this process can the student acquiring understanding of the unalterable truths of the world.

The curriculum of Neo-Scholasticism would include the humanities, math, and foreign languages (primarily Greek and Latin). The humanities allow students to understand the logic and thinking of great minds, math demonstrates unchanging truths, and foreign languages provides rigors training for the mind. The mind is a muscle that must be strengthened through examining the works of other men.

Conclusion

Neo-Scholasticism has not had the impact on education that idealism or realism has. The emphasis on teacher-centered instruction and memorizing is a major departure from modern forms of teaching. A good memory is not the same as a critical thinker. As with all schools of thought, Neo-Scholasticism suffers from a lack of balance. What is really needed is a flexible position that varies depending on the context.

Path Generators in D3.js

D3.js has the ability to draw rather complex shapes using techniques called path generators. This will allow you to many things that would otherwise be difficult when working with visualizations.

In this post, we will look at three different examples of path generation involving d3.js. The three examples are as follows

  • Making a triangle
  • Duplicating the triangle
  • Make an area chart

Making a Triangle

To make a triangle we start by appending a svg to the body element of our document (lines 7-12). Then when create an array that has three coordinates. We need three coordinates because that is how many coordinates a triangle needs (lines 13-17). After this, we create a variable called generate and use the .svg.line() method to draw the actual lines that we want (lines 18-20).

After this, we append the data and other characteristics to the svg variable. This allows us to set the fill color and the line color (lines 21-28). Below is the code followed by the output.

12

A simple triangle was created with only a few lines of code.

Create a Triangle and Duplicate

This example is an extension of the previous one. Here, we create the same triangle, but then we duplicate it using the translate method. This is a powerful technique if you need to make the same shape more than once.

The new code is found in lines 29-36

12

You can see that the new triangle was moved to a different position based on the arguments we gave it.

Area Chart

Area charts are often used to make line plots but with the area under the line being filled with a certain color. To achieve this we do the following.

  • Add our svg element to the body element (lines 7-10)
  • Create some random data using the .range() method and several functions (lines 12-18)
    • we generate 1000 random numbers (line 12) between 0 and 100 (line 14)
    •   We set the Y values as random values of X in increments of 10 (line16-17)
  • We create a variable called generate to create the path using the .area() method (line 20-23)
    • y0 has to do with the height or depth of the area the other two attributes are the X and Y values
  • We then append all this to the svg variable we created (lines 25-31)

Below is the code followed by the visual.

12

Much more can be done with this but I think this makes the point for now.

Conclusion

This post was just  an introduction to making paths with D3.js.

Metaphysics & Education

Metaphysics is the study of reality and the nature or character of it. This branch  of philosophy deals primarily with what is real. This may seem like an obvious question with an obvious answer. However, different people answer this question in different ways based on what they believe about the nature of reality and how we come to know it.

There are at least four sub-branches of metaphysics  that attempt to address the question of the nature of reality. These four branches are…

  • Cosmology
  • Ontology
  • Anthropology
  • Theology

We will look at each of these and then try to examine how metaphysics manifest itself in education.

Cosmology

Cosmology deals with the origins of the universe. The main views of the origins of the universe can be seen as a continuum from the universe was created or design by God or the other extreme that everything about the universe has happened by accident as is commonly viewed by evolution.  A middle ground along this continuum would be theistic evolution, which states that a divine being used evolution to create the world.

The beliefs an  individual has about cosmology affects other aspects of their life, education, and how they interpret what they experience. For example, an atheist scientist see nature and is awed by the random movement of natural selection to create such beauty. However, a theist would see the same evidence in nature and be led to the conclusion that God has created a beautiful climate. When these two sides meet they cannot agree because they have different assumptions or beliefs about origins and interpret what they see based on these beliefs.

Ontology

Ontology is the study of existence. This is probably one of the harder positions to understand. However, ontology deals with such ideas as whether reality is physical or spiritual, or a combination of the two. In addition, Ontology addresses whether reality is orderly and stable.

People’s beliefs about being can impact how the approach life. If there is nothing there is no reason to care or do anything. However, if there is something beyond this life and life was created with purpose this will alter a person’s behavior as they consider how they may be held accountable for their actions.

Anthropology

Anthropology is the study of man. Some questions that anthropology focuses on in particular is the relationship between the mind and the body. Is it the mind or the body the primary agent of behavior. Other questions include examining whether people or good or evil or morally neutral. Lastly, anthropology addresses the question of the freedom people have. Do people have choice or is their behavior determined by their environment?

The nature vs nurture argument is an old argument about the condition of man. The ultimate question is who is responsible for the actions that people take. The answer to this question evolves around views of the will.

Theology

Theology is the study of the nature of God and plays a profound role at least indirectly in all philosophy. Atheist strongly believe there is no God. As such, the support primarily science as a way of understanding reality. Theists believe there is a God or gods and this natural affects how they view realty.

Even among theists there is disagreement over how many gods there are. Polytheists believe in many gods while monotheists believe in one God. Pantheists believe god(s) is in everything and that they are gods. The position a person has on God can change how they view the world. Monotheists often believe in having a relationship with  one God in order to prepare for the reality of death in this life and the promise of living forever. Polytheists tend to have a contractual quid pro quo relationship with many different gods in order to do better in this world now and smooth the transition to living another life via some form of reincarnation.

Metaphysics and Education

Metaphysics manifest itself in many ways in education. In terms of cosmology and theology, most schools support the idea that the world came about by chance and that life evolved from almost nothing billions of years ago. This is related to theology in that most schools doubt the existence of God being openly atheistic in nature or may at most be agnostic in nature.   In a non-Western context, gods or polytheism is acknowledged and accepted in everyday life but traditional science and atheistic origins of the universe are generally taught in school. This can lead to a dual world view at times.

In terms of ontology and anthropology, the views on ontology vary by culture in education. In the West, the spiritual aspect of man is not acknowledged in education due in part to the focus on science. However, this is beginning to change with the emphasis on mindfulness and meditation in public education. In the East, there is a more open view towards the spiritual nature of man.

In terms of education, students are generally taught that man is inherently good but  may be corrupted by his environment and culture. In the East, education teaches that man is good by nature but may make mistakes. Culture is rarely criticized in eastern education.

Conclusion

Metaphysics is a difficult concept to try to address and understand. The important thing to remember is that metaphysics deals with the question of what is reality and that different people answer this question i different ways. How people answer these questions depends in part on their beliefs about cosmology, ontology, anthropology, and theology.

Drag, Pan, & Zoom Elements with D3.js

Mouse events can be combined in order to create some  rather complex interactions using d3.js. Some examples of these complex actions includes dragging,  panning, and zooming. These events are handle with tools called behaviors. The behaviors deal with dragging, panning, and zooming.

In this post, we will look at these three behaviors in two examples.

  • Dragging
  • Panning and zooming

Dragging

Dragging allows the user to move an element around on the screen. What we are going to do is make three circles that are different colors that we can move around as we desire within the element. We start by setting the width, height of the svg element as well as the radius of the circles we will make (line 7). Next, we create our svg by appending it to the body element. We also set a black line around the element so that the user knows where the borders are (lines 8-14).

The next part involves setting the colors for the circles and then creating the circles and setting all of their attributes (lines 21 – 30). Setting the drag behavior comes later, and we use the .drag() and the .on() methods t create this behavior and the .call() method connects the information in this section to our circles variable.

The last part is the use of the onDrag function. This function retrieves the position of the moving element and transform the element within the svg element (lines 36-46). This involves using an if statement as well as setting attributes. If this sounds confusing, below is the code followed by a visual of what the code does.

1

If you look carefully you will notice I can never move the circles beyond the border. This is because the border represents the edge of the element. This is important because you can limit how far an element can travel by determining the size of the elements space.

Panning and Zooming

Panning allows you to move all visuals around at once inside an element. Zooming allows you to expand or contract what you see. Most of this code is a extension  of the what we did in the previous example. The new additions are explained below.

  1. A variable called zoomAction sets the zoom behavior by determining the scale of the zoom and setting the .on() method (Lines 9-11)
  2. We add the .call() method to the svg variable as well as the .append(‘g’) so that this behavior can be used (Lines 20-21).
  3. The dragAction variable is created to allow us to pan or move the entire element around. This same variable is placed inside a .call() method for the circles variable that was created earlier (Lines 40-46).
  4. Lines 48-60 update the position of the element by making two functions. The onDrag function deals with panning and the onZzoom function deal with zooming.

Below is the code and a visual of what it does.

You can clearly see that we can move the circles individually or as a group. In addition, you also were able to see how we could zoom in and out. Unlike the first example this example allows you to leave the border. This is probably due to the zoom capability.

Conclusion

The behaviors shared here provide additional tools that you can use as you design visuals using D3.js. There are other more practical ways to use these tools as we shall see.

Realistic Teacher

Realism is another philosophy that has had a tremendous impact on education and the world in general. The modern world seems to be almost exclusively realist in terms of its worldview thanks in part to the scientific position that most individuals take on matters.

In this post, we will look briefly at the characteristics of realism. In addition, we will also examine how a teacher who believes in realism may approach teaching and realism’s impact on the broader educational process.

Background

Just as Plato was reacting to the change that was surrounding him when he developed his views on idealism, his pupil Aristotle react to idealism by proposing realism. Realism states that objects we perceive with our senses are independent of our mind. In other words, what see exist independently of us and our mind.

However, realism is not a rejection of idealism but in many ways an extension of it. Aristotle thought that everything was made of a combination of form and matter. Form was similar to the ideals of Plato’s idealism and matter was the new contribution that Aristotle was making which is a focus on the material aspect of an object. Form or ideas can exist without matter, such as the ideal or form democracy. Yet matter cannot exist with a form, such as a physical chair with the idea or form of a chair.

Aristotle further proposed that studying the world or matter would lead to a better understanding of universal ideas. This concept has had a strong impact on research in the development of inductive methodology also known as the scientific method.

Philosophical Implications

Reality as seen through idealism is the physical world. The world is similar to a giant machine in which humans are both passively acted upon and actively influencing as well. There are also natural laws that govern the physical world that can be discovered through observation.

Knowledge is gained only through the senses. Something is true because  it was observed. The natural law is within the reality of the natural world and the realist is looking for this through specific examples. This inductive process helps the realist to understand the world around him. In many ways, the Natural Law of the realist is the Absolute Self of the idealist. The difference is in how each is discovered. The idealist thinks about the Absolute Self and knows through intuition that there is an external standard. The realist observes the Natural Law with is senses which confirms the Natural Law’s reality.

Natural Law also extends into the realm of ethics. It is through observing nature and the world that what is right and wrong, beautiful and ugly can be determined according realism. In the Declaration of Independence, Thomas Jefferson  alludes to realism when he speaks of “inalienable rights.” In other words, Jefferson was proposing that some of the rights of man are obvious if one examines the world in which they live.

Realism and Education

A realistic teacher stresses that students learn through their senses. This involves teaching methodologies that have students doing and experiencing things rather than just listening. This can include such activities as field trips, group work, projects etc.

On a darker side, a realist teacher may believe that students are a product of their environment. This has been interpreted as meaning that students do not truly have choice as they are simple responding to the stimuli in their environment. This has lead to a push in education for a focus on behaviorism and even classical conditioning. Furthermore, most learning objectives are behaviorist in nature because a teacher can “see” a behavior which is evidence that the student can do something.  Off course, this has clash with cognitivism (idealism in the 20th century) which focuses on the mind rather than the behavior.

The teacher’s role is to provide sound information about the reality of the physical world and the Natural Law. This is further supported by a focus on math and science, which today is viewed as a focus on STEM majors. One thing all STEM majors have in common is a focus on what can be seen and a disinterest in the realm of ideas and the highly theoretical. Critical thinking is focus almost exclusively on  problem solving and never for the development of an opinion. What really matters are facts and not so much what people think about them.

With the focus on the senses, one thing the teacher and the students will notice is that the world is in a constant state of change. This has led to a rejection of a permanent Natural Law due to the ephemeral quality of reality.

Conclusion

Realism is the primary worldview of education  today. Seeing is believing as the saying goes. Almost nothing is taken seriously unless there is clear observable evidence to support it. Of course, many people believe that feelings and personal experience counts as evidence. This is because feelings and personal experience have actual occurred in the individual person’s life.

Intro to Interactivity with D3.js

The D3.js provides many ways in which the user can interact with visual data. Interaction with a visual can help the user to better understand the nature and characteristics of the data, which can lead to insights. In this post, we will look at three basic examples of interactivity involving mouse events.

Mouse events are actions taken by the browser in response to some action by the mouse. The handler for mouse events is primarily the .on() method. The three examples of mouse events in this post are listed below.

  • Tracking the mouse’s position
  • Highlighting an element based on mouse position
  • Communicating to the user when they have clicked on an element

Tracking the Mouses’s Position

The code for tracking the mouse’s position is rather simple. What is new is Is that we need to create a variable that appends a text element to the svg element. When we do this we need to indicate the position and size of the text as well.

Next, we need to use the .on() method on the svg variable we created. Inside this method is the type of behavior to monitor which in this case is the movement of the mouse. We then create a simple way for the browser to display the x, y coordinates.  Below is the code followed by the actual visual.

1.png

You can see that as the mouse moves the x,y coordinates move as well. The browser is watching the movement of the mouse and communicating this through the changes in the coordinates in the clip above.

Highlighting an Element Based on Mouse Position

This example allows an element to change color when the mouse comes in contact with it. To do this we need to create some data that will contain the radius of four circles with their x,y position (line 13).

Next we use the .selectAll() method to select all circles, load the data, enter the data, append the circles, set the color of the circles to green, and create a function that sets the position of the circles (lines 15-26).

Lastly, we will use the .on() function twice. Once will be for when the mouse touches the circle and the second time for when the mouse leaves the circle. When the mouse touches a circle the circle will turn black. When the mouse leaves a circle the circle will return to the original color of green (lines 27-32). Below is the code followed by the visual.

1

Indicating when a User Clicks on an Element

This example is an extension of the previous one. All the code is the same except you add the following at the bottom of the code right before the close of the script element.

.on('click', function (d, i) {

alert(d + ' ' + i);

});

This .on() method has an alert inside the function. When this is used it will tell the user when they have clicked on an element and will also tell the user the radius of the circle as well what position in the array the data comes from. Below is the visual of this code.

Conclusion

You can perhaps see the fun that is possible with interaction when using D3.js. There is much more that can be done in ways that are much more practical than what was shown here.

Idealistic Teacher

Idealism is an ancient philosophy that had a strong influence on education through the 20th century. Recently, this position has been overshadowed by realism, however, the influence of idealism can still be felt in education to this day. In this post, we will describe idealism, explain the implications, and examined how an idealistic teacher views education.

Description

Idealism is focus on reality as consisting of ideas, the mind and self. In other words, the mind makes the material world rather than the other way around as found in realism. Plato is the primary author of this philosophy.

The context of Plato’s life was one of change. This was during the time of the Persian Wars in which Greece, Athens in particular, did remarkable well. War naturally brings new ideas to both countries which was leading to changes. In addition, there was a push for individualism from a group of philosophers known as the sophists which was straining the communal culture of Athens.

Some have stated that Plato’s idealism was a reaction against this threat of change. Truth for Plato was permanent and unchanging. Since the world was changing, there could be no truth in this world. Truth must be found somewhere else. The real truth was found in the world of ideas a place that was beyond the senses used in this world.

Plato has rather negative views towards the senses. In his “Allegory of the Cave”, Plato essentially asserts that people who go by their senses are chain and trapped inside a cave of ignorance where they are bound to watch shadows of reality. Those who break free from these chains are those who have gone beyond their senses and use their intellect to reach the world of ideas. Naturally, only an elite handful of chosen ones or philosopher kings are able to do this.

Philosophical Implications

For idealist, the source of knowledge comes from intuition (knowing without conscious thought), revelation (knowing through supernatural encounters), and rationalism (knowing through conscious thought). What is important here is what is missing, which is empiricism (knowledge through the senses). Idealist do not require empirical verification of what is true. In the world today, this is almost laughable but was a core component of education for centuries.

Ethically, idealism emphasis a belief in an external ethical standard to man. Man cannot be the one to decide what is right or wrong. Instead, morals are determined by the world of ideas through the intellect. There is something called the Absolute self that the individual self is trying to imitate. This Absolute Self is considered by many to be God as seen from a christian perspective. Again this is something that would not be considered seriously by many educators.

There is an eternal consistency to truth for idealist.  Something is true when it fits with the harmony of the universe. Even art must make sense and must be used in a way that is consistent the perfect form of the world of ideas. This explains the sonority of early forms of music that have been lost gradually over time.

Idealism and Education

An idealistic teacher is going to focus on the development of the students mind. There is a constant striving for perfection in study of various subjects. Speaking of subjects, the curriculum consist primarily of the humanities and math. History and literature help students to see what is ideal for humans and the study of math is powerful because of its universal nature along with it being a self-evidently true. Generally, any subject that brings students into contact with ideas rather than things should be considered for the curriculum

The teacher’s responsibility is to pass their knowledge of the ultimate reality to the student as the teacher has more experience in this and the Absolute Self. Therefore, the teacher is an example for the student. Knowledge is seen as something that is transferred from the teacher to the student either verbally or writing. This implies that lecturing and direct instruction are key methodologies.

One of the more shocking positions of the idealistic teacher is that the school is not an agent of change. The idealistic teacher and the idealistic school do not train and educate “change agents”. Rather, since absolute truth is unchanging the school should natural reflect an unchanging nature and support the status quo. Anyone familiar with education in universities today would find this difficult to accept.

Conclusion

With focus on an other worldly perfect standard,  idealism is strongly out of place in a world that is governed or perhaps controlled by what they see and experience. Whenever people try to appeal to some sort of unqualified standard it is looked upon almost with ridicule. The exception seems to be when people share an emotional objection to something. Feelings have replaced some form of ethereally standard because emotions are experienced and felt rather than thought about.

The overemphasis on ideals is perhaps the weakness of idealism. Plato thought that people who only rely on their senses were trapped in a cave and unaware of true reality. However, the same can be said of a person who is trapped in the world of ideas. The person who is truly free is the one who can move between the senses and the mind or who can move between the reality of t ideas and physical world. Moving between these positions provides a flexible that neither has by itself.

Tweening with D3.js

Tweening is a tool that allows you to tell D3.js how to calculate attributes during transitions without keyframes tracking. The problem with keyframes tracking is that it can develop performance issues if there is a lot of animation.

We are going to look at three examples of the use of tweening in this post. The examples are as follows.

  • Counting numbers animation
  • Changing font size animation
  • Spinning shape animation

Counting Numbers Animation

This simple animation involves using the .tween() method to count from 0 to 25. The other information in the code determines the position of the element, the font-size, and the length of the animation.

In order to use the .tween()  method you must make a function. You first give the function a name followed by providing the arguments to be used. Inside the function  we indicate what it should do using the .interpolateRound() method which indicates to d3.js to count from 0 to 25. Below is the code followed by the animation.

1

You can see that the speed of the numbers is not constant. This is because we did not control for this.

Changing Font-Size Animation

The next example is more of the same. This time we simply make the size of a text change. TO do this you use the .text() method in your svg element. In addition, you now use the .styleTween() method. Inside this method we use the .interpolate method and set arguments for the font and font-size at the beginning and the end of the animation. Below is the code and the animation1

Spinning Shape Animation

The last example is somewhat more complicated. It involves create a shape that spins in place. To achieve this we do the following.

  1. Set the width and height of the element
  2. Set the svg element to the width and height
  3. Append a group element to  the svg element.
  4. Transform and translate the g element in order to move it
  5. Append a path to the g element
  6. Set the shape to a diamond using the .symbol(), .type(), and .size() methods.
  7. Set the color of the shape using .style()
  8. Set the .each() method to follow the cycle function
  9. Create the cycle function
  10. Set the .transition(), and .duration() methods
  11. Use the .attrTween() and use the .interpolateString() method to set the rotation of the spinning.
  12. Finish with the .each() method

Below is the code followed by the animation.

1

This animation never stops because we are using a cycle.

Conclusion

Animations can be a lot of fun when using d3.js. The examples here may not be the most practical, but they provide you with an opportunity to look at the code and decide how you will want to use d3.js in the future.

Intro to Animation with D3.js

This post will provide an introduction to animation using D3.js. Animation simply changes the properties of the visual object over time. This can be useful for help the viewer of the web page to understand key features of the data.

For now we will do the following in terms of animation.

  • Create a simple animation
  • Animate multiple properties
  • Create chained transitions
  • Handling Transitions

Create a Simple Animation

What is new for us in terms of d3.js code for animation is the use of the .transition() and .duration() methods. The transition method provides instructions on how to changing a visual attribute over time. Duration is simply how long the transition takes.

In the code below, we are going to create a simply black rectangle that will turn white and disappear on the screen. This is done by appending an svg that contains a black rectangle into the body element and then have that rectangle turn white and disappear.

1

1.gif

This interesting but far from amazing. We simply change the color  or animated one property. Next, we learn how to animate more than one property at a time.

Animating Multiple Properties at Once

You are not limited to only animating one property. In the code below we will change the color will have the rectangle move as well. This id one through the x,y coordinates to the second .attr({}) method. The code and the animation are below.

12

You can see how the rectangle moves from the top left to the bottom right while also changing colors from black to white thus disappearing. Next, we will look at chained transitions

Chained Transitions

Chained transitions involves have some sort of animation take place. Followed by a delay and then another animation taking place. In order to do this you need to use the .delay() method. This method tells the  browser to wait a specify number of seconds before doing something else.

In our example, we are going to have our rectangle travel diagonally down while also disappearing only tot suddenly travel up while changing back to the color of black. Below is the code followed by the animation.

13

By now you are starting to see that the only limit to animation in d3.js is your imagination.

Handling Transitions

The beginning and end of a transition can be handle by a .each() method. This is useful when you want to control the style of the element at the beginning and or end of a transition.

In the code below, you will see the rectangle go from red, to green, to orange, to black, and then to gray. At the same time the rectangle will move and change sizes. Notice careful the change from red to green and form black to gray are controlled by .each() methods.

11

Conclusion

Animation is not to only be used for entertainment. When developing visualizations, an animation should provide additional understanding of the content that you are trying to present. This is important to remember so that d3.js does not suffer the same fate as PowerPoint in that people focus more on the visual effects rather than the content.

Adding labels to Graphs D3.js

In this post, we will look at how to add the following to a bar graph using d3.js.

  • Labels
  • Margins
  • Axes

Before we begin, you need the initial code that has a bar graph already created. This is shown below follow by what it should look like before we make any changes.

1

1

The first change is in line 16-19. Here, we change the name of the variable and modify the type of element it creates.

1.png

Our next change begins at line 27 and continues until line 38. Here we make two changes. First, we make a variable called barGroup, which selects all the group elements of the variable g. We also use the data, enter, append and attr methods. Starting in line 33 and continuing until line 38 we use the append method on our new variable barGroup to add rect elements as well as the color and size of each bar. Below is the code.

1.png

The last step for adding text appears in lines 42-50. First, we make a variable called textTranslator to move our text. Then we append the text to the bargroup variable. The color, font type, and font size are all set in the code below followed by a visual of what our graph looks like now.

12

Margin

Margins serve to provide spacing in a graph. This is especially useful if you want to add axes. The changes in the code take place in lines 16-39 and include an extensive reworking of the code. In lines 16-20 we create several variables that are used for calculating the margins and the size and shape of the svg element. In lines 22-30 we set the attributes for the svg variable. In line 32-34 we add a group element to hold the main parts of the graph. Lastly, in lines 36-40 we add a gray background for effect. Below is the code followed by our new graph. 1.png

1

Axes

In order for this to work, we have to change the value for the variable maxValue to 150. This would give a little more space at the top of the graph. The code for the axis goes form line 74 to line 98.

  • Line 74-77 we create variables to set up the axis so that it is on the left
  • Lines 78-85 we create two more variables that set the scale and the orientation of the axis
  • Lines 87-99 sets the visual characteristics of the axis.

Below is the code followed by the updated graph

12

You can see the scale off to the left as planned..

Conclusion

Make bar graphs is a basic task for d3.js. Although the code can seem cumbersome to people who do not use JavaScript. The ability to design visuals like this often outweighs the challenges.

Defining Terms in Debates

Defining terms in debates is an important part of the process that can be tricky at times. In this post, we will look at three criteria to consider when dealing with terms in debates. Below are the three criteria

  • When to define
  • What to define
  • How to define

When to Define

Definitions are almost always giving at the beginning of the debate. This is cause it helps to set up limits about what is discussed. It also makes it clear what the issue and potential propositions are.

Some debates focus exclusively on just defining terms. For example, highly controversial ideas such as abortion, non-traditional marriage, etc. Often the focus is just on such definitions as when does life beginning, or what is marriage? Defining terms helps to remove the fuzziness of the controversy and to focus on the exchange of ideas.

What to Define

It is not always clear what needs to be defined when staring a debate. Consider the following proposition of value

Resolved: That  playing videos games is detrimental to the development of children

Here are just a few things that may need to be  defined.

  • Video games: Does this refer to online, mobile, or console games? What about violent vs non-violent? Do educational games also fall into this category as well?
  • Development: What kind of development? Is this referring to emotional, physical, social or some other form of development
  • Children: Is this referring only to small children (0-6), young children (7-12) or teenagers?

These are just some of the questions to consider when trying to determine what to define. Again this is important because the affirmative may be arguing that videos are bad for small children but not for teenagers while the negative may be preparing a debate for the opposite.

How to Define

There are several ways to define a term below are just a few examples of how to do this.

Common Usage

Common usage is the everyday meaning of the term. For example,

We define children as individuals who are under the age of 18

This is clear and simple

Example

Example definitions give an example of the term to illustrate it as shown below.

An example of a video game would be PlayerUnknwon’s Battleground

This provides a context of the type of video games the debate may focus one

Operation

An operational definition is a working definition limited to the specific context. For example,

Video games for us is any game that is played on an electronic device

Fex define video games like this but this is an example.

Authority

Authority is a term that is defined by an expert.

According to technopedia, a video game is…..

Authority uses their experiences and knowledge to set what a term means and this can be used by debaters.

Negation

Negation is defining a word by what it is not. For example,

When we speak of video games we are not talking about educational games such as Oregon Trail. Rather, we are speaking of violent games such as Grand Theft Auto

The contrast between the types of games here is what the debater is using to define their term.

Conclusion

Defining terms is part of debating. Debaters need to be trained to understand the importance of this so that they can enhance their communication and persuasion.

Making Bar Graphs with D3.js

This post will provide an example of how to make a basic bar graph using d3.js. Visualizing data is important and developing bar graphs in one way to communicate information efficiently.

This post has the following steps

  1. Initial Template
  2. Enter the data
  3. Setup for the bar graphs
  4. Svg element
  5. Positioning
  6. Make the bar graph

Initial Template

Below is what the initial code should look like.

1

Entering the Data

For the data we will hard code it into the script using an array. This is not the most optimal way of doing this but it is the simplest for a first time experience.  This code is placed inside the second script element. Below is a picture.

1

The new code is in lines 10-11 save as the variable data.

Setup for the Bars in the Graph

We are now going to create three variables. Each is explained below

  • The barWidth variable will indicate ho wide the bars should be for the graph
  • barPadding variable will put space between the bars in the graph. If this is set to 0 it would make a histogram
  • The variable maxValue scales the height of the bars relative to the largest observation in the array. This variable uses the method .max() to find the largest value.

Below is the code for these three variables

1

The new information was added in lines 13-14

SVG Element

We can now begin to work with the svg element. We are going to create another variable called mainGroup. This will assign the svg element inside the body element using the .select() method. We will append the svg using .append and will set the width and height using .attr. Lastly, we will append a group element inside the svg so that all of our bars are inside the group that is inside the svg element.

The code is getting longer, so we will only show the new additions in the pictures with a reference to older code. Below is the new code in lines 16-19 directly  under the maxValue variable.

1

Positioning

New=x we need to make three functions.

  • The first function will calculate the x location of the bar graph
  • The second function  will calculate the y location of the bar graph
  • The last function will combine the work of the first two functions to place the bar in the proper x,y coordinate in the svg element.

Below is the code for the three functions. These are added in lines 21-251

The xloc function starts in the bottom left of the mainGroup element and adds the barWidth plus the barPadding to make the next bar. The yloc function starts in the top left and subtracts the maxValue from the given data point to calculate the y position. Lastly, the translator combines the output of both the xloc and the yloc functions to position bar using the translate method.

Making the Graph

We can now make our graph. We will use our mainGroup variable with the .selectAll method with the rect argument inside. Next, we use .data(data) to add the data, .enter() to update the element, .append(“rect”) to add the rectangles. Lastly, we use .attr() to set the color, transformation, and height of the bars. Below is the code in lines 27-36 followed by actual bar graph. 1.png

1

The graph is complete but you can see that there is a lot of work that needs to be done in order to improve it. However, that will be done in a future post.

Types of Debate Proposition

In debating, the proposition is the main issue or the central topic of the debate. In general, there are three types of propositions. The three types of propositions are propositions of

  • Fact
  • Value
  • Policy

Understanding the differences in these three types of propositions is important in developing a strategy for a debate.

Proposition of Fact

A debate that is defined as a proposition of fact is a debate that is focused on whether something is true or not. For example, a debate may address the following proposition of facet.

Resloved: human activity is contributing to global warming

The affirmative side would argue that humans are contributing to global warming while the negative side would argue that humans are not contributing to global warming. The main concern is the truthfulness of the proposition. There is no focus on ethics of the proposition as this is when we come to a proposition of value.

Proposition of Value

A proposition of value looks at your beliefs about what is right or wrong and or good and bad. This type of proposition is focused on ethics and or aesthetics. An example of a proposition of value would be the following..

Resolved: That television is a waste of time

This type of proposition  is trying to judge the acceptability of something and or make an ethical claim.

Value propositions can also have these other more nuances characteristics. Instead, affirming the good or bad of a proposition, a proposition of value can also make a case of one idea being better than another such as…

Resloved: That exercise is a better use of time than watching television

Now the debate is focus not on good vs bad but rather on better vs worst. It is s slightly different way of looking at the argument. Another variation on proposition of value is when the affirmative argues to reject a value such as in the following.

Resolved: That encouraging the watching of television is harmful to young people

The wording is slightly different from previous examples but the primary goal of the affirmative is to argue why television watching should not be valued or at least valued less.

One final variation of the proposition of value is the quasi-policy proposition of value. A quasi-policy value proposition is used to express a value judgement about a policy. An example would be

Resolved: That mandatory vaccinations would be beneficial to school age children

Here the affirmative is not only judging vaccinations but simultaneously the potential policy of making vaccinations mandatory.

Proposition of Policy

Propositions of policy call for change. This type of proposition in pushing strongly against the status quo. Below is an example.

Resolved: That the cafeteria should adopt a vegetarian diet

The example above is using for clear change. However, notice how there is no judgement on the current state affairs. In others words, there is not judgement that the non-vegetarian diet is good or bad or that a vegetarian diet is good or bad. This is noe reason why this is not a proposition of value.

In the case of a proposition of policy, the affirmative supports the change while the negative supports the status quo.

Conclusion

Debate propositions shape the entire direction and preparation for the debate itself. Therefore, it is important for debaters to understand what type of proposition they are dealing with. In addition, for teachers who are creating debates, they need to know exactly what they want the students to do in a debt when they create propositions.

SVG and D3.js

Scalable Vector Graphics or SVG for short is a XML markup language that is the standard for creating vector-based graphics in web browsers. The true power of d3.js is unlocked through its use of svg elements. Employing vectors allows for the image that are created to be various sizes based on scale.

One unique characteristic of svg is that the coordinate system starts in the upper left with the x axis increases as normal from left to right. However, the y axis starts from the top and increases going down rather than the opposite of increasing from the bottom up. Below is a visual of this.

1

You can see that (0,0) is in the top left corner. As you go to the right the x-axis increases and as you go down the y axis increases.  By changing the x, y axis values you are able to position your image where you want it. If you’re curious the visual above was made using d3.js.

For the rest of post, we will look at different svg elements that can be used in making visuals. We will look at the following

  • Circles
  • Rectangles/squares
  • Lines & Text
  • Paths

Circles

Below is the code for making circle followed by the output

1.png

1.png

To make a shape such as the circles above, you first must specify the size of the svg element as shown in line 6. Then you make a circle element. Inside the circle element you must indicate the x and y position (cx, cy) and also the radius (r). The default color is black however you can specify other colors as shown below.

12

To change the color simply add the style argument and indicate the fill and color in quotations.

Rectangle/Square

Below is the code for making rectangles/squares. The arguments are slightly different but this should not be too challenging to figure out.

12

The x, y arguments indicate the position and the width and height arguments determine the size of the rectangle, square.

Lines & Text

Lines are another tool in d3.js. Below is the code for drawing a line.

1

2

The code should not be too hard to understand. You now need to separate coordinates. This is because the line needs to start in one place and draw until it reaches another. You can also control the color of the line and the thickness.

You can also add text using svg. In the code below we combine the line element with the text element.

12

With the text element after you set the position, font, font size, and color, you have to also add your text in-between the tags of the element.

Path

The path element is slightly trickier but also more powerful when compared to the elements we have used previously. Below is the code and output from using the path element.

12

The path element has a mini-language all to its self. “M” is where the drawing begins and is followed by the xy coordinate. “L”  draw a line. Essentially, it takes the original position and draws a line to next position. “V” indicates a vertical line. Lastly, “Z” means to close the path.

In the code below here is what it literally means

  1. Start at 40, 40
  2. Make a line from 40, 40 to 250, 40
  3. Make another line from 250, 40 to 140, 40
  4. Make a vertical line from 140,40 to 4,40
  5. Close the path

Using path can be much more complicated than this. However, this is enough for an introduction

Conclusion

This was just a teaser of what is possible with d3.js. The ability to make various graphics based on data is something that we have not even discussed yet. As such, there is much more to look forward to when using this visualization tool.

Phrasing Debate Propositions

Debating is a practical way for students to develop communication and critical thinking skills. However, it is often the job of the teacher to find debate topics and to form these into propositions. A proposition is a strong statement that identifies the central issue/problem of a controversial topic.

There is a clear process for this that should be followed in order to allow the students to focus on develop their arguments rather than on trying to figure out what they are to debate about.

This post will provide guidance for teachers on developing debate propositions. In general, debate propositions have the following characteristics

  • controversial
  • central idea
  • unemotional word use
  • Statement of affirmative’s wanted decision

We will look at each of these concepts in detail

Controversial

Controversy is what debating is about. A proposition must be controversial. This is because strong statements for people to take a position. With a slight push to the edges students are not required to dig deep and understand the topic. Below is an example of an uncontroversial proposition

Resloved: Illegal immigration is sometimes a problem in the world

This is not controversial because it’s hard to agree or disagree strongly. The mildness of the statement makes it uninteresting to debate about. Below is the same proposition but written in a more controversial manner

Resloved: Illegal immigration is a major problem that destabilizes nations all over the world.

The revised proposition uses languages that is less neutral yet not aggressive. People have to think carefully where they stand.

Central Idea

A debate proposition should only address one single idea. The safest way to do this is to avoid using the word “and” in a proposition. However, this is not a strict rule but rather a guideline. Below is an example of proposition that does not have one idea.

Resloved: Illegal immigration and pollution are major problems that destabilizes nations all over the world.

The problem with the proposition above is to determine if the debate is about illegal immigration or pollution. These are topics that are not connected or the debaters must find ways to connect them.  In other words, this is messy and unclear and the proposition cannot have these characteristics.

Unemotional Words

Propositions should avoid emotional language. One of the foundational beliefs of debating is rational thought. Emotional terms lead to emotional thinking which is not the goal of debating. Generally, emotional terms are used more in advertising and propaganda than in debate. Below is an example of emotional language in a proposition.

Resloved: Illegal immigration is an abominable problem whose deprived, lawless, existence destabilizes nations all over the world.

The terms here are clearly strong in how they sound. For supporters of illegal immigration such words as abominable, depraved, and lawless are going to trigger a strong emotional response. However, what we really want is a logical, rational response and not just emotional attacks.

Statement of affirmative’s wanted decision

This last idea has to do with the fact the proposition should be stated in the positive and not negative. Below is the incorrect way to do this.

Resloved: Illegal immigration is not a major problem that destabilizes nations all over the world.

The proposition above is stated in the negative. This wording makes debating unnecessarily complicated. Below is another way to state this

Resloved: Illegal immigration is beneficial for nations all over the world.

This slight rewording helps a great deal in developing clear arguments. However, negative affirmatives can appear in  slightly different manner as shown below.

Resloved: Illegal immigration should be decriminalize.

The problem with this statement is that it provides no replacement for illegal immigration. When debating identified problems must be matched with  identified solutions. Below is a revised version of the previous proposition.

Resloved: Illegal immigration should be decriminalize and replaced with a system of open borders who monitor the movement of people.

This proposition has a strong opinion with a proposed solution.

Conclusion

This is not an exhaustive list of forming debate propositions. Rather, then goal here was to provide some guidelines to help teachers who are trying to encourage debating among their students. Off course, the guidelines provided here are for older students. For younger, kids it would be necessary to modify the wording and not worry as much about the small details of making strong debate propositions.

Presumption & Burden of Proof in Debating

In debating, it is important to understand the role of presumption and burden of proof and how these terms affect the status quo. This post will attempt to explain these concepts.

Status Quo

The status quo is the way things currently are or the way things are done. The affirmative in a debate is generally pushing change or departure from the status quo. This is in no way easy as people often prefer to keep things the way they are and minimize change.

Presumption

Presumption is the tendency of favoring one side of an argument over another. There are at least two forms of presumption. These two forms or judicial presumption and policy presumption.

Judicial presumption always favors the status quo or keeping things they way they are currently. Small changes can be made but the existing structure is not going to be different. In debates that happen from the judicial perspective it is the affirmative side that has the burden of proof or how must show that the benefit of change outweighs the status quo. A common idiom that summarizes the status quo is “If it ain’t broke don’t fix it.”

The policy form of presumption is used when change is necessary to the status quo. Example would be replacing an employee. The status quo of keeping the worker is impossible and the debate is now focused on who should be the replacement. A debate from a policy perspective is about which of the new approaches is the best to adopt.

In addition, the concept of burden of proof goes from the burden of proof to a burden of proof. This is because either side of the debate must provide must support the argument that they are making.

Burden of Refutation

The burden of refutation is the obligation to respond the opposing arguments. In other words, debaters often need to explain why the other side’s arguments are weak or perhaps even wrong. Failure to do so can make the refuting debater’s position weaker.

This leads to the point that there are no ties in debating. If both sides are equally good the status quo wins, which is normally the negative side. This is because the affirmative side did not bring the burden of proof necessary to warrant change.

Conclusion

Structure of debating requires debaters have a basic understanding of the various concepts in this field. Therefore, understanding such terms as status quo, presumption, and burden of proof  is beneficial if not required in order to participate in debating.

Intro to D3.js

D3.js is a JavaScript library that is useful for manipulating HTML documents. D3. js stands for Data Driven Documents JavaScript and was developed by Mike Bobstock. One of the primary purposes of D3.js is for data visualization. However, D3.js can do more than just provide data visualization as it can also allow for interaction binding, item selection, and dynamic styling of DOM (document object model) elements.

In order to use D3.js you should have a basic understanding of HTML. For data visualization you should have some idea of basic statistics and data visualization concepts in order to know what it is you  want to visualize. You also need to pick some sort of IDE so that you can manipulate your code. Lastly, you must know how to start a server on your local computer so you can see the results of your work.

In this post, we will make document that will use D3.js to make the phrase “Hello World”.

Example

Below is a bare minimum skeleton that an HTML document often has

1.png

Line 1 indicates the document type. Line 2 indicates the beginning of the html element. The html element can be used to store information about the page. Next, in line 6 is the body element. This is where the content of the web page is mostly kept. Notice how the information is contained in the various elements. All code is contained within the html element and the head and body elements are separate from one another.

First Script

We are now going to add our first few lines of d3.js code to our html document. Below is the code.

1

The code within the body element is new. In line 7-8 we are using a script element to access the d3.js library. Notice how it is a link. This means that when we run the code the d3.js library is access from some other place on the internet. An alternative to this is to download d3.js yourself. If you do this d3.js must be in the same folder as the html document that you are making.

To get d3.js from the internet you use the src argument and the place the web link in quotations. The charset argument is the setting for the character encoding. Sometimes this information  is important but it depends.

The second script element is where we actually do something with d3.js. Inside this second script element we have in line 10 the command d3.select(‘body’) this tells d3.js to select the first body element in the document. In line 11 we have the command .append(‘h1’) this tells d3.js to add an h1 heading in the body element. Lastly, we have the .text(‘Hello World’). This tells d3.js to add the text ‘Hello World’ to the h1 heading in the body element. This process of adding one command after another to modify the same object is called chaining.

When everything is done and you show your results you should see the following.

1

This is not the most amazing thing to see given what d3.js can do but it serves as an introduction.

More Examples

You are not limited to only one line of code or only one script element. Below is a more advanced version.

1.png

The new information is in lines 14-20. Lines 14-15 are just two p elements with some text. Lines 17-19 is another script element. This time we use the d3.selectAll(‘p’) which tells d3.js to apply the following commands to all p elements. In line 19 we use the .style command to set the background color to light blue. When this is done you should see the following.

1

Still not amazing, but things were modified as we wanted. Notice also that the second script element is not inside the body element. This is not necessary because you never see script elements in a website. Rather, you see the results of such a code.

Conclusion

This post introduce d3.js, which is a powerful tool for visualization. Although the examples here are fairly simple, you can be assured that there is more to this library than what has been explored so far.

Quadratic Discriminant Analysis with Python

Quadratic discriminant analysis allows for the classifier to assess non -linear relationships. This of course something that linear discriminant analysis is not able to do. This post will go through the steps necessary to complete a qda analysis using Python. The steps that will be conducted are as follows

  1. Data preparation
  2. Model training
  3. Model testing

Our goal will be to predict the gender of examples in the “Wages1” dataset using the available independent variables.

Data Preparation

We will begin by first loading the libraries we will need

import pandas as pd
from pydataset import data
import matplotlib.pyplot as plt
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis as QDA
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from sklearn.metrics import (confusion_matrix,accuracy_score)
import seaborn as sns
from matplotlib.colors import ListedColormap

Next, we will load our data “Wages1” it comes from the “pydataset” library. After loading the data, we will use the .head() method to look at it briefly.

1

We need to transform the variable ‘sex’, our dependent variable, into a dummy variable using numbers instead of text. We will use the .getdummies() method to make the dummy variables and then add them to the dataset using the .concat() method. The code for this is below.

In the code below we have the histogram for the continuous independent variables.  We are using the .distplot() method from seaborn to make the histograms.

fig = plt.figure()
fig, axs = plt.subplots(figsize=(15, 10),ncols=3)
sns.set(font_scale=1.4)
sns.distplot(df['exper'],color='black',ax=axs[0])
sns.distplot(df['school'],color='black',ax=axs[1])
sns.distplot(df['wage'],color='black',ax=axs[2])

1

The variables look reasonable normal. Below is the proportions of the categorical dependent variable.

round(df.groupby('sex').count()/3294,2)
Out[247]: 
exper school wage female male
sex 
female 0.48 0.48 0.48 0.48 0.48
male 0.52 0.52 0.52 0.52 0.52

About half male and half female.

We will now make the correlational matrix

corrmat=df.corr(method='pearson')
f,ax=plt.subplots(figsize=(12,12))
sns.set(font_scale=1.2)
sns.heatmap(round(corrmat,2),
vmax=1.,square=True,
cmap="gist_gray",annot=True)

1

There appears to be no major problems with correlations. The last thing we will do is set up our train and test datasets.

X=df[['exper','school','wage']]
y=df['male']
X_train,X_test,y_train,y_test=train_test_split(X,y,
test_size=.2, random_state=50)

We can now move to model development

Model Development

To create our model we will instantiate an instance of the quadratic discriminant analysis function and use the .fit() method.

qda_model=QDA()
qda_model.fit(X_train,y_train)

There are some descriptive statistics that we can pull from our model. For our purposes, we will look at the group means  Below are the  group means.

exper school wage
Female 7.73 11.84 5.14
Male 8.28 11.49 6.38

You can see from the table that mean generally have more experience, higher wages, but slightly less education.

We will now use the qda_model we create to predict the classifications for the training set. This information will be used to make a confusion matrix.

cm = confusion_matrix(y_train, y_pred)
ax= plt.subplots(figsize=(10,10))
sns.set(font_scale=3.4)
with sns.axes_style('white'):
sns.heatmap(cm, cbar=False, square=True, annot=True, fmt='g',
cmap=ListedColormap(['gray']), linewidths=2.5)

1

The information in the upper-left corner are the number of people who were female and correctly classified as female. The lower-right corner is for the men who were correctly classified as men. The upper-right corner is females who were classified as male. Lastly, the lower-left corner is males who were classified as females. Below is the actually accuracy of our model

round(accuracy_score(y_train, y_pred),2)
Out[256]: 0.6

Sixty percent accuracy is not that great. However, we will now move to model testing.

Model Testing

Model testing involves using the .predict() method again but this time with the testing data. Below is the prediction with the confusion matrix.

 y_pred=qda_model.predict(X_test)
cm = confusion_matrix(y_test, y_pred)
from matplotlib.colors import ListedColormap
ax= plt.subplots(figsize=(10,10))
sns.set(font_scale=3.4)
with sns.axes_style('white'):
sns.heatmap(cm, cbar=False, square=True,annot=True,fmt='g',
cmap=ListedColormap(['gray']),linewidths=2.5)

1

The results seem similar. Below is the accuracy.

round(accuracy_score(y_test, y_pred),2)
Out[259]: 0.62

About the same, our model generalizes even though it performs somewhat poorly.

Conclusion

This post provided an explanation of how to do a quadratic discriminant analysis using python. This is just another potential tool that may be useful for the data scientist.

Background of Debates

Debating has a history as long as the history of man. The is evidence that debating dates back at least 4,000 years. From Egypt to china and even in poetry such as Homer’s “Iliad”  one can find examples of debating. Academic debating is believed to have started about 2,500 years ago with the work of Pythagoras.

We will look at the role of culture in debating as well as debate’s role in academics in the US along with some of the benefits of debating.

Debating and Culture

For whatever reason, debating is a key component of Western civilization and in particular Democratic civilizations. Speculating on why can go on forever. However, one key component for the emphasis on debating in the west is the epistemological view of truth.

In many western cultures, there is an underlying belief that truth is relative. As such, when two sides are debating the topic it is through the combine contributions of both arguments that some idea of truth is revealed. In many ways, this is a form of the Hegelian dialectic in which thesis and antithesis make syntheses. The synthesis is the truth and can only be found through a struggle of opposing relative positions.

In other cultures, such as Asian, what is true is much more stable and agreed upon as unchanging. This may be a partial reason for why debating is not as strenuously practice in non-western context. Confucianism in particular focus on stability, tradition, and rigid hierarchy. These are concepts there often considered unthinkable in a Western culture.

Debating in the United States

In the United States, applied debating has been of the country from almost the beginning. However, academic debating has been present since at least the 18th century. It was at the beginning of the 20th century that academic debating begin to be taken much more seriously.  Intercollegiate debating during this time lead to the development of several debate associations that had various rules and ways to support the growth of debating.

Benefits of Debating

Debating has been found to develop argumentation  skills, critical thinking, and enhance general academic performance. Through  have to gather information and synthesis it in a clear way seems to transfer when students study for other academic subjects. In addition, even though debating is about sharing one side of an argument it also improves listening skills. This is because you have to listen in order to point out weaknesses in the oppositions position.

Debating also develops the ability to thinking quickly. If the ability to think is not develop a student will struggle with refutation and rebuttals which are key components of debating. Lastly, debating sharpens the judgment of participants. It i important to be able to judge the strengths and weaknesses of various aspects of an argument in order to provide a strong case for our against an idea or action and this involves sharp judgment.

Conclusion

With its rich history and clear benefits. Debating will continue to be a part of the academic experience of  many students. The skills that are developed are practical and useful for many occupations found outside of an academic setting.