Generalized Linear Models
OptimizationProblems.GeneralizedLinearModel — Type
GeneralizedLinearModel{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 — Type
GLMFamilyAn abstract type specifying the partition function for a GLM.
(Bernoulli) Logistic Regression Problem
OptimizationProblems.LogisticRegression — Function
LogisticRegression(::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 — Type
Bernoulli <: GLMFamilyA structure specifying a Bernoulli response GLM.
Binomial Regression Problem
OptimizationProblems.BinomialRegression — Function
BinomialRegression(::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 — Type
Binomial <: GLMFamilyA structure specifying a Binomial response GLM.
Exponential Regression Problem
OptimizationProblems.ExponentialRegression — Function
ExponentialRegression(::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 — Type
Exponential <: GLMFamilyA structure specifying an Exponential response GLM.
Geometric Regression Problem
OptimizationProblems.GeometricRegression — Function
GeometricRegression(
::Type{T};
num_param::Int64,
num_obs::Int64,
name::String="Geometric Regression"
) where T<:RealConstructs a Geometric Regression problem with 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 uniform vectors on (0, 1/(num_param-1)). The response is a vector of type Int64 with non-negative values. Returns a GeneralizedLinearModel{Vector{Int64}, Matrix{T}, Geometric}.
GeometricRegression(; resp::Vector{Int64}, feat::Matrix{T},
name::String="Geometric Regression") where T<:RealConstructs a Geometric Regression problem with a user-supplied response vector, resp, and feature matrix, feat. Returns a GeneralizedLinearModel{Vector{Int64}, Matrix{T}, Geometric}.
OptimizationProblems.Geometric — Type
Geometric <: GLMFamilyA structure specifying a Geometric response GLM.
Linear Regression Problem
OptimizationProblems.LinearRegression — Function
LinearRegression(::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 — Type
Normal <: GLMFamilyA structure specifying a linear model with Normally distributed responses.
Negative Binomial Regression Problem
OptimizationProblems.NegativeBinomialRegression — Function
NegativeBinomialRegression(
::Type{T};
num_param::Int64,
num_obs::Int64,
max_successes::Int64=100,
name::String="Negative Binomial Regression"
) where T<:RealConstructs a Negative Binomial Regression problem with 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 uniform vectors on (0, 1/(num_param-1)). Each response is a pair of integers, (failures, successes). Think of repeating a trial that either fails or succeeds, and stopping once a set number of successes is reached. The second integer is that number of successes, picked at random from 1 to max_successes. The first integer is how many failures happened before stopping. Returns a GeneralizedLinearModel{Vector{Tuple{Int64, Int64}}, Matrix{T}, NegativeBinomial}.
NegativeBinomialRegression(
; resp::Vector{Tuple{Int64, Int64}},
feat::Matrix{T},
name::String="Negative Binomial Regression"
) where T<:RealConstructs a Negative Binomial Regression problem from a user-supplied response vector, resp, and feature matrix, feat. Each entry of resp is a pair of integers, (failures, successes). The second integer is the number of successes to reach, and the first is how many failures happened before reaching them. Failures must be non-negative and successes must be at least one. Returns a GeneralizedLinearModel{Vector{Tuple{Int64, Int64}}, Matrix{T}, NegativeBinomial}.
OptimizationProblems.NegativeBinomial — Type
NegativeBinomial <: GLMFamilyA structure specifying a Negative Binomial response GLM.
Poisson Regression Problem
OptimizationProblems.PoissonRegression — Function
PoissonRegression(::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 — Type
Poisson <: GLMFamilyA structure specifying a Poisson response GLM.