Monday, 14 August 2017

Ethical Machines

Swami Gulagulaananda said:
Teaching ethics to a human being is hard. I wonder if machines are easier"

There is an old psychology question that we used to ask as kids:
There is a railway track on which trains typically pass on, and another track on the side that is not supposed to be used. There is a sign that indicates walking on the main track is dangerous. Walking on the side track is not a problem because trains are not expected to pass on it. A group of ten young boys are playing on the main track while a lone boy is playing on the side track. You notice the train approaching rapidly and are standing beside a lever that can be used to control whether the train continues on the main track, or switch it to the alternate track. Assuming that the side track is not risky for the train and that you cannot shout to shoo the kids off the tracks because they are too far away from you or do anything else - and given only the two following choices, which would you go for?
- Let the train continue on the main track and allow the ten kids to die?
- Or send the train on the alternate track and let only one kid to die?

The reason this question is interesting is because it allows us to choose between saving many lives versus a single life, but at the same time between saving the lives of those who broke the rules versus the one who followed the rules. While you can save many lives, you are making the rule follower pay the penalty for following rules. Or let many people die… Which would you go for?



Now, imagine that a program had to answer this question. I remember seeing a similar question on Twitter long back, though I don’t remember the source - where self driving cars have a similar dilemma. Imagine a self driving car in which you are seated. It’s driving rather fast down an empty street when suddenly some boy comes running across the street. It’s too late to stop the car. The car can do one of three things:
- Continue going straight and run over the kid
- Swerve left into a group of five boys
- Swerve right into a pole that may kill you

What should the car do?

Whose life is more valuable? How do you measure the value of life? Are all lives equally valuable? What if it is between the lives of an old man versus that of a child? Can we say that the child should live since the old man has already lived most of his life? These are very hard problems to solve.

Person of Interest is a wonderful TV series, a fast paced action filled show that has machine learning at its core. At one point of time, the machine (the central computer that uses ML is called ‘The Machine’ in the show) decides that a key politician has to be eliminated for peace. This is when the creator of the machine ponders over this decision. Is a machine equipped to take decisions that humans find hard to take? If the death of a single person can bring peace, should that single person be killed? The answer may seem simple - Yes, kill Hitler, save thousands of Jews… But can a machine reach that level of human thinking? As the creator continues, “What if the machine indicates that a large number of people have to be killed in order to reduce world hunger?” Of course, if there are no people, then there cannot be hungry people - Simple logic for the machine.

The idea of teaching ethics to a machine seems to be very interesting to pursue. I wonder if this can be taught. Perhaps then, we may not have to worry about Skynet… #GoAsimov

Sunday, 13 August 2017

The Censorship Dilemma

Swami Gulagulaananda said:
(this quote has been censored)

A couple of days back, the chairman of Central Board of Film Certification (CBFC), Pahlaj Nihalani, was sacked and replaced by another person. It seems that a section of Indian film industry and media celebrated this fact. It turns out that Nihalani was branded ‘Sanskaari’, an of late derogatory word, often used to represent a person with a 'regressive mindset'. The reason? The official reason for his sacking was that he was muzzling the creative and artistic freedoms of cinema. Basically, he denied U/A certifications to movies that had scenes and language that was deemed inappropriate.

The official reason mattered because the incumbent government formed by the BJP has been accused by leftist liberals and the so called intelligentia (I have lost respect for that word now because leftist liberals and intelligentia are associated together) of imposing Hindutva on ‘minorities’. While there is a lack of a shred of evidence of this, any indications in this direction will be pounced upon by this group. So, sanskaari Nihalani had to go from the official standpoint. He also claimed that an influential lobby was behind it.

Of course, the above paragraph seems to acquit Nihalani of all wrong doing. Is he truly a victim of circumstances? For some time, let’s forget if he actually watches movies before requesting for edits (he claimed he doesn’t). On Arnab Goswami’s Republic, there was an interview with Nihalani where Arnab said that we were going into a regressive world and bullied Nihalani to say the word ‘intercourse' on live TV. Nihalani was visibly embarrassed and refused. Arnab went on to say the word ‘intercourse' repeatedly and insisted that Nihalani say it, and if not, justify it - "Do you feel you will get polluted? Why wouldn’t you say it?"

And this brings me to the central question, a question that I have asked previously as well - Where do you draw the line? Today, not allowing kissing scenes on screen is considered regressive. "All the western movies allow it. Therefore we should also allow it because it is a global standard." First of all, who made the West, the paragon of freedom? Why can’t we think of things by ourselves? Why can’t we set standards? Second, TV shows like Game of Thrones, Rome, Spartacus etc. have a lot of nudity and simulated sex scenes. So, should we let that happen as well? If yes, then why not go to the full length and show ‘tasteful’ porn on TV as well? Or why tasteful? Why not brutal porn that depicts rape? This seems like a slippery slope. Where do you draw the line and on what basis do we conclude that something is allowable and something is not?

Interestingly, there is another TV show doing rounds on social media at the moment. Pehredar Piya Ki, is a series about a 10 year old boy who gets married to a 19 year old girl (woman?) Apparently, someone in the show tells the bride “I don’t know when he will be able to satisfy you” (nudge nudge wink wink, I hope you can wait...) Now, while child marriage is illegal, it still happens in some places and this is a story of one fella, a fella in love. However, there is a petition requesting a ban of this show on change.org. Should we allow this show to run or should we ban it? Funnily, there is another petition to not ban the show on change.org. Some people who are requesting the ban are calling the show regressive - So according to cinematic freedom, should we allow to run a regressive show or should we be regressive and censor it? Either way, someone is being regressive.

In yesterday’s news, I read about a girl who is a prostitute by choice. She chose to become a prostitute because she desired expensive things and her regular job couldn’t provide it. She claims to be a high class escort, someone who is well read and speaks fluent English. She was recently taken on an all expenses paid foreign trip by a client who introduced her as his girlfriend. “We live in an intolerant society where people are killed for food habits. That’s why I can’t tell others that I am a prostitute”, she said. “You sell your brains, we sell our bodies. There’s nothing wrong with that”, she added. Buddha, the enlightened one, asked us to curb our desires because ‘Desire is the root cause of all evil’. Then there is this enlightened prostitute who said - ‘Meh! Why curb desires when you can whore around and make more money’ After all, the ends justify the means, doesn’t it?

Recently, a Google engineer wrote an essay with his opinion on why there are more men than women in the tech industry. Now, factually, there are more men than women in the tech industry. This Google engineer got fired for his reasons - They said that his essay propagates gender stereotypes. Is this muzzling of free speech? If his reasons were not true, Google can prove it otherwise, with data. But rather than that, they fired him. Is this censorship?

In the end, it comes down to these questions - What is morality? Who decides what is moral and what’s not? Is morality an antiquated topic? What comes under morality? And what should we censor?

The Censorship Board’s job is to censor things that it doesn’t think is appropriate. If you oppose every decision that it takes, then do we even need a censorship body? If you think no, then read the paragraph about Pehredar Piya Ki where there is another set of people screaming for censorship.

My primary request to people is to drop using words like regressive, intolerant, etc. and to think of more constructive ways of solving issues. Rather than hollering from the rooftops, create campaigns and polls and show it with data. Opinion based problems are very hard to solve. One approach could be to use technology to block specific channels at specific times with control lying in the hands of adults of the house to prevent impressionable children from finding it. Of course, this means that the adult should be aware of what ‘objectionable’ shows play at what times. A simpler solution is to make it rule based so that objectionable shows get blocked by default unless allowed explicitly by the end user - Ah, but who tags shows as objectionable or otherwise? A central board like the censorship board? Let’s start all over again... :)

Saturday, 5 August 2017

Ultimate Tic Tac Toe

Swami Gulagulaananda said:
"You can always make a mundane problem interesting by thinking about scaling it"

Tic Tac Toe used to be one of the standard games played by us in school along with Dots and Bingo. The problem with Tic Tac Toe is the frequent draws you end up with once you are familiar with the game. Eventually, it gets really boring and you stop playing the game.

One day, I stumbled upon a blog post at Math With Bad Drawings, called Ultimate Tic Tac Toe. The post discusses this problem of Tic Tac Toe and comes up with a very interesting approach. In this post, I have provided an implementation of their idea for you guys to play.

While you can read the entire content in that post, I will summarise it here.

Rules:
  • You are provided by a 3x3 board of Tic Tac Toe boards. That's 9 boards.
  • The first player can make his move in any square.
  • The next player has to make his move in the board depending on the square in which the previous player made his mark. For example, if the previous player chose the top left square in any board, the next player has to make his move in the board that is in the top left.
  • This constraint makes it pretty fun because you have to think of maximising your points while being careful about where you are driving your opponent
  • The goal is to win most number of boards. Whoever wins 5 boards wins



On Interfaces

Swami Gulagulaananda said:
Every person is the same from the outside, and the insides are merely implementation details"

A long time ago, I was introduced to an interesting concept called The Black Box. A box that takes something in and gives something out - and what it did to convert the input to the output is not something that we are supposed to be concerned with… It is a black box, and its insides are opaque to us.

The black box paradigm can be used in a multitude of places and is very useful to simplify flows of thought processes. You move away from the so called 'Implementation Details’, the nitty-gritty details, the brass tacks if you will and assume that whatever is inside performs its duty.


In our electronics course, a cell was often connected to a load. The cell didn’t really care about the load - it’s job was to supply voltage and current. The consumption was the load’s job and not the headache of the cell. The load itself could have been a bulb that could glow, a motor that could turn or a buzzer that could make some noise… The load is a blackbox as far as the cell is concerned. Similarly, if you add a switch to this circuit, the switch itself can be treated as a blackbox. The ‘switch’ in this case need not be a mechanical switch that our minds immediately went to - Rather, a switch is a device that can be used to complete or break the circuit. The switch, thus, could be an LDR (Light Dependent Resistor) that could complete or break the circuit depending on the intensity of light falling on it, a push switch, a toggle switch, etc.

This way of thinking is interesting because the only aspect defined at the beginning is the behaviour. We can develop modules in this manner and stitch them together. Google’s ambitious project, Ara (is it dead yet or still alive?) is a great example of the blackbox idea. The phone has slots for you to add or remove pieces - camera, another screen, a larger battery - You could remove one piece to add a different one.

Amazon Web Services (AWS) has made good use of this concept in their data pipelines offering. Read data from a source, transform it and save it to a destination location. The source could be a database like Oracle, an S3 bucket, DynamoDB etc. and the desination could be… well, Oracle, an S3 bucket, DynamoDB etc. This means, you can read from Oracle and save to Dynamo, read from Dynamo and save to S3 etc. The source and sink are treated as blackboxes as far as we, the end users are concerned and the ETL happens internally by itself.

This kind of pluggable architectures makes engineering very easy. When we were in college, using an Atmega 16 microcontroller was a big deal. We had to solder together the IR LED, sensor, resistors and capacitors to create an IR sensor module, burn code into the chip, and do a whole lot of work ourselves. Now, all these sensors and other useful devices come as modules or shields. You just plug them together and they just work. You can swap one out and swap in a different one without any issues.

This concept is of course not new. In the world of programming, this is called an Interface.

By building standards, everyone should be able to make their products work well with one another. For example, a micro USB phone charger can charge a variety of phones irrespective of manufacturer (except Apple, of course) This brings down the cost of devices and spare parts and also opens up a world of choice. If I don’t like Company A’s camera lens, I can swap it for Company B’s lens in my phone. Imagine having Honda’s engine in a Hyundai body.

It introduces some limitations, but also opens up some opportunities… Do you think that such a world is possible? Do you see any immediate pitfalls?

Saturday, 29 July 2017

Spatial Memory Game

Swami Gulagulaananda said:
"Our short term memory is only as good as... uh oh, I think I lost my train of thought"


We have two types of memory - Long Term Memory, which like our hard disks allow us to remember things for a longer duration, like names, faces, places and other memories; and Short Term Memory, which is like cache, used to remember things for a brief moment, like the OTP that we get on our phones. We remember that OTP long enough to enter into our computers and then a minute later - *poof* it's gone!

This is a simple game that shows you a grid and highlights a bunch of squares randomly for a short period of time. You have to remember the highlighted squares and select them. See how far you can go! Click on Start Game below

You may also be interested in The Knight's Tour.