Signal combinations are important in many fields, it is also important in portfolio construction, let’s find out why.

Not always

Suppose I have a portfolio (1) that returns 1% on even days and 0.5% on odd days:

Whenever people talk about Natural Language Processing(NLP), images of fancy machine learning models and prospects of powerful AI pop up. But nothing starts from nowhere, at the most rudimentary level, NLP is simply a collection of tools for processing textual data to makes them clean and more uniform. Let’s begin!

Clean up the sentence

First, let’s start with the a sentence:

`test001 = "01 Google Gains In Popularity, Soon Surpassing Apple"`

It’s a head line so all words are capitalized and there are punctuations, we need to clean them:

`# remove punctuations import string translator = str.maketrans('', '', string.punctuation) test002…`

As I accumulate more experience in coding and life in general, one of the things among my observations that stood out to me is that, whenever there is a problem to be solved, there usually exists a very intuitive solution to it. Sometimes this solution happens to be efficient, sometimes grossly suboptimal. This is especially noticeable in algorithms, because an algorithm is often times a conceptualization of a real life problem, and through the algorithm the essential elements of the problem is kept, allowing us to tackle the problem directly.

The largest rectangle in a matrix is one such problem…

When I first started learning to use Kalman filter, it seemed very complicated to me, mainly because there were so many inputs to it and you never really knew if you’ve set them correctly. By going through this example, I hope my readers will understand that the motivations and logic behind it is really very pragmatic in nature and not so complicated after all.

So let’s get started with our example.

I am dropping a tennis ball from a helicopter (or maybe my airship), I would like to predict its position in the air until it hits the ground.

Tarjan’s Off-line Lowest Common Ancestor Algorithm is an interesting application of the disjoint set structure for optimizing the performance of determining the lowest common ancestor(LCA) of two nodes within a tree, which also involves concepts such as caching and recursion. In preparation for this story, please refer to my previous story on Lowest Common Ancestor for context.

Ok, let’s get started!

In order to understand this algorithm, we first have to have a good grasp on the concept of disjoint sets…

*Disjoint sets are collections of nodes, where there is no overlap between sets.*

Sounds simple, right? Actually, it is…

It is the lowest level parent shared by two nodes within a tree.

Let’s take a look at an example:

Normal distribution, also called gaussian distribution, is one of the most widely encountered distributions. One of the main reasons is that the normalized sum of independent random variables tends toward a normal distribution, regardless of the distribution of the individual variables (for example you can add a bunch of random samples that only takes on values -1 and 1, yet the sum itself actually becomes normally distributed as the number of sample you have becomes larger). This is known as the central limit theorem. …

A classic formulation of the problem would be:

If I were given a graph of nodes, each node is connected to several other nodes and the connections are of varying distance, what is the shortest path to every node in the graph if I start from one of the nodes in the graph?

In order to implement Dijkstra’s algorithm we first need to define a node and an edge:

`class Node:`

def __init__(self, value):

self.value = value

self.edges = set()

self.distance = -1

@staticmethod

def add_edge(a, b, dist):

a.edges.add((b, dist))

b.edges.add((a, dist))

In this case, I have defined a node…

In portfolio performance analysis, sharpe ratio is the usually the first number that people look at. However, it does not tell us the whole story (nothing does…). So, let’s spend some time looking at a few more metrics that can be very helpful at times.

Sharpe ratio is the ratio of average return divided by the standard deviation of returns annualized. We had an introduction to it in a previous story.

Let’s take a look at it again with a test price time series.

`import pandas as pd import numpy as np from pandas.tseries.offsets import BDay def daily_returns(prices): res =…`

New York government provides a large variety of datasets related to the city, making New York one of the best cities to do data analysis on (I love NYC!). For example: NYC OpenData. From driver applications data to rodent inspection, you can pretty much find any data you can think of…

The Coronavirus data we are going to look at today comes from NYC Health Department. It is a daily updated Github repository that contains NYC coronavirus cases data. All data shown below are as of date 2020–09–29.

Interesting pieces on various topics in finance and technology.