Month: July 2018

How to Calculate the Standard Deviation of a Numpy Array?

Daily Data Science Puzzle [python] import numpy as np temp_sensor = np.array( [ 18, 22, 22, 18 ]) mean = np.mean(temp_sensor) std = np.std(temp_sensor) print(str(int(mean – std)) + "-" + str(int(mean + std))) [/python] What is the output of this puzzle? *Intermediate Level* (solution below) Numpy is a popular Python library for data science for …

How to Calculate the Standard Deviation of a Numpy Array? Read More »

Python Numpy 101: How to Calculate the Row Variance of a Numpy 2D Array?

You can play with the following interactive Python code to calculate the variance of a 2D array (total, row, and column variance). Here’s another practical example: [python]import numpy as np # stock prices (3x per day)# [morning, midday, evening]APPLE = np.array([[50,60,55], # day 1[60,60,65]]) # day 2 # midday variancey = np.var(APPLE, axis=0)[1] print(int(y))[/python] What …

Python Numpy 101: How to Calculate the Row Variance of a Numpy 2D Array? Read More »

[2-min CS Concepts] A Rapid Introduction to the PubSub Communication Pattern

Did you check the news today? Or receive an email newsletter from a company? This type of communication is one way. Information flows from a publisher to the subscribers. The publisher creates information, the subscriber consumes information. Thus, computer scientists call this communication pattern publish and subscribe paradigm – pubsub. When consuming news, you seek …

[2-min CS Concepts] A Rapid Introduction to the PubSub Communication Pattern Read More »

A Case for Puzzle-based Learning Python

Overcome the Knowledge Gap The great teacher Sokrates delivered complex knowledge by asking a sequence of questions. Each question was building on answers to previous questions provided by the student. This more than 2400 year old teaching technique is still in wide-spread use today. A good teacher opens a gap between their’s and the learner’s …

A Case for Puzzle-based Learning Python Read More »

How to Calculate Variance of Python NumPy Arrays?

To calculate the variance of a Python NumPy array “x”, simply use the function “np.var(x)”. Here is an example: What is the output of this puzzle?*Intermediate Level* (solution below) Numpy is a popular Python library for data science focusing on arrays, vectors, and matrices. This puzzle introduces a new feature of the numpy library: the …

How to Calculate Variance of Python NumPy Arrays? Read More »

[2-min CS Concepts] A Rapid Introduction to Decision Trees for Machine Learning

Deep learning has become the megatrend within artificial intelligence and machine learning. Yet, training large neural networks is not always the best choice. It’s the bazooka in machine learning, effective but not efficient. A human will not understand in practice why the neural network classifies one way or the other. It is just a black …

[2-min CS Concepts] A Rapid Introduction to Decision Trees for Machine Learning Read More »

29+ Killer Resources on How to Learn Python [Overview Article]

Python is one of the most popular programming language according to a recent Spectrum article. But why should you decide to enter the game as well and invest your scarce time in learning Python? For three reasons: Python developers are among the highest paid across all programming languages: on average you can expect to bring …

29+ Killer Resources on How to Learn Python [Overview Article] Read More »

[2-min CS Papers] A Short Overview of the Apache Spark System

Large companies analyze massive amounts of data coming from various sources such as social nets, weblogs, or customers. An important class of data analytics concerns large-scale set operations. Suppose you have two customer data sets A and B. Set A contains all customers who bought in 2017. Set B contains all customers who bought in …

[2-min CS Papers] A Short Overview of the Apache Spark System Read More »

[Numpy * Operator] Element-wise Multiplication in Python

How does element-wise multiplication of two numpy arrays a and b work in Python’s Numpy library? Simply use the star operator “a * b”! Here is a code example from my new NumPy book “Coffee Break NumPy”: Can you guess the output of this puzzle?*Advanced Level* (see solution below) NumPy is a popular Python library …

[Numpy * Operator] Element-wise Multiplication in Python Read More »