A month ago, a few friends and I scratched our way through a stack of scratch cards while enjoying beers at a local Waltham dive bar. We kept cashing in our winnings (our very small winnings) and putting the money back into more scratch cards. As you could have guessed, this strategy was not effective for us.
This got me wondering...what does someone get for the price of a scratch ticket? I concluded that you get a slim chance to win some money, a brief rush while your mind imagines a huge windfall, a few short minutes of entertainment, and then, ultimately, the dull satisfaction of donating a small sum of money to the state.
If you’re able to enjoy the entertainment value of a scratch card – and if you’re able to avoid falling into the lottery "deep end" – then maybe a buying a few scratch cards is justifiable. But what if we put the entertainment aside and focus only on the chance of winning money. Can we somehow maximize our chances of winning? What are the odds, really? There are a lot of mysteries when it comes to scratch cards – and I get the sense that few people stress the details when it comes to scratch cards.
Did you know that the winning statistics for all scratch cards in Massachusetts (and most other states) are available on the state lottery website? Sometimes they are even on the back of the card. I built a tool that reads those statistics and aggregates them. I analyzed those posted statistics for 22 different types of scratch cards ranging in purchase price from $1 to $30, hoping to somehow find scratch card enlightenment.
So how bad are your odds to win any money when you play a scratch card?
Pretty bad. Your chances of actually making more money than what you paid are 1 in 4 at best (if you buy a $30 scratch card), and 1 in 9 at worst (for a $1 card).
Let's say you're not looking to win a million dollars. What are your chances of winning just $100?
Super bad. For $1 cards, about 1 in 950 have a prize of $100 or more. For $10 cards, those odds improve to 1 in 60.
Are your chances of winning higher if you buy a more expensive scratch card?
The short answer to this question is: yes. But keep in mind that the odds are heavily against you even with the more expensive cards, so buying more expensive cards is really just putting you on a faster lane to losing money.
Are some scratch cards within a price tier better than others?
Not really. From my analysis, I saw that the statistics for typical $1 cards are all fairly consistent, and the same goes for the other price tiers. The exception to this are the "limited issue" cards, which I talk about below...
Do the “limited issue” scratch cards have a better chance of winning?
The short answer is no. But, it's noteworthy that some of the "limited issue" cards do weird things with the statistics. For example, there’s a limited edition $10 scratch card this year called “$50, $100 and $500 Blowout” which only offers prizes between $50 and $500. This is fairly unusual because most scratch cards have a few million-dollar prizes and many small winners too. While the prizes for this card are different, the chances of winning aren’t really better.
Ok, let’s say you want to dream big. What’s your chance of winning over $1 million?
Well, the $1 and $2 scratch cards don’t even offer a $1 million prize - so if you're buying those your chances are literally zero. Higher value cards do technically offer a $1 million prize, so your chances of actually winning $1 million improve from literally zero to effectively zero. The chance of winning $1 million or more on a $5 card is 1 in 4.2 million. Those odds improve to about 1 in 650,000 for the $20 cards. While these odds are super-duper low, winners do exist. It happens...just not that often.
How much money is Massachusetts making off of these scratch cards anyways?
I can’t really approximate how much money the state spends on designing the cards, manufacturing, distributing, managing the prizes, paying retailers, etc. But I can see from the statistics that their profit margin (accounting only for prize payouts) is about 30% for the $1 scratch cards and 15% for the $20 and $30 cards.
At first, those margins seemed low to me. If the odds of actually winning some money is between 1 in 4 and 1 in 9, then should their profit margin be higher – like 80%? Well, the truth is that there are technically a few big jackpot winners. Those lucky few jackpot winners take a hefty bite out of the state’s profit.
All that being said…how can you maximize your chances of winning?
No matter what you do, your odds of winning are garbage. But there technically are some things you can do to prevent your odds from worsening into hot garbage.
But here is the real hint: One way to win every time is to shift the definition of “winning”. As you scratch, enjoy dreaming of those big prizes, and enjoy your beer when you don’t win those prizes. Revel in the fun of scratching off those tickets. Stick to a budget, and don’t lose too much money.
My machine learning project was on the back burner for the last few months. I recently resurrected the project for no reason other than to just push it to a decent stopping point. I already spent a lot of time developing a tool to categorize thousands of self-captured images of vehicles to train the neural network. It would have been silly to leave the project off before actually implementing all of that data.
So, I re-trained the neural network last month - and just this weekend I finally got around to putting the re-trained tool to work. I set it loose on some pre-recorded traffic footage from cameras owned by the Maryland Dept. of Transportation - and I was very happy with its performance!
If you recall, the earlier version of this tool was trained on third-party car images and - let's be honest - it didn't do such a good job. The retrained network is much much better. I recorded some video clips of its performance and saved it onto youtube. You can check it out here.
My primary goal of this project was to learn as much as possible, and from that perspective, it was a success. Some of my other goals, such as optimizing the neural network to run on the Raspberry Pi (a $35 mini computer), were not completely accomplished. I mean it can technically run on the pi, but it only does about 5 frames per second. With time, I am confident I can improve that - probably a lot - but there will be diminishing returns in terms of learning if I spend more time on this. Also, it's easy to imagine developing a set of tools that would sit on top of this technology to do useful things like count cars, detect traffic conditions, etc. All of that stuff would be fun to do, but time-consuming.
So, with this last post, I am putting this project on hold indefinitely.
I created a patch! I have a bunch of them. Read below for info on how to get a patch, and to learn how the patch was made.
Over the past few months, I've been steering the content on Comet.cool towards being slightly more about projects (while still keeping all of the other fun and goofy stuff too). I am testing the hypothesis that if someone writes about a project that they themselves are passionate about, a few things will happen: first of all, they will be more motivated in that project, the project will be more rewarding, and other people will feed off of their enthusiasm and passion.
So, I will give you one of these very exclusive and moderately desireable patches in exchange for a single post onto this site documenting the initiation, progress, or completion of a project (big or small). If you want help with the post, let me know.
(If nobody is interested in writing about projects, then I will give up and hand out the patches for free after a few months)
For the past few months, I've been experimenting with designs for a Comet.cool t-shirt, hat, or some other kind of merchandise. The problem was, I couldn't really see myself (or anyone else) actually wearing Comet.cool clothing. So, I decided to instead design an embroidered patch. I liked this better because the patch could be ironed onto a piece of clothing if desired, or it could just be tucked away somewhere like a badge of honor without any expectation of actually being worn in public.
The picture above shows the design process I went through to make the patch. I haven't ever designed a patch, so I had to do some reading to figure out what design principals to follow for embroidery. I realized I would need to keep the design relatively simple, avoid color gradients, and limit the color palette. Beyond that, I knew I wanted a somewhat geometric design with highly contrasting colors. I started with paper and pen, then used CAD to quickly sketch the "COMET" characters. I finished the design off using image editing software.
I commissioned www.qualitypunch.net for the actual embroidering. I recommend this site if you need to do any similar work. They were extremely helpful and responsive throughout the whole process.
This is a great image that was generated by an artificial neural network. The neural network was very likely configured to apply the "style" of various romantic-era paintings to the "content" of this famous painting of Napoleon. I am not sure if this brilliant and bizarre output was intended, but I like it.
The behavior of artificial neural networks has strange parallels with our human brains (hence the name). This image exploits those parallels. When glancing at it, our brain quickly identifies it as Napoleon - but upon closer inspection, the image is complete nonsense!
In a somewhat recent post, I mentioned that I was making a program to quickly flip through large collections of unlabeled images and assign labels to them. I finished developing that program about a month ago, and I've used it quite a bit since then. I named the program tkteach, and I've made it free for anybody to download, use, and modify on github (a website for sharing and improving code for programs). As I mentioned, the program is designed to be fast, easy, and reliable. It outputs the labels to a database, and it saves as you go - so you shouldn't have to worry about losing progress.
Over the past month or so, my time for working on machine learning has been limited. I've spent my limited time labeling as many images as possible using tkteach. I've labeled about 5,800 images so far - and I still have about 14,000 unlabeled images left. It's not necessary to label ALL of those images - but the more the better. Labeling the images is a little boring, so I usually do it while watching a twitch stream or listening to music.
The next step (which I'll likely start this upcoming weekend) will be re-training the neural network using all of these newly labeled images. I anticipate a very big jump in accuracy since this new training data is much more representative of the actual images that the network will be seeing.
I've come to the conclusion that the performance of my vehicle detection neural network is being severely limited by the dataset of car images I used to initially train it. Those car images were almost always taken from the side, front, or back of the cars. So whenever the neural network looks at a car or truck from a diagonal angle, it struggles to classify it.
I got that batch of training images off the internet. I pieced together a couple different pre-made datasets to total about 6,500 images. If I want better performance, I will need A LOT more data. I need to collect it myself.
I wrote a program to detect movement in a videofeed (from youtube, for example). If the movement meets certain criteria, then the camera saves a picture of the localized movement area and re-sizes it to 64 pixels by 64 pixels (the size I am using for the neural network input). Using a video feed from a traffic camera, I can easily collect 1,500 images per hour (or a lot more if I increase the screen-shot frequency). The images will often contain cars, but they also sometimes contain other movement (such as shadows, moving trees, clouds, etc.) That's good, because the neural network will benefit from learning what non-car images look like.
Now I am capable of collecting (comparatively) massive amounts of image data. I can set this thing to run overnight and wake up with tens of thousands of images. The problem is, the images aren’t labeled. The neural network can't learn from them unless it knows which images contain cars and which do not.
So...I wrote a program that can be used to quickly flip through images and manually label them as car or no-car. The program is designed from the ground-up to be quick. It can work with the mouse, but it can also work with just key presses. I am working on getting it to output the labels directly into a sqlite database.
With these new tools, I will be able to expand my training dataset.
I haven't posted much lately. That's partially because I've been quite busy at work. The little time I've had over the past two weeks for extra-curricular activities has lead to a string of failures. I will now blog these failures to officially put them behind me...
I've been experimenting with a machine learning package named "Yolo" (which, in this case, stands for "You Only Look Once"). This is supposed to be a very fast object detection framework. I thought it would be good to implement this for my machine learning project. It has been fairly difficult to get it running, mainly because it was written in the programming language "C", and I am trying to run it through a modified "python" wrapper so it can play nicely with other things I've programmed so far in this project.
After a lot of effort, I was able to get it running. I trained the "Yolo" model on my car image dataset. But, the final results weren't so great. I need to tinker with it some more. There really isn't any fun output that I can share on this yet.
After failing fairly hard with the "Yolo" stuff, I went back to tinkering with the Raspberry Pi a little bit. Except, for seemingly no reason, the camera stopped working. I checked the connections, reinstalled some of the firmware, searched online a bunch, but found no solutions. Then, after about an hour of troubleshooting, I noticed that there is a little orange-colored plug above the camera lens that wasn't perfectly seated into its connection. I fixed that, and it started working again. Nice.
I've been trying fairly hard to buy some cryptocurrency. So far I've mined a grand total of $25 in Ethereum (over the past 16 days). That's not bad - but I've noticed a few "up and coming" cryptocurrencies that I'd like to make an investment into.
The problem is, TD Bank is being a major pain in the butt. They keep blocking any crypto-related transactions. At first, I gave them the benefit of the doubt. Buying cryptocurrency looks shady, and it would likely be a good way for a scammer to steal cash. But, I've been on the phone with them a few times and they continue to block my transactions. I havent been able to buy anything, and I've been trying for 2 weeks now. I'm convinced that TD Bank must have an anti-cryptocurrency stance, and they block these transactions for strategic reasons (i.e., they feel that cryptocurrency might someday challenge our banking systems, so banks want to make using crypto as inconvenient as possible). That's a little bit of a conspiracy theory.
The major cryptocurrency exchanges (which you use to buy these coins) now have my account blocked because they think I'm a scammer. I guess sending through a few transactions that get blocked by the bank doesn't look so good to them. I don't blame them, but it's got me very stuck.
Also, while making this post my hard drive filled up. Geeeez.
It’s time for another Machine Learning update. This one is only tangentially related to Machine Learning. In this post, I am going to spill the beans on how I made 46 cents in only 12 hours – and I only had to pay an up-front cost of about $280 to make it possible!
About a month ago, I bought a new graphics card for $280 to use for neural network training. It’s a weird thing, but in addition to rendering computer graphics, graphics cards are also very good at performing large computations that require a lot of “parallel processing”.
There is another thing that requires a lot of parallel processing – and that’s mining cryptocurrency. What is a cryptocurrency? – and what does it mean time “mine” them? - both legitimate questions that I honestly didn’t have great answers to about a week ago. But I spent some time learning, and I just mined my first ever 46 cents worth of cryptocurrency over the last 12 hours.
You’ve probably heard of Bitcoin, which is the most famous cryptocurrency. Or perhaps its infamous, because it got a lot of news coverage for being an “anonymous” currency that could be used to buy illegal things. I initially wrote a lot about this controversial aspect of bitcoin, but decided to pull it from the post because it's just not that interesting.
In a general sense, cryptocurrency is a decentralized electronic currency. The “decentralized” part means that no singular entity sets its value or manages a ledger. All transactions are traced by all users – so when Lisa pays Tony a bitcoin, literally every bitcoin user would be able to see it (if they wanted to). But they wouldn’t necessarily know that it was Lisa and Tony – they would just see that account A4E23B11 paid 1 bitcoin to account 676BC144.
The beating heart of all cryptocurrencies is a technology known as the “blockchain”. This was a breakthrough invention made by an unknown person (or group of people) under the pseudonym Satoshi Nakamoto. I will have an entire post to write about Nakamoto – maybe later this week. The blockchain is a giant database that is concurrently maintained by millions of users; it contains information such as how much money every user has, as well as a log of every transaction. Without going into too much technical detail, the blockchain is able to do accomplish this thanks to the work of “miners”.
Miners are people who dedicate their souped-up computers to the task of processing transactions and maintaining the ledger for the cryptocurrency. The ledger is essentially compacted using a very difficult-to-solve math problem that all miners’ computers labor at trying to solve. Solving it comes down to luck, but a faster computer can attempt to solve it more times per second than a slower computer. The lucky computer that succeeds at solving the problem first gets rewarded 12.5 bitcoins – and since 1 bitcoin is equal to roughly $11,500, that comes out to about $140,000. Not bad! One of these is solved about once every ten minutes. Take that, Powerball…
So, obviously, the chance of successfully solving this problem before anyone else is very small, especially with a cheap $280 graphics card. There are miners out there who have rooms full of purpose built mining rigs that sound like a jet engine taking off – their electric bills from mining alone can be upwards of $1,000 per month.
So I clearly didn't make $140,000 - but, you might be wondering how I made 46 cents. I did this by joining a large pool of miners. By joining the pool, I agree that if my computer finds the solution, I will split the profits with everyone else based on how fast everyone’s computers are in the pool. And if someone else finds the solution, they need to split it with me too. Well, some folks in my pool must have hit it, and me and my baby graphics card got our 46 cents worth!
Now, 46 cents in 12 hours shouldn't be coughed at. If I do some tweaking I could possibly get that up to $1.50 per day. That comes out to $550 per year – enough to cover the cost of the card, and then some. And that’s not taking into account the value growth that cryptocurrency is going through. 1 bitcoin used cost only $3 back in 2012. So there is growth potential.
I know that the geek is strong enough in this post as it is – but I need to take this one step deeper before I sign off. I’ve been using bitcoin as an example in this post because most people are familiar with the term “bitcoin” – but that’s far from the only cryptocurrency in existence.
The second most popular cryptocurrency is called “Ethereum” – and it takes the blockchain idea established by bitcoin and pushes it to the next level. The defining characteristic of Ethereum is that it allows entire programs and all sorts of other data to be stored within the blockchain – not just a ledger. I am having a hard time wrapping my head around the possibilities of Ethereum, but my gut reaction is that it could become big in the next few years. So, I chose to spend my time (and I earned by 46 cents) mining Ethereum rather than bitcoin.
© 2017. All rights reserved.