Skip to content

Latest commit

 

History

History
176 lines (125 loc) · 3.59 KB

utils.md

File metadata and controls

176 lines (125 loc) · 3.59 KB

Utilities

In this section we document commonly used utility structures methods.

Interpolation Methods

DiffFusion.interpolation_methods

Polynomial Regression Methods

DiffFusion.PolynomialRegression
DiffFusion.polynomial_regression
DiffFusion.predict(reg::DiffFusion.PolynomialRegression, C::AbstractMatrix)
DiffFusion.multi_index(n::Int, k::Int)
DiffFusion.monomials(C::AbstractMatrix, V::AbstractMatrix)

Pice-wise Polynomial Regression Methods

We implement a piece-wise polynomial multivariate regression.

The method represents a combination of a simple decision tree model with polynomial regression on the leaf nodes.

For reference and motivation, see the following blog post.

We consider a data set of controls C of size (n,p). Here, n represents the number of features and p represents the number of observations.

A partitioning is represented by a multi-index π = (π_1, ..., π_n) with π_k > 0. Each π_k represents the number of partitions for the k-th feature.

The idea is to sort C by the values of the first feature. Then, we split the data set into π_1 partitions. For each partition the procedure is repeated with the second feature and following features.

As a result, we get a split of the full data set into π_1 * ... * π_n subsets. For each subset of data we calculate a polynomial regression.

For model prediction have a given data point c. We need to identify the subset and regression which is to be used with c. This step is split into the following sub-steps:

  1. Determine a multi-index α that identifies the subset.

  2. Determine a scalar index r via a total ordering of multi- indices.

The elements of α in step 1 are determined successively by means of a branching matrix Q. A branching matrix is of size (π_k - 1, m_k). Each column in Q represents quantiles that evenly split the calibration data set for the k-th feature.

In order to determine an element α_k from c_k in step 1 we determine the relevant column from the k-th branching matrix and compare c_k against the quantile values.

DiffFusion.PiecewiseRegression
DiffFusion.piecewise_regression
DiffFusion.predict(reg::DiffFusion.PiecewiseRegression, C::AbstractMatrix)
DiffFusion.partition_index(π::Vector{Int}, α::Vector{Int})
DiffFusion.sub_index(c_k::ModelValue, π::Vector{Int}, α::Vector{Int}, Q::AbstractMatrix)
DiffFusion.multi_index(c::AbstractVector, π::Vector{Int}, Qs::AbstractVector)
DiffFusion.branching_matrix(π::Vector{Int}, Alpha::Matrix{Int}, C_k::AbstractVector)
DiffFusion.partitioning(C::AbstractMatrix, π::Vector{Int})

Black Formula Methods

DiffFusion.black_price
DiffFusion.black_delta
DiffFusion.black_gamma
DiffFusion.black_theta
DiffFusion.black_vega
DiffFusion.black_implied_stdev
DiffFusion.black_implied_volatility

Bachelier Formula Methods

DiffFusion.bachelier_price
DiffFusion.bachelier_vega
DiffFusion.bachelier_implied_stdev
DiffFusion.bachelier_implied_volatility

Barrier Pricing Formulas

DiffFusion.black_scholes_vanilla_price
DiffFusion.black_scholes_barrier_price
DiffFusion.up_hit_probability
DiffFusion.down_hit_probability
DiffFusion.barrier_no_hit_probability