ProjectionPursuit
Documentation for ProjectionPursuit.
Functions
ProjectionPursuit.gensphere
— Methodgensphere(N::Int64, d::Int64)
Generate low discrepancy sequences of length N on a d dimension unit sphere.
Roughly speaking, a low discrepancy sequence is a sequence of samples of a random variable has the property that the number of points within a region is proportional to the size of the region.
This function returns a N-by-d matrix, where each row represents a sample of a random vector that is uniformly distributed on a d-dimensional unit sphere.
See Brauchart, Johann S., Josef Dick, and Lou Fang. "Spatial low-discrepancy sequences, spherical cone discrepancy, and applications in financial modeling." Journal of Computational and Applied Mathematics 286 (2015): 28-53.
ProjectionPursuit.fastgensphere
— Methodfastgensphere(N::Int64, d::Int64; par::Bool=true)
A faster way to generate lds of length N on a d dimension unit sphere.
Similar to gensphere()
. This function is much faster and support parallelism, but may degenarate when d is large.
ProjectionPursuit.fromsphere
— Methodfromsphere(theta::Vector{Float64})
Transform a d-dimensional spherical coordinate to the corresponding d+1 Cartesian coordinate.
See also tosphere
.
ProjectionPursuit.tosphere
— Methodtosphere(s::Vector{Float64})
Transform a d-dimensional Cartesian coordinate to the corresponding d-1 spherical coordinate.
See also fromsphere
.
ProjectionPursuit.ProjectionPursuitRes
— TypeProjectionPursuitRes
Returned object of projection_pursuit
or sphere_optimize
.
Fields
object_vals::Vector{Float64}
: projetion pursuit index. Analogous to eigenvalues in PCA.proj::Matrix{Float64}
: projetion pursuit direction. Analogous to eigenvectors in PCA.
ProjectionPursuit.sphere_optimize
— Functionsphere_optimize
Optimize a given objective fucntion constrained on a unit sphere.
See http://hdl.handle.net/10012/16710 for more detail.
Arguments
data::Matrix{Float64}
: each row contains an observation.object_fun::Function
: an arbitrary objective function defined on unit sphere.n_of_candidate::Int64=5
: number of candidate directions in the fine search step.unit_sphere=nothing
: the unit spehre can be pre-generated. By default a unit sphere will be generated automatically.proj=nothing
: previously found projection directions. Seeprojection_pursuit
.fnscale::Int64=-1
: maximize or minimize the objective function. By default equals -1, which means maximize objective function. If the objective function needs to be minimized, set tofnscale=1
.par::Bool=true
: run the program in parallel.fast::Bool=true
: generate the unit sphere using fast algorithm. Seegensphere
andfastgensphere
.
ProjectionPursuit.projection_pursuit
— Functionprojection_pursuit
Conduct dimension reduction corresponding to specified objective function.
See http://hdl.handle.net/10012/16710 for more detail.
Arguments
data::Matrix{Float64}
: each row contains an observation.object_fun::Function
: an arbitrary objective function defined on unit sphere.outdim::Int64
: target dimension of the output.n_of_candidate::Int64=5
: number of candidate directions in the fine search step.unit_sphere=nothing
: the unit spehre can be pre-generated. By default a unit sphere will be generated automatically.fnscale::Int64=-1
: maximize or minimize the objective function. By default equals -1, which means maximize objective function. If the objective function needs to be minimized, set tofnscale=1
.par::Bool=true
: run the program in parallel.fast::Bool=true
: generate the unit sphere using fast algorithm. Seegensphere
andfastgensphere
.