Ad

Thursday, December 28, 2017

Using Python Pandas to analyze and visualize financial data

Using Pythons pandas to analyze and visualize financial data http://pandas.pydata.org/pandas-docs/version/0.13.1/visualization.html Visual examples include multi axis plotting, subplots, bar chart, stacking bar chart, box plot aka candle stick plot, sample code making a scatter matrix, seaborn kernal density estimation (kde) plot, Andrew Curves, Parallel Coordinates, Lag Plot, AutoCorrelation Plot, Bootstrap Plot, RadViz, ColorMaps,

Shapeways Free 3D Model Checking Tool

Shapeways 3D printing shop / factory free 3D model checking tool, resource https://www.shapeways.com/getting-started/3d-tools

Wednesday, December 27, 2017

LRU Cache Android Development Pattern

Beyond understanding LRU aka least recently used cache for technical interview here is another reason to learn the technique: you can actually use this in Android development

https://youtu.be/R5ON3iwx78M

Tuesday, December 26, 2017

Kadane's Algorithm - Maximum Subarray Problem




The Maximum Subarray Problem using Kadane's Algorithm

https://en.wikipedia.org/wiki/Maximum_subarray_problem

History and Trivia of Kadane's Algorithm

The Maximum Subarray Problem using Kadane's Algorithm

https://en.wikipedia.org/wiki/Maximum_subarray_problem

Maximum Likelihood Estimation

https://en.wikipedia.org/wiki/Maximum_likelihood_estimation

Upon observing data, what is the likelihood of the original population distribution. 

Going on a tangent to Bayesian Statistics

https://en.wikipedia.org/wiki/Bayesian_statistics

Udacity video explains Maximum Likelihood Statistics Problems


Sebastian Thrun of Udacity explains Maximum Likelihood Estimator




Deriving Maximum Likelihood Estimator, Proof



Proof Mean MLE




Friday, December 22, 2017

Topics of Deep Learning with Tensorflow

Examples of Deep Learning: Deep Learning is widely used in Google for its features and apps such as Google Photo. More generally it is used for recognizing images, understand natural languages, helping robots interact with the world. Also computer vision and speech recognition, two of the hottest fields all fall into Perception.

Some technical terms you may encounter when studying deep learning Logistic Classification Stochastic Gradient Descent, Data and parameter tuning, Regularization, Convolutional Networks, Embedding, Recurrent Models

Understanding XOR in machine learning

An analogy of XOR is a person can not physically be at two places at the same time. So both of the input cannot be True. True XOR True is False. Another way to think about XOR is that XOR = OR - AND. That is to say XOR is everything OR stands for except the AND part.

Prepping the data, data preprocessing in machine learning

Post construction in progress. This is a draft.
Things to consider when prepping data:

Downloading data, extract unzip data
!wget -O url_to.tar.gz
!tar -zxf url_to.tar.gz -C folder
This is useful for command line. The exclamation mark is a prefix for command line commands to run in Jupyter Notebook

Use exploratory data analysis to understand the distribution of your data, helps scout out opportunity of regularization, normalization, feature selection and model selection.

If you have hundreds of features, feature selection can be very effective. Dimensionality reducFion can help simplify the data, generate better results, faster results. It also makes sense to only retain features that actually can predict the labels.

You can cut your dataset into even smaller more manageable subsets by sampling the data.

It’s a standard procedure to further divide the input dataset into train and test splits with shuffling. But some datasets do not do well with shuffling such as time series data. We cannot simply mix past data with present and future. 

Is data linearly separable? SVM can employ different kernels to handle non-linear data. RELU and Sigmoid also generates non-linear output.

Data Transformation

sklearn.preprocessing.Imputer Imputation transformer for completing missing values. Handling missing value, process and replace NaN with mean, median, most_frequent etc.


Celebrating 200000 views milestone

Thank you for your support! We have reached 200000 views! A true milestone. Continue to follow us for coding tutorials, silicon valley news, lifestyle and jobs at subscribe@uniqtech.co


Implementing a Trie in JAVA by Cracking the Coding Interview Author Tutorial Recommendation

This Trie tutorial in JAVA is by Cracking the Coding Interview (the bible of coding interview) author Gayle Laakmann Mcdowell for Hacker Rank Youtube Channel. The explanation is crystal clear and very helpful. Too bad it is not in Python, but it gets the idea across. 



Wednesday, December 20, 2017

Coin Change Problem with Memoization and DP by Cracking the Coding Interview Author Tutorial Recommendation

The key to the coin change problem is Dynamic programming coin change with and without the coin. Start from bottom up rather than largest denomination to small. 

This is another coin change problem tutorial we recommend. This one is by Cracking the Coding Interview (the bible of coding interview) author Gayle Laakmann Mcdowell. The explanation is crystal clear and very helpful. The only thing it didn't cover in depth is the idea of using a coin (reduce sum) and withholding a coin (not reducing the sum) while increasing the index to process the next coin. This is also a memoization and dynamic programming problem.







Previously we recommended Coin Change problem by O'Neill Code. That one uses a bottom up greedy approach to solve for smaller denominations. Then add the ways up as approaching bigger denominations. http://www.siliconvanity.com/2017/11/coin-change-problem-dyanmic-programming.html

Tutorial highlights

Visualize using a coin versus not using a coin

Gayle Laakmann Mcdowell helps visualize using a coin vs withholding a coin.

Visualize the need for memoization

Using 50 cents is equivalent to using two 25 cents. The same sub problem appears when the original problem is reduced. Amount is now 29 cents. If we don't use dynamic programming we will be repeating work. 
Hacker Rank tutorial video coin change problem
Other tutorials that cover the coin change problem include Geek for Geeks, Interview Cake (there are some pluses and minuses, the variable names are a bit hard to read, but the code has a python version!). Most sample codes are in JAVA.

Coin Change Problem with Memoization and DP by Cracking the Coding Interview Author Tutorial Recommendation

This is another coin change problem tutorial we recommend. This one is by Cracking the Coding Interview (the bible of coding interview) author Gayle Laakmann Mcdowell. The explanation is crystal clear and very helpful. The only thing it didn't cover in depth is the idea of using a coin (reduce sum) and withholding a coin (not reducing the sum) while increasing the index to process the next coin. This is also a memoization and dynamic programming problem.







Previously we recommended Coin Change problem by O'Neill Code. That one uses a bottom up greedy approach to solve for smaller denominations. Then add the ways up as approaching bigger denominations. http://www.siliconvanity.com/2017/11/coin-change-problem-dyanmic-programming.html

Tuesday, December 19, 2017

Insert with SQL — CRUD with SQL Database

Add information into a SQL table
INSERT INTO
tables_name
(col_1, col_2, col_3)
VALUES
(‘value_1’, ‘value_2’, ‘value_3’)
Tiny tutorials delivered to you by Uniqtech. We are bootcamp and beginner friendly. Learn to code with us!

Sunday, December 17, 2017

Serialization - A Crash Course - Best Serialization Tutorial

This video tutorial on Youtube is excellent it walks through the high level concept of serialization - compression, optimization and some common types of serialization like JSON YAML and XML. Great effort.



Getting started with Python Pickle Module for saving objects (serialization)

pandas.DataFrame.to_pickle Pickle can serialize any python objects. Everything in Python is an object so technically many python components can be pickled. The concept is we can save any object and data objects in python into pickle format, of which we can load later, much like csv. This is a very important data science tool, and is especially useful for working with pandas in machine learning and deep learning.

Turn a variable called my_dataframe, my variable name for a Pandas Dataframe into a pickle file with extension pkl.
my_dataframe.to_pickle(file_name)





This tutorial introduces the idea of pickling of Python objections, Python Dictionaries for better loading speed, optimization and note pickling is used in Machine Learning as well.

Unlike other serialization libraries, pickle can serialize (flatten or "preserve") most python objects. It is also different from JSON, which is human readable. Pickle is binary, hence it is fast to load and small to store.

Check out the official documentation for this detail. Source 1

Source 1 https://docs.python.org/3/library/pickle.html

Pandas Vectorized Methods - Intro to Data Science


This Udacity data vectorization video shows that Dataframe.apply(Numpy.mean) can be used to calculate column mean. Pandas allow easy vectorization of data charts. DataFrame['col_name'].map(lambda x: x==0) check each data cell in the column if it is equal to zero. DataFrame.applymap(lambda x: x ==0) will check each data cell in the entire dataframe.

Subscribe to our blog. We help discover the best tutorials on technology and programming subscribe@uniqtech.co we are beginner and bootcamp friendly.

Vector math is not only optimized, speed wise, it's also clean and elegant.

Bird Dog - Restaurants of Silicon Valley

Ultra modern, ultra abstract from plates to decors of flying wooden decoys / ducks, and ingredients, this place screams modern trend and  innovation. Chef Robbie Wilson worked at The French Laundry and Matsuhisa (Nobu Matsuhisa, hot hot hot in SoCal). Get Wagyu, Duck and other specialty dishes at this Palo Alto gem, in the heart of Silicon Valley. And dine here to brush shoulders with the giants! Literally ran into Mark Zuckerberg here. Well, he didn't put up a private screen while dining, we should also respect his privacy. According to Silicon Valley magazine, table No. 31 is the chef's table that overlooks all the open kitchen actions.

Visualize Random Uniformly Distribution of Data

Visualize what a random uniformly distribution of data would look like.

http://www.sthda.com/english/wiki/print.php?id=238
K Nearest Neighbor (KNN) lookup will have a hard time dealing with this distribution. It's practically random.

What's the difference between uniform and random? Here're two illustrations from Britannica that do the job of explaining. Visit their web page below.

https://kids.britannica.com/students/assembly/view/108151


Banking on Bitcoin - Netflix's New Documentary on Bitcoin

What is Bitcoin? Bitcoin for dummies? Netflix's new Banking on Bitcoin helps you get started learning about the crypto currency in hype.

If you are reading my blog, chances are you love technology, Silicon Valley and the clout of it all. Chances are you are aware that Bitcoin just skyrocketed and now it is even offered on the stock exchange for improved liquidity. This blog is not about investment, not about bitcoin but about Netflix's new documentary on the subject.

Banking on Bitcoin Netflix

This documentary features interviews with experts, enthusiasts and opportunists of this crypto currency. Subtitles including English, Spanish, Chinese and French! Think of as a quick overview of Bitcoin's past and future to get you started.
For those who studied Netflix's business model, you might be aware of netflix's strategy to target niche interests since its founding: indie films, documentaries, foreign cinema and more. Recently it really stepped up original series like House of Cards and Stranger Things. It nature documentaries reservoir is arguably the best on the internet, except it's not playing Planet Earth 2. Have you seen Tales by Light? It's gorgeous.  Have you seen Chef's Table? Delicious! What about that documentary on becoming Warren Buffet? Lovely narrative about nuances of Warren's life. This new documentary is definitely a perfect fit for this niche pipeline. Popular but not mainstream? You can probably find it on Netflix. Youtube too, but less interrupted on Netflix. These are not the Netflix and Chill movies though.

Startup Guide to Silicon Valley Tech - Books and Movies Recommendations

Moving to Silicon Valley? Looking for the next startup job gig? Here are some movies, documentaries and books you might want to watch and read before starting your journey to become an unicorn.

Know your unicorns

Not all unicorns are sexy startups. Here's a list of true unicorn companies by Wall Street Journal


Joining the next YC batch? How to get into Y Cominbator as told by insiders

First of all, probably follow Hacker News. Second of all, try to qualify for the annual Startup School. There is a female exclusive Female Founders Conference by YC as well. Here are some past highlights from YC Startup School.

http://www.siliconvanity.com/search?q=y+combinator
http://www.siliconvanity.com/2013/10/y-combinator-startup-school-2013.html
http://www.siliconvanity.com/2013/10/y-combinator-startup-school-2013_21.html


Have you heard of the No.1 Startup Accelerator in America and in the World? Yes, the investor of Dropbox, Airbnb, Reddit, Stripe, Zenbenefits, Instacart and Weebly - some of the biggest startup and "unicorns" in the Silicon Valley. They have only invested in 940 companies so far. The odds are high. Want to get into YC? Besides talking to real YC alumni and founders you should probably read these books. And of course the essays by the "godfather" of the startup world Paul Graham, former YC partner and chief.



The Launch Pad: Inside Y Combinator

A peel-the-onion view for looking inside the heart of Y Combinator, the most sought-after accelerator of the world.  Written by a New York Times Columnist and Stanford History PhD. It's a professionally written book looking at the seemingly chaotic world of startups.  Reviewed by world renowned venture capitalist  Marc Andreessen. 



Review

“Y Combinator is a national treasure, a Silicon Valley seed fund that is mass-producing new startups. Randall Stross’s behind-the-scenes look at YC offers a rare glimpse into what it really takes to conceive an idea and get it to market as quickly as possible. The Launch Pad is a must-read for anyone interested in the realities of modern entrepreneurship.”
—Eric Ries, author of the New York Times bestseller The Lean Startup
“The Launch Pad is an intimate look at the white-hot center of the new Silicon Valley star tup ecosystem. Stross’s account of the best new entrepreneurs and the exciting companies they’re building at startup schools is a great read for founders and would-be founders alike.”
—Marc Andreessen, cofounder, Andreessen Horowitz

About the Author

Randall Stross writes the “Digital Domain” column for the New York Times and is a professor of business at San Jose State University. He is the author of several acclaimed books, includingeBoys, Planet Google, and The Wizard of Menlo Park. He has a Ph.D. in history from Stanford University.

Guide to YC  - what's YC and how to get in by an alum


  


Paul Graham: The Art of Funding a Startup (A Mixergy Interview)


While you should probably just read  Paul Graham's essays for free from his renowned collection of well written essays - http://paulgraham.com/articles.html you can also buy this book compiled by professionals and publishing houses. 


While many in the silicon valley has laughed at the accuracy of these movies blow. They are rather sensational romantic stories about the Silicon Valley and founders who created empires here. We recommend the hit TV show Silicon Valley, The Social Network (Movie), and The Internship to get started romanticizing about becoming big in the Silicon Valley. 
  

These motion pictures surely are fun to watch quickly and get a sense of the startup culture in the Silicon Valley.


More startup bibles that you can read


Binge watching Silicon Valley (the TV show) already? We have the perfect book recommendations for you if you are finding "romance" in the Silicon Valley startup world. These are legit hustle blockbusters recommended by real Silicon Valley founders and YC alumni.

The Lean Startup by Eric Ries



Zero to One Peter Thiel Startup Venture Capitalist of the Year




The Startup Playbook: Secrets of the Fastest-Growing Startups from Their Founding Entrepreneurs



But ultimately remember Paul Graham the godfather and mafia chief of YC said focus on your product. Eat exercise and product. That's it. No books :)

Saturday, December 16, 2017

Make art with code

Make plotter art using AxiDraw a machine that looks like a prototype and still costs hundreds of dollars but is capable of holding pens and pencils make precision art of lines, pictures, patterns. Take any drawing or art, lettering and calligraphy, run it through a program that generates artistic data from your underlining image (example deciding which dots to plot in what pattern) and in 30 lines of code, you can get this 2D printer like machine to draw anything on paper.

Want to make tripy surreal art with Machine Learning? Google’s deep dream let you do just that. There’s a twitter account that highlights deep dream artworks. http://www.siliconvanity.com/2017/12/google-cs-first-teaches-you-how-to-make.html?m=1

Google CS First class teaches you how to make animated Google Doodles with simple codes.

Friday, December 15, 2017

Google CS First Teaches You How to Make Google Doodles Google Logos

This teach how to code, learn programming tutorial by Google teaches you how to create and animate Google Doodles, Google Logos that change on a daily basis to reflect current event and highlight heroes and accomplishments of the past.

How to make Google Doodles
You can learn to make caricatures (sprites) bounce, spin, ... animate them, change scenes change backgrounds and more. It's quite cool. https://csfirst.withgoogle.com/en/hoc2017

Subscribe subscribe@uniqtech.co follow us as we continue to highlight the best learn to code tutorials and experiences from learning to code to machine learning and beyond.

Wednesday, December 13, 2017

What is a Neural Network - Best Machine Learning Tutorials

Neural networks are important for ML as well as artificial intelligence and deep learning. This Youtube channel explains NN in depth. Take a look.



How to Rotate a Matrix by Gayle Laakmann McDowell - Author of Cracking the Coding Interview

Great tutorial highlights by author of the most popular technical interview prep book Cracking the Coding interview.





Personally because this particular problem is tedious I like to read blog format tutorials. I feel that written format works better for this question and the matrix spiral problem. This is one of the best video format I can find.

Reverse a Linked List in Python - Technical Interviews Programming Interview

Take a moment to think about what would the data structure of a linked list look like in Python.

class Node:
     def __init__(data):
          self.data = data
          self.next = None

Each element of the Linked List is a node which contains data and a next pointer.

We use pointer to indicate a Python variable, which is not the same as the * operator.

To reverse a Linked List, you have to recursively put the current head as the previous node, the list head will become the second to last element and points to None, while the list tail is now the new head.

It's assume that the Linked List has a head pointer just like all Linked Lists defined by its abstract data structure (ADS)

current = head
prev = None
next = None

while current:
     next = current.next
     current.next = prev
     prev = current
     current = next
return prev

It gets a bit confusing in the middle. It's important to remember that the previous pointer starts with None, because the old head points to None after being reversed. Next serves as a temp pointer, we need to temporarily store current.next, and change it to previous. Since we just completed processing the current node, we store it in the new prev variable, which has the current and new current.next.  Then store the next node as the current node. The order matters when assigning current.next and the new current.

Monday, December 11, 2017

Finding Repeats in an Array or a List - Technical Interview in Python Patterns

Practice using Hash map.

def find_repeat(numbers):
seen = set()
for n in numbers:
if n in seen:
return n
else:
seen.add(n)
return False #if no duplicate found

Instead of returning False, you can also raise an exception. Use this:
raise Exception('custom exception message here')

Getting started with theme development - theme development resources

Ready to make money on the internet? Well, hold your horses, it is not that easy, but developing themes is free to start, though time consuming to optimize, but once you have a product, you can deploy it on any platform. Here are some resources to get you started!

Free themes and giveaways can attract followers, ratings and get you started in the theme business

Shopify Theme and Shopify Partner Program

Shopify allows you to take a cut from retail store subscriptions and sell your themes. You can fetch up to $120 - $2000 dollars. 

Tumblr Custom Themes

Get inspired by Tumblr themes here https://www.tumblr.com/themes/
Get educated and get inspired. Tumblr themes go up to $49 dollars and more.
https://www.tumblr.com/docs/en/custom_themes

Know your artists

Animators and manga artists are thriving on Tumblr. If you were to monetize on tumblr, make sure you know your audience. Here's an example of an artist blog on Tumblr http://tzysk.tumblr.com/ Here''s another thousandskies.tumblr.com


What's a beginner friendly tutorial for getting started with theme development on Tumblr?

Apparently General Assembly Dash has a Tumblr Theme project. It guides you throw basic HTML and CSS and essentially that's what you need to get started. It will walk you through creating a basic bubble shaped profile picture and an input field to collect email addresses.

Amazon supports native ads on Tumblr

Technically Amazon supports banner displays and CPM ads on Tumblr but implementing it on the Tumblr side is a different issue all together. Pay attention Tumblr community guidelines and term of services is always the way to go.


Take Advantage of the Build-in Viral Factors

As someone who has done a lot of social media and content marketing, I think Tumblr has the most re-sharable form of blog posts. It's almost as instant as Favoriting a post. The newcomer with this prowess is Medium. Customize themes should not hinder this experience. In fact, it should highlight social shares and showcase them. 

Sunday, December 10, 2017

Great Adobe Tutorial : Basics of Smart Objects :: Photoshop Tutorial

Manipulate smart objects in Adobe Photoshop



Great Adobe Tutorial : Basics of Smart Objects :: Photoshop Tutorial

Manipulate smart objects in Adobe Photoshop



New Google Doodles Teaches Kids How to Code

Celebrating 50 years of kids coding and the learn to code movement, Google Doodle let's visitors play a mini bunny (rabbit) chases carrots game. Player will solve the puzzle using drag and drop (much like MIT Scratch and other beginner, kids friendly learn programming languages). It's easy for players to drag and drop loops, forward, turn left and turn right to command the bunny. The loop block is quite smart, can automatically resize based on how many other individual blocks it contain.  These puzzles are not trivial. To beat the levels, players need to experiment and think hard about the logic.



The real challenge is to get the optimal solution. If you have beat a level with the optimal route, you will get a ribbon!


You can access this coding game in the Google Doodles archive: https://www.google.com/doodles/celebrating-50-years-of-kids-coding

To learn more about learn-to-code resources, news and career job opportunities subscribe to our blog! We cover learn to code and we were featured on Fast company Venture Beat and TechCrunch!

subscribe@uniqtech.co
subject: Learn to Code

Saturday, December 9, 2017

Natural Language Processing with Python

A trick to test input type str.isalpha() str.isalnum()
For example 'a'.isalpha() == True -> True, '5'.isalpha() == True -> False
isalpha() only returns true if the string is completely alphabetical.
numbers need to use isalnum() which refers to is alpha numerical
More string type tricks here https://docs.python.org/3/library/stdtypes.html including how to check for spaces.

Friday, December 8, 2017

CS50 - Behind the Internet's most popular computer science MOOC class

Behind the massively popular CS50 class

Now the most popular computer science class in the history of computer science. Creator, however Professor David Malan has attracted over 1 million students World wide including Emerging tech hubs like India and Brazil. The Harvard professor attributes his success to newly found the popularity of computer science as a field,  but the editor and author of departure seems to think it is because of David's natural showmanship. He is very good at employing props and leveraging industry experts. His class has also attracted prominent guest speakers such as Facebook founder Mark Zuckerberg. David has turned this traditional content into the new online medium. Cs 50 really stands out among 7000+ MOOCs among coursera Udacity and edx emerged as 3 major platforms. 


The entire course lecture is free on Youtube. My personal favorites are CS50 shorts, excellent for quickly getting started on a new concept or reviewing an old one. Awesome CS50 shorts include Ruby on Rails, PHP, Sorting Algorithms and more.


The curriculum improves every year. The 2017 lecture series include:



https://www.youtube.com/watch?v=y62zj9ozPOM&list=PLhQjrBD2T3828ZVcVzEIhsHVgjANGZveu


The curriculum is comprehensive and informative. I recommend every bootcamp graduate and people learning to code, learning to program to quickly watch all lectures to solidify your coding foundation. Pro tip: use youtube 1.5x speed.


Python Dictionary, hash map a very useful data structure in technical interviews

When brainstorming solutions in an interview, the first thought is to start with a brute force solution, then what? Gaye of Cracking the Coding Interview mentions that hash map should be the first data structure to think about. It is incredibly useful and versatile, retrieval is only O(1) and space is at most O(n) because there is no repeat in keys. 

Median the undervalued summary statistics - technical interviews

Usually medians are quickly glossed over in college statistics classes and beginner coding courses. It's a simple concept : pick the middle number in a sorted dataset. Turns out that sorting is non trivial in large datasets so finding the median is harder in real life. Also know it depends on whether the dataset has even or odd number of data points. Recursively partition data by the median of subpartitions helps break sorted data into chunks that are easy to store and retrieve. It also makes binary search much easier.

A slightly challenging interview question is finding the median or two sorted arrays. The solution is nontrivial. 

Technical interview formats - programming interview at Google what to expect

IPInterview formats at Google for Software Development Engineer (SWE):

For the phone ingdrview:

It is recommended that the interviewee wears headphones in order to free hands for coding. 

Google Hangout audio or even video and Google Document (real time typing and pseudo code, code sharing). A fast internet connection is a must.

Make sure Hangout has access to your camera and microphone.

Choose a noise free environment. 

On-site interview includes whiteboard sessions and one lunch meeting. 

Statistics understanding why average can be misleading

Franklin Leonard responded to press secretary to explain statistics in layman's term. He say if 10 apples are given to 1 person, on average every one has an apple yet 9 people will be mad because the wealth, in this case apple is unevenly distributed. 

This does not have to be political. Often average or mean is not the only summary statistics reported. Median, variance, distribution are all helpful and present for good reasons.

Bitcoin and relationship joke

Here's an internet find: a girl named Kate dumped her then boyfriend John for working on Bitcoin when it was unknown and then this happened


Get it? You need to look at the dates too. She finally realized the grave mistake.

Thursday, December 7, 2017

String Manipulation in Python - Technical Interview with Python for Bootcamp Graduates

What would happen if you try to split an empty string? '' Will it throw an error?

''.split()

Answer:

-----
No. It will return an empty Python list array.
-----

What would happen if you try to join an empty array? [] Will it throw an error?

''.join([])

Answer:

-----
No. It will return an empty string ''.
-----


Make a cat class - Programming jokes

Here's a joke question to test your Objected Oriented Programming (OOP) skills. How would design a cat class? What are some of the features to consider?

Answer: my cat class should have functions that satisfy a cat's essential needs. Here's my pseudo code.

class cat:
eat()
sleep()
internet()


THE END

Integer Overflow in Python - Python for Technical InterviewsProgramming Interviews Series

How to handle large integers in Python?
Unlike other lower level programming languages. Python can dynamically resize arrays and integers to fit larger data. You are less likely going to run into integer overflow issues in Python. Also less likely going to have to worry about bit manipulation. What if this question comes up in an interview?

You can use float('inf') to represent positive infinity and - float('inf'), read it as negative infinity casted as a float, to represent really large negative number. Note you are casting the number as a float not as integer.

More familiar with the notion of MAXINT from JAVA? You can use an external module to cast integers. The module is called sys


import sys 
my_max_num = sys.maxint 
my_min_num = -sys.maxint


Here's a tip for beginners: why is this useful? Let's say you are asked to find a min in an array, which can contain both positive and negative numbers. You may want to initialize current_min as -sys.maxint

https://github.com/theoptips/technical_interview/blob/master/stock_profit_basics.py

Why not just set it equal to negative one? Well the array can contain other negative numbers smaller than one so that wouldn't work.

Uniqtech Technical Interview with Python series is geared towards learn to code, learn programming beginners and bootcamp grads. subscribe to our newsletter
subscribe@uniqtech.co
subject: technical interview with python

float('inf') will result in a floating point number. That's not always the desired result.  Turns out, we can also get a maxint estimate from the sys module.

>>> import sys
>>> sys.maxint
9223372036854775807

The above behavior is Python 2.x 
The difference between Python 2.x and Python 3 can be viewed here. https://stackoverflow.com/questions/7604966/maximum-and-minimum-values-for-ints

Wednesday, December 6, 2017

Reverse a Python List in Place


There are two easy ways to reverse Python in place shown in this beginner Python tutorial. 

l = [1, 5, 6, 2]
l.sort(reverse=True)
l.reverse()
Note .reverse() only reverse the order if there is an order in the first place like timestamp data.

There is also 
sorted(l, reverse=True)
l is just our list variable name. This is not an in place sort. It returns a copy! Remember to update your copy if you have changed or modified the list. 

Monday, November 27, 2017

Review Udacity Artificial Intelligence Nanodegree

I cannot recommend this nanodegree despite that the video lecture quality improved tremendously. The price tag of this series of nanodegrees is very pricey and will definitely not help you get jobs unless you are quite familiar with AI already. Most of the concepts covered in lecture, can be found on the internet in much cheaper and digestable forms. I wish I can get a refund in this course.

This is the first nanodegree I regret purchasing. I had positive experience with machine learning engineer nanodegree and digital marketing nanodegree. The first iteration of ML Nanodegree was not very cohesive but it was a really good overview as well as hands on experience for ML. I am surprised that the artificial intelligence one seems to have much higher quality course content but terrible result.

I thought I'd be getting started with AI playing with basic, fun, but informative projects. Nope just puzzles just printing out lines and lines of game board. While an important foundation of AI, there's no need to pay Udacity price tag. Udacity projects are supposed to be fun, real world, practical, and a new style of education. For puzzles, printing out game boards using dashes and dots, I can go to Coursera and many college courses to find that, better explained

Video quality has improved across the board

Professors and assistants from Georgia Tech is spearheading the teaching with a little bit of Luis Serrano here and there. Overall the lecture videos and animations are professional. They are updated, and professional, becoming more suitable for the price tag. The lectures by  the professor at Georgia is quite pleasant and well designed. They are great at explaining high level intuitions and concepts of AI. One minus is that the lectures don't translate to problem solving. They will not successfully prepare students for the problem sets and projects.

Projects are very dry and hard to get through

As explained below, the first installment is quite dry. Projects are difficult to go through. Without building a solid foundation, you are hit with a Sudoku puzzle right away. Sample codes are filled with cryptic python list comprehensions with poorly chosen variable names. Painful, purely painful. 

This nanodegree is an expensive rip-off

This nanodegree, like the SmartCar series are chopped into several semesters. Due to the difficulty level of the material, it is hard to obtain the full-set of skills in a single semester. It also means that you have to invest north of $1800 to complete the actual nanodegree. It's a deal breaker for me. Udacity is turning greedy for sure. It basically thinks it can charge you anything below a college degree or a graduate degree. It's important to realize that traditional academic expenses cover many resources, activities and experiences in addition to lectures.

The first installment of the nanodegree only scratches the surface of artificial intelligence

The first installment touches a little more than solving puzzles like Sudoku and basic games, while learning constraints problems, building a basic agent. While an important foundation, it is quite dry. I think it is quite tough for independent learners to go through this dry material. 

Again materials are stitched together

Udacity likes to patch materials together. While there's nothing wrong with recycling, the lectures are not always cohesive, and can be quite frustrating for students.

Career prospect is dismal

Career prospect of this nanodegree will be dismal unless you finish the entire series, which is quite expensive. The first installment just touches constraint resolution, backtracking, and advanced technical interviews, but does not give you enough toolset to solve it. I recommend getting tutorials online and studying technical interview problems related to puzzle, solving instead. The sample code in this nanodegree will not be appropriate for interview use. 

Overall, I do not recommend this course. Google for better education in natural language processing, artificial intelligence and more.

Sunday, November 12, 2017

What is Tensorflow? - Tensorflow for Dummies Google Tensorflow 101

What is Tensorflow

Tensorflow is a deep learning framework, and deep learning is a hot field of machine learning. It's like like rails is a framework for web applications and bootstrap is a framework for front end development.

More generally, Tensorflow is built for large scale numerical computation. Deep learning is one of its capabilities.

You can scale your machine learning code, with Google in the cloud by employing more than one core. Even use GPU and parallel processing.

Tensorflow computes gradients, a non trivial calculation, fast.

TF provides a library of machine learning APIs, models, scoring metrics, optimizer for machine learning. It also provide mathematical computation libraries and functions that support high dimension matrix calculation, manipulation for linear algebra.

Get a taste of Tensorflow for beginners here: https://www.tensorflow.org/get_started/mnist/beginners
Get a taste of Tensorflow for experts here: https://www.tensorflow.org/get_started/mnist/pros
Google Cloud app engine will soon offer Cloud ML

Matrix Vector Representation of an Image - Image Classification for Machine Learning

Each pixel intensity can be represented with RGB values - red green blue. See this Coursera Deep Learning MOOC by Andrew Ng. The RGB data of an image is known as the three 3 channels. Each is a matrix. We vectorize the RGB data into feature matrix X. Dimension length of X is = width_pixel  multiply by height_pixel multiply by number of channels 3. E.g. the digits in LSMNT  are 28 by 28 by 1 because they are black and white, so instead of 3 channels, it only has one channel.

Coursera Deep Learning MOOC by Andrew Ng Convolutional Neural Net

Udacity Offers Free Preview of its Deep Learning Nanodegree

"What will you create?" with Deep Learning? Previously the deep learning foundation is taught by Youtube star Sraj Raval, quite a personality, look him up! Luis Serrano head of Machine Learning at Udacity is revamping the series with a course developer - Matt. Luis is a machine learning specialist PhD who has taught, done research and worked as a Google Engineer. Matt has used datas science and python for his PhD work. They just offered a free preview of this Nanodegree. Here are some reviews, observations and commentaries.

Luis, Matt
will guide you through this Udacity
Deep Learning Nanodegree process

You can meet the instructors. Learn about Neural Networks including:

  • Convolutional Networks
  • Recurrent Neural Networks
  • Generative Adversarial Networks
  • Deep Reinforcement Learning. 

Real world projects of this nanodegree:

  • Create original art like Picasso, Hokusai (Japanese wood print painting), using deep learning transfer learning (though you can do this right now. Google Developer demo shows you how)
  • Teach a car to navigate in simulated traffic (Deep Reinforcement Learning)
  • Train a gaming agent to play Flappy Bird
There will also be stories about Sebastian Thrun's work at Stanford skin cancer detection by Alexis Cook. Understand how Sebastian's team devised this new life saving algorithm. Technically after learning Convolutional Neural Network (CNN) you can analyze medical MRI, X-rays and more. 


Exposure to technologies:

  • Keras
  • Tensorflow
Exposure to experts:
  • Sebastian Thrun
  • Google AI, Google Brain
Information covered in this nanodegree: CNN, RNN, GAN, Reinforcement learning, projects. See the infograph below


Deep Learning Nanodegree has 5 parts:


Introduction

Create art with transfer learning
Linear regression, machine learning

Neural Networks

Build simple neural networks from scratch using python 
Gradient Descent, backpropagation
Project 1, predict bike ridership using a NN
Model evaluation, validation, 
Guest instructor Andrew Trask author of Grokking Deep Learning
Predict text and predicting sentiment

Convolutional Networks

Computer vision
Build Convolutinal networks in Tensorflow
Project 2 use CNN to classify dog breeds
Build autoencoder with CNN
A network architecture for Image compression and denoising
Use pretrained neural network VGGnet to classify images of flowers the network has not seen, using transfer learning

Recurrent Neural Networks (RNN)

Transform sequences like text, music, time series data,
Build a RNN generate new text character by character
Natural language processing, Word embedding, Word2Vec model, Semantic relationship between words, 
Combine embedding and RNN to predict sentiment of movie reviews
Project 3: generate tv scripts from episodes of the simpsons

Generative Adversarial Networks (GANs)

Great for real-world data.
Generating image as in the CycleGAN project
Guest instructor Ian Goodfellow from CycleGAN implementation
semi supervised learning
training classifier with data with mostly missing abels. 
semi-supervised learning, a technique for training classifiers with data mostly missing labels.
project 4 use deep covolutional GAN to generate human faces.

 

Use Kindle Unlimited to Read Coding Interview Prep Books for Free!

Deep Reinforcement Learning

Artificial intelligence
AlphaGo by DeepMind, Video gaming agent, robotics
Design agents that can learn to take actions in a simulated environment
Project 5 Deep Reinforcement Learning agent to control several quadcopter flying tasks, including take-off, hover, and landing.

Learning Resources and support: there will be community forum, a slack channel and a waffle board.

https://www.udacity.com/course/deep-learning-nanodegree-foundation--nd101

Wednesday, November 1, 2017

Computer Science Tutorials for MBAs and Business Leaders

Amazing Computer Science tutorials for MBAs and Business Leaders by CS on Youtube
Link to the playlist
https://www.youtube.com/watch?v=WMYyD5zx9_c&list=PLhQjrBD2T383wBEMbMIpdWghyHVQU2wB_

Easy to understand, world class quality. Brought to you by the Harvard team that made the massively popular CS50 Series.

Behind the scene

Friday, October 13, 2017

MATLAB eBook on Machine Learning

Working on graduate study work? MATLAB now offers a free eBook on Machine Learning. Great resource for those in the academia.

https://www.mathworks.com/campaigns/products/display/machine-learning-with-matlab.html

For those not familiar with MATLAB, it is the definitive math software, great for matrix manipulation, used throughout college and graduate school labs. Solid software for any one pursuing a PhD in quantitate fields and advanced social science studies. Had to use MATLAB for my work at a Stanford Physics lab a long long time ago and also a few Physics PhDs still use it.  You can get a student discount (very substantial, lifetime license) from most US universities.

Coursera Announces Deep Learning Machine Learning by Andrew Ng new timeline

After releasing Course 1 of the Deep Learning specialization on Coursera, Andrew Ng's team is working on releasing the next few courses: Course 2, 3, 4 Convolutional Neural Network (Late October) and 5. Sequence Models (Late November). Course 1-3 are available right now on Coursera.

  • Course 1 Neural Networks and Deep Learning
  • Course 2 Improving Deep Neural Networks: Hyperparameter Tuning, Regularization, Optimization
  • Course 3 Structuring Machine Learning Projects
  • Course 4 Convolutional Neural Networks
  • Course 5 Sequence Models
For those new to the realm of Machine Learning, you will need CNN to do machine learning work on images. Sequence models are used for Natural Langue Processing and Audio models, pretty advanced.

My personal experience with the series so far: knowledgeable, info packed, still Andrew Ng talking one man team one man class, great sequel to his Machine Learning course, and the Udacity Machine Learning Engineering Nanodegree, but definitely need some background on ML techniques and NN. 

Ask me about this course, ask me about the Udacity machine learning engineering nanodegree. I have quite some in-depth experience with the two. 


https://www.coursera.org/specializations/deep-learning

Wednesday, October 11, 2017

Famous Machine Learning Datasets - Machine Learning Wiki

  • MNIST dataset, a collection of 70,000+ labeled digits, starting point of machine learning practice
    • Beginner Machine Learning data
    • Each image is 28 by 28 pixels so 784 data points per image
    • Pixel value 0 to 255. Grayscale, zero means black, 255 means white or completely lit
    • Often used in Google Tensorflow demos
    • sklearn provides this dataset too
    • Small images written by students teachers and government workers
  • Inception-v3 pre-trained Inception-v3 model achieves state-of-the-art accuracy for recognizing general objects with 1000 classes, like "Zebra", "Dalmatian", and "Dishwasher"
  • vgg19 image data
  • What is VGG-16?

    "Since 2010, ImageNet has hosted an annual challenge where research teams present solutions to image classification and other tasks by training on the ImageNet dataset. ImageNet currently has millions of labeled images; it’s one of the largest high-quality image datasets in the world. The Visual Geometry group at the University of Oxford did really well in 2014 with two network architectures: VGG-16, a 16-layer convolutional Neural Network, and VGG-19, a 19-layer Convolutional Neural Network."
  • Imagenet can output 1000+ classes. If we don't need that many, instead need transfer learning should consider replacing it with bottleneck of only 1-10 classes.
  • Youtube 8M Video Data Kaggle https://www.kaggle.com/c/youtube8m
  • 1000+ different objects in 1.3 million high resolution training images
  • cornell movie dialog https://www.cs.cornell.edu/~cristian/Cornell_Movie-Dialogs_Corpus.html
  • More famous datasets on github - amazing public databases https://github.com/caesar0301/awesome-public-datasets
  • “Twenty Newsgroups” The 20 Newsgroups data set is a collection of approximately 20,000 newsgroup documents, partitioned (nearly) evenly across 20 different newsgroups. To the best of our knowledge, it was originally collected by Ken Lang, probably for his paper “Newsweeder: Learning to filter netnews,” though he does not explicitly mention this collection. The 20 newsgroups collection has become a popular data set for experiments in text applications of machine learning techniques, such as text classification and text clustering.


Additional datasets, some famous some lesser known
  • Movie review https://grouplens.org/datasets/movielens/100k/ 100K ratings from 1000 users on 1700 movies
  • Datasets on Keras

Inception - Tensorflow Wiki


  • Google's state of art image classifier
  • Pre-trained
  • Open sourced
  • Trained on 1.2 million images
  • Training took 2 weeks

Sunday, October 8, 2017

Time your python script


  • Time it in the terminal
time file_name.py
  • Time it in your script

import time
start = time.time()

fun()

print 'It took', time.time()-start, 'seconds.'

Source:StackOverflow - https://stackoverflow.com/questions/6786990/find-out-time-it-took-for-a-python-script-to-complete-execution

You can now open Jupyter Notebook in Coursera! - this week in online learning

Open Jupyter Notebook in Coursera
As seen in this Michigan Data Science MOOC, Coursera now allows you to open and edit Jupyter Notebook right in the browser. Pretty amazing engineer! Truly the future of learning. Think of it as a super Codecademy.com

Saturday, October 7, 2017

Augmented Reality in Painting of Mona Lisa by Leonardo Da Vinci


Leonardo Da Vinci carefully studied the human anatomy of smiles and experimented with new painting techniques to create life like realistic smile of Mona Lisa. The smile is so illusive that it only is picked up by peripheral vision.

Thursday, October 5, 2017

Python Interview List Slicing

a = [1,2,3,4] 
a[0:3] 
-> [1, 2, 3] 

 a[0:3:2] # slice with increment of 2 
->[1, 3] 

 a[::-1] # reverse slicing 
->[4, 3, 2, 1] 

 t=(1,2,3,4,5) #slicing tuples 
t[0:4] 
->(1, 2, 3, 4) 

 t=(1,2,3,4,5) 
sliceObj = slice(1,3) 
t[sliceObj] ->(2, 3)

t[:]
-> returns a full copy of the list

Friday, September 22, 2017

Preview of Flying Car Nanodegree Program from Udacity

Udacity's Flying Car Nanodegree trailer featuring Sebastian Thrun, KittyHawk flying drones, flying smart cars and more.

Host an HTML website on Github in 5 minutes HD

Web development with Github in 5 minutes. Build your personal portfolio today.



Wednesday, September 20, 2017

Coding Interview Questions - OOP

Class definition



class Person(object): 
 def __init__(self, name, age): 
      self.name = name 
      self.age = age 
 def birthday(self): 
      self.age += 1

Note class name is capitalized. Initialization is the constructors where self.xyz defines class variables. Next def defines a function. Class functions take self as the default, 1st parameter.

Salary for Self Driving Car Engineer

How much salary can you make with a self driving car engineer degree? If you graduated from Carnegie Mellon University at the epicenter of self driving car testing in Pittsburgh, your starting salary can be as high as $200,000 a year. In general, graduates of the Computer Vision program at Carnegie Mellon are receiving offers north of $200K. Majoring in STEM programs really generate high rewards, now especially in computer science and specifically computer vision. See Time CNBC report on how to get a high salary as a self driving car engineer and/or work for Uber!  http://time.com/money/4946034/high-paying-jobs-college-vision-pittsburgh-uber/

Friday, September 1, 2017

Roomba and Machine Learning Artificial Intelligence for the cleaning robot



The latest Roomba 980 can scan room size, identify obstacles and optimize routes. This robot is equipped with state of the art sensors and cameras to scan the room, scan for obstruction and record odometry (used by wheeled robot to estimate distance traveled from a starting position). Its decision tree may work something like scan a small room 3x, a medium size room 2x, a large room for only once. source

It is equipped with infrared receiver for sensors such as cliff sensors and object sensors. It calculates the room size based on distance traveled. The wall sensor allows iRobot to travel closely along the wall.  The iRobot 980 camera can look forward and up at a 45 degree angle.



In machine learning, robot - the agent will interact with the environment, record each state and reward for moving into the next date, update a Q table with utility and eventually choose the best way to complete the task. Reinforcement learning such as that allows the robot to optimize its routes and maximize reward for completing a task based on a set of policies.

In reality, Roombas are forgetful (resets after each run) but it's getting advanced AI functionalities fast. With its existing cameras and image processing software, Roomba iRobot can map out your room with surprising precision. The camera and software in the  Roomba iRobot 980 device can navigate much better than its predecessors which move around semi randomly (at one point Roomba Red travels in spirals, the SPOT cleaning feature still looks a bit like that). 980 has vision! It does not recognize objects yet.

Roomba uses  simultaneous location and mapping or SLAM, an algorithm that takes significant time to optimize and is a lot to pack into a small device according to researchers at MIT. MIT professor John Leonard says Google self driving cars already use navigation systems based on SLAM technology (the self driving car also made significant improvements and use a whole lot more data than SLAM for iRobot which a simple localization task only source).

This little robot is mapping out your room. With the newest Roomba connecting to WIFI and working with Alexa and Google Homes, researchers are concerned about data collection and privacy. The user has to keep Roomba offline or explicitly opt out of data sharing for the advanced wireless models. Albert Gidari, director of privacy at the Stanford Center for Internet and Society, told NYTimes that sharing such data will draw legal ramifications.
source

Did you know that iRobot was created by MIT alumni?

Roomba reached 655 millions in sales 2016. (source)
https://uniqtech.tumblr.com/post/164869166245/irobot-roomba-980-algorithm-machine-learning-slam

React UI, UI UX, Reactstrap React Bootstrap

React UI MATERIAL  Install yarn add @material-ui/icons Reactstrap FORMS. Controlled Forms. Uncontrolled Forms.  Columns, grid