All posts by laimonas

What are the odds of …. ?

My mind is kind of blown right now. Need to put this into words and write it down. Perhaps others have some input to validate or contradict what I am saying.

I was studying probabilities and going through a topic of binomial distributions. I finished the lectures and went online to see how this information could be useful in the real world. Textbook examples are all about coin flips and I had a hard time relating the information to the real world scenarios. How often do you need to know the probability of tails coming up twice in three flips? Why does this binomial distribution topic matter?

A cursory search brought more coin examples. The real stuff was starting to show through here and there, starting with this article. Yet nothing that I could relate to or apply directly. Until it hit me: binomial distribution could help explain some of the NBA betting behavior I have been seeing! Let me backtrack to how I got there.

Background

I’ve been running an experiment to see if it would be possible to come out cash positive when betting on NBA games using wagering lines provided online. A short answer to that is a “no”: gambling institutions are sophisticated money-making operations that have no interest in losing money to a common man. Yet, the temptation to find an edge is strong, if you combine that with machine learning and stats analysis, one can’t help but try.

For three months now I simulate NBA bets against the real lines and record what happens. The first two months resulted in a negative balance. Last month+ has been positive. My initial approach that was losing money was strictly using a machine learning model I built and I made bets using moneyline odds. It was a good experience in that I learned that favorites in NBA lose much more often than a casual fan realizes. I also learned a ton on how simple ML models won’t cut it against skewed odds that oddsmakers setup against you, simple stab won’t work.

Bad results did not discourage me from experimenting, and I decided to see what would happen if I used the model only as one of the signals, and then relied on my own intuition as I watch the games and keep up with the teams. I no longer did “moneylines” and instead picked “the spread” bets that have payoff anywhere from -115 to -105. I also decided to only bet up to three games per day regardless of the number of matchups in the day. The three game choice was random, but I figured it was a number that forced me to think about the choices harder and pick the games I had the most confidence. With the spread odds, picking two out of three correctly guaranteed a positive night if you bet equal amounts on each game. 66% target rate did not sound too intimidating.

The new strategy has been in place for most of December and all of January. During this time I am winning ~62% of bets and slowly making up for the losses encountered during the first two months. 62% is close to 66% I was hoping to achieve. I track each bet, and the average odds come out to be ~-114. Basically for $10, you win $8.77 ($10 * 1000 / 114). Expected Value with params like this is positive: 0.62 * 8.77 – 0.38 * 10 = 5.43 – 3.8 = 1.63. All of this is assuring. I still can’t explain the winning rate with formula since intuition is a big part of it. This is concerning since I could be just hitting a lucky streak but for now, I am continuing with the approach.

During all of the time that the strategy has been running, I’ve had two questions in the back of my mind. My most common outcome when betting three games has been two wins and one loss. Kind of makes sense since in aggregate I am hitting about 62% win rate. But I wondered “what are the odds of hitting all three correctly? what about two, and one, and zero?”. And also wondered if I should continue to make three bets a day or increase it. I did not spend too much time trying to answer those questions and instead focused on getting better data, etc.

Aha! moment

With all the background info out of the way, here is the big realization of the day: betting on games is exactly where the field of binomial distribution can be applied. The outcome is binary: you either win or lose the bet (I consider push a win). A historical probability of winning is known from your past results, 0.62 in my case. If you expect to maintain this rate, you can calculate the probability of hitting all three, two, one, and zero bets when you make three picks using the binomial distribution formula! Like it or not, you are rolling a weighted dice three times!

Here is the formula for calculating the probability of each specific outcome. Let “n” be the number of bets, “k” be the number of wins, probability of success be Ps then the probability of “k” wins out of “n” bets can be calculated using this formula:

n! / ((n-k)! k!) * (Ps) ^ k * (1-Ps) ^ (n-k)

For my example of 3 picks and 0.62% of success rate:

3! / ((3-k)! k!) * (0.62) ^ k * (0.32) ^ (3-k)

And here are the results:

# of winsprobability
3 wins23.8%
2 wins43.8%
1 win26.8%
0 wins5.5%

Two win outcome is the most probably, no wonder I am seeing it the most! I have hit zero win days, but those are rare, and that fits in line with a 5% according to the probabilities above. I should be seeing three-win days more frequently than I am but I am extremely excited at the moment to know what is expected.

I was happily going through binomial distributions topic for two days, searching for real world examples, and only after a repeated push to find one did I realize that I am living this binomial distribution outcome almost every day for the last three months!

I can now only answer the question if I should stick to three-game bets or increase this further. Let’s set the n=4, what do we get? Here is the new table:

# of winsprobability
4 wins14.7%
3 wins36.2%
2 wins33.3%
1 win13.6%
0 wins2%

In aggregate, I will end up positive for the day only if I win three or four times out of the four picks. Combined probability of that is 50.9%. Compare that with the three-bet approach, where the likelihood of coming out positive for the day is combined probabilities of hitting two and three right, which comes out to 67.6%! Should I increase the number of games I bet? The math says: no.

This realization was hugely helpful in explaining the results I was seeing. It also convinces me to stick with the current approach of three bets. I am still not clear if my 62% hit rate is blind luck or if it’s something sustainable, so I will continue to probe further as I learn and run this experiment.

Predicting sports game outcomes

NBA model performance for the last month

Being a sports fan and someone who uses machine learning, it is just a matter of time before you will attempt to use the skills to predict the outcomes of the sports games. The temptation is too great: alure of making money on the side while bettering your skills combined with working on something that’s interesting outside of writing software is a recipe for action. The number of articles like this is huge. My goal is to share the lessons I learned and offer tips for others that might want to do a similar project in the future.

It was a fall of 2018 and I was a complete newbie when it came to sports wagering. I knew nothing about sports betting, lines, spreads, etc. It was gibberish that I heard on sports podcasts that I found amusing but never really dug in or cared too much about.

The question of “could I build a model that gave accurate predictions” kept on coming back ever since I picked up machine learning two years ago. I’ve built numerous models for work and for play since and I tossed the idea around but never executed on it. It kept on nagging at me until one weekend in the fall of 2018 I decided to jump in.

It took me about two weeks to gather the basic stats and build training database and start building models. I then spent the next two weeks simulating bets against real lines posted online looking for the winning strategies. Basically, a month (I worked on this during the weekends only for the most part) before I settled on a model I liked and evaluated against the real wagering numbers week to week.

Outcome

Let’s me summarize what was accomplished before I dive into details as to how things were done and what was learned:

  • I built an NFL prediction model that predicted 68% of the games correctly for the 2017 season, and 65% for the 2018 season. Not that impressive, some of the models out there that I had seen were achieving 70-73% rate, but good enough to make money if you used it to wager on a certain class of games.
  • I learned a ton about financial modeling and dissected two financial modeling books, treating NFL games like futures one could purchase and sell. I ended up with a system in place that allowed me to experiment with strategies, evaluate the results, graph the outcomes and see what works and does not work.
  • I learned a ton about gambling and how the system is basically very skewed against the gambler, and how gamblers don’t care and go for it anyway. Hey, sometimes you just want to have fun.
  • The final setup that was built was robust enough to be reused in predicting NBA games with similar overall accuracy but not as useful as the NFL model if one tried to use it for wagering.

Again, 65% might not sound that impressive, but the devil is in the details. I had some models that resulted in %69-70 accuracy but were not that useful from a money-making perspective. That’s the beauty of a real-world exercise vs a classroom problem. If you are working on a hypothetical model that will never be used in real world, you will do all kinds of crazy optimizations to achieve the best overall accuracy. But when you go out and try to use it against real-world data that’s available to you, the best accuracy model might not be the one that makes you the most money. More on that later.

Key Lessons learned

  1. As is usually the case, the machine learning part was a small part of the project. The amount of time spent on model type selection, feature selection, and training is small compared to the time you have to spend on gathering the data, setting up systems to fetch the results automatically, pre-processing it to fit your model needs, and the amount of time you spend on looking for winning strategies.
  2. You can’t predict randomness and searching for perfect accuracy is a futile attempt that probably ruins many that attempt this exercise. I could have spent time in trying to optimize the model and gather more data to perhaps bring up the model accuracy to the %70+ range but settled on something that was good enough to give me %28 profit if the money was spent on real wagering lines.
  3. Evaluate, evaluate, and evaluate your strategies. After using the model for the 2018 season and looking back at the results, I have a feeling I got lucky and should spend more time on the evaluation of my model and more plotting of its pasts results that would give me more confidence of its performance. I went with a bit of blind faith and gut feeling that the model was good enough but retroactively was able to prove out that indeed it was good enough.
  4. Reading financial machine learning books gave good ideas in the system setup and evaluation. “Building Winning Algorithmic Trading Systems” was fantastic in that regard, and the same can be said about “Advances in Financial Machine Learning“.

Future Posts

I want to dive in deeper into how things were done and some key ideas that were used in building a system to predict the games. In the next coming weeks, I will publish more details about the process that was used to build the model. Then will dive into the model evaluation, the most critical step, if you ask me and then share more lessons and tidbits of knowledge gathered. Depending on how much data I have gathered by then, will also share the results of the system and how it is doing for NBA game predictions.

Factfulness

I just finished a pretty cool book called “Factfulness“. It essentially presents a summary of the current state of the world from the big picture perspective with broad categories of income, education, and health. It deep dives into how misunderstood the world is by the masses, how biased is our outlook of the world, and the main reasons why we are so wrong.

An average person continues to have an outdated mindset about the world and assumes that things are much worse than they really are.
However, the reality is that the world is an incredibly better place than it was even as recently as 40 years ago.

The book begins with a 13 question quiz and the results he has collected over the years are downright abysmal. The majority get only three out of 13 right! (got 10 out of 13 but I am an optimist and basically, if you picked the optimistic answer, you were right most of the time). It did not matter how well educated the test takers were, what country they came from, or what profession. Not a single group of people that were polled beat out random guessing. 15% of test takers scored zero!

Bashing media was not one of the goals of the books, but it came up rather frequently when the author dived into the reasons why the population continues to be so disconnected from the reality. Our worldview is being updated by us reading the news. And news, especially in today’s world, are not interested in keeping us educated. The goal is to shock, entangle, and keep on coming back for more articles that shock, entice fear, and further cloud our thinking.

The news is not the same as it used to be. The amount of articles is ever growing and is insanely high today. The same story is distracted seemingly millions of times from various angles. So much fluff and irrelevant commentary. Media has had years of training on how to capture our attention with headlines and article structure. Keep the stories shocking, latch on to people’s fears, capitalize on uncertainty and our biological wiring.

I can’t blame the writers. Their goal is to make money. How do you make money? By building audience and traffic and nothing generates traffic more than attention-grabbing headlines and shocking articles. The goal is not to educate or report the truth without embellishments or conjecture. I honestly believe we are far better off leaving the major media outlets. The negatives far out weight the positives of following the information flow.

Last year many of us said we will leave social networks such as Facebook (although not sure how many actually did). I went through with the departure and could not love it more. Couple months back I have started to cut out my consumption of news in general and it’s been refreshing. This book is making me think that I should do more and go deeper with the clearance.

The first thing I did after finishing the book is clear out my featured section for google assistance app on the phone. Previously it suggested news articles, and honestly, I visited that page at least 5-6 times a day. No more. Gone. That was the only news outlet that I let myself visit, and now it’s empty. I am sure I will need to replace it with something, but for now, I want to see how far I can go without any news dropped on my lap. I have a feeling that what I will replace will be specific blogs or authors and that’s about it. Let’s see how this experiment will go.

End of the year reading list

Happy to report that the reading habit is doing well with a total of 26 books read this year, averaging about two books per month. Considering that the majority of what I read is non-fiction work, I think that’s a pretty good rate. The highlight has to be the book I just finished, called “Bad Blood”. I accidentally picked it up from my library’s featured section. It’s a story about a now-defunct startup “Theranos” that promised cheap and superior blood testing technology, rose to 10 billion dollar valuation and the founder was considered as the next Bill Gates, etc. All of it came crashing down when it was discovered that the company lied about its capabilities and had created nothing but barely functioning blood testing devices that could only do a few tests and even then performed terribly. The story might not sound that amazing since many companies rise and fail. What makes this one different to me is two things. One, the lengths that the company and the major players went to hide the shortcomings of the technology and all the “lawyering” it employed to survive. The second reason is that the book is just well written and the reporter stayed out of the way so to speak and presented the timeline in an incredibly coherent and clear fashion. Highly recommended. Here is my month to month breakdown: January: no books, sad February
  • Principles: Life and Work – Ray Dalio shares his core principles for various areas of life. It was excellent, causing me to blog about the book and the author’s way of explaining the expected value calculations.
March
  • Happiness by Design: Change What You Do, Not How You Think – a somewhat typical self-help book that gives advice on how to live a happier life. The main idea was that happiness comes from having pleasure and purpose and there are ways to increase the amount of each with various advice on how to do so.
  • Skin in the Game: Hidden Asymmetries in Daily Life I am a big fan of Nassim Taleb and this book did not disappoint. I can’t summarize the book in a single theme as his touches a large variety of topics, as usually is the case. Most of it is around the probability of events, the importance of understanding probabilities and causes if you are going to make decisions for the future. And of course, the usual Nassim’s digs at journalists and academics that don’t avoid work in the real world.
  • Designing Bots: Creating Conversational Experiences – this book was meh, a summarize of what it takes to design a bot and some tips.
  • War Against All Puerto Ricans: Revolution and Terror in America’s Colony -not the book I would typically pick up but read it based on my wife’s recommendation. It was an interesting diversion from the usual science/software reads into the history but that’s about it. Summary – being colonized sucks and it’s not as glorious as the victor’s try to portray it. What else is new…
April May June
  • Ego Is the Enemy – this was a good reminder of focusing on your work and goals and ignoring the desire to get fame and recognition. It’s a tough balance to achieve as recognition can serve as a source of energy to continue going and working hard but ultimately the book is right: recognition is fleeting and often fake, find the reward somewhere else.
  • Nine Algorithms That Changed the Future: The Ingenious Ideas That Drive Today’s Computers – it was a decent summary of things like encryption, compression, etc.
  • Designing Distributed Systems: Patterns and Paradigms for Scalable, Reliable Services – I had high hopes for this one and was very much disappointed. It was basically a collection of patterns expressed via Kubernetes templates, boring.
  • Writing High-Performance .NET Code – I picked this one up after somebody I know mentioned it on twitter, it provides an excellent insight into troubleshooting and writing fast performing software.
July – no books, not unusual for me to skip reading during summer days. August – no books read, same as July. September
  • Getting to Us – as is the case almost everywhere, eventually I pick up sports books and get my sports reading binge going. This one summarized several high profile coaches and profiled what were the key things they did with their teams to achieve success.
  • Gridiron Genius – continuing the sports reads, this was a book by a football scout and front office executive that worked with Bill Walsh, Bill Belichik, and Al Davis and shared some of this thoughts and stories on leadership and successful team execution.
  • Python Machine Learning Cookbook – had very low expectations for this book and instead was pleasantly surprised. I would consider this a must-have if you are doing machine learning with Python. A good guide to solving a variety of problems and can serve as a way to get surface level info on a topic before diving in deep somewhere else.
October
  • Algorithms of the Intelligent Web – Ideas on how you could make the software more intelligent (user recommendations, machine learning, search, etc). The topic sounds good but the book itself is not detail enough to be useful.
  • The Master Algorithm – I consider this a must read if you have started with Machine Learning applications. The author does an excellent job dissecting the history of machine learning techniques and tries to anticipate what is the holy grail/final frontier for the machine learning industry. I absolutely loved this book and how it walks the reader through the history while tying all the different pieces together and explains what is happening in machine learning today.
November
  • The Site Reliability Workbook – a follow up to highly regarded, “The Site Reliability” book, very disappointing to be honest. Maybe my expectations were too high? I recommend skipping this book if you are considering reading it.
  • Building Algorithmic Trading Systems – I got this book to learn some of the tips and tricks for building a sports betting system. I felt like there are some parallels between sports event and betting on them and the stock/futures market and betting on those. Definitely got some good insight on how to evaluate the prediction systems, I think that’s where I found it the most useful.
December
  • When – lukewarm about this one, perhaps because most of the material it presents I’ve heard it before.
  • Kids Are Worth It! – I read one or two books per year usually on raising children, just to get some ideas and thoughts on dealing with the little ones (have three of them in my house). I thought the author was too conservative, but eventually, I came around and loved this book. A lot of very practical advice on dealing with children issues from the time they are two to until they go to high school.
  • Dopesick – The information presented inside is very powerful and paints a detailed picture of how prescription medicine addiction comes around and leads to other drug use and the demise of communities and institutions. Eye-opening information on how pharma industry played a critical role in introducing painkiller addiction to the masses and how the rest of the system furthered it along into an epidemic that you hear about today.
  • Bad Blood – two words: READ IT!

Domain Modeling Made Functional

I really enjoyed reading Domain Modeling Made Functional, an excellent intro to modeling and implementing software requirements using a functional language (F#) with Domain Driven Design (DDD) principles.

I don’t use F# (but appreciate functional programming in general) and the reason why I picked this book up is to learn and revisit DDD concepts.

The first two chapters of the book were the most valuable. The main takeaway: when doing DDD, start with the events and not domain objects! I know that when I approach a problem, I always start with trying to define the domain objects. This seemingly small switch to focus on events instead felt profound as I was reading the first few chapters.

The biggest value that software gives to its users is not in the domain objects it stores and retrieves, but in the transformation of the input data through the domain, usually via workflows which are triggered by … events! Identifying the events will give you a good idea of possible workflows that either exist or will need to exist which then lead to defining commands, bounded context, domain objects, aggregates, etc. It all starts with events.

The process of identifying the events occurs during the eventstorming sessions (a good intro here). Eventstorming unites implementers and business users together as they work on defining the events, commands, and bounded contexts. Pulling people together during this phase is a great way to make sure that as little as possible gets lost in translation when somebody takes the requirements and then “translates” them to the implementation group. Instead, implementers are active participants that learn and define things together with the users.

A domain event is the starting point, always termed in the past as it has occurred and cannot be changed. Eg. user created, user added, etc. Events can start workflows which then end with usually another event that other contexts can subscribe to and act upon.

And then the rest of the book was more around F# approach to design and implementation. Several rules stand out, such as: avoid names and concepts that are not directly described by domain experts;  build the smallest units, functions, that do the work, connect the functions to form services. Connect the services as pipelines to form workflows.

Really neat book. Even if you don’t use F#, this books introduces many great concepts and if you don’t dabble much in DDD space, gives you topics about DDD that you can then go and explore on your own.

Expected value calculations

I am in the process of reading “Principles: Life and Work” by Ray Dalio. Overall the book is very good and informative but one chapter really caught my attention: Learn How to Make Decisions Effectively.

In particular, what stood out there was the author’s explanation of making decisions as expected value calculations.

When you make a decision or take action that can either result in success or a failure, you have these factors to consider:

  • the probability that the action will result in success
  • reward gained if the action results in success
  • the probability that the action will result in failure
  • penalty/loss if the action results in failure

The expected value (EV) for such a decision then can be defined as follows:

EV = Probability of success * reward – probability of failure * penalty

EV greater than zero can be thought as a winning decision and if you have multiple choices, pick one that has the highest expected value.

A quick example from the book: let’s say the reward for being right is 100$ and the chance of you being right is 60% (0.6). The penalty is also $100 dollars (and the probability is 0.4 arrive at 1-0.6). Then EV = 0.6 * 100 – 0.4 * 100 = +20.

This simple example is all well and good but check out couple thoughts now to branch out further.

The best bet is not always a bet with the highest probability. If something is very probably but has a small positive outcome and very large negative outcome, the EV is negative.

A decision can have a relatively small chance of success but if the payoff is much larger than the cost if you fail, that decision has a positive EV and is the right choice as long as you can cover the loss. This is where investments in risky but highly rewarding endeavors can pay off greatly. Again, as long as you can cover the losses.

If you stick to “playing” with EV positive outcomes, over time you will come on top. The key is to make sure you have a good information and feel for the event’s probabilities and costs.

What’s cool is that when taking an action or making a decision, you have four things that you can leverage to increase your EV: increase your chance of success, increase your positive outcome, decrease the chance of failure, decrease the penalty. Not always all four are malleable but you would be surprised how often there are other options to consider that increase the expected value. Following such thought process teaches your brain to search for alternatives that influence the four factors I just mentioned.

Furthermore, when you start searching for different options with better odds, the actual odd value is less important than knowing that the decision you are picking is either less risky (you are decreasing the chance of failure) than the previous one or is more rewarding, etc.

Now whenever I am working on let’s say a feature release, I consider expected value formula and ask myself: what’s my confidence level that what I am releasing will work correctly? In my profession (software) this is often tied to proper and extensive testing and validation. If I get a feeling that I could have done more testing, I right away do so to increase the chance of success. If the release goes wrong, what is the worst that can happen? This often makes me re-evaluate the size and scope of the release and if possible I break things up into smaller pieces which means the impact of a negative outcome will be smaller.

I am continuing to dig and have thought exercises with this rule but so far it has been very beneficial.

Artificial Intelligence Engineer Udacity Degree – Finished

Happy to say that earlier this month I have graduated from the Udacity’s AI nano degree! It was the hardest course I have taken since college, which was some 15 years ago. At the same time, it was a fun challenge that I am happy to see reach a successful end.

I want to quickly summarize the parts of the course I enjoyed the most. I really had two subjects that were awesome: game playing AI and deep learning.

We learned game agent AI topics such as minimax, alpha-beta pruning, and various other tree/graph traversal techniques. It was awesome, enjoyable, just immersed myself during that part of the course. Search algorithms kept me busy and tinkering for weeks. A*, DFS/BFS, the basics that I had to re-learn and happy that I did. The game playing agent project was cool to go through and actually see your agent in action was rewarding.

The second term introduced neural networks. I could not recommend enough the neural network (NN) lectures. I went from zero knowledge of NN to somewhat being able to grasp the basics in a very short time and was able to build several models that could return decent predictions in their domain.

Would I recommend this course overall? It depends on your learning goals. If you want to get an introduction to a wide variety of topics that AI encompasses, this course is great. The field itself is HUGE. I took it to find out what the field is all about and equally important challenge myself to see if I could finish an intense course like that. I will say I am happy that I did.

But if you want to learn about ML/NN, this course contains too many topics outside of the ML field. Planning, HMM, and a few other topics were quite out dated and more important from the historical perspective. They took up a lot of time that I wish I would have spent doing ML projects instead.

What’s next? I have enrolled in Udacity’s Machine Learning Nano Degree! It will allow me to close up some of the knowledge gaps I have around machine learning, also give me an opportunity to continue practice machine learning on more projects that come with the degree. In addition to that, I am looking for ways to apply ML at work and have a few areas that I am trying it out already. Just keep on doing work and gathering the practical experience.

Book review: How to Fail at Almost Everything and Still Win Big

The book was highly enjoyable and packs so much useful information and advice. I am impressed how succinctly and clearly Scott has expressed his opinion on a large variety of topics.

It is essentially Scott’s take on life and how to succeed. Success can mean different things to different people, but I can safely say many will find information in here that they can use. I would highly recommend this book to anyone who is looking to get a good sense of how one can accomplish difficult tasks and live a fulfilled life.

At a high level, his take on life boils down to several key points (which I hear repeated in various forms over and over again in other books):

Increase your energy capacity by eating right, getting a good amount of sleep every day, and exercise/stay active. These are the foundational pillars that enable you to work hard, think clearly, seek out knowledge or adventure, and in general lead a fulfilling existence. Beyond that, you need luck, be at the right place at the right time so to speak. But luck is not a fixed concept, you can increase your odds of luck by picking up new skills, mastering concepts such as psychology, finance, social interactions, public speaking. The additional skills will increase your surface area of luck, so to speak and the rest is up to you: once given an opportunity, take

Through it all, embrace the failure for it is a valuable signal and a learning material that if utilized properly will enable you to grow.

The topics that the book covers are rather varied and all expressed from Scott’s point of view and what he learned. The presentation style though is fun and engaging which makes it easy to read and learn.

A couple of ideas that stood out to me in addition to the above big level concepts:

  • Systems vs goals. I’ve had heard this distinction before but did not fully buy into it. The author has some really interesting points and examples of how expressing your goals as systems instead can make a huge difference.Let’s take reading books as an example. You could set a goal of reading two books per month. It’s measurable, you know when you succeed or fail. And is actionable, action being sitting down and reading. But putting that number out there, Scott argues, makes you feel somewhat inadequate if you don’t succeed, you are always in a state of failure until you reach that number.

    Instead, you should come up with a system for reading books, such as: anytime you commute on a train, you will read a book (instead of looking at twitter/fb/etc on my phone). Or every other day during lunch you will read. etc. You pick what works for you and do the action. You don’t worry about the count of books, just make sure you put a system in place that allows you to spend time reading. Then pay attention to how well you are doing. If you are not reaching the amount of reading you want, try to find a better system. Iterate.

    It’s a simplified example, but if you apply it to enough behaviors, you can have a pretty good setup going on for reading and anything else. For instance, I have couple systems for reading (that I setup without even knowing): 1) keep my kindle in the commuting backpack 2) when on a train, read 3) when I see a book I like, buy it. The number of books per month varies, but I feel like I am always reading. I am almost at the end of the month and have finished four books. Last month 2, a month before 2. I am happy with the amount of reading I do and sometimes it drops to zero but that’s OK.

  • Happiness level of a human being depends on the direction of the progress and not the current state. (e.g. A rich person that goes from 2 billion to 1 billion dollars in fortunate is often sadder than a person who is increasing his earning from 90k to 120k).
  • Affirmations, a somewhat vague and controversial concept of essentially wishing for a certain outcome and it becoming a reality. Scott presents multiple examples from his life and makes sure to mention how there is no science behind it and it all could essentially be bullshit. Yet he seems to have used them in the past and tends to believe there is something there.
  • Avoid career traps that require you to sell your time for money. I am definitely in that stage right now, basically, my time is what earns me money and this book is making me strongly consider what other revenue streams I could add to improve this situation.
  • Happiness is being able to do what you want when you want it. The flexibility of choosing when to do the activity that you want to do is very important to us, it appears. I can attest to that and could explain why I am very happy at my current job: the flexibility of my schedule.
  • One should be familiar with or get a good understand of topics such as psychology, public speaking, accounting, and a few other foundational skills. I jotted down the list and see which ones are my weak points. I am always taking courses in my field of profession, but this book is making me consider if I should try to branch out and see if I can learn a complimentary skill that is not necessarily tied to my current profession (software engineering).

Again, if you are a looking for an easy yet educational read, I highly recommend Scott’s book. Enjoy!

AI Nano Degree update – Term 2, almost done

I am loving Term 2. It starts with the basics of neural networks and the introduction to Multilayer Perceptron networks (MPLs) where you build a basic neural network that you can train and use to predict either categorical (classification) or numerical values (regression). It’s power and limitations are presented through very fun exercises involving analyzing IMDB and image data.

MLPs are followed by Convolution Neural Network (CNN) introduction, by far the most fun I’ve had in this course. CNNs are mostly used for image recognition and you get to experience building image recognition networks while working on a project to classify dog breeds from a set of provided images. Really cool and fun project. It barely scratches the surface of what’s possible but you get a very nice intro and then you can branch out on your own.

CNN intro was followed by the Recurring Neural Networks (RNN). The application here focuses on language and character prediction tests with the project asking to implement a model that is capable generating English language words. It was really cool how effective the model was and how it was able to generate English words after just a few hours of toying around with training and parameters. This article http://karpathy.github.io/2015/05/21/rnn-effectiveness/ contains really cool info on RNNs.

After these topics, you reach a point in the degree where you have to select a specialization. I went with Computer Vision as that is the area that I find really fascinating and exciting. The other choices are Natural Language Processing (NLP) and Voice User Interfaces. NLP is probably the most useful but I am trying to stay away from it as everything that has to do with “language” I find very boring. It’s something that I will get over but right now I want to just have a lot of fun and learn and I know Computer Vision will provide me with both.

The plan right now is to finish up the lectures, get the project done (I hear it’s short, a weekend type of endeavor) and I am done! Can’t wait to graduate!

Book review: Antifragile

Antifragile

Absolutely loved the book and its main messages. It’s deep, ambitious, and very thought provoking. It was an immense pleasure to read.

Things that jumped out of me, in no particular order:

  • Term “Antifragile”. As defined by the author, antifragile is something that benefits from random events, somebody that gets stronger when stress is applied to it. This is a step above “robust” where robust most often means ability to deal with stress. Love it as a concept. Netflix’s Chaos Monkey seems to be something that you could define as a tool of antifragility. By randomly killing cloud instances, it helped Netflix build a more resilient architecture that now survives all kinds of cloud service failures. It actually gains from AWS going out as the rest of the services scramble, they stand strong and get positive press, admiration, tech fans that want to work there, etc. Evolution is another example. Individual participants (a human, animal) dies and disappears but the concept of genome continues to survive and actually gets stronger as individual members experience stressors that take out the weak and let the strong survive.

  • Barbell strategy, a way to build antifragility. There are many ways to explain this strategy, but it boils down to playing majority of the time safe, and be very aggressive otherwise. NO MIDDLE GAME. Playing safe you are not exposing yourself to destructive events that could take you out, so to speak. At the same time, if you truly pick a smart but aggressive investment or activity, since it’s loss magnitude is small, even if all of it disappears – that’s just a small percentage lost. But if you hit “gold”, you benefit greatly. The key is finding an activity/investment that has such a great upside and whose downside is small. Seems obvious at first, but I think in real life we play mostly in the middle. Very little on the safe side, very little on the risky side and fat column in the middle. This thought is really nagging at me and making me reconsider many of my own activities and actions.

  • Optionality, another way to build antifragility. When you have little or no options, you are limited in your actions and when you have no options, a catastrophic event can wipe you out. You don’t get better when Black Swans hit, you either suffer greatly, or survive. Options can enhance you ability to benefit from the Black Swan.

  • Via Negativa. Another way to increase antifragility, as well as a way to look at life. Don’t try to add, but work hard to remove. When looking at a design of the systems, adding functionality adds complexity, which adds fragility. Simplify, remove it, and remove some more. A noble goal in any profession and in life. It’s something that is really hard to do as adding can be tempting and short-term gratifying. Also, rarely did anybody receives an award for not doing something. Bigger/complicated systems seem to hide failures underneath the surface and it eventually all comes out in a large (Black Swan) event that has catastrophic repercussions. Large governments, top-down as opposed to bottom-up, are inflexible, fragile, and susceptible to large crises. Think of how much infrastructure and layers of bureaucracy that exist within large governments and corporations. When you get an inside look, the picture is not pretty. According to the author, such setups are just a matter of time before they get hit with a Black Swan event that can wipe them out. At the very least many people suffer.

  • Lindy effect. The longer the technology is around, the longer it will survive. Another way to spin it, don’t trust something that is new because by the mere fact that it is new, it has a really high probability not sticking around.

  • Skin in the game. A large topic but it boils down to an idea that don’t listen/rely on somebody who is not impacted by whatever they are saying or asking you to do. A doctor that suggests you a procedure which he himself would never under go (e.g. risky back surgery), an investment advice from somebody that does not use it themselves. These appear to be obvious but are not obvious in real life. There are a ton of forecasters and prediction people that get things wrong all the time, their false forecasts or news being used in real life with negative consequences. Yet the forecaster suffers no consequences. That’s the reality of the modern world. We are too large, too big, we seek out commentators on anything and everything and then follow them without asking if that person has anything in it or just spewing nonsense for profit and moving on.

In general, the book praises the life of stoicism, small size, and simplicity, suggesting the reader looks at Mother Nature, the most antifragile thing that we know of, for clues on how to live and advance.

I love this book so much that I will buy a print copy to refer to from time to time.

As a side note, I found it fascinating to see how many people absolutely deplore the author and this book. I can see how the ideas can be unsettling, and the author’s style is rather rude. I actually like it, no sugar coating and straight to the point. If you are offended by it, move on. The message is simply not for you.