Remote Collaboration using Git/GitHub with RStudio

This tutorial shows the step by step process of how to effectively collaborate remotely by integrating Git/GitHub with RStudio. Following this tutorial you will be able work with your team on R/RStudio based projects. This is meant to be a beginner’s guide – with my students as the primary audience.

You can get a PDF version of the tutorial at this link: RStudioGitHubSetup. Continue below for an HTML version.

Continue reading →

Experiments in Generative Art with RStats

I am experimenting with generative art – essentially creating computer generated art. Here is my first creation – I am calling it StarCircle. I love how it has a 3-D aspect to it – almost spherical.

This is created in R using the ggplot package. Code for creating this is simple enough. Caution – it does take a while to run and render even in my decently powerful home desktop.

suppressMessages(library(tidyverse))
seq(-10, 10, by = 0.01) %>%
expand.grid(x=., y=.) %>%
ggplot(aes(x=(x+9.5*sin(y)), y=(y+9.5*cos(x)))) +
geom_point(alpha=.01,
shape=20, #Shape 20 is essentially a filled circle
color="blue",
size=0)+theme_void()+
coord_polar()

I cannot claim any credits for originality here though. I am following the lead of  Antonio Sánchez Chinchón

The process for creating StarCircle was quite iterative – a lot of hit-and-miss, trial-and-error. The output is very sensitive to even small changes in code parameters. For example, let us try changing the ggplot command to the following:

seq(-10, 10, by = 0.05) %>%
expand.grid(x=., y=.) %>%
ggplot(aes(x=(x+3.1*sin(y)), y=(y+19.1*cos(x)))) +
geom_point(alpha=.01,
color="darkgreen",
size=0)+theme_void()+
coord_polar()

The code above leads to this beautiful delicate Green Butterfly:I am teaching two courses in Data Visualization in Fall. This is part of my ongoing efforts to include more creative elements in those courses. Especially for the course TO404: Big Data Manipulation and Visualization as the course is based on R and this content will fit right in.

Here is a red version of StarCircle:

More generative art below the fold.

Continue reading →

What it Means to be Human? AI Depiction in Video Games: NieR Automata

This post comes courtesy my brilliant student Michael Tarn in my TO433: Artificial Intelligence for Business class. One of the class assignment is to talk about a mass media depiction of AI from the point of view of trust in AI. This is a popular assignment as you might imagine.

Most of the times I get predictable submissions around I, Robot; 2001: A Space Odyssey and recently Ex Machina and a couple episodes of Black Mirror. Michael though decided to leverage his expertise in gaming and wrote about his experience playing the award winning game: NieR Automata. Michael wrote about his reflections on trust in AI in the context of playing as AI agents in the game. It comes down to the basic question – what does it mean to be human? Is humanity defined by who we are or how we behave? Can AI be more human than humans?

Below is lighted edited version of Michael’s thoughts.

NieR Automata

Disclaimer

We will be discussing NieR Automata, a game released in 2017. Please do keep in mind that this discussion will include massive spoilers, as in, the entire premise and plot twist revealed near the end. So proceed at your own risk.

Context

The story takes place in a post-apocalyptic world where humanity has been driven to near extinction as a result of a machine army invasion from another world. After the primary war, humans fled to take refuge on the moon as they were unable to protect and live on earth after being nearly wiped out during the invasion. In this game, you essentially play as 3 main characters: 2B, 9S, and A2.

Character 2B
Character 9S
Character A2

These characters are AIs. Specifically, androids created by humanity. They were created during the war to serve, protect, and fight for the humans. However, post-war, they remained on earth to fight the machine invaders while the last remains of humanity were on the moon.

What defines human?

This is an essential driving factor throughout the entire story of NieR and the primarily focus of this write up – “what defines human?”

2B is a combat android whose main traits are calmness and composure. 9S is a scanner android whose main defining trait (often mistaken for malfunctioning) is displaying more emotion than other units. A2 is an attack android who has a very solitary and lonesome demeanor. What’s interesting is that this is how they were “made” to be by the humans, and often that becomes a really harsh reality.

Throughout a player’s time playing through the game, the conversations that often occur between these characters and other androids they meet are essentially indistinguishable between that of an android vs human, and it is like that for a reason. Their conversations down to inflection and tone mimic that of a human almost entirely. However, what’s harrowing at times is the stark contrast between the duo of 2B and 9S.

Due to their drastically different personalities, 2B and 9S share dialogue that really brings up the question on who is really human? 9S is a curious character that has immense development throughout the game but starts off always asking questions on why things are the way they are and what 2B thinks of certain things. 2B, being a rather stoic and collected (a rather more generalized idea of what a robot should be like), always answers with logic and reason, or dismisses 9S’s questions with comments about the unnecessary “thoughts” of 9S. Here’s where this gets interesting. To us, 9S seems like the most “human” character due to the curiosity, emotion, and wonder he displays. However, as a player, you often forget that he simply is not human. Every time, 2B responds that they are doing what they are doing – wiping out the machines – for humanity, and that everything they do is for humanity, and that is what they were made for. This begins to bother 9S as the story progresses as he starts to wonder more on the “why” they are doing what they do.

So, now we know a little bit about the personality/humanity of these characters. But what about the actual humans? Well, here are the big spoilers. As I mentioned, I’d highly recommend you don’t look at the next section if you have not had the chance to experience this game in person. I believe this game is honestly one of the most “must-play” experiences available.

Spoilers follow after the break

Continue reading →

This is Why I Teach: Getting Students Job Interviews Edition

I live for emails like below – real instances of my teaching helping students do well.

My student Janybek Monolbaev was wonderful in my TO628: Advanced Big Data Analytics class. It is a hard class to teach – we go from students starting to learn basics of R to building predictive models in seven short weeks. It helps though to have such talented and engaged students as Janybek. When I built the course in 2016, I tried to make it as applied, as hands-on, as practical as possible. It is great to see that all that work is actually helping students do well in their professional aspirations.

I am reproducing Janybek‘s email with his permission. I am redacting references to the specific company.

Hi Sanjeev,

I hope that you are doing great and enjoying the spring. I just wanted to thank you for teaching TO628 as the skills that I learned in that class helped me pass one of the toughest analytics assignments at (name redacted). I have applied for a Sr. Anti-Fraud Associate role and the team sent me a data set with some fraudulent and legit transactions. The team asked me to present insights/solutions based on the data, so I immediately thought to use the skills and knowledge from TO628 class.

The assignment and data looked very similar to the final group project, so I used the principles, steps, and the R code to tackle the problem. It took me about 8 hours to clean and normalize the data, but it paid off big times. By using some ML algorithms (Logistic Regression and Decision Tree), I was able to crack the case and show that my model can predict 95% of fraudulent orders and potentially save 75% of fraud related chargebacks with only 0.45% of legit orders getting blocked. I created a short presentation and sent it to the team for the evaluation. Next thing I know I was invited for a 2-hour long interview with the team. This was a big win and a testament to your teachings. Thank you. I’ll keep you posted on the progress and regardless of the result I am happy that I could apply my classroom skills in the real world.

This was a real case of the Ross difference and action based learning.

This is why I teach. This is what makes all the work worth it.

More Deaths Than Births in Apr 2020? Demographic Impact of COVID-Crisis

2018 was the first time in ~80 years when we had less than 1 million natural increase in population (live births minus deaths). Yup – last time that happened was in 1937. We already were in a demographic tailspin – and Covid crisis is poised to make the situation even more terrible.

We have been putting up a lot of “firsts”, demographically speaking anyway (all data below for 2018):

  • Lowest Total Fertility Rate (TFR) ever: 1.729. TFR can broadly be understood as average number of children per woman. A TFR of 2.1 is considered replacement TFR – where population remains stable. (It is a little large than 2 because not all kids survive to childbearing age unfortunately). Signs are the TFR is continuing to go down in 2019 and will likely crater in 2020 as a result of Covid crisis.
  • Lowest Natural Increase in Population since 1936: 0.95 million. Natural increase in population is defined as number of live births minus number of deaths. This is a result of the following two factors.
  • Lowest Number of Births since 1986: 3.79 million. Note that total population in 1986 was ~240 million compared to ~327 million in 2018 – so on a relative scale, there is a significant dropoff. Update: 3.75 million for 2019 as per provisional estimates. 
  • Highest Number of Deaths ever: 2.84 million. With the aging population, we can expect this number to continue climbing, even without considering the impact of Covid-19.

Continue reading →

Chief AI Officer: Origin Story

Age of AI is coming – and with that – the time for CAIO: Chief Artificial Intelligence Officer is coming too. CAIO is supposed to be the point person in the organization with the responsibility of effective deployment of AI. I motivate students in my Artificial Intelligence for Business classes with the pitch that the class will prepare them for a career path leading to the role of a CAIO.

Opinions are mixed on whether you need a CAIO, whether it is a good idea to have one. Andrew Ng in HBR says Yes:

The benefit of a chief AI officer is having someone who can make sure AI gets applied across silos… A dedicated AI team has a higher chance of attracting AI talent and maintaining standards… Hiring the right AI leader can dramatically increases your odds of success.

Tarun Gangwani at CIO.com agrees: The CAIO would most likely be a seasoned businessperson with direct experience working on data analytics, cloud computing and machine learning technologies. On the other hand, Kristian Hammond at HBR is a strong No:

The very nature of the role aims at bringing the hammer of AI to the nails of whatever problems are lying around. This well-educated, well-paid, and highly motivated individual will comb your organization looking for places to apply AI technologies, effectively making the goal to use AI rather than to solve real problems.

Well – whichever way your loyalties lie (for the record – I am a Yes, at least in this initial phase when dedicated resources are needed to ramp up, deploy and extract value from AI investments), you would agree that would be great to see how this new buzzword: Chief Artificial Intelligence Officer came about. Thanks to a quick LexisNexis search, cleaning/exploration of resulting data and some judicious editorial decisions by me; here is the origin story of CAIO.

Continue reading →