Search within Lanny's blog:


Leave me comments so I know people are actually reading my blogs! Thanks!

Tuesday, July 16, 2019

10 Famous Thought Experiments That Just Boggle Your Mind Part 9

Read part 8: The Chinese Room

2. Schrodinger's Cat

Schrödinger’s Cat is a paradox relating to quantum mechanics that was first proposed by the physicist Erwin Schrödinger. He hypothesized a scenario where a cat is sealed inside a box for one hour along with a radioactive element and a vial of deadly poison. There is a 50/50 chance that the radioactive element will decay over the course of the hour. If it does, then a hammer connected to a Geiger counter will trigger, break the vial, release the poison, and kill the cat. Since there is an equal chance that this will or will not happen, Schrödinger argued that before the box is opened the cat is simultaneously both alive and dead.

Schrödinger meant to use this thought experiment to demonstrate the absurdity of Bohr's Copenhagen interpretation of quantum mechanics, where a quantum system remains in superposition until it interacts with, or is observed by the external world. Turned out that:
Successful experiments involving superpositions of relatively large (by the standards of quantum physics) objects have been performed.



I still remember the day when my Statistics Professor Dr. Reese threw a coin to the floor and then immediately put his foot on top of it. "The event has already occurred. But what is the outcome?" he asked. That was a great example of the Bayesian world, where the reality has already happened, but we still don't know -- the uncertainty.

Uncertainty is actually everywhere in AI/Machine Learning/Robotics challenges. For example, an object detection model detected a person, but only with 50% confidence. That means the object detected could be a person or not a person at all. And the bounding box detected could be spot on, perfectly bound the person inside, or it could be 50% off with a 50% IOU (Intersection Over Union). So how do you use this information if you have to decide if there is a visitor by your door? In this case, the event has already happened (there's an object there, whether person or not). There are also cases where you don't know what future holds. If you are in a self-driving car, the self-driving car has no idea what the car next to it will do in the next minute, it could just stay in its lane, or it could change into your lane and collide with your car. A well-designed self-driving car has to be able to deal with uncertainty, maybe when it notices the car next lane starts to weave, maybe it's a good idea to break a bit and keep a good distance from it. But just like Schrödinger’s Cat, before you open the box, anything is possible.

One solution is to try to obtain more observations that might give you more information and reduce the uncertainty. Maybe if you shake the box and hear the cat meow, then you know the cat is likely still alive. Maybe you wait 20 years, and then likely the cat is dead. Actually you don't even have to wait that long, a cat probably will die if it eats no food for a week? What is the cat is pregnant when you put it in the box. You would now have multiple cats that are both dead and alive and you don't even know how many cats you have.


Let's end this with a picture of cute kittens. Didn't Jeff Dean build a deep neural network that learned the concept of a cat all by itself simply by watching lots and lots of youtube videos?


Read part 10: Brain in a Vat

BTW: The easiest way to remember my blog address is http://lanny.lannyland.com

Monday, July 15, 2019

10 Famous Thought Experiments That Just Boggle Your Mind Part 8

Read part 7: Monkeys and Typewriters

[Found a 10-year old draft of this post that was never published. So here it is with some new contents added.]

3. The Chinese Room (Turing Test)

Source: Wikicomms
The Chinese Room is a famous thought experiment first proposed in the early 1980s by John Searle, a prominent American philosopher. Searle first hypothetically assumes that there exists a computer program that can translate Chinese into English and vise versa. Now imagine a man who only speaks English is placed in a sealed room with only a slot in the door. What he has are an English version of the computer program and plenty of scratch paper, pencils, erasers, and file cabinets. He would then receive Chinese characters through the slot, process them following the program instructions, and then produce Chinese characters on paper that he can slip out through the slot on the door. Although he doesn’t speak a word of Chinese, Searle argues that through this process the man in the room could convince anyone on the outside that he was a fluent speaker of Chinese.

Searle wanted to answer the question of whether a machine can truly "understand" Chinese, or does it only simulate the ability to understand Chinese. By creating this thought experiment, Searle argues that the man in the room does not really understand Chinese, therefore, the machine can also be a simulation and doesn't have a "mind" to understand the information, even if the machine can produce responses that gives people the impression of human intelligence.





This thought experiment raises a big question: Does something that appear to be intelligent truly possesses the intelligence. Searle calls the system that actually possesses the intelligence "Strong AI", and the system that doesn't "Weak AI". He argues that this thought experiment proves that "Strong AI" is false.

Today, there are many AI/Machine Learning algorithms at work that perform tasks for us human beings, from chatbots to self-driving cars. Especially with the popularity of deep neural networks, computers can do an amazing job at recognizing things such as human, cars, or stop signs. But how does the machine know an object is a stop sign? With the deep learning approach, we humans don't really know. Interestingly, with just changing the values of a few pixels, an object that still looked like a stop sign to humans now becomes a sign for speed limit 45 sign. And that's the danger of using blackbox systems, where misclassifying the sign could mean the difference of life and death.




This thought experiment is an extension of the Turing Test, which deserves a blog post entirely dedicated to that topic. Turing proposed that if a computer can fool human judges into thinking they are conversing with a real human through a typing only chat program, then the computer is considered to have artificial intelligence and has passed the Turing Test.

Based on this simple definition, many programs could be considered as having passed the Turing Test. in 1964, a program named ELIZA out of the MIT AI Lab gained fame by making users believe they were actually chatting with a psychotherapist, when in fact, the program simply was parroting back at patients what they'd just said. Then later in 2007, a Russian chatbot that emulated a woman was able to fool many lonely Russian males into giving out personal and financial details, given that these males probably couldn't think straight especially after excessive vodka consumption. In both cases, these chatbot programs appeared to be intelligent, when they don't really truly understand what humans had said to them.

[Fun fact: You can talk to a Martian version of ELIZA in Google Earth.]





On March 23, 2016, Microsoft released a chatter bot named Tay via Twitter. Only 16 hours later, Microsoft had to shutdown the bot because it started posting all kinds of inflammatory tweets. Was Tay really a racist? Of course not! But it sure looked like it was intelligent enough to get conversations going.


In one of our Innovation Weeks at work, I actually played with a bunch of chatbots, including cleverbot and Mitsuku (Pandorabots), and integrated them with smart home/smart assistant functions. Mitsuku chatbot has won the Loebner Prize 4 times out of the last 6 years, so it is really up there with respect to its capabilities. During the live demo, when I asked the bot "where is my wife?" it actually replied, "Did you check the bathroom?" Very impressive!! Things got a bit weirder when I had a volunteer talking with the bot and the bot started asking him, "How is your father?"

Earlier this year, OpenAI's researchers unveiled GPT-2, a text-generating algorithm that can write news articles if you give it the beginning part.
[GPT-2] has no other external input, and no prior understanding of what language is, or how it works,” Howard tells The Verge. “Yet it can complete extremely complex series of words, including summarizing an article, translating languages, and much more.
This is a perfect example of the Chinese Room scenario. We have AI that can behave as if it is intelligent, yet has no understanding of language. I guess we have to be super careful about what tasks we give such AI agent/algorithms/models. It might be able to fool us most of the time. But when it comes the time when it fails, because it is only a fancy simulation, we are in big trouble.


Read part 9: Schrodinger's Cat



Picture of the Day:

Amazing depiction of how I felt about my thesis during grad school years... (picture credit: http://www.phdcomics.com)

BTW: The easiest way to remember my blog address is http://lanny.lannyland.com

Sunday, July 14, 2019

Daily Battles: Restore windows to original locations on a Mac with multiple external monitors

I like to keep things organized, especially when it comes to open apps on my computer. I use 3 external monitors at work (only 2 at home). Once I plug in my external monitors, I have 4 displays. Multiplying that with the 7 Mac Spaces (virtual desktops) I use, I have a total of 28 screens where I can put my open apps in.

By the way, if you are not aware of the feature called Mac Spaces, you should seriously check it out. Great feature to give you ample desktop spaces and improve your efficiency by staying organized!



Just remember to disable auto arrange from within system preferences - mission control. You can also easily access your spaces using keyboard shortcut COMMAND+UP.

So why do I need so many screens and desktops? For one, with my ever diminishing eyesight, I needed all the fonts in my various app windows to be bigger, which requires more screen real estates. Also, with multiple virtual desktops, I can group apps/windows together for various categories. For example, all apps/windows related to my blogs would stay on the same virtual desktop, and all the articles I want to read later can stay on the same virtual desktop.

However, whenever my laptop auto locks or goes to sleep mode due to inactivity, or when I unplug my external monitors to go to meetings or go home, all my open app windows get moved to the laptop screen and stay there even when I wake up the computer or plug my external monitors back in. Now I have to manually move all the open apps/windows back to their respective virtual desktops onto the right monitor screen to the old location. This is super annoying!!!

I guess Apple engineers (or really the product managers) have simply decided that this feature (putting open windows back to their original positions) is low priority despite the fact that many users craved for such capabilities for more than 10 years.

One feature MacOS (Mojave) has is to be able to assign an application to a specific desktop. That way, the app will always open on that desktop. But that doesn't address the case where I want one Chrome window to open in desktop one and another Chrome window to open in desktop two.



Well, look no further. I have finally found the solution(s).

First solution is an app called Stay made by Cordless Dog. It does exactly that: Keeps windows in their place. The app has a price tag of $15 and offers a 30 day trial period so you can give it a free run.



When you plug in your external monitors (or wake up your computer), the app automatically detects the event and then moves most of the windows back to their original locations most of the times. So why not all the time? My guess is that the programmer of the app didn't expect a user to have that many apps open on that many desktops. Anyway, the big plus for Stay is that it can handle multiple virtual desktops.

There is only one downside for me with Stay: when I go home to my 2 external monitors setup instead of the 3 external monitors setup at work, Stay freaks out and all my open apps are all over the place again.

Luckily, I found a second solution, an app called Moom made by Many Tricks.



This app costs $10 and comes with a free demo mode where you can try things for 100 times. The nice things about this app are:
  • It allows you to save different screen layouts. So I could have one layout for my 3-monitor setup and another layout for my 2-monitor setup.
  • It also detects how many displays you have and then trigger different layouts accordingly. Now as soon as I plug in my external monitors, the app will put all the windows to the positions and desktops I want them whether I am at home or at work! Wow!!
  • And it is $5 cheaper! Can't complain on that! 😜

Paid my $10 and got the app configured the way I want! I am a happy camper!! But wait, this app also had glitches. Guess developers for this app didn't expect a user like me who uses 28 screens simultaneously. The good news is that the developers are actually well on top of things. As soon as I created bug tickets with them, they responded the same day. Hopefully they can quickly get the issues addressed in the next minor release of the app.

So anyway, my vote is on Moom, option two. But choose the one that works the best for you. According to other people who tried to solve the same problem, some other options are: 


BTW: The easiest way to remember my blog address is http://lanny.lannyland.com

Saturday, July 13, 2019

Random Thoughts: Answers to a few Brain Teasers

Quite a while ago, I posted some brain teasers in my blog. When I was randomly looking through my past blog posts, I realized that I never provided answers to those brain teaser questions. So today I'll post the answers in a new blog post. If you have not seen those questions before, you can read the questions here:





Give it a try and see if your brain hurts. 😁



[Spoiler Alert]: Scroll down to find the answers:.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

Problem 1: The Missing Dollar
==========================


Image credit: Canvas
Answer: 

The three guests each spent $9 at the end. That makes it $9 x 3 = $27. The hotel owner kept $25 and the bellhop kept $2. That makes it $25 + $2 = $27.

The common mistake people tend to make is that they use $27 + $2 = $29, instead of realizing it is really $27 the 3 guests spend and the $3 the guests got back: $27 + $3 = $30. The $2 here really should be -$2, which makes it $27 - $2 = $25, where $25 is the real cost of the hotel stay for the 3 guests.

The official name of the problem is Missing Dollar Riddle.


Problem 2: Cut the Loss
==========================

Image credit: iStockPhoto

Answer: 

This problem seems very confusing due to the many moving parts and money (real or counterfeit) exchanging hands. The easiest way to think through this is from the perspective of each person involved and just check the difference at the end.

If we treat the counterfeit bill as worth $0.

Customer: $0 out and $20 worth of merchandize plus $30 cash in. Total gain: $50

Tom: $20 worth of merchandize, $30 cash to customer out. Nothing in ($50 from Charlie was returned to Charlie at the end, so just a wash). Total loss: $50

Charlie: $50 out to Tom and then $50 in from Tom at the end. Total loss: $0

Everything balances out. So the answer is $50 total loss for Tom. There are many variations of this Counterfeit Money Problem out there you can read about.


Problem 3: Green Onion Vendor
==========================


Image credit: The Virginian Pilot
Answer: 

The original price of the green onions is $1/lb. So you spend $1 you get 1lb. of green onions. Once separating into stems and leaves, the prices become $0.70/lb. for stems and $0.30/lb. for leaves. So spending $1 now you can get 1lb. of stems and 1lb. of leaves. That is actually a total of 2lb. of green onions. That's why the customer was able to spend $50 and get 100lb. of green onions.


Problem 4: Find the Odd Ping Pong Ball
==========================
Image credit: 123RF.com

Answer: 


The key challenge in this problem is that we don't know if this odd ball is lighter or heavier.
There are many solutions to this problem. Here's one:

If you divide 12 balls to 3 groups of 4 each. You can compare two groups with the first weighting. Let's name them group 1, 2, and 3. If group 1 and 2 are identical (case 1), then the odd ball has to be in group 3. If group 1 and 2 are not equal (case 2), then group 3 must have all normal balls.

For case 1, take 3 balls out of group 3 and compare to 3 normal balls (just pick them from group 1 and 2). 

Case 1.1: if the weights are identical, the 3 balls from group 3 must be normal. The remaining ball from group 3 is the odd ball. We just have to compare it against a normal ball in the third weighting to see if it is lighter or heavier.

Case 1.2: if the 3 balls from group 3 are heavier, now we know the odd ball is heavier. Pick 2 out of these 3 and compare them. If the weights are identical, then the remaining ball is the odd ball. If the weights are not equal, then the heavier one is the odd ball.

Case 1.3: if the 3 balls from group 3 are lighter, now we know the odd ball is lighter. Then perform same steps as above, but looking for lighter ball instead.

For case 2, let's just say group 1 is the heavier side (we can swap group names if not),  remove 3 balls from group 1, take 3 balls from group 2 and add to group 1, and take 3 balls from group 3 (normal balls) and add to group 2. Remember the balls originally in group 1 and 2.

Case 2.1: If group 1 is still heavier, that means either that original ball in group 1 is the odd ball and is a heavier ball, or the original ball in group 2 is the odd ball and is a lighter ball. Just compare one of them to a normal ball, we would know which one out of the two original balls is the odd ball and if it is lighter or heavier.

Case 2.2: If group 1 is now lighter after the swap, that means one of the three balls moved from group 2 to to group 1 is the odd ball and it is lighter. Now you just have to find the light odd ball out of the 3 by comparing 2 of them similar to case 1.2.

Case 2.3: If group 1 and 2 have same weights now, that means the one of the three balls we removed from group 1 is the odd ball and it is heavier than a normal ball. Now just find the heavier ball out of those 3 using methods similar to case 1.2.

The official name of this problem is the Balance Puzzle. You can read the Wiki page if you want to lean more.


Problem 5: Silver Utensils Problem
==========================


Image credit: Shutterstock

Answer: 

The key of solving this problem is to realize that there are many possible combinations of how much the fork, spoon and knife each cost. But there is only one answer on how much money Bill has once the prices for the fork, spoon and knife are set.

The easiest way to solve this problem is to just pick some easy numbers for the prices of the utensils that meet the requirements, and then figure out how many sets Bill can buy.

For example, let's just say a fork is $1 and a spoon is also $1. That means 21 forks and 21 spoons would cost $42 and that's how much money Bill has. If $42 can buy 28 knives, each knife must cost $1.50, and a set of fork, spoon and knife would cost $3.50. Now divide $42 by $3.50, we get 12. So Bill can buy 12 sets of utensils with all his money.

If we double the prices of each utensils, so fork is $2, spoon is $2 and knife is $3, the only thing changes is how much money Bill has. He now has $84, and he can still buy 12 sets of utensils.

What if the fork is $1, spoon is $2, and knife ends up been $2.25, and with the $63 Bill has, he can still buy 12 sets of utensils. You just have to make sure each utensil ends up in whole cents.

You can of course solve this problem using system of linear equations. You will end up with 12 set and you also don't need to know what price each utensil has.

Hope you enjoyed the reading. Do you feel smarter now?

BTW: The easiest way to remember my blog address is http://lanny.lannyland.com


Friday, July 12, 2019

Daily Battles: Finder on Mac Not Refreshing

With macOS Mojave, sometimes you might find that the file list in your Finder window stops refreshing. This happens more often if you have many Finder windows open (which I do all the time) and you start to manipulate files (delete, move, rename, etc.) from a terminal window.



The fix for this problem is quite simple. All you have to do is to hold the Option key and then right lick the Finder icon in your launcher. Once the menu pops up, just select Relaunch.


Image credit iDwonladBlog.com

The nice part is that the relaunched Finder will open all your previous Finder windows in their respective virtual desktops/spaces, so you won't lose anything.

Happy fighting your daily battles!!


BTW: The easiest way to remember my blog address is http://lanny.lannyland.com

Thursday, July 11, 2019

Daily Battles: TeamSnap Delayed Calendar Updates


TeamSnap is a popular mobile (and web) app used by many community sports teams/clubs (non-professional) to manage games and practice schedules. Both my kids play competitive soccer with local clubs, and both clubs use TeamSnap heavily for all the communication needs. I, myself, also use TeamSnap with my soccer buddies for weekly pickup games.




One feature provided by TeamSnap is that all the schedules can easily be integrated into Google Calendar. All you have to do is to import the calendar in the form of a URL (ICS feed) or an ICS file. Many other popular apps also provide such Internet Calendars (iCal), such as Facebook, Microsoft Outlook, Apple Calendar, and Trello.



My family rely on Google Calendar heavily for our scheduling needs, especially when it comes to coordinating parents-sponsored chauffeur service for the kids' transportation needs for their many activities (e.g., Ping Pong, Piano, Dance, Drawing, Tutoring Classes, Parties, Summer Camps, etc.). So it is certainly a convenience to be able to import calendars from TeamSnap, and then copy events to various family member's individual calendars. Copied together with the events are also addresses, which can be easily retrieved from mobile phones by the respective parent when it comes to driving time.

Practices and games get canceled, rescheduled, moved to different locations frequently. I do get email notifications when these happen. However, when I try to copy events from these imported calendars, many times I would realize that events on these imported calendars in Google Calendar are not updated, or out of sync with the TeamSnap calendar.

To be fair, TeamSnap is not the problem, and Google is really the problem!

Many Internet Calendars show latest updates within minutes (up to one hour in TeamSnap's case). However, when importing the calendar into Google Calendar, Google Calendar uses a pull model to get the latest changes. What this means is that it is totally up to Google to decide how soon and how frequently it wants to sync up with these other calendar providers. According to Google Calendar documentation, Google says that Google Calendar can take up to 8 hours to initiate a pull (sync up) from imported calendars. Recently, Google actually updated the documentation and increased the delay time to up to 12 hours.

But don't let that fool you. The truth is that it can actually take up to 48 hours for Google Calendar to initiate the pull and get synced up with imported calendars. And that can be very inconvenient and misleading when you look at your Google Calendar in a hurry and not realizing that the event you are driving to (30+ minutes one way) has been canceled.

TeamSnap team actually acknowledged this as a problem and provided the following tutorial article on how to solve the problem:

Team Schedule is not Updating in Google Calendar

Their solution is to delete the imported calendar and then reimport the calendar with a different query parameter (e.g., add the string "?query=1") at the end of the calendar URL to force Google Calendar to reimport (thus sync up) all the events and not use the cached version (which is outdated). Definitely a hack! Although this hack works, it only works once. Next time an event gets out of sync, you have to change the parameter and delete/reimport the calendar again. Not very convenient at all!!

So why doesn't Google Calendar provide a button or something to let you manually sync an imported calendar? Sounds simple enough for a company as big as Google, right? Turned out many Google Calendar users have been requesting this feature since as early as 2010 (9 years ago):

Feature Request: Manual Refresh of external calendar URL / .ics / iCal feeds

Google Calendar not updating published calendar added by URL

And unsurprisingly, Google chooses to ignore such cry for help, just as usual.

It is typical for Google when it comes to free services they offer, such as Google Tasks, Google Keep, Google Assistant, Google Calendar, and the list goes on and on. They ignore bugs people report, features people request, and questions people ask relating to how to use Google products. The Google Help Forum (support.google.com) is just a joke. It is filled with user seeking help only responded by other users echoing same problems. But hey, aren't these free services? Then why do we puny users expect to get free support? If you don't like it, stop using it!

Ranting aside, so are there any other options we have on solving this problem?

Options 1: Write your own solution if you know how to use Google Calendar API.

In the past when I was so pissed at Google Tasks' lack of repeated tasks, I wrote my own using Google Tasks API. 8 years later, they finally implemented that feature.

Options 2: If you don't know how to code or are too lazy to code it yourself, look for programs by other people who are so pissed at Google's lack of concern/support on core features and decide to write their own hack.

I actually found such a program specifically for this Google Calendar syncing issue:

ical_to_gcal_sync by Andrew Wramsay

This is a code repo (written in python) that will go through events on your iCal and then make sure to sync all these events on your specified Google Calendar. You could then schedule this to run periodically (Such as Task Scheduler for Windows or Cron for Linux). Just make sure to pull changes from the GitHub Repo when new codes are added.

Hope you find this useful!


BTW: The easiest way to remember my blog address is http://lanny.lannyland.com

Wednesday, July 10, 2019

Daily Battles: Airsense CPAP Machine Leaking Water

I just found out recently that my CPAP machine has been slowly leaking water onto my nightstand and ruining the surface of the nightstand.

For those of you who don't know, and don't suffer (good for you), a CPAP machine is a prescription machine that uses constant air pressure to help keep the breathing canal open for people who have sleep apnea, so they can get better sleep and better rest at night. According to sleepapnea.org, 22 million Americans suffer from sleep apnea (moderate to severe), which is 6.7% of the entire US population. Basically, if you snore pretty loudly at night, changes are, you have sleep apnea.

The model of my CPAP machine is AirSense 10 by ResMed.



After some research, again, turned out this leaking problem is actually quite common:
http://www.cpaptalk.com/viewtopic/t107107/My-Airsense-10-Autoset-leaked-water.html

The problem resides in the water chamber for the built in humidifier. Probably due to low quality gluing work, after some usage (Your Miles Might Vary), the part where the metal is glued to the plastic would eventually start leaking. And because most likely the leak is very slow, you won't notice it, since there would still be water left in the tank in the morning, and the leakage is well hidden underneath the CPAP machine. 
Once I found out the exact problem, I gave my CPAP supplier a call to try to order a replacement. Turned out since I didn't order supplies from my supplier once a month, they deactivated my account. And in order to activate my account again, I have to schedule an appointment with my sleep doctor. I can't even just buy parts from this supplier, because it would require a doctor's prescription.

In my case, since I have already hit my high medical deductibles this year, it makes sense to get the prescription from my doctor, so my health insurance can help cover the majority of the cost on the replacement parts (which means I have to wait 5 weeks before I can see my sleep doctor and then order my parts).

If you have the same water leakage problem and just want to take care of it right away, you can visit CPAP.com to order replacement parts directly out of pocket. The web site does charge shipping if you don't order over $99 of products.

It is unfortunate that my nightstand now has visible water damage. But that's life and life has many challenges. So be strong and be ready for your next battle with technology and life in genera!

BTW: The easiest way to remember my blog address is http://lanny.lannyland.com