This week I read Effective C++ Second Edition, because it was on the bookshelf at work. This book was published in 1998, which was around the time I learned C++. I have about 20 years of programming experience. Wow, I’m old. After going through book, I realized I had a really good programming instructor, because most of these tips were ingrained into me by Mr. Simon. Although the book is good, you should probably read the newer edition of the book. I don’t think they program C++ now the same way they did in the 1990s. Some books describe a programming language. This book shows you best practices when using the language.
Recently, I’ve been thinking about the ephemeral aspect of things. When you’re young, you don’t really think about it. Nothing is forever. Sorry babe, diamonds aren’t forever. That is just De Beers brainwashing since the 1930s. I used to think about things as if they will last forever. Compared to my short lifespan, most things might as well last forever. Once you realize that longevity is finite, you start thinking about trading longevity for performance. Performance comes at a price.
I started thinking about F1 cars and how they have to rebuild the engine after each race and replace the tires often. Track days are expensive when you are eating tires. The barrels of railguns get damaged with every firing.The more performance, the sooner you have to replace it. I wonder if reusing SpaceX rockets is viable.
Everything eventually wears out. You have to be aware of it. You start losing your vision. You stop being able to recover from your injuries. Your body starts dying. Your heart only has so many beats left before it fails. Marie Kondo in The Life-Changing Magic of Tidying Up talks about appreciating items for the utility they provide. Knowing that my time is finite make me more appreciative.
Strategies for Engineered Negligible Senescence
I should definitely chat with Audrey de Grey the next time I see him carrying a six pack down the street. Although, I think they closed the liquor store.
This week I read The 10% Entrepreneur, because it is the in thing to give your classmates free copies of your book to read and if you don’t read it, I’ll do it for you. Patrick J. McGinnis, originator of FOMO (fear of messing out), got screwed by playing it safe in life. He did everything he was supposed to do, get a Harvard MBA and a job at a company that was too big to fail, AIG. The thing is we know we are supposed to diversify our stock portfolio, which is an investment of our assets, but working for one company doesn’t yield any diversification. Adding an little entrepreneurship to the mix is an insurance policy. Everyone wants to be an entrepreneur, lured by rags to riches origin stories. I’ve learned that these origin stories are written after the fact by marketing forces. In reality most of the work done for the Apple computer was in Wozniak’s cubicle at HP. I learned in Founder’s At Work that he explicitly got written approval from HP that there was no conflict of interest. This book is written for people with good jobs and good skills who are willing to invest a portion their financial and intellectual capital for long term gains. Not very helpful for someone who is poor and stupid, but I finished the book anyway. Being a 10% Entrepreneur is to make small investments that provide for long term growth personally, financially and professionally.
5 Reasons Not to be a Full-time Entrepreneur
- The lifestyle is lousy.
- You can ruin your finances.
- You’re abandoning status and affirmation.
- You don’t have the right idea (yet).
- Failure sucks.
If you’re reading this book, you probably aren’t considering being a full time entrepreneur anyway. Having a base and steady income gives you something to invest from. Whatever you do, should be synergetic with your current job.
5 Types of 10% Entrepreneurs
- The angel – give money
- The advisor – give time
- The founder – hire other people to do things
- The aficionado – motivation more passion than profit, could be either of the above
- The 110% entrepreneur – side company, too many ideas
There is a difference between freelancing and being an entrepreneur. Being an entrepreneur is about thinking and acting like an owner of the business. A freelancer is a contract employee. I think the difference is cash vs stock.
The 10% Plan
Throughout the book, Patrick provides six exercises to put you on the path toward being a 10% entrepreneur.
- Managing Time
- Managing Financial Capital
- Opportunity Cost Zero: What Do You Want to Do?
- Writing Your Professional Biography: Your Intellectual Capital
- Crafting Your Pitch
- Building Your Team
You need to carve out time, so you have something to invest. You can multitask and cut out things like social media. If you have money, how much are you willing to invest? If you could do anything regardless of opportunity cost, what would you spend your time and money on? How do you want other people to see you as? You should craft your biography to give an overarching theme that is consistent. The pitch is about relating your biography to what you hope to achieve in your 10%. Since you’re only in at 10%, you can’t do it alone. You need to connect people together and hope it pays itself forward. Your network will strengthen over time. I should probably be really good friends with an accountant and a lawyer.
How to Reach Out
- Use personal email
- Be cordial and succinct
- Personalize the text
- Never send a form letter
- Highlight any shared points of interest or mutual contacts
- Make a specific request—no one wants to trade endless messages to get your “ask”
- Offer to help with anything they might need in return
- Always say please and thank you
- Follow up on outstanding items
- Be responsive
- Stay in touch and share news of future developments.
The #1 thing on this list that I’ve learned from reaching out to people is that you need to make a specific request. Once they know your specific request, they know how to help you or steer you in the right direction.
People will choose to work with you based on your track record and the quality of your references.
Your reputation is your most important asset. When you have nothing, there’s only your reputation left to lean on. You don’t want to lend your name to a company who will drag it through the mud. Even experienced people make that mistake. If someone googles you, what do you see? Patrick calls this the Google test.
You Googled them! You Googled them! Well, Google me, motherfucker! —Navy SEAL, Living with a SEAL
Once you build some reputation, you can keep leveraging it to increase your reputation. Patrick bootstrapped his online writing presence with his blog and then cold-calling Huffington Post to become a writer for them.
Also, you shouldn’t trust reputation blindly. Patrick describes VCs as wildebeest. Do your own due diligence.
Some entrepreneurs bet on long term trends and try to ride those waves. One of these trends is the decriminalization and legalization of cannabis for medical purposes. It is expensive to grow plants indoors under artificial conditions. We should harness the life giving energy the sun gives off to grow cannabis for cheaper and undercut Mexican drug cartels with higher quality product. Economics affect behavior. If you can change the economics of things, then you can change behavior when the incentives change. The problem is where is the best place to grow cannabis.
Plants are sensitive to weather conditions, so I will choose the best place to grow based on weather conditions. But where to get weather data. There’s the Weather Underground API, but it is not setup for bulk data analysis. I need a big data dump. Thankfully our tax payer’s money goes to collecting weather data.
NOAA’s National Centers for Environmental Information (NCEI) is responsible for preserving, monitoring, assessing, and providing public access to the Nation’s treasure of climate and historical weather data and information.
I’m going to rely on Quality Controlled Local Climatological Data (QCLCD). The National Weather Service (NWS), Federal Aviation Administration (FAA) and Department of Defense (DoD) developed Automated Surface Observing System (ASOS), which provides standardized weather data at airports usually. Weather is pretty important if you’re flying. You can get the raw 1-minute and 5-minute ASOS data, but I opted to use the monthly QCLCD summaries, which have hourly aggregations also. The figure below shows the locations of all California weather stations in the QCLCD dataset.There’s a lot of data (wind speed, visibility pressure, …), but I only opted to look at temperature for my analysis.
Cannabis Growing Conditions
After summarizing information I found on the internet, I’ll make a scoring metric based on weather. The weather is okay if the temperature is above 60 °F and below 95 °F with less than 20 °F fluctuation between day and night. Generally 70 – 85°F is good, with preference for cooler temperature at night and when flowering. I’m going to count up the number of days for each weather station that satisfy that criteria.
Guam is the best place, with every day in 2015 meeting that criteria. Any place you would go for a tropical vacation would be great for growing cannabis if you’re only going by temperature. I only looked at 2015 data, because with climate change, past weather is not indicative of future weather. And I was lazy. If you’re trying to grow in California, the best place is sunny San Diego.
|41415||AGANA||GU||GUAM INTERNATIONAL AIRPORT||13.48333||144.80000||365|
|11641||SAN JUAN||PR||LUIS MUNOZ MARIN INTERNATIONAL AP||18.43250||-66.01083||363|
|11624||CHRISTIANSTED||VI||HENRY E ROHLSEN AIRPORT||17.69970||-64.81250||363|
|21510||KAILUA/KONA||HI||KONA INTL AT KEAHOLE ARPT||19.73556||-156.04889||363|
|11640||CHARLOTTE AMALIE||VI||CYRIL E KING AIRPORT||18.33630||-64.98000||362|
|23188||SAN DIEGO||CA||SAN DIEGO INTERNATIONAL AIRPORT||32.73360||-117.18310||202|
Here’s the 2015 temperatures for Guam .
Here is the month of March zoomed in with hourly updates.
I wonder how optimal are the locations we grow things. Agriculture might be driven more by geopolitics than pure optimization. Weather also changes a lot by microclimate. Different parts of San Francisco vary drastically.
I could have spent more effort in creating a scoring metric that was more fine grained, but the simple metric was more than enough to tell me what I already knew, some place with nice weather. Wouldn’t have thought of Guam, though.
- Legal marijuana causes Mexican drug cartel revenues to plummet (sfgate)
- Quality Controlled Local Climatological Data (QCLCD)
- What is ASOS?
- Automated Surface Observing System (ASOS)
- It’s Time for a New Approach to Marijuana (ricksteves)
- What Is The Best Temperature For A Marijuana Grow Room?
- Cannabis Temperature Tutorial
- Grow hack: day and night growroom temperatures
- Cannabis in Guam
Read more about cannabis.
This week I read Zero Waste Home by Bea Johnson, because one day I hope to be rich enough to afford to be zero waste. This book has some tinges of the philosophy found in The Life Changing of Magic of Tidying Up, but it feels like Bea’s feelings of focus and uncluttering was a byproduct of her trying to achieve zero waste. This book is more about the tips to replace makeup, household cleaning supplies, grocery shopping, etc. Some are practical, some I find too extreme. I’m not going to bring jars to the fish counter, but I might try some of her vinegar based cleaning solutions. I learned that going commando is wasteful, because you need to wash your clothes more, so I should wear underwear and you should too. Bea admits her methods were a little extreme, like making her own butter, but even she had to relent on having video games in the home, because her children were spending more time at their friend’s place.
The 5 Rs
A zero waste lifestyle involves applying the 5 Rs to all aspects of your life.
- Refuse – Don’t bring home crap that will take up space that you need to throw away later. How many free pens do you need?
- Reduce – Decrease consumption
- Reuse – Use reusable containers. Try the ancient Japanese art of Furoshiki to wrap presents with cloth.
- Recycle – Municipal transforming of old material into new material
- Rot – Compost
People lived a zero waste lifestyle back in the days. We only became wasteful as we opted for more conveniences in life. I think it is good to look at the trash we throw away and see how we might mitigate that. I don’t aim for zero waste, but I aim for focus and clarity in life. If reducing waste helps you in that respect, go for it.
Mary had back pain from sitting in the office all day. The doctor prescribed some medicinal cannabis for her, but she didn’t know where to start. She didn’t know the differences between the strains, so she ended up choosing strains based on the names. She liked Jimi Hendrix, so choose Purple Haze. Girl Scout Cookies sounded good, but she was health conscious. Purple Haze was good, but Mary was still curious about the other strains. She had a hard time choosing between the 2000 strains listed on leafly. It was overwhelming. Mary asked Jane for advice. Jane brought Mary to me, so I decided to help them out by writing a recommendation engine.
The modern web is built on recommending you things that you like to get you to buy more stuff. Recommendations are the engines of commerce. If you find cannabis that suits you better, your satisfaction will increase and you’ll buy more of it. It is about recommending things specifically for you based on your preferences. If you don’t tell me what you like, then I have nothing to go on. I told Mary she needed to get me more data to work with if she wanted recommendations.
The technique I am going to use is based on giving ratings to movies. Intuitively it works like this. If I like movies A, B, and C and someone else likes movies A, B, C and E, then I have a good chance to like movie E also. But intrinsically there are some characteristics that can describe those movies. Maybe all those movies are science fiction movies or maybe they all have the same director. Collaborative filtering tries to infer those characteristics by using the ratings of many people using math. Once you infer the intrinsic characteristics of all the movies, you can score a person’s preferences toward those characteristics to provide a personalized score.
person <- degree of preference -> intrinsic characteristics <- degree of possession -> movie
The method I use below is based on alternating least squares, which goes back and forth between person and movie trying to figure out what the intrinsic characteristics are.
Data at a Glance
Everybody gets high sometimes, you know —Justin Bieber
First thing you need to do is to take a look at the data and check if it is sane or not. Leafly lists about 2000 different strains. My review data set consisted
- 148,034 reviews
- 1,801 strains
- 61,446 users
The reviews were on a 5 star system. The most reviewed strain was blue dream.
Most of the users only wrote a review for 1 strain. This is not very helpful. You want to review at least 2 strains, so I can form relationships between strains.
Things look a little better if I look at number of reviews per strain. There are quite a few strains with over 100 reviews and only a handful of strains with only 1 review.
Okay. People have rarely met a strain that they didn’t like. If I returned 5 as a prediction for every strain, I’d be right most of the time. I could split the difference and guess a 4.5 rating. This is not very helpful. You can’t provide good recommendations if people like all strains. It would be better to provide recommendations based on descriptions of the strain and its effects rather than user ratings.
I literally wrote a recommendation engine in 10 lines of code using the Apache Spark 2.0.0 prebuilt binary for Hadoop 2.7, the latest release at the time of writing.
rdd = sc.parallelize(dataset) ratingsRDD = rdd.map(lambda p: Row(userId=int(p), movieId=int(p), rating=float(p))) ratings = spark.createDataFrame(ratingsRDD) (training, test) = ratings.randomSplit([0.8, 0.2]) als = ALS(maxIter=20, regParam=0.01, userCol="userId", itemCol="movieId", ratingCol="rating") model = als.fit(training) predictions = model.transform(test) predictions = predictions.na.drop() evaluator = RegressionEvaluator(metricName="rmse", labelCol="rating",predictionCol="prediction") rmse = evaluator.evaluate(predictions)
No longer are the days where I have to debug matrix elements in numpy. Practical production machine learning is now all about hyperparameter tuning and model design. For ALS, there is the rank and regularization parameters. You can think of rank as the number of intrinsic characteristics you want to represent your strain. Regularization is to prevent overfitting.
Yoga also helps with back pain.
- Spark SQL, DataFrames and Datasets Guide
- Collaborative Filtering – RDD-based API
- Scalable Collaborative Filtering with Apache Spark MLlib (databricks)
- RecCanna (github)
- Stanford CS229 Machine Learning
- Machine Learning (coursera)
This week I read The Visual Handbook of Building and Remodeling, because the previous book on building a home didn’t have anything about electrical and plumbing. Notice how both books are visual in nature. Easier to look at pictures and point rather than trying to read text. This book talked more about design and regulations, which is a good thing. Regulations are important. They are there, because someone died. Kids so often want to remove themselves from the gene pool by sticking their heads between railings, climbing railings and falling from the third floor or dropping from a window. When you are remodeling a building, you need to be able to picture how people will interact with their surroundings when you’re finished. Sometimes it is easier to gut the place and remodel it. Especially if you have neighbors trying to throw a wrench into things.