Why is Python beautiful?
Amazing thing about Python is its syntax, its expressiveness, simplicity. A simple HTTP Server : >>> python -m SimpleHTTPServer A full web server: >>> python -m CGIHTTPServer Downloading YouTube videos (Awesome PyPI) >>> pip install youtube-dl >>> youtube-dl "<video_url>" Finding the longest line in a file: >>> max(open('file.txt'), key=len) Its simplicity >>> 'git' in 'github' True >>> 'yes' in 'no' False Sum the digits in an unsigned integer: >>> sum(map(int, str(num))) The prettiest of them all, which conveys a lot about Python's expressiveness : Swapping : >>> a, b = b, a
Explain the difference between discriminative & generative models.
A generative algorithm models how the data was generated in order to categorize a signal. It asks the question: based on my generation assumptions, which category is most likely to generate this signal? Whereas, a discriminative algorithm does not care about how the data was generated, it simply categorizes a given signal. E.g.- Suppose we would like to classify a speech to a language. We can do it either by: 1) Learning each language and then classifying it using the knowledge we gained OR 2) Determining the difference in the linguistic models without learning the languages and then classifying the speech. The first one is the Generative Approach and the second one is the discriminative approach.
Explain one lesser known but useful data structure.
TRIE data structure Trie is the data structure very similar to Binary Tree. Trie data structure stores the data in particular fashion, so that retrieval of data became much faster and helps in performance. The name "TRIE" is coined from the word retrieve. What are TRIE data structure usage or applications? 1. Dictionary Suggestions OR Autocomplete dictionary Retrieving data stored in Trie data structure is very fast, so it is most suited for application where retrieval are more frequently performed like Phone directory where contact searching operation is used frequently. 2. Searching Contact from Mobile Contact list OR Phone Directory Auto suggestion of words while searching for anything in dictionary is very common. If we search for word "tiny", then it auto suggest words starting with same characters like "tine", "tin", "tinny" etc. Auto suggestion is very useful and Trie plays a nice role there, Lets see real time use. If say, Person doesn't know the complete spelling of the some word but know few, then rest of words starting with few characters can be auto suggested using TRIE data structure. For proper reading, we can go through https://en.wikipedia.org/wiki/Trie