Generalized Linear Models
OptimizationProblems.GeneralizedLinearModel — TypeGeneralizedLinearModel{R, F, G<:GLMFamily} <: OptimizationProblemData for specifying the negative log-likelihood objective function for a generalized linear model.
Fields
name::String, the name of the problemcounters::Dict{Symbol, Counter}, a dictionary of symbols that identify a counternum_param::Int64, dimension of the optimization parameter.num_obs::Int64, the total number of observations.resp::R, the responses of the data of typeR, which will depend on the type of model being considered.feat::F, the features or explanatory variables of typeF, which will depend on the way features are stored.family::G, specifies the GLM family being considered
Constructors
LogisticRegressionFor details, see the docstrings for each function listed.
OptimizationProblems.GLMFamily — TypeGLMFamilyAn abstract type specifying the partition function for a GLM.
(Bernoulli) Logistic Regression Problem
OptimizationProblems.LogisticRegression — FunctionLogisticRegression(::Type{T}; num_param::Int64, num_obs::Int64,
name::String="Logistic Regression") where T <: RealConstructs a Logistic Regression Problem where the given number of parameters is num_param and the number of observations is num_obs. The feature matrix is a matrix of type T. It has a column of ones followed by num_param-1 columns of independent random normal vectors with mean zero and variance 1/num_param. The response vector is a randomly generated BitVector corresponding to a logistic regression model. Returns a GeneralizedLinearModel{BitVector, Matrix{T}, Bernoulli}.
LogisticRegression(;resp::BitVector, feat::Matrix{T},
name::String="Logistic Regression") where T <: RealConstructs a Logistic Regression Problem with the user-supplied response vector, resp, and feature matrix, feat. Returns a GeneralizedLinearModel{BitVector, Matrix{T}, Bernoulli}.
OptimizationProblems.Bernoulli — TypeBernoulli <: GLMFamilyA structure specifying a Bernoulli response GLM.
Binomial Regression Problem
OptimizationProblems.BinomialRegression — FunctionBinomialRegression(::Type{T}; num_param::Int64, num_obs::Int64,
max_trials::Int64=100, name::String="Binomial Regression") where T<:RealConstructs a Binomial Regression problem where the given number of parameters is num_param and the number of observations is num_obs. The feature matrix is of type T. It has a column of ones followed by num_param-1 columns of independent random normal vectors wih mean zero and variance 1/num_param. The response is a vector of integer pairs. The first integer in the pair is a non-negative integer representing the number of successes. The second integer in the pair is positive integer representing the number of trials which is randomly selected from 1 to max_trials. Returns a GeneralizedLinearModel{Vector{Tuple{Int64, Int64}, Matrix{T}, Binomial}.
BinomialRegression(;resp::Vector{Tuple{Int64, Int64}}, feat::Matrix{T},
name::String="Binomial Regression") where T<:RealConstructs a Binomial Regression problem with the user-supplied response vector, resp, and feature matrix, feat. Each entry of resp should be a pair with the first number indicating the number of successes and the second number indicating the number of trials. Returns a GeneralizedLinearModel{Vector{Tuple{Int64, Int64}, Matrix{T}, Binomial}.
OptimizationProblems.Binomial — TypeBinomial <: GLMFamilyA structure specifying a Binomial response GLM.
Exponential Regression Problem
OptimizationProblems.ExponentialRegression — FunctionExponentialRegression(::Type{T}; num_param::Int64, num_obs::Int64,
name::String="Exponential Regression") where T<:RealConstructs an Exponential Regression problem where the given number of parameters is num_param and the number of observations is num_obs. The feature matrix is a matrix of type T. It has a column of ones followed by num_param-1 columns of independent random vectors whose entries have uniform distirbution (0,1/num_param). The response vector is a randomly generated vector of type T corresponding to the exponential regression model. Returns a GeneralizedLinearModel{Vector{T}, Matrix{T}, Exponential}.
ExponentialRegression(; resp::Vector{T}, feat::Matrix{T},
name::String="Exponential Regression") where T<:RealConstructs an Exponential Regression problem witha user-supplied response vector, resp, and a feature matrix, feat. Returns a GeneralizedLinearModel{Vector{T}, Matrix{T}, Exponential}.
OptimizationProblems.Exponential — TypeExponential <: GLMFamilyA structure specifying an Exponential response GLM.
Linear Regression Problem
OptimizationProblems.LinearRegression — FunctionLinearRegression(::Type{T}; num_param::Int64, num_obs::Int64,
σ::T=T(1), name::String="Linear Regression") where T<:RealConstructs a Linear Regression problem where the given number of parameters num_params and the number of observations is num_obs. The feature matrix has elements of type T. The feature matrix is a column of ones followed by num_param-1 columns of independent normal vectors with mean zero and variance 1/(num_param-1). The response is a vector of type T. The value of σ specifies the standard deviation of the responses. Returns a GeneralizedLinearModel{Vector{T}, Matrix{T},Normal}.
LinearRegression(;resp::Vector{T}, feat::Matrix{T},
name::String="Linear Regression") where T<:RealConstructs a Linear Regression problem with a user-supplied response vector, resp, and feature matrix, feat. Returns a GeneralizedLinearModel{Vector{T}, Matrix{T}, Normal}.
OptimizationProblems.Normal — TypeNormal <: GLMFamilyA structure specifying a linear model with Normally distributed responses.
Poisson Regression Problem
OptimizationProblems.PoissonRegression — FunctionPoissonRegression(::Type{T}; num_param::Int64, num_obs::Int64,
name::String="Poisson Regression") where T<:RealConstructs a Poisson Regression problem with the num_param parameters and num_obs observations. The feature matrix has elements of type T. The feature matrix is a column of ones followed by num_param-1 columns of independent normal vectors with mean zero and variance 1/(num_param-1). The response is a vector of type Int64 with non-negative values. Returns a GeneralizedLinearModel{Vector{Int64}, Matrix{T}, Poisson}.
PoissonRegression(;resp::Vector{Int64}, feat::Matrix{T},
name::String="Poisson Regression") where T<:RealConstructs a Poisson Regression problem with a user-supplied response vector, resp, and feature matrix, feat. Returns a GeneralizedLinearModel{Vector{Int64}, Matrix{T}, Poisson}.
OptimizationProblems.Poisson — TypePoisson <: GLMFamilyA structure specifying a Poisson response GLM.