Friday 31 January 2020

Why is Python a language of choice for data scientists?

While there are numerous languages that a data scientist could choose from, however, the reason why most of us choose Python over others include
1. Python is the only general-purpose programming language, which is backed by a solid ecosystem of scientific computing libraries.
2. It has a simple syntax – similar to other programming languages.
3. Python allows for speedy prototyping and yes, did I mention that it is an undisputed king of Deep Learning.
Other reasons include…
4. All the other languages, which most of us may or may not use like R are better suited when we are doing statistical analysis. And my experience with Python tells me that it integrates better than any other languages presently used by some of us.
5. As a data science professional myself, I find Python simple, easy to use, highly readable backed with useful libraries making it an essential part of our data science toolbox.
6. As I said earlier, the language is natural to pick up, boasts of colossal community support and possess some of the most updated libraries, training and documentation.
7. Some of the significant Big Data platforms like Spark has Python APIs.
These are some of the reasons why I as a data science professional prefer Python over other languages available to me.

However, don’t take my word for it and see it for yourself what the data has to say about the popularity of Python for data science professionals like me.
Python clearly enjoyed the top positioned closely followed by Java, C++ and R. The industry experts predict that Python’s popularity could be because —
  • Of its assembly of specialized Deep Learning and Machine Learning libraries.
  • Of its tools like Scikit-learn, Keras, & TensorFlow that enable data scientists like me to develop data models that are sophisticated and could be directly plugged into a production system.
And 2020 and beyond would again be the year of Python as NASA, Google, Walt Disney Feature Animation are using Python as their scripting language.
I hope you have now understood why data scientists choose Python over other languages.

What's the difference between iterators and generators in Python?

Iterators and Generators are related in a similar fashion to how a square and rectangle are related.
That is, every generator is an iterator, but not every iterator is a generator.
Iterator in this scenario is the rectangle. Iterators are objects that use a next method to get the next value in a sequence. Say for example you wanted to create an iterator for the Fibonacci sequence. You might write,
  1. class Fib:
  2. def __init__(self, max = None):
  3. self.previous = 0
  4. self.current = 1
  5. def __iter__(self):
  6. return self
  7. def next(self):
  8. self.previous, self.current = self.current, self.previous + self.current
  9. return self.previous

Now we can call the .next() method on an instance of Fib. We have created an iterator. islice() can be used in various ways, such as printing the first 10 terms in the fibonacci sequence.
  1. >>> fibs = Fib()
  2. >>> for i in islice(fibs, 10):
  3. >>> print i,
  4. 1 1 2 3 5 8 13 21 34 55
A generator is a function that uses the yield statement to create an iterable.
  1. def fibGenerator(numTerms):
  2. first = 0
  3. second = 1
  4. for i in xrange(numTerms):
  5. yield first
  6. first,second = second, first + second
We have created a generator. We can use them as follows
  1. >>> fib_sequence = fibGenerator(10)
  2. >>> for i in fib_sequence:
  3. >>> print i,
  4. 0 1 1 2 3 5 8 13 21 34
When you use the xrange() builtin function, you are using an iterable.
So why use generators and iterables?
Well one cause is that its some distance more memory efficient. Lets say you had some big graph and you desired to follow some path and print out every cost alongside your walk. You may want to follow your course and store each fee along the walk, and then on the end you could loop thru the values and show the effects.

wordEmbeddingLayers() available in Deep Learning Toolbox?

Hello,   trying to run the  "Deep Beer Designer" , I got stuck on the use of  wordEmbeddingLayer()  which is flagged as an unknown...