SlideShare uma empresa Scribd logo
1 de 17
Does the Presidential debates have any
impact on election results?
Ashwath V
Avudaiappan R
Harish A
Sudhakaran S
Suganthy E
Monday, January 18, 2016 Active Learning Project 1
Big Data (Hadoop - Map Reduce, Pig, Hive) – for input text file processing
R & Tableau – for Visualization
Excel – for output interpretation
Tools and Technologies used
Reference
http://www.debates.org/index.php?page=debate-transcripts
Monday, January 18, 2016 Active Learning Project 2
Monday, January 18, 2016 3
Does the Presidential debates have any impact on
election results?
Objective:
• Finding out the word frequency and distribution for different parts of speech.
• Categorization of Positive and Negative words from the speech and if it has any impact
on election results
Our analysis will be helpful, If you are any of the
following:
• Do you want to contest in the next Presidential Elections?
• Would you like to know which of the two candidates fared well after the debate?
• Are you a political or a media person?
Sources:
www.debates.org
Well, my first job as
commander in chief, is to keep
the American people safe.
We need strong leadership. I'd
like to be that leader with your
support. I'll work with you.
Monday, January 18, 2016 Active Learning Project 4
MAPPER -Code to find word count
/**The mapper reads one line at the time, splits it into an array of single words and emits every word to
the reducers with the value of 1**/
public static class TopNMapper extends Mapper<Object, Text, Text, IntWritable> {
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
private String tokens = "[_|$#<>^=[]*/,;,.-:()?!"']";
@Override
public void map(Object key, Text value, Context context) throws IOException, InterruptedException
{
String cleanLine = value.toString().toLowerCase().replaceAll(tokens, " ");
StringTokenizer itr = new StringTokenizer(cleanLine);
while (itr.hasMoreTokens()) {
word.set(itr.nextToken().trim());
context.write(word, one);
}}}
MAP-REDUCE
Monday, January 18, 2016 Active Learning Project 5
REDUCER -Code to find word count
/** The reducer retrieves every word and puts it into a Map: if the word already exists in the
map, increments its value, otherwise sets it to 1**/
public static class TopNReducer extends Reducer<Text, IntWritable, Text, IntWritable> {
private Map<Text, IntWritable> countMap = new HashMap<>();
@Override
public void reduce(Text key, Iterable<IntWritable> values, Context context)
throws IOException, InterruptedException {
// **computes the number of occurrences of a single word**/
int sum = 0;
for (IntWritable val : values) {
sum += val.get();
}
Monday, January 18, 2016 Active Learning Project 6
OUTPUT
Monday, January 18, 2016 Active Learning Project 7
Code to find word count
/**Loading data**/
debate_dataset = LOAD '/home/cloudera/Desktop/debate.txt' AS (line:chararray);
/** Extract words from each line and put them into a pig bag**/
/** datatype, then flatten the bag to get one word on each row**/
words = FOREACH input_lines GENERATE FLATTEN(TOKENIZE(line)) AS word;
/**filter out any words that are just white spaces**/
filtered_words = FILTER words BY word MATCHES 'w+';
/**create a group for each word**/
word_groups = GROUP filtered_words BY word;
/**count the entries in each group**/
word_count = FOREACH word_groups GENERATE COUNT(filtered_words) AS count,
group AS word;
/**order the records by count**/
ordered_word_count = ORDER word_count BY count DESC;
STORE ordered_word_count INTO '/home/cloudera/Desktop/wordcountoutput’;
PIG
Monday, January 18, 2016 Active Learning Project 8
OUTPUT
Monday, January 18, 2016 Active Learning Project 9
I wonder who spoke more
positively?? How to find it??
Monday, January 18, 2016 Active Learning Project 10
Monday, January 18, 2016 Active Learning Project 11
Map Reduce code
public class CompareTwoFiles {
public static class Map extends
Mapper<LongWritable, Text, LongWritable, Text> {
@Override
public void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
context.write(key, value);
}
} public static class Map2 extends
Mapper<LongWritable, Text, LongWritable, Text> {
@Override
public void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
context.write(key, value);
}
}
public static class Reduce extends
Reducer<LongWritable, Text, LongWritable, Text> {
@Override
public void reduce(LongWritable key, Iterable<Text> values,
Context context) throws IOException, InterruptedException
Monday, January 18, 2016 Active Learning Project 12
Map Reduce code
{
String[] lines = new String[2];
int i = 0;
for (Text text : values) { lines[i] = text.toString(); i++; }
if (lines[0].equals(lines[1])) { context.write(key, new Text("same")); }
else { context.write(key, new Text(lines[0] + " vs " + lines[1])); } } }
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
conf.set("fs.default.name", "hdfs://localhost:8020"); Job job = new Job(conf);
job.setJarByClass(CompareTwoFiles.class);
job.setJobName("Compare Two Files and Identify the Difference");
FileOutputFormat.setOutputPath(job, new Path(args[2]));
job.setReducerClass(Reduce.class);
job.setOutputKeyClass(LongWritable.class);
job.setOutputValueClass(Text.class);
MultipleInputs.addInputPath(job, new Path(args[0]), TextInputFormat.class, Map.class);
MultipleInputs.addInputPath(job, new Path(args[1]), TextInputFormat.class, Map2.class);
job.waitForCompletion(true);
}
}
Monday, January 18, 2016 Active Learning Project 13
Positive words Output
Monday, January 18, 2016 Active Learning Project 14
Obama Romney
Series1 194 153
194
153
0
50
100
150
200
250POSITIVEWORDCOUNT
Obama VS Romney
Final Interpretation
Our Analysis reveals that positive words spoken by Barack Obama is comparatively
higher than Mitt Romney. Coincidentally Obama was elected as the President of
United States of America.
Yes, debates do have an impact on the Election results !
Monday, January 18, 2016 Active Learning Project 15
Positive words cloud
Monday, January 18, 2016 Active Learning Project 16
THANK YOU
Monday, January 18, 2016 Active Learning Project 17

Mais conteúdo relacionado

Destaque

EvictedInDaneCounty_final
EvictedInDaneCounty_finalEvictedInDaneCounty_final
EvictedInDaneCounty_final
Ruanda McFerren
 
Dr. Cason's Resume December
Dr. Cason's Resume DecemberDr. Cason's Resume December
Dr. Cason's Resume December
Jo Ann Cason
 
Curriculum Vitae of Roth Channy
Curriculum Vitae of Roth ChannyCurriculum Vitae of Roth Channy
Curriculum Vitae of Roth Channy
Roth Channy
 

Destaque (13)

Didáctica crítica
Didáctica críticaDidáctica crítica
Didáctica crítica
 
EvictedInDaneCounty_final
EvictedInDaneCounty_finalEvictedInDaneCounty_final
EvictedInDaneCounty_final
 
Using pattern stories in the world language classroom helena curtain
Using pattern stories in the world language classroom helena curtainUsing pattern stories in the world language classroom helena curtain
Using pattern stories in the world language classroom helena curtain
 
new CV Rehan
new CV Rehannew CV Rehan
new CV Rehan
 
Dr. Cason's Resume December
Dr. Cason's Resume DecemberDr. Cason's Resume December
Dr. Cason's Resume December
 
How to know if your business idea will succeed
How to know if your business idea will succeedHow to know if your business idea will succeed
How to know if your business idea will succeed
 
Pkk 2
Pkk 2Pkk 2
Pkk 2
 
El amor y la locura
El amor y la locuraEl amor y la locura
El amor y la locura
 
Curriculum Vitae of Roth Channy
Curriculum Vitae of Roth ChannyCurriculum Vitae of Roth Channy
Curriculum Vitae of Roth Channy
 
PRINT ADS 5
PRINT ADS 5PRINT ADS 5
PRINT ADS 5
 
401 norma sanitaria
401  norma sanitaria401  norma sanitaria
401 norma sanitaria
 
Orientation
OrientationOrientation
Orientation
 
конспект уроку 11 клас eating out
конспект уроку 11 клас eating outконспект уроку 11 клас eating out
конспект уроку 11 клас eating out
 

Semelhante a Does presidential debates have impact on election results?

Semelhante a Does presidential debates have impact on election results? (20)

Introducing DataFrames in Spark for Large Scale Data Science
Introducing DataFrames in Spark for Large Scale Data ScienceIntroducing DataFrames in Spark for Large Scale Data Science
Introducing DataFrames in Spark for Large Scale Data Science
 
Introducción a hadoop
Introducción a hadoopIntroducción a hadoop
Introducción a hadoop
 
Introduction to Map-Reduce Programming with Hadoop
Introduction to Map-Reduce Programming with HadoopIntroduction to Map-Reduce Programming with Hadoop
Introduction to Map-Reduce Programming with Hadoop
 
TheEdge10 : Big Data is Here - Hadoop to the Rescue
TheEdge10 : Big Data is Here - Hadoop to the RescueTheEdge10 : Big Data is Here - Hadoop to the Rescue
TheEdge10 : Big Data is Here - Hadoop to the Rescue
 
Hadoop
HadoopHadoop
Hadoop
 
PigSPARQL: A SPARQL Query Processing Baseline for Big Data
PigSPARQL: A SPARQL Query Processing Baseline for Big DataPigSPARQL: A SPARQL Query Processing Baseline for Big Data
PigSPARQL: A SPARQL Query Processing Baseline for Big Data
 
Map Reduce introduction
Map Reduce introductionMap Reduce introduction
Map Reduce introduction
 
Spark what's new what's coming
Spark what's new what's comingSpark what's new what's coming
Spark what's new what's coming
 
Advance Map reduce - Apache hadoop Bigdata training by Design Pathshala
Advance Map reduce - Apache hadoop Bigdata training by Design PathshalaAdvance Map reduce - Apache hadoop Bigdata training by Design Pathshala
Advance Map reduce - Apache hadoop Bigdata training by Design Pathshala
 
Writing MapReduce Programs using Java | Big Data Hadoop Spark Tutorial | Clou...
Writing MapReduce Programs using Java | Big Data Hadoop Spark Tutorial | Clou...Writing MapReduce Programs using Java | Big Data Hadoop Spark Tutorial | Clou...
Writing MapReduce Programs using Java | Big Data Hadoop Spark Tutorial | Clou...
 
Big Data otimizado: Arquiteturas eficientes para construção de Pipelines MapR...
Big Data otimizado: Arquiteturas eficientes para construção de Pipelines MapR...Big Data otimizado: Arquiteturas eficientes para construção de Pipelines MapR...
Big Data otimizado: Arquiteturas eficientes para construção de Pipelines MapR...
 
Map reduce模型
Map reduce模型Map reduce模型
Map reduce模型
 
MapReduce wordcount program
MapReduce wordcount program MapReduce wordcount program
MapReduce wordcount program
 
Bootcamp Code Notes - Akshansh Chaudhary
Bootcamp Code Notes - Akshansh ChaudharyBootcamp Code Notes - Akshansh Chaudhary
Bootcamp Code Notes - Akshansh Chaudhary
 
Big data shim
Big data shimBig data shim
Big data shim
 
Rattle Graphical Interface for R Language
Rattle Graphical Interface for R LanguageRattle Graphical Interface for R Language
Rattle Graphical Interface for R Language
 
Monads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy DyagilevMonads and Monoids by Oleksiy Dyagilev
Monads and Monoids by Oleksiy Dyagilev
 
Study material ip class 12th
Study material ip class 12thStudy material ip class 12th
Study material ip class 12th
 
Spark overview
Spark overviewSpark overview
Spark overview
 
Scalable and Flexible Machine Learning With Scala @ LinkedIn
Scalable and Flexible Machine Learning With Scala @ LinkedInScalable and Flexible Machine Learning With Scala @ LinkedIn
Scalable and Flexible Machine Learning With Scala @ LinkedIn
 

Último

Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
amitlee9823
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
amitlee9823
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
amitlee9823
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 

Último (20)

Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
April 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's AnalysisApril 2024 - Crypto Market Report's Analysis
April 2024 - Crypto Market Report's Analysis
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
 
Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -
Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -
Thane Call Girls 7091864438 Call Girls in Thane Escort service book now -
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night StandCall Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Doddaballapur Road ☎ 7737669865 🥵 Book Your One night Stand
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night StandCall Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Hsr Layout ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 

Does presidential debates have impact on election results?

  • 1. Does the Presidential debates have any impact on election results? Ashwath V Avudaiappan R Harish A Sudhakaran S Suganthy E Monday, January 18, 2016 Active Learning Project 1
  • 2. Big Data (Hadoop - Map Reduce, Pig, Hive) – for input text file processing R & Tableau – for Visualization Excel – for output interpretation Tools and Technologies used Reference http://www.debates.org/index.php?page=debate-transcripts Monday, January 18, 2016 Active Learning Project 2
  • 4. Does the Presidential debates have any impact on election results? Objective: • Finding out the word frequency and distribution for different parts of speech. • Categorization of Positive and Negative words from the speech and if it has any impact on election results Our analysis will be helpful, If you are any of the following: • Do you want to contest in the next Presidential Elections? • Would you like to know which of the two candidates fared well after the debate? • Are you a political or a media person? Sources: www.debates.org Well, my first job as commander in chief, is to keep the American people safe. We need strong leadership. I'd like to be that leader with your support. I'll work with you. Monday, January 18, 2016 Active Learning Project 4
  • 5. MAPPER -Code to find word count /**The mapper reads one line at the time, splits it into an array of single words and emits every word to the reducers with the value of 1**/ public static class TopNMapper extends Mapper<Object, Text, Text, IntWritable> { private final static IntWritable one = new IntWritable(1); private Text word = new Text(); private String tokens = "[_|$#<>^=[]*/,;,.-:()?!"']"; @Override public void map(Object key, Text value, Context context) throws IOException, InterruptedException { String cleanLine = value.toString().toLowerCase().replaceAll(tokens, " "); StringTokenizer itr = new StringTokenizer(cleanLine); while (itr.hasMoreTokens()) { word.set(itr.nextToken().trim()); context.write(word, one); }}} MAP-REDUCE Monday, January 18, 2016 Active Learning Project 5
  • 6. REDUCER -Code to find word count /** The reducer retrieves every word and puts it into a Map: if the word already exists in the map, increments its value, otherwise sets it to 1**/ public static class TopNReducer extends Reducer<Text, IntWritable, Text, IntWritable> { private Map<Text, IntWritable> countMap = new HashMap<>(); @Override public void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException { // **computes the number of occurrences of a single word**/ int sum = 0; for (IntWritable val : values) { sum += val.get(); } Monday, January 18, 2016 Active Learning Project 6
  • 7. OUTPUT Monday, January 18, 2016 Active Learning Project 7
  • 8. Code to find word count /**Loading data**/ debate_dataset = LOAD '/home/cloudera/Desktop/debate.txt' AS (line:chararray); /** Extract words from each line and put them into a pig bag**/ /** datatype, then flatten the bag to get one word on each row**/ words = FOREACH input_lines GENERATE FLATTEN(TOKENIZE(line)) AS word; /**filter out any words that are just white spaces**/ filtered_words = FILTER words BY word MATCHES 'w+'; /**create a group for each word**/ word_groups = GROUP filtered_words BY word; /**count the entries in each group**/ word_count = FOREACH word_groups GENERATE COUNT(filtered_words) AS count, group AS word; /**order the records by count**/ ordered_word_count = ORDER word_count BY count DESC; STORE ordered_word_count INTO '/home/cloudera/Desktop/wordcountoutput’; PIG Monday, January 18, 2016 Active Learning Project 8
  • 9. OUTPUT Monday, January 18, 2016 Active Learning Project 9
  • 10. I wonder who spoke more positively?? How to find it?? Monday, January 18, 2016 Active Learning Project 10
  • 11. Monday, January 18, 2016 Active Learning Project 11
  • 12. Map Reduce code public class CompareTwoFiles { public static class Map extends Mapper<LongWritable, Text, LongWritable, Text> { @Override public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { context.write(key, value); } } public static class Map2 extends Mapper<LongWritable, Text, LongWritable, Text> { @Override public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { context.write(key, value); } } public static class Reduce extends Reducer<LongWritable, Text, LongWritable, Text> { @Override public void reduce(LongWritable key, Iterable<Text> values, Context context) throws IOException, InterruptedException Monday, January 18, 2016 Active Learning Project 12
  • 13. Map Reduce code { String[] lines = new String[2]; int i = 0; for (Text text : values) { lines[i] = text.toString(); i++; } if (lines[0].equals(lines[1])) { context.write(key, new Text("same")); } else { context.write(key, new Text(lines[0] + " vs " + lines[1])); } } } public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); conf.set("fs.default.name", "hdfs://localhost:8020"); Job job = new Job(conf); job.setJarByClass(CompareTwoFiles.class); job.setJobName("Compare Two Files and Identify the Difference"); FileOutputFormat.setOutputPath(job, new Path(args[2])); job.setReducerClass(Reduce.class); job.setOutputKeyClass(LongWritable.class); job.setOutputValueClass(Text.class); MultipleInputs.addInputPath(job, new Path(args[0]), TextInputFormat.class, Map.class); MultipleInputs.addInputPath(job, new Path(args[1]), TextInputFormat.class, Map2.class); job.waitForCompletion(true); } } Monday, January 18, 2016 Active Learning Project 13
  • 14. Positive words Output Monday, January 18, 2016 Active Learning Project 14
  • 15. Obama Romney Series1 194 153 194 153 0 50 100 150 200 250POSITIVEWORDCOUNT Obama VS Romney Final Interpretation Our Analysis reveals that positive words spoken by Barack Obama is comparatively higher than Mitt Romney. Coincidentally Obama was elected as the President of United States of America. Yes, debates do have an impact on the Election results ! Monday, January 18, 2016 Active Learning Project 15
  • 16. Positive words cloud Monday, January 18, 2016 Active Learning Project 16
  • 17. THANK YOU Monday, January 18, 2016 Active Learning Project 17