liveBook · Manning

Inner product

As explained in Build a Robo-Advisor with Python (From Scratch)

The dot product is an operation that sums the pairwise products of corresponding components of two vectors to produce a scalar.

A dot product multiplies corresponding components of two vectors and adds the results, producing a scalar. In portfolio construction, it computes expected return as the weighted average of asset-level expected returns: μₚ = w · μ = wᵀμ. section 2.2

Expected portfolio return

For a portfolio containing FE, WMT, and AAPL, weights such as [0.2, 0.3, 0.5] combine with the corresponding expected-return vector. NumPy’s @ operator performs the multiplication and summation, producing an expected portfolio return of 9.5% for the illustrated inputs. section 2.2

The same operation evaluates future outcomes in dynamic programming. For each wealth state and asset allocation, transition probabilities form a vector, and the dot product with future-state values gives the allocation’s expected value. section 6.2.1

How Build a Robo-Advisor with Python (From Scratch) covers it

How deep it goes
Defines the vector operation and implements it with NumPy, stopping short of broader matrix-multiplication details.
Examples
Uses FE, WMT, and AAPL weights for portfolio return, then evaluates wealth-state transitions against future values.
What it assumes
Assumes familiarity with vectors, asset weights, expected returns, transition probabilities, and value functions.
What you can do after
Apply it via NumPy to calculate portfolio returns and expected values for discrete allocation decisions.
How it connects
Connects vectors, expected return, portfolio construction, transition probabilities, value functions, and dynamic programming.

Also explained in

Compare how 12 books explain inner product →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Robo-Advisor with Python (From Scratch). The section links point to the parts of the book it draws on.