Week 7 : Response to The Danger of A Single Story

I think this particular talk is something that almost anyone can relate to because of the core message in the talk – a single perspective can never conjure an unbiased, coherent narrative.  She says, “The single story creates stereotypes, and the problem with stereotypes is not that they are untrue, but that they are incomplete. They make one story become the only story.” But, sometimes, racial stereotypes are almost unavoidable because of mainstream media portrayal of different people, and the same holds true for anyone. 
For example, as a South Asian, the question, “Are you Indian?” is not uncommon to me. While I am Sri Lankan in reality, I do not blame people for asking so since I myself make the same mistakes when it came to identifying where a lot of my Latino and Slavic friends came from. 
I can also relate to Chimimanda to a decent extent for the sole reason that I also grew up reading really popular English Kids’ books such as The Hardy Boys, The Famous Five, The Secret Seven, and since I went to a school that followed the UK System, my math problems would involve pounds and pence, and English lessons would narrate experiences utterly foreign to me.
In this day and age, there is no excuse for being culturally unaware. We have the fastest information superhighway at our fingertips. And, as artists and storytellers, it is paramount that we take the factor of cultural inclusion and sensitivity into account in our work.

Week 7 : Audio Project Individual Write-Up – Abdullah Zameek

The project can be found here

The code for this project can be found on this Github repo

Project Idea :

The idea (that Harry came up with and further refined together afterwards) was to come up with a audio-visual representation of the popular thought experiment :
“If a tree falls in a forest and no one is around to hear it, does it make a sound?”

Typically, like other thought experiments such as Schrodinger’s Cat or Maxwell’s Demon, there is no clear way to demonstrate a prototype as to how the experiment actually works. We attempted to demonstrate an artistic interpretation of the experiment through a series of interactive pictures and sound that that tries to highlight the phenomenon that the experiment entails.
The user initially hears and sees a tree being chopped down, and as he “moves away”, he begins to be flooded with more ambient sound and eventually the sound of a tree falling. The question is, was it the same tree that the user saw at the onset?

Implementation:

The implementation was fairly straightforward – we have two main HTML pages – the title screen, and the page with the images and the actual sound. The second page has  a zoom button which serves multiple purposes. 
1) Reduces the size of the image with each click.
2) Swap the image out for the next one once the image reaches a certain size.
3) Reduce the volume of the sound with each click. This is done to reinforce the notion of the surroundings getting further away from you as you keep clicking. 
The idea is that the closer you are to the tree, the more you hear sounds related to the tree and less sounds related to the ambiance, but as you zoom out, the ambient sound starts to become more prevalent. Ultimately, you hear a tree fall, but that sound is soon overshadowed by the sounds of the ambient surroundings. 

Another feature is the onhover on the images. This triggers the image and the soundtrack to be swapped out for their distorted counterparts. This essentially adds an extra dimension to the entire project where we experimented with different forms of the same piece that conveys a different sort of feel and emotion and provides for a totally different experience.

Workload Split-Up : 

With regards to the splitting up of the workload, Harry came up with the initial concept and we further refined the implementation together.  I was in charge of gathering the audio sources which included several open source tracks. I then put these tracks on Audacity and mixed them, cutting certain portions out, adding special effects such as distortion, and modified the amplitude and echo manually to suite the purposes of the project. Each track in the project (with the exception of the last one) has at least two different tracks mixed together to create a cohesive piece that fits the setting of the scenario. 

I also worked on some of the core JavaScript features which included the zoom feature for the image, as well as the distortion on hover. 
The zoom feature was quite troublesome to configure since I couldn’t find a proper standardized way to do it, so I went along with a method I devised myself. It seemed to work for the most part so we went along with that. The distort and undistort functions worked perfectly fine and smoothly, which was a great plus.
Making the audio and the images switch out was fairly easy with two arrays and a bit of modulo division to make the counter loop through the array in a circular manner. 

Reflections:

Harry and I made it a point to make this project as concept-driven as possible. We drew out the plans on paper first and translated the concepts to code as closely as possible.  As a work partner, Harry was absolutely wonderful, and put a lot of thought and effort into making sure that the concept shone throughout the entire project. All in all, we are quite satisfied with the overall outcome.

Week 07 : Confessor Bot – Midterm Writeup – Abdullah Zameek

The main motivation for the midterm was my obsession with the content of the posts that could be found on the confessions pages of NYU Abu Dhabi. The posts had very amusing content, so I thought it would be interesting to see what would happen if posts were fed to a machine learning algorithm that would in turn generate its own “confessions”. 
Another motivation was a couple of Twitter profiles that I found that were entirely managed by bots and spewed out random tweets at set frequencies.

Putting these two interests together gave rise to the ConfessorBot – A Twitter Bot that would tweet random NYU related confessions. 

Strategy

The first step was to understand exactly how I can train and generate the random confessions. After a quick google search, I noticed the words “RNN” and “LSTM” show up almost on every hit for “Text Generation Machine Learning”.  These were two resources that proved to be useful in understanding the theory behind the networks.
http://colah.github.io/posts/2015-08-Understanding-LSTMs/
https://machinelearningmastery.com/text-generation-lstm-recurrent-neural-networks-python-keras/
https://towardsdatascience.com/learn-how-recurrent-neural-networks-work-84e975feaaf7
https://skymind.ai/wiki/lstm
http://karpathy.github.io/2015/05/21/rnn-effectiveness/

I then began to read up on the technologies, but was soon overwhelmed by the vast intricacies that both of them posed. I then explored the different implementations of RNNs/LSTMs in Keras and Tensorflow (mostly the one shown in the Machine Learning Mastery article linked above).
This was the first major roadblock. Even though I followed the tutorial down to the letter, the code failed to compile and spawned many errors, so I attempted to resolve them one by one. After resolving two errors, I bumped into an error related to a dependency itself, and then came to realise that the article was relatively old, and so it was likely that the said dependency may have been deprecated. I did not want to spend much more time on this model so I began to look for another one.

Then, I came across Tensorflow’s own tutorial for text generation using RNNs and its eager execution module. This seemed much more promising and ultimately, I found out that it was. (More about the actual training and testing at the end) 

After discussing my project with Aven, he suggested that I give more focus to get  a working model first before focusing too heavily on the data collection itself, since the corpus that I wished to train on had to be collected manually by me. What made it tougher to collect this data was the fact that it was to be collected from Facebook. In my midterm proposal I stated that collecting data from Facebook would prove to be one of my biggest challenges, and eventually, it did prove to be quite hard indeed. 
This was primarily because Facebook has heavily restricted the use of its Graph API after the entire Cambridge Analytica scandal. So, the only option was to use some sort of web scraping technique to collect the data.
My idea was to use some combination of BeautifulSoup (A Python HTML Parser) and Selenium (a browser automator) to retrieve the posts one by one. However, once again, I came across two major problems.
1. The HTML architecture was quite complicated – the Facebook feed is quite complex and the data I wanted was buried deep within 8-9 different tags.
2. Facebook is quite strict with their web crawler/bot policies, so it was very likely that I would get blocked early into the scraping. 

Navya suggested that I scrape from the mobile version of Facebook instead due to its simpler structure, and minimal use of Javascript which meant it was less likely to detect bot behaviour. He also told me about a BS4 method called getText() which turned out to be an absolute saviour to retrieve the deep buried text from the site. After writing up a relatively straightforward python script and tweaking with the load times, I was able to get posts out of the Facebook page and into a textfile. The text that I got was quite clean, so it just took me a couple of minutes to clean them manually using basic tools on VSCode. 
One problem, however, was that I would not get all the past since the beginning of time (on that page). Selenium would reach a scroll limit and stop there. I tried to manually scroll past that point, however, I encountered the same roadblock. I’m guessing this is due to the fact that the browser cache has a limit to the amount of data it can hold for a given time so that’s why it failed to load every single post. As a result,  I was only able to get around 300-350 posts per page, giving me a grand total of around 1200 posts. This is far from optimal for training a RNN, and comes across as the first drawback of my current project. However, at the same time, I believe my project has shown the Proof of Concept sufficiently, i.e, it will give better results once the data is scaled up and the current prototype sufficiently demonstrates the base functionality that I wished to achieve. 
Here’s a short demo of the scraper in action (I set it to scrape only for a few seconds so as to keep the video short)

During this course of trying to get data out of Facebook, I did learn many new concepts with regards to web architecture such as lazy versus eager loading, infinite scrolling, and web tools such as Selenium WebDriver (a browser automation tool) and Python’s BeautifulSoup. (On that note, major shoutout to Navya for pointing me in the right direction with regards to how to approach the problem, from which version of Facebook’s site to use to useful BS4 methods used to retrieve text data).

The next step was to create a very simple Twitter Bot. The main functionality of this bot was to simply tweet something at a set interval, so configuring it was fairly straightforward. I relied heavily on a tutorial by Daniel Shiffman to create the bot, with some additions to suit my use case. I used Node JS and the Twit package to do this, along with some other npm dependencies for some additional functionality. My program would then read a text file containing the generated tweets and tweet them out at set intervals. 

With regards to the actual RNN, I followed the instructions on Tensorflow’s site to write the code. I tested the code with the “shakespeare.txt” text file with three epochs and the results looked promising. I then proceeded to train it with my own dataset. It was at this point, I realized the biggest limitation in my project – since the size of my dataset was small, there would inevitably be a high degree of overfitting. Initially, I planned to use posts only from NYUAD Crushes and Compliments and NYUAD Confessions, but since my scraper had hit a physical limit with regards to the number of posts it could scrape, I decided to also scrape posts off NYU Secrets (which is NYU New York’s Confessions Page). This slightly increased the size of my dataset but not to drastically great extent where it would combat the overfitting problem. However, I believe that the model still highlights the proof of concept of the initial idea and will be able to give more amusing results for  a larger set of confessions. 
Another aspect that I underestimated was the amount of time it would take for the RNN to train. It took a total of 6.5 hours for 200 Epochs on the Intel AI cluster, and three failed attempts because of broken pipes and failed connections. Ultimately, I was able to generate some “confessions” from the network and feed it to the Twitter bot.

Here’s a demo of the bot in action:

Reflections and Future Enhancements

I really enjoyed working on this project since it introduced me to a lot of new concepts in Machine Learning (such as the theoretical foundations of a RNN)  and Web Scraping, as well as made me aware of practical limitations in training a ML model. 
However, there are certain things that could certainly do with a lot of improving.
1) A more efficient scraping technique – I’m not really sure if there’s another way out there to retrieve posts off Facebook without an API, but the current method does get quite slow and tedious, in addition to the fact that it could only scrape 300 or so posts. before hitting a limit.
2) Use of a much larger dataset – This is important to combat overfitting, and at present, my current model overfits the data to a large extent.
3) Further refinement of the model to create more semantic structure and grammar rules – it would be much better if the model could be trained on more grammar so that it would generate more cohesive and interesting sentences. 

The actual code used for this project can be found here.

The Twitter profile can be found here.
(Initially, I planned to create a completely new account for this project, but my developer account application was rejected. As a result, I used an account that was created as part of a running project and was named after an inside joke from a previous IM class last spring)

Week 06 : iML Midterm Presentation

My midterm concept and motivation for doing so can be found in the following PDF file :
ConfessorBot

Progress Report: 
I found  a sample LSTM RNN model on the internet and I attempted to run the code after some brief modifications. However, the code would not run due to several errors from the library end. I’m guessing the reason is a deprecated dependency. I’m currently reading through Tensorflow’s Text Generation in hopes of trying to get a working model done soon.

Week 6 : Response to Kenny G-Auld Lang Syne – Abdullah Zameek

Thoughts :
A good proportion of the lyrics barely resonated with me for the sole reason that I have never studied American history in-depth. What struck me though was the lyric about Iraq, “The skies over Baghdad have been illuminated.”
I didn’t understand why the person who mixed this track would put in such a line since it relates to the US Invasion of Iraq which was one of the biggest atrocities in recent history and led to absolute political instability in the region as well as influenced the rise of modern terrorism.
I don’t find this track to be particularly inspiring because of the fact that it is very US-centered and there were several, more significant events that took place in the last century that had nothing to do with the US. 
This also brings up an important point with regards to conveying a story – while the sound effects and techniques might be impressive, it will inevitably be overlooked by the masses if it doesn’t have content that resonates well with the masses.

The first words I spoke in the original phonograph, Mary had a little lamb, its fleece was white as snow, and everywhere that Mary went, the lamb was sure to go. 

“The distinguished flying cross upon Colonel Charles Lindberg”

“Today, panicked investors ordered their brokers to sell at whatever the price in the stock market crashed.”

“The only thing we have to fear is fear itself.”

“Horrific place, ladies and gentlemen, the smoke and the flames now. Oh, the humanity!”

“Now, with the help and support of the woman I love.” 

“Urging the people to evacuate the city as Martians approach.”

“Never to go to war with one another again”

“. . .Juden. . .”

“This country is at war with Germany.”

“December 7, 1941,  a date which will live in infamy.”

“This is Bob Command performance Hope telling each Nazi that s in Russia today that, “Crimea doesn t pay. ”

“I consider myself the luckiest man on the face of the earth.” 

“President Franklin D. Roosevelt stricken late today.”

“The world will note that the first atomic bomb was dropped on Hiroshima.”

“Reports from the new Germany tell of horrors leading to the total extermination of the Jews of Europe.”

“An iron curtain has descended across the continent of Europe.” 

“Jackie Robinson goes to bat for the first time in a Major League.”

“Old soldiers never die. They just fade away.” 

“It was a little cocker spaniel dog, and our little girl, Tricia, the six year old, named it Checkers ”

“Are you a member of the Communist Party?” 

“Oh, a cop, eh. Woo, woo, woo.” – THE THREE STOOGES

“Or have you ever been a member of the Communist Party?” 

“A blast from the past! A blast from the past! A blast from the past!” “Baby, you re the greatest.”

“From Sun Recording artist, Elvis Presley” 

“I d like to thank all, all the wonderful folks, and I d like to thank you, too.”  

“Three young singers were killed today in the crash of a light plane.”

“American bandstand. And now, here he is, the star of our show, Dick Clark.”

“Ask not what your country can do for you. Ask what you can do for your country.” 

“They re standing up, waiting to see if Maris is going to hit number 61”

“Godspeed, John Glenn.” 

“Happy birthday, Mr. President.” 

“Wondering how and why Marilyn Monroe died.”

“Something has happened in the motorcade. President Kennedy died at  1p.m. Central Standard Time” 

“Lee Harvey Oswald was shot.”

“I have a dream that my four little children will one day live in a nation where they will not be judged by the color of their skin, but by the content of their character.” 

“And I say segregation now” 

“What we have foremost in common is their enemy.” 

“Segregation tomorrow” 

And segregation forever”

He’s an enemy to all of us.” 

“I have a dream” 

“I am about to sign into law the Civil Rights Act of 1964.” 

“The Beatles!”

“And today I ordered to Vietnam the Air Mobile Division. Additional forces will be needed later and they will be sent.” 

“I have very sad news for all of you. Martin Luther King was shot and was killed tonight in Memphis Tennessee.”

“Senator Kennedy has been shot. Is that possible?”

“As he said many times in many parts of this nation, Some men see things as they are and say, Why? I dream things that never were and say, Why not? ” 

“That s one small step for man, one giant leap for mankind.” 

“It s a free concert from now on.”

“We must be in Heaven, man” 

“Four persons including two women were shot and killed in Ohio today. Hundreds of students were involved as National Guard”

“There ll be a killer and a thriller and a chiller when I get the gorilla in Manila.” 

“I have concluded an agreement to end the War and bring peace with honor in Vietnam.”

“There’s a drive into left center field. That ball is gonna be, out of here. It s gone. It’s 715. There s a new home run champion of all time and it s Henry Aaron.”

“Well, I m not a crook”

“Hereeeeeeeeeeeeeeeeeeeeeeeeeee’s Johnny!” 

“I shall resign the Presidency effective at noon tomorrow.” 

“An absolute pardon unto Richard Nixon.”

“My name is Jimmy Carter, and I m running for President.”

“Live from New York, it s Saturday Night.”

“Elvis Presley died today at Baptist Hospital in Memphis.”

“John Lennon was brought to the Emergency Room. He was dead on arrival.”

“Today marks day number 64 in the hostage crisis in Iran.”

“I, Diana Frances take thee Philip Charles Arthur George”

“To my wedded husband.” 

“To my wedded husband.” 

“A disease striking primarily in the gay community called Acquired Immune Deficiency Syndrome. ”

“The liftoff of the 25th Space Shuttle Mission, and it has cleared the tower. Rock and roll, Challenger.” 

“We will never forget them, nor the last time we saw them, as they prepared for their journey and waved Goodbye, and slipped the surly bonds of Earth to touch the face of God.”

“I have as much experience in the Congress as Jack Kennedy did when he sought the Presidency.”

“Senator, you’re no Jack Kennedy.” 

“Mr. Gorbachov, tear down this wall.”

“I don’t think it was wrong.” 

“We did not trade weapons or anything else for hostages.” 

“I think it was a neat idea.” 

“Everyone on Sesame Street is always talking about love. Yuck”

“Hundreds of Berliners from East and West, standing atop the Wall, with chisels and hammers.” 

“The skies over Baghdad have been illuminated.”

“Read my lips.” 

“We, the jury, in the above entitled action, find the defendant, O.J Simpson, not guilty of the crime of murder, a felony, upon Nicole Brown Simpson, a human being.” 

“Princess Diana died of injuries suffered in a car accident”

“I’m Ellen and I’m gay.” 

“Yeah, baby.” 

“There it is, 62, folks, and we have a new home run champion, Mark McGure.”

“Welcome, you’ve got mail.”

“I did not have sexual relations with that woman.” 

“This vast right-wing conspiracy conspiring against my husband.”

“Watch me pull a rabbit out of my hat” 

“Indeed I did have a relationship with Miss Lewinski that was not appropriate. It was wrong. I need to go back to work for the American people.”

“The young killers of Columbine High School do not stand for the spirit of America. We can rise up and we can say No more. ”

“Let the word go forth from this time and place, that the torch has been passed to a new generation of Americans.”