Monthly Archives: April 2019

Phrasing Debate Propositions

Advertisements

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

Advertisements

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

Advertisements

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

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.

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.

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.

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.

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

Advertisements

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.

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])

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)

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)

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)

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

Advertisements

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.

Types of Debates

Advertisements

Debating has a long history with historical evidence of this practice dating back 4,000 year. Debating was used in ancient Egypt, China, and Greece. As such, people who participate in debates are contributing to a rich history.

In this post, we will take a look at several types of debates that are commonly used today. The types of debates we will cover are as follows.

  • Special
  • Judicial
  • Parliamentary
  • Non-formal
  • Academic

Special Debate

A special debate is special because it has distinct rules  for a specific occasion. Examples include the Lincoln-Douglas debates of 1858. These debates were so influential that there is a debate format today called the Lincoln-Douglas format. This format often focuses on moral issues and has a specific use of time for the debaters that is distinct.

Special debates are also commonly used for presidential debates. Since there is no set format, the debaters literally may debate over the rules of the actual debate. For example, the Bush vs Kerry debates of 2004 had some of the following rules agreed to by both parties prior to the debate.

  1. Height of the lectern
  2. type of stools used
  3. Nature of the audience

In this example above, sometimes the rules have nothing to do with the actual debate but the atmosphere/setting around it.

Judicial Debate

Judicial debates happen in courts judicial like settings. The goal is to prosecute or defend individuals for some sort of crime. For lawyers in training or even general students, moot court debates are used to hone debating skills and mock trial debates are also used.

Parliamentary Debate

The parliamentary debate purpose s to support or attack potential legislation. Despite its name, the parliamentary debate format is used in the United States at various levels of government. There is a particular famous variation of this called the Asian parliamentary debate style.

Non-formal Debate

A non-formal debate lacks the rules of the other styles mentioned. In many ways, any form of disagreeing that does not have a structure for how to present one’s argument can fall under the category of non-formal. For example, children arguing with parents could be considered non-formal as well as classroom discussion on a controversial issue such as immigration.

This form of debate is probably the only one that everyone is familiar with and has participated in. However, it is probably the hardest to develop skills in due to the lack of structure.

Academic Debate

The academic debate is used to develop the educational skills of the participants. Often the format deployed is taken from applied debates. For example, many academic debates use the Lincoln Douglas format. There are several major Debate organizations that promote debate competitions between school’s. The details of this will be expanded in a future post.

Conclusion

This post provided an overview of different styles of debating that are commonly employed. Understanding this can be important because how you present and defend a point of view depends on the rules of engagement.

Persuasion vs Propaganda

Advertisements

Getting people to believe or do something has been a major problem on both an individual and even an international level. To address this concern both individuals and nations have turned to both persuasion and propaganda. This post will define both persuasion  and propaganda and compare and contrast them.

Persuasion

Persuasion is communication that attempts to influence the behavior or beliefs of others. This can be done through appeals to reason, appeals to emotions, or a combination of both. Often persuasion is done  on a small scale and is informal. Example would be a child trying to persuade their mother to let them go outside to play.

A more serious example would be a lawyer trying to persuade a judge. This involves one lawyer try to move the opinion of one judge. The goal here is for the lawyer to show the strength of their position while discrediting the position of others and the opposition.

Even though it is not on a large scale, persuasion works critical thinking, deep thought, with a thorough knowledge of the problem and the person(s) one is trying to persuade. Nothing can ruin persuasion like ignorance of the problem or people who you want to persuade.

Propaganda

Propaganda is persuasion on a large scale. It involves a group or organization of persuaders who combine their efforts to reach a large audience. The term propaganda was supposedly created in the 17th by Pope Gregory XV who in 1622 created the Sacred Congregation for the Propagating of the Faith. This group is responsible for spreading the Catholic religion in an evangelistic manner for conversions to the religion, which implies that propaganda is the spreading of ideas so that people accept them.

Edward Bernays is often seen as the master of propaganda. It was he who brought the use of propaganda to an art form in the early to mid 20th century. Ever the master of language and knowing the negative connotation of propaganda Bernays used an alternative term publicly on many occasion called “public relations.” This is the term essentially all institutions used today even though it has the same primary characteristics of propaganda which is to influence public opinion about something.

As mentioned in the previous paragraph, generally, the term propaganda is viewed negatively even though it is simply massive organized persuasion. This may be because propaganda is usually used for nefarious purposes throughout history. For example, Hitler used propaganda to strengthen the Nazi party. However, all countries are guilty of developing  propaganda for reasons that may not be completely altruistic in order to support their position in a competitive world.

Comparison

Persuasion and propaganda are in many ways opposite extremes of the same idea. What persuasion is on a small scale propaganda is on a large scale. However, it is hard to tell how big persuasion has to become before it reaches the level of propaganda. One indication may be in perception of the message. People who disagree with a position may call it propaganda, while people who agree with the message may call it persuasion.

Both persuasion and propaganda involve the use of planning and serious thought. Propaganda may involve more planning as it requires a large group of people to impact a  much larger audience. Finally, when persuasion and propaganda fail it may lead to something more sinister called coercion. This is when people are not necessarily forced to believe but usually to do something.

Conclusion

Whether persuading or sharing propaganda it is important to be aware of how these two terms are similar and different. Generally, the difference is a matter of scale. Persuasion is a local personal form of propaganda while propaganda is a massive impersonal form of persuasion

Random Forest Classification with Python

Advertisements

Random forest is a type of machine learning algorithm in which the algorithm makes multiple decision trees that may use different features and subsample to making as many trees as you specify. The trees then vote to determine the class of an example. This approach helps to deal with the high variance that is a problem with making only one decision tree.

In this post, we will learn how to develop a random forest model in Python. We will use the cancer dataset from the pydataset module to classify whether a person status is censored or dead based on several independent variables. The steps we need to perform to complete this task are defined below

  1. Data preparation
  2. Model development and evaluation

Data Preparation

Below are some initial modules we need to complete all of the tasks for this project.

import pandas as pd
import numpy as np
from pydataset import data
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report

We will now load our dataset “Cancer” and drop any rows that contain NA using the .dropna() function.

df = data('cancer')
df=df.dropna()

Next, we need to separate our independent variables from our dependent variable. We will do this by make two datasets. The X dataset will contain all of our independent variables and the y dataset will contain our dependent variable. You can check the documentation for the dataset using the code data(“Cancer”, show_doc=True)

Before we make the y dataset we need to change the numerical values in the status variable to text. Doing this will aid in the interpretation of the results. If you look at the documentation of the dataset you will see that a 1 in the status variable means censored while a 2 means dead. We will change the 1 to censored and the 2 to dead when we make the y dataset. This involves the use of the .replace() function. The code is below.

X=df[['time','age',"sex","ph.ecog",'ph.karno','pat.karno','meal.cal','wt.loss']]
df['status']=df.status.replace(1,'censored')
df['status']=df.status.replace(2,'dead')
y=df['status']

We can now proceed to model development.

Model Development and Evaluation

We will first make our train and test datasets. We will use a 70/30 split. Next, we initialize the actual random forest classifier. There are many options that can be set. For our purposes, we will set the number of trees to make to 100. Setting the random_state option is similar to setting the seed for the purpose of reproducibility. Below is the code.

x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)
h=RandomForestClassifier(n_estimators=100,random_state=1)

We can now run our modle with the .fit() function and test it with the .pred() function. The code is velow.

h.fit(x_train,y_train)
y_pred=h.predict(x_test)

We will now print two tables. The first will provide the raw results for the classification using the .crosstab() function. THe classification_reports function will provide the various metrics used for determining the value of a classification model.

print(pd.crosstab(y_test,y_pred))
print(classification_report(y_test,y_pred))

Our overall accuracy is about 75%. How good this is depends in context. We are really good at predicting people are dead but have much more trouble with predicting if people are censored.

Conclusion

This post provided an example of using random forest in python. Through the use of a forest of trees, it is possible to get much more accurate results when a comparison is made to a single decision tree. This is one of many reasons for the use of random forest in machine learning.