Year: 2020

Journal

Fixed ethernet connection after installing Ubuntu Server 18.04

Reading Time: < 1 minute

For some reason, Ubuntu server 18.04 does not start with a valid ethernet connection on my newly acquired, an oldie but goodie, Dell R710 server. After some searching around this solution at tecmint that works for me.

sudo netplan generate 
sudo vim /etc/netplan/01-netcfg.yaml 
ifconfig -a # find the ethernet name, mine is eno1
# this will auto config using DHCP

network:
 version: 2
 renderer: networkd
 ethernets:
   eno1:
     dhcp4: yes
     dhcp6: yes

sudo netplan apply
ifconfig -a # should now show IP on eno1
AI, Journal

Containerize Everything

Reading Time: < 1 minute

In an effort to curb my video game playing hobby, and be close to my wife, I have been trying to stand up a bunch of machine learning services on my home server. I tried to do some standard things like WordPress and a regular website, but this proved to be inconsistent and tedious to configure. I decided to just pay for those services. But I’m designing more ML/AI oriented projects such as how to design a computer learning system similar to the human brain. And from previous experience, it seems that docker-compose is a good choice. Both for its ease to configure (someone did the job already in a docker container), and for modularity (I can start/stop a server without destroying my Linux server). So I decided to just use the latest docker images for things like MongoDB. The idea is to have each container do one type of service, and share the docker volume to a host/local folder for easier replication when I move to a different server. For this MongoDB container, I mostly followed the guide at this

dev.to tutorial

The only change I made was to change the volume to a local folder rather than docker volume so I can access it easier with greater modularization. Obviously this is not for production usage, but it’s sufficient enough for my own usages.

version: '3.7'
services:
  mongodb_container:
    image: mongo:latest
    container_name: mongo_db_main
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: rootpassword
    ports:
      - 27017:27017
    volumes:
      - ./mongodb_data_container:/data/db

Now you can use this to access the Mongodb.

mongo --username <username> --password <password> --host <ip address>

Misc

Covid-19

Reading Time: 5 minutes

There is no escape as this virus has dominated everybody’s life this year. I will write my personal journey here. And if in the future I get to look at it again, it may be a reminder for if I fall into similar situations again.

I first heard of the virus on Wechat, a Chinese social app, when a group of people at Wuhan thought SARS came back. There was some news about possible new cases of SARS, but it soon got quiet and nobody was mentioning it. I never gave much thought about it since similar rumors are quite often on social platforms. This was around mid-December of 2019. About two weeks before the Chinese New Year 2020, a bunch of people in China got tested positive for some new disease that’s similar to SARS. And there were some cases of death. It seems that things were starting to get serious. Then just before the Chinese New Year celebration, the government started to be open about the disease, and the New Year celebration TV show was filled with the topic. It was around how medical personnel was pulled from other areas of China to support Wuhan. My parents in law told me about how their activities were being limited. My brother-in-law and his wife found some surgical mask for my parents-in-law and send it to them back in China. It’s all-around Chinese social media now. This was just the end of January 2020.

At the same time, Americans were not very worried. My coworkers were not talking about it as much. I tried to warn them, but I don’t think anybody was actually concerned. I had to take a company-wide meeting in the last week of January. I took some surgical masks with me on the flight but was too “scared” to use it because nobody else was using it. In the U.S. this is a sign that someone is really sick. I didn’t want to raise that flag, especially since I’m Asian looking. On the flight back, my transport from the airport to near my house was a bus ride. On the bus ride, there were two groups of Chinese travelers wearing masks. They mostly have surgical masks, and one guy even has an N-95 mask. Even the two children had masks on. I remember I was thinking that my son will never put a mask on. At that time, most people didn’t know that children under 12 are not heavily affected by the virus. I had some debate about whether I should have pulled the masks from my luggage, but it was under the bus already, and I didn’t want to ask the driver to get it for me. I intentionally shipped two rows of seats as I passed them. They weren’t coughing, so I wasn’t too worried. That may have not been a good thing, because we now know it can spread without symptoms, even if they had masks on.

After coming back from the business trip, there was no change in terms of public sentiment. There were no known cases in America except the Princess Diamond Cruise travelers. President Trump did close the border to China pretty early. But there was no mentioning of any country in Europe, and no known cases in Italy yet. I pretty much carried out the same at work. No masks or gloves. But every morning, I would ask Google Home to tell me about cases near my home. And see if there are cases. I checked the CDC website pretty regularly. The Sina Chinese site was keep tracking of cases by day. And there are more cases every day. No media other than CDC is covering this in America.

Right around the time my son had a break in February, there started to have cases around us because they went to Italy for vacation. There are more confirmed cases due to travel around my hometown. I was getting increasingly worried. We discussed as a family and thought about whether we should take my son out of school, even though he will be marked absent. We did not end up doing it. I just watched super closely. However, when California, Washington, and Massachusetts starting to have double triple-digit cases, I worked up the courage to ask my boss to let me work from home. My boss was of course super understanding about it. The funny thing was our CEO decided my whole company is going to work from home the next day. So all that was just for one day of working from home.

Once I started working from home, we were more worried about getting food and try to limit our trips to crowds. We started getting deliveries more and stocking up on rice, flours, and other non-perishable foods. Trips to grocery stores are getting more intense. We used masks and gloves even though no more than 10% of the public is doing that. My coworkers didn’t seem to be too worried about it. We were, of course, trying to get masks. But they would either be extremely expensive, like $20 each. Or simply not in stock for physical drug stores. All the big vendors were out. Since my wife is close to the healthcare system, she was still working. They are starting to lock PPE supplies at work. She had two 3 more weeks than me because she simply cannot work from home. When she no longer required to work, she was put on furlough. Unlike my company, her employer didn’t ever plan a similar situation, or have the funds to support her. She was told to apply for unemployment benefits.

Life post the big event is settling in place. We don’t go out. Try to get food delivered to us when we can. And only go out for groceries when it’s necessary. I can still work from home, so it’s somewhat regular. I have done online meetings before so I don’t think work is hugely affected. My son has to study and do homework for about 6 hours a day. All that time is managed by my wife, so she is getting stressed more than normal. We go out to run early in the morning to get some exercise. We live in a somewhat rural town, so it’s no difficult to avoid neighbors. We just say hi from far away. I don’t know when I will be going back to work physically as my son’s school is “home only” for the rest of the year. I don’t think we can manage my son’s school work with both my wife and I working the whole day without teachers. There are some talks already for people going back to work because some states have protested about it. And I think people area unrest because not everybody can make ends meet. A lot of people need to work to survive. And some people are willing to take the chance to fight for what they built with their whole life. They don’t want to see that go away because of the virus. For myself though, I think I will stay put for a while until there is a definite plan to return.

AI, NLP, Reinforcement Learning

Using reinforcement learning for Conversation understanding

Reading Time: 3 minutes

I went to the NeurIPS 2019 conference in December and focused on NLP and reinforcement learning (RL) topics. The former is what I do for work, analyzing call center conversations, understanding what works for customer interactions, and make suggestions to clients based on their data. The latter is my personal interest, started all the way back when DeepMind beat the world’s best Go players. At the RL sessions, the tutorials mentioned using imitation learning to do natural language understanding tasks and generate responses to questions or chit-chat. People have some success, but it has some of the common pitfalls like repetitive usage of the most likely responses, and responses being too short. And sometimes the response is too simple and the bots fall into a cycle of “I don’t understand what you are saying”. So one night at a social gathering, I did get to meet Drs. David Silver and Richard Sutton. They briefly mentioned that I could try to set up the RL environment like a conversation and see if the agents can learn from the conversations. And in one of the workshops related to NLG conversations, people have talked about using various rewards to penalize for repetitiveness and encourage the generation of different texts. So that got me thinking. In addition to making a chatbot that’s similar to a call-center agent and customer interactions, I can design an environment that helps me discover the reason why people are calling. What I can do is set up categories of actions that are similar to “give refund”, “cancel service”, “keep the customer on the phone” etc, and use (regret = current action – best action), when the reward is either made the customer happy for 1 or made customer mad for 0. This may help me find the best action in a specific situation that results in the most wanted outcome given by the client. Granted, this might not give me the causal reasons why did the customer call directly, but it’s more similar to me designing a potential causal relationship graph before making the model and test if the causal relationship is correct. Even if it does not give me the exact cause, if it gives me the best action to take, then at least I have a product that does what the clients want. So the goal of the new year is to design an environment so I can test this idea and see if I can get the best type of action to take.

To get myself familiarize with the Gym framework from Open.Ai, I set up my own card game environment and made a double deep q-learning network. So here are some resources if you want to start your own:

Taking some design hints from https://github.com/zmcx16/OpenAI-Gym-Hearts
Some more help to design the environment: https://datascience.stackexchange.com/questions/28858/card-game-for-gym-reward-shaping
Other projects using gym: https://awesomeopensource.com/projects/openai-gym
Probably already programmed here: https://awesomeopensource.com/project/datamllab/rlcard
Create your own gym environments: https://github.com/openai/gym/blob/master/docs/environments.md https://stable-baselines.readthedocs.io/en/master/guide/custom_env.html https://github.com/openai/gym/blob/master/docs/creating-environments.md https://towardsdatascience.com/creating-a-custom-openai-gym-environment-for-stock-trading-be532be3910e https://medium.com/@apoddar573/making-your-own-custom-environment-in-gym-c3b65ff8cdaa

For the environment I look for in the conversation task, I will need to have an environment that mimics a conversation. A reset would result in starting a new conversation. Render is just how the conversation carried before a specific point. Each step can be a turn of the conversation, with texts randomly chosen from the same category pool. A downside I can see with this approach is that the training data might not generate the best solution to the customer service session. It may just be the bare minimum to get to the desired outcome. But I hope that the fact I can design my own regret in an RL framework, I can penalize for things like the length of the conversation or sentiment/emotional outcome, while I’m trying to achieve the outcome of retaining a customer.

I have encountered a similar situation before when I was making a chatbot using Rasa. They have a simpler RL environment, where a user can choose which route to take in a certain situation. But when I used it, the policy was too simple and does not achieve what I want, especially not give a causal relationship. I hope this could be integrated into this framework and be more useful.

View More