Emergent Ethics for Artificial Intelligence

AI systems today present not only a new set of technical challenges but ethical ones as well. The one that I have seen mentioned the most often involves the decision a self driving car that is about to crash and has to choose between hitting children on the street, a pedestrian on the footpath or a wall and killing the occupant. As the MIT Technology Review’s article titled “Why Self-Driving Cars Must Be Programmed to Kill” phrases it:

How should the car be programmed to act in the event of an unavoidable accident? Should it minimize the loss of life, even if it means sacrificing the occupants, or should it protect the occupants at all costs? Should it choose between these extremes at random?

Its hard to imagine anyone trying to solve this problem since it doesn’t have any good solutions. But not taking a decision here would be a decision itself.

At SXSW today I did see an interesting presentation that did spark an idea. I attended a session titled “Humans and Robots in a Free-for-All Discussion” had two robots have a discussion on different ideas with each other and a human. A video of the session is embedded below:

 

The idea of robots talking to each other had a previous brief internet popularity moment with two bots on hacked Google Home devices chatting with each other that was live streamed on Twitch.

What is interesting is that the bots were programmed with just facts and allowed to come to their own conclusions. The photo from the presentation below shows how the system took in bare facts and then, by using supporting or negating statements, could come to a conclusion by itself.

The idea is intriguing. Could this be how cars will learn ethics? No human would ever verbally put a price on human life, yet by action a lot of us do all the time.

Could ethics in AI not be something we code but allow to emerge based on facts that we train the model on?

 

 

Serving multiple ReactJS apps with Express

I am currently working on a web portal for showcasing our teams’ different projects, white-papers and reports. Given the limited scope of the project, we thought it might be a good idea to try it with a full JavaScript stack of  MongoDBExpress and ReactJS.

Since the site needed both a user facing portal and an admin portal, we started building both of those in parallel but as separate projects. The goal was to keep the admin portal independent of the actual site itself. The pages on the site are also more or less completely defined in JSON schemas so it could be reused in the future if we ever wanted to use it for a different project or release it as an open source project.

The Create-React-App library from Facebook was really useful for a pretty painless start to the projects.

Proxying calls to the API

The first issue I ran into was accessing Express that was running on a different port (3000) than Create-React-App’s development server (3001). Since the browser considered these two different sites, browser security wouldn’t let be make API calls to the server from the client. Figuring it was a problem for later, I just allowed the dev server to handle CORS requests using something like:

app.use(function(req, res, next) { 
    res.header("Access-Control-Allow-Origin", "*"); next(); 
});

This worked for all GET requests but completely failed when I tried to POST JSON from the client. Turns out when sending JSON, the browser pre-flights the POST request with an OPTIONS request that I was not handling at all. As found in the MDN docs:

The [CORS] specification mandates that browsers "preflight" 
the request, soliciting supported methods from the server with an 
HTTP OPTIONS request method, and then, upon "approval" from the server, 
sending the actual request with the actual HTTP request method.

Turns out, all the headache was for nothing. Create-React-Apps allows you to proxy calls to a dev server by adding a proxy line in your package.json

"proxy": "http://localhost:3000/",

Packaging React Apps for different server paths

Another issue was that Create-React-Apps by default assumes the final built app will be served from the root of the server. It took a bit of finding out that the it does allow you to set the folder path for your app on the server using the homepage field in the package.json:

"homepage": "http://localhost:3000/admin",

Allowing Express to serve multiple React Apps

Finally as we tried to deploy the front end and the admin app, we ran into another issue. Since Express needed to serve front-end from the server root, admin from the /admin/ path and also a bunch of different api responses from /api urls, we had to do a bit of trial and error to get the pathing for the resources right. Our final response paths for the Express app look like this:

// API end points defined first
app.get("/api/projects",  (req, res)=>{})
app.post("/api/project",  (req, res)=>{})

// Admin paths
app.use('/admin/', express.static(path.join(__dirname, 'admin')))
app.get('/admin/*', function (req, res) {
 res.sendFile(path.join(__dirname, './admin', 'index.html'));
});

// Site path
app.use('/', express.static(path.join(__dirname, 'front-end')))
app.get('/*', function (req, res) {
 res.sendFile(path.join(__dirname, 'front-end', 'index.html'));
});

This is still work in progress and I am sure a lot more learnings will come going forward, but at right now, with the first version of the site deployed to our dev server, I am gonna get a well earned beer 🙂

 

Remembering Yahoo

Today’s news of the post-acquisition Yahoo being called Altaba made me think of the Yahoo I have known (and for a while loved) for the last 20+ years.

While AOL may have been America’s portal, Yahoo was ours in India. I was a happy enough Yahoo Mail, Yahoo Groups and Yahoo News user but what I was really addicted to was Yahoo Chat and Yahoo Messenger. Yahoo Chat was fantastic. The basic functionality was yahgood enough but I got really addicted to their IMvironments: mini flash-based experiences that you could play in while chatting.

I spent hours on it in different chat rooms and even made 2 of my closest friends on a Yahoo India chat room. The first of those friends was a girl from Romania named Anca. We talked a lot about our individual countries and that made me fairly knowledgable about Romania, a country I never really thought of otherwise. When I went to grad school at Rutgers, I ended up sitting next to a very quiet guy during one of the international student orientation sessions. He opened up when he mentioned he was from Romania and we could connect on that. That guy, Nicu, ended up being my best friend in grad school and is single-handedly responsible for me not dropping out of grad school when I struggled with writing code (I had never written code before having majored in Electronics in undergrad) and suddenly doing graduate level and research level C++ programming put me way out of my depth. Nicu, who had by then worked for a couple of years as a Software Engineer in Germany sat with me for HOURS teaching me programming concepts and helping me with my assignments.

So in a way I might owe Yahoo for my entire career 😉

As I became a web developer, Yahoo was one of the technology companies I envied. They were always building amazing pieces of technology. Some pieces of technology I was fascinated by and worked with included:

  • YUI which was THE user interface library for web experiences,
  • YSlow which I used a LOT when I was developing web apps
  • Yahoo Widgets, which was the Konfabulator app that Yahoo bought, that I wrote a couple of widgets for
  • BrowserPlus, which apparently I was a fan of at some point (Who remembers?!)
  • Yahoo Cocktails, a JavaScript based platform that powered their LiveStand iPad app.
  • YQL, a query language that mapped web apis like SQL queries.

In fact, I even went to a Yahoo Hack Day in NY a while back and my friend Gabo and I ended up building an AIR app for YQL queries (we didn’t win though 😦 )

This list doesn’t include other amazing tech that came out of Yahoo like Hadoop etc that I never interacted with.

I also interacted with Yahoo a fair bit professionally, when Comcast and Yahoo struck an ad deal in 2007 and I was responsible for integrating their video ad system (that didn’t exist) into The Fan video player that I was leading the development for. It was also one of my favorite engineering stories to tell but that is a story for another time 😉

Thanks for the memories Yahoo.

 

2016 Retrospective

Another year passes by.  Here is a quick summary of my professional and academic 2016.

Work
It was a year of a lot of change at work. The make up of the team I work in changed dramatically as we rethought how a corporate labs group should operate. I worked on 2 big projects this year, one exploring the world of bots and messaging platforms and the other around Virtual Reality. The VR project was a great showcase piece which meant a lot of demos at various locations. As used to VR as I have become, its still great to see new people experience it for the first time.

I did a lot more work-travel this year than the previous year (which is saying something) VR on the Lot and Re:Code were probably my 2 most memorable trips, the former at the Paramount Studios Lot and the latter where I demoed our VR app to a few bigwigs in the tech world.

Education
I took a 3 months-ish bootcamp on Entrepreneurship organized by Philly Startup Leaders. It was really educational and I learnt quite a bit on quantitative competition analysis, business model generation etc with talks (and homework) by some of the most successful entrepreneurs in Philadelphia. It was also great to meet some people with a strong “makers streak” in them.

I also spent a couple of weeks at Microsoft (Redmond) learning to code for the Hololens system at their Hololens Academy. Hopefully I’ll be able to carve some time out next year actually do some apps for it.

The other technology I continue to academically investigate is Blockchains and Bitcoin. I am such a fan of the system and its potential to revolutionize the internet. I seem to be having a “I see Blockchains needed everywhere” phase. I started coding some Blockchain based apps this year but didn’t get too far. Hopefully next year I have something to show there.

I also participated in the RET program with UPenn working with teachers from local high schools and PhD graduate students.

Code
I started 2016 working a lot in Swift 2 as we scrambled to finish an iOS app around iOT and bots. We finished that project around March and spent the rest of the year at work mostly in Unity and C#. I have grown to like that system a lot which reminds me of my early years in Flash where creativity and design was so integrated into the engineering process, not the design/developer dichotomy we seem to have drifted back into today with mobile or web apps.

On personal projects I continued to build some Android apps (stay tuned for that in 2017) and learnt enough Ruby on Rails to consider myself fairly proficient at it now.

Android Philly
The Android Philly group I run is still going strong and with a lot of familiar faces there, it has really become a community I enjoy being a part of. One of the big reasons has been the #androidphilly Slack channel on the PhillyDev Slack account that we all connect in in between events.

Android Philly Bootcamp

Talks
I also gave a couple of talks at AndroidPhilly, two at the Coding Bootcamp we organized early this year and one later on building Bot-based apps. I also gave a talk at a Women I Cable Technologies event on VR and a couple of other internal work events.

Patents
I was issued a patent grant on a method for pairing devices this year and another was published on image based group creation. Some others around VR are being moved forward as well, so thats cool.

Books:
The free library continued my reading addiction. Here is what I read this year:

Screen Shot 2016-12-30 at 1.10.31 AM.png

Do you need a Blockchain?

As some of you may know I have been very interested in Bitcoin and blockchains for the past couple of years and have been digging into it even more lately as part of my day job. However, blockchains have been in the news a lot lately to the point where it often feels like its a solution looking for a problem. Sure, blockchains are the sexy new tech but here are some questions you need to ask when debating looking into blockchains as a solution to your problem:

  • Can you deal with transparency? Writing to a public blockchain is may be a difficult new way of working (as banks are starting to find out). There is also a huge mindset today that considers data an asset that could be profitable and not worth sharing (though with the increasing risk of hackers and data breaches, its worth considering if your big data is an asset or a liability?)
  • Do you need immutable history? A huge value of the blockchain is in the fact that the blockchain is a record of history that can never be modified. Certain initiatives around blockchains with super users that can rewrite history completely negate the core trust mechanism of the blockchain. However there may be data that is incorrectly reported at times. Does your data consist of absolute truths or may need to be corrected once in a while?
  • Will you have untrusted peers or the network? One of the big reasons to adopt a blockchain is in environments of limited trust. If the only people that can write to a blockchain need to be authorized in a different way, you are just trading your current problem for a new one.
  • Can you keep your blockchain from being hijacked? If you do have untrusted peers on a network, and your network is fairly small, can a peer take over your blockchain with a 51% attack?
  • Can you just leverage the Bitcoin blockchain? Keeping an operational blockchain is work and needs nodes and miners that are incentivized to maintain it. What kind of rewards do you offer that make your chain worth working on? If you don’t have the right incentives in place, your blockchain may not outlive the individual or corporate curiosity that spawned the idea. A better idea may be to write it or, more likely, a hash of it to the Bitcoin blockchain making it a part of the official history and something that will exist even if your project dies.

There is a huge tendency to fixate on the distributed nature of the blockchain, but if that is your sole goal, there are other distributed database technologies that you should be looking into.

 

Thoughts from Oculus Connect 3

For the last 3 days I have been at San Jose at the third official Oculus Connect conference (OC3) and its been amazing to see some of the prototypes, talk to a few developers and just learn from other folks who are charting the VR space. Its been an amazing mix of education and fun and given me a lot of mull over on the flight back tomorrow. Here are some highlights though:

The Social Focus: Putting people at the center

Social was definitely the big message at OC3, and the Facebook Social concept that Mark Zuckerberg demoed was really well done.

I really liked the avatars and the way they worked here. What was a little weird was it was at the same stage where a few minutes later they talked about the new Oculus Avatars system which as developers we are encouraged to use. These 2 projects are totally independent of each other and a later talk by Facebook’s Mike Booth talked about a lot of learnings that they developed while building Facebook’s avatar system that flies in the face of the look of the official Avatars app/sdk. Hopefully these two will me merged at some time in the future but there is enough of a chance that they may not.

avatars
The Oculus avatars (top) have a completely different aesthetic than the Facebook Social ones (bottom)

 

Oh and I hope you didn’t liked the boxy avatars from Oculus Social app, cause that effort seems to be dead.

Oculus Touch

Oculus finally revealed the pricing and availability of the Touch controllers. At $200 they are a little pricey and make a full Rift setup be almost the exact same price as the Vive. That aside the controllers are really nice and bringing your hands into VR does up the level of immersion in VR tremendously (at work we had used the Leap Motion sensor on top of the DK2 to get some hand tracking in a demo but thankfully we can leave those kludges behind). The only unfortunate thing with the Touch controllers being optional purchase is that developers can’t really rely on them being available which might prevent them from leveraging them to avoid splitting the market. Hopefully most Rift owners choose to get it cause I will say they work really well.

touch.png

Room Scale

Oculus can now do Room-scale VR but requires a third sensor that you can now buy for $79. I can’t imagine a lot of people going for this at least immediately and Room scale might remain the domain of the Vive for now.

Video

One of the messages Oculus apparently wanted to send was that passive experiences shouldn’t be dismissed as apparently usage of Oculus is equally divided between games and video apps. At the keynote, Oculus also announced a Video SDK that will let video publishers create content but let Facebook host and distribute that content efficiently based on their research around optimized 360 video streaming (Foveated rendering etc). I need to dig more into this.

Misc items:

Other things also interesting included:

  • Facebook continuing to fund more VR development with another 250M fund for VR apps and games
  • Oculus is adding an Education category to their stores so expect more apps and games for that
  • Cheaper Oculus Ready certified PCs including a $500 one. Oh and Oculus Ready certified laptops for you developers on the go.
  • Oculus will cover Unreal Engine license fees for apps sold through the Oculus Store for up to the first $5 million in gross revenue.
  • Lots of effort being put into audio and ambisonic rendering. A new higher audio quality headphone for the Rift was also introduced and given away to the attendees.
  • Untethered stand-alone VR headset in the works in the lab.
  • Oculus will now support WebVR and introduced a VR flavor of their popular React JavaScript framework

Favorite Game:

Most of the OC3 event was about trying out the demos for different games coming soon. Lots of good ones to choose from but Eagle Flight was totally awesome.

Favorite moment: Talking to John Carmack

Okay so this was a totally nerd moment, but I have been a big fan of John Carmack for a long time and he was kinda like a geek hero of mine. Being able to talk to him for a bit was really amazing. I even captured a part of it on video (vertical cause I saved it from Periscope 🙂 )

My Experience with UPenn’s Research Experience For Teachers program

For the last few weeks I have been involved with Penn’s Research Experience for Teachers program (RET). The 6 week NSF funded program paired 10 teachers from local high schools in Philadelphia with a research engineer at Penn’s General Robotics, Automation, Sensing & Perception (GRASP) laboratory at Penn and an industry mentor in an effort to expose these teachers to advanced engineering concepts that they could take back to their students.

I had the pleasure to help with Matthieu Lecce and Danelle Ross on an effort to use computer vision to detect the volume of transparent liquid in a glass container. The project built on previous effort by Matthieu and the research team on seeing glassware (more information on that research can be found here). Technically Philly did a great writeup on their site as well on the final day of the project.

ret
Learning some machine vision at Matthieu’s office at the GRASP lab

The program was really intense for the teachers and major props to Danelle for completing it and going through this intense learning experience. My own contribution was fairly limited as I spent only a couple of hours a week with the team answering how groups like Comcast Innovation Labs (where I work) investigate such technology and how machine vision is being used in Virtual Reality and Augmented Reality, a domain I am currently very involved in at the lab.

More than anything though, it was a great learning experience for me. I learnt a lot of new concepts on how machine vision is approached (my only real experience with raw machine vision previously had been some OpenCV experiments in Processing and some half complete Android projects with face detection). Learning the core concepts that go into machine vision and the current state of the art in that field was a great experience.

Sometimes I really miss grad school.