Open-access Can you beat logistic regression? The performance of four binary classifiers predicting premature birth

ABSTRACT

This paper presents a comparison of four predictive models for classification tasks: logistic regression, support vector machines (SVM), Gaussian process (GP) classification, and a model based on partial exchangeability. The models were evaluated using a dataset with 7 binary covariates, where 70% of the sample was used for training and the remaining 30% for testing. Predictive performance was assessed through three metrics: the area under the receiver operating characteristic curve (AUC), Brier score, and logarithmic score. Results show that, while the SVM model performed distinctly, the other three models exhibited similar performance, with logistic regression demonstrating the best overall results, though not by a large margin. Theoretical insights from de Finetti’s representation theorem for partially exchangeable data suggest that logistic regression can be seen as a specific case of a more general model, which captures the influence of covariates on the outcome probabilities. Furthermore, we explored the Bayesian counterpart of logistic regression, using a flat prior on the model coefficients, and found that its predictive performance was almost identical to the frequentist approach. Although logistic regression was the most effective model for this dataset, the paper discusses the advantages of more flexible models, like SVM and GP classification, which may be better suited for capturing complex nonlinear relationships in data. The results indicate that while logistic regression is a reliable, fast, and interpretable model, alternative models may outperform it in cases where complex interactions between covariates and the target variable exist. However, the results shown in Section 4 indicate that the dataset studied in this article most probably does not reveal complex nonlinear interactions between the covariates and the target variable.

Keywords:
classifier; logistic regression; Gaussian processes; partial exchangeability

1 INTRODUCTION

Logistic regression is widely regarded as one of the first binary classifiers introduced by 1, although Bliss originally proposed what is now known as the probit model. Despite this distinction, logistic regression became popular due to its ease of numerical implementation and the intuitive interpretation it offers. These qualities facilitated its adoption across various fields where the dependent variable is binary. The natural extension of logistic regression to multi-class classification further expanded its applicability.

Over the past few decades, advances in computational methods and hardware have spurred the development of other classifiers, particularly in the context of machine learning, where predictive accuracy is a primary concern. As a result, the performance of logistic regression has often been compared to that of newer techniques.

The goal of this study is to assess and compare the predictive efficacy of four binary classifiers, including logistic regression. The other classifiers are Gaussian processes for classification, support vector machines (SVM), and an inductive model based on partial exchangeability. To perform this comparison, we use a dataset containing information on 5,060 childbirths recorded in Maringá, Brazil, in 2017. The target variable is whether a birth was premature or preterm (i.e., before 37 weeks of gestation). Notably, the dataset is imbalanced, with only 11.8% of births being preterm. Moreover, all covariates are categorical. Given this setup, it is not immediately clear which model will demonstrate the best predictive performance. We use the area under the receiver operating characteristic curve (AUC), Brier and logarithmic scores as the evaluation metrics for the model comparisons.

Therefore, the main contributions of this work may be summarized as follows. First, it develops a unified perspective on binary classification inspired by de Finetti’s ideas on partial exchangeability, showing that common methods such as logistic regression and Gaussian process classification can be understood as particular cases of a broader probabilistic framework. Second, it adapts Gaussian process classification to settings with purely categorical covariates by indexing the latent function on all possible combinations and applying a Laplace approximation, which yields closed-form predictive probabilities. Third, it conducts a systematic comparison of four classifiers-logistic regression, Gaussian processes, support vector machines, and a partially exchangeable model on a real dataset of over five thousand births, using three complementary performance metrics. Finally, it shows that Bayesian logistic regression with weak priors has virtually the same predictive performance as its frequentist counterpart, thereby confirming in practice the theoretical link between these approaches.

This paper is structured as follows: Section 2 describes the dataset, while Section 3 provides an overview of the statistical models employed. Section 4 presents the prediction results for each model, and Section 5 discusses the conclusions of the study.

2 DATASET

The dataset analyzed in this study comes from the Live Birth Information System (SINASC, Sistema de Informações sobre Nascidos Vivos), which compiles records from the Live Birth Declaration (DNV, Declaração de Nascido Vivo) issued for each live birth. The data were originally described by 6), (7 and were kindly shared by the authors. The dataset contains records of 5,060 live births in the city of Maringá, located in the state of Paraná, Brazil, during 2017. It includes information on 11 potential explanatory variables related to the mother, prenatal care, childbirth, and the newborn.

The target variable, prematurity, is defined according to the World Health Organization’s classification: a birth is considered premature if the child is born alive before completing 37 weeks of gestation; otherwise, the birth is classified as on-term (non-premature). As shown in the last row of Table 1, the dataset is imbalanced: only 11.8% of the births are classified as preterm, while 88.2% are non-premature. This imbalance may pose challenges for some classifiers, as they typically perform better with balanced datasets.

Table 1:
Proportions according to premature birth in Maringá, PR, 2017.

According to 7, the key explanatory variables for preterm births include the mother’s age, whether the mother had a partner at the time of birth, parity (whether the pregnancy was primary or multiple), type of pregnancy (singleton or multiple), type of childbirth (vaginal or Cesarean), prenatal care (whether the mother had fewer or more than 7 prenatal visits), the mother’s race or skin color (white or non-white), and whether the newborn had a congenital malformation. All variables are dichotomous, with the proportions of each category presented in Table 1 for both preterm and non-premature births.

For the predictive modeling, we exclude variables that are unknown prior to birth, namely, the type of childbirth and congenital malformation. Additionally, unlike 6, we include the mother’s level of education (whether she completed 12 or more years of schooling) as a covariate in our models. It is important to highlight that childbirth location was not used as covariate in our model since there is no variation of the target variable when the covariate has label 1 (“other”), meaning that the birth did not take place at a hospital.

3 METHODOLOGY

3.1 Logistic regression

Logistic regression is one of the most well-known and widely used models for classifying binary variables. Although it predicts the probability that a given observation belongs to a specific category-thus functioning like a regression method-it is commonly regarded as a classifier.

To formally describe this model, let us first establish some notation. Let Y=(Y1,Y2,…,Yn)∈{0,1}n represent a random vector of binary target variables, with dimension n ∈ ℕ. Here, Y i = 1 indicates that a feature of interest is present for the i-th individual or observation, and Y i = 0 otherwise. For each individual i = 1, . . . , n, let xi=(xi1,xi2,…,xic) denote the vector of c ∈ ℕ explanatory (independent) variables, also known as covariates. Given the observed value of x i , we assume that the random variables Y i are independent and follow a Bernoulli distribution with parameter pi=P(Yi=1∣xi).

Under these assumptions, we have pi=E(Yi∣xi)=r(xi), where r(x i ) is referred to as the regression function. The standard linear regression model assumes that r(x) is a linear function of unknown parameters (coefficients of the covariates or functions of those covariates). However, since p i represents a probability, it must lie within the interval [0, 1], making the standard linearity assumption unsuitable in this context.

A generalized linear model (GLM) addresses this issue by introducing a link function that relates the regression function to the so-called linear predictor. More specifically,

G ( p i ) = G ( r ( x i ) ) = β 0 + β 1 x i 1 + … + β c x i c = β 0 + η ( x i ) ,

where G is the link function, and β 0 + η(x i ) represents the linear predictor for individual i. Rewriting this relationship using the inverse of G, we have

p i = r ( x i ) = G - 1 ( β 0 + β 1 x i 1 + … + β c x i c ) = G - 1 ( β 0 + η ( x i ) ) . (3.1)

This formulation shows that distribution functions of continuous real random variables can serve as inverse link functions, as they map any real value to the unit interval [0, 1]. The most common choices for G −1 are the standard normal distribution, yielding the probit model, and the logistic function, which underlies logistic regression.

In logistic regression, we specify

p i = 1 1 + e - ( β 0 + β 1 x i 1 + … + β c x i c ) , (3.2)

implying that

ln p i 1 - p i = β 0 + β 1 x i 1 + … + β c x i c .

This expression provides an intuitive interpretation of the coefficients in terms of the log-odds of the characteristic of interest.

Under the frequentist framework, the logistic regression model is estimated by finding the parameter values that maximize the likelihood function-i.e., the joint probability of observing the given sample as a function of the unknown parameters. Given our assumptions about the target variable, the likelihood function is defined as

L ( β ∣ X , y ) = ∏ i = 1 n p i y i ( 1 - p i ) 1 - y i , (3.3)

where p i is given by (3.2), X = {x 1 , . . . , x n } represents the observed covariates, y = {y 1 , . . . , y n } denotes the observed labels for each of the n individuals and β = (β 0 , β 1 , . . . , β c ). Since this likelihood function is nonlinear in the parameters, maximizing the logarithm of the likelihood is often a simpler approach.

The original sample used to estimate the model parameters is referred to as the training set. From this training set, we obtain parameter estimates, denoted by β^j, which enable probabilistic predictions for individuals not included in the training set. Denoting the covariate values of one of these out-of-sample individuals by x*=(x1*,…,xc*), the probability this individual has the characteristic of interest is simply

p * = r ( x * ) = G - 1 ( β ^ 0 + β ^ 1 x 1 * + … + β ^ c x c * ) = G - 1 ( β ^ 0 + η ^ * ) .

The set with values for covariates and target variables not used in the estimation of the model is called test set.

3.2 Gaussian Processes

A Gaussian process (GP) is a stochastic process, or collection of random variables, {Z(t)}t∈T, all defined within the same probability space. The probability space is represented by the triple (Ω, 𝒜 , P), where Ω is the sample space, 𝒜 is a sigma-algebra of subsets of Ω, and P is a probability measure. Here, T is an index set.

Gaussian processes are characterized by the property that, for any finite subset of indices t 1 , t 2 , . . . , t n ∈ T with n ∈ ℕ, the corresponding random vector (Z(t 1), Z(t 2), . . . , Z(t n )) has a joint distribution that is multivariate Gaussian. This distribution is fully characterized by

Z t 1 ⋮ Z t n ~ N n m t 1 ⋮ m t n , k t 1 , t 1 ⋯ k t 1 , t n ⋮ ⋱ ⋮ k t n , t 1 ⋯ k t n , t n

where m: T → ℝ denotes the mean function, and k: T × T → ℝ is the covariance function of the process. The covariance function k must be symmetric in its inputs and satisfy k(t, t) ≥ 0 for every t ∈ T, ensuring that the covariance matrix is symmetric and positive semi-definite. When the process Z(t) is described by a Gaussian process, we denote it as Z(t)~GP(m(t),k(t,t')).

Note that the definition of a Gaussian process accommodates processes with a discrete index set T, as is the case for processes defined over discrete time sets. In particular, T may also be finite, in which case the joint distribution of all random variables in the process will be a multivariate Gaussian distribution with the same dimension as T.

The set of all possible covariate values, 𝒳, typically serves as the index set, which can be more general. For instance, 𝒳 could be ℝc , where c ∈ ℕ represents the number of covariates, as described in Section 3.1. This setup allows GPs to describe a distribution over regression functions, such that E(Y∣x)=r(x) for x ∈ 𝒳. Modeling regression functions as GPs offers greater flexibility, as it does not restrict the functions to linear combinations of parameters (as in standard regression analysis) or transformations of these linear combinations (as in GLMs). This approach to regression is known as Gaussian process regression.

Gaussian processes can also be applied to binary classification problems using a strategy similar to that in GLMs, as the regression function needs to be constrained to the interval [0, 1]. In this context, GPs model a latent function f(x), which is then restricted to [0, 1] by a function that maps real values into this interval. Using the notation from Section 3.1, we define r(x)=G-1(f(x)). Specifically, we replace the linear predictor β 0 + η(x i ) in equation (3.1) with f(x i ), where f is a Gaussian process.

The latent function f acts as a nuisance function, much like unknown parameters in linear models: we do not observe the values of f directly; instead, we observe only the inputs x i and the class labels y i . Our main interest lies in r(x i ), particularly for test values r(x*).

Due to the stochastic nature of f and r, it is generally not appropriate to estimate r(x∗) simply by computing G-1(f^(x*)), where f^ is an estimate of f. The correct approach is to derive the expected value of r(x*), with the distribution of the latent variable f* = f(x*) for a test case, given by πn+1(f*∣X,y,x*) as follows

π n + 1 f * ∣ X , y , x * = ∫ ℝ n π f * ∣ X , x * , f · π n ( f ∣ X , y ) d f (3.4)

where f = (f(x 1), . . . , f(x n )), the vector of latent variables, and

π n ( f ∣ X , y ) = π ( y ∣ f , X ) · π 0 ( f ∣ X ) ∫ ℝ n π ( y ∣ f , X ) · π 0 ( f ∣ X ) d f (3.5)

is the posterior over f, π(y | f , X) is the likelihood and π 0(f | X) the prior over f, described by a Gaussian process.

Using the distribution over the latent variable f*, we can produce a probabilistic prediction

P y * = 1 ∣ X , y , x * = ∫ ℝ G - 1 f * · π n + 1 f * ∣ X , y , x * d f * .

As discussed in Section 2, we will use 7 binary variables from the dataset as covariates, so that 𝒳 = {0, 1}7 with |𝒳| = 128. Following the notation established above, let y = (y 1 , . . . , y n ) ∈ {0, 1}n , where n represents the size of the training set. Therefore, some covariate vectors x 1 , . . . , x n may be identical.

To account for this, we introduce modified notation: let f be the vector of dimension 128, consisting of values of f evaluated at each element of 𝒳, denoted by e j to distinguish them from observed covariate vectors x i for individuals i. Thus, we have 𝒳 = {e 1 , . . . , e 128} and f = (f(e 1), . . . , f(e 128)). When 𝒳 is continuous, the elements of X will almost surely not coincide, and f will have the same dimension as the training set.

Following this notation and using the standard normal distribution function Φ as the inverse of the link function, the likelihood function is given by

π ( y ∣ f , X ) = ∏ i = 1 128 Φ f e i y ( e i ) 1 - Φ f e i n ( e i ) - y ( e i ) ,

where

y ( e i ) = ∑ { j : x j = e i } y j and n ( e i ) = { j : x j = e i } .

The GP prior for f, with mean function m(e) and covariance function k(e i , e j ), is in this case equivalent to a multivariate normal distribution of dimension 128 with mean vector m and covariance matrix V. In this work, we use a constant mean function reflecting a prior probability of that childbirth will be preterm, along with the radial basis function (RBF) or Gaussian kernel as the covariance function

π 0 ( f ∣ X ) ~ N 128 ( m , V ) , where m = Φ - 1 ( 0 . 1 ) 1 128 , and V = k e i , e j = exp - 1 2 e i - e j 2 , i , j = 1 , … , 128 .

Following [9, sec. 3.4], we approximate the posterior π n (f | X , y) with a Gaussian distribution q(f | X,y)

f ∣ X , y ~ q = N 128 f ^ , V - 1 + W - 1 ,

where f^=argmaxfπn(f∣X,y) is the maximum a posteriori (MAP) estimator of f, and W=-∇∇logπn(f∣X,y)f=f^ is the Hessian matrix of the log-posterior evaluated at this point. The MAP estimator was obtained using a Newton-Raphson algorithm to maximize the log of the unnormalized posterior, as the denominator of π n (f | X , y) does not depend on f.

The posterior predictive distribution of f*, from equation (3.4), is also approximated by a Gaussian distribution. For this, we require only the mean and variance of f* under the Laplace approximation

E q f * ∣ X , y , x * = k * ⊤ V - 1 f ^ , and var q f * ∣ X , y , x * = k x * , x * - k * ⊤ V + W - 1 - 1 k * ,

where k*=kx*,X is the vector of covariances between the test point x* and all covariate vectors in 𝒳. Finally, the predictive probability Py*=1∣X,y,x* is approximated by

E q π * ∣ X , y , x * = ∫ ℝ Φ f * · q f * ∣ X , y , x * d f * = Φ E q f * ∣ X , y , x * 1 + var q f * ∣ X , y , x * . (3.6)

This integral has an exact solution because q has a Gaussian density. For details, see [9, sec. 3.9].

3.3 Support Vector Machines (SVM)

Support Vector Machines (SVMs) generalize a classifier known as the maximal margin classifier. This classifier assumes it is possible to find a hyperplane that perfectly separates the observations in the training set based on their target variable values.

To make this more precise, let us slightly modify the notation: in this section, y i = 1 indicates, as before, that the i-th childbirth was preterm, while y i = −1 now indicates that the birth was at term. If these values are separable, then a hyperplane exists, i.e., a set {z∈ℝc:β0+β1z1+…+βczc=0}, such that for each observation in the training set, (y 1 , x 1), . . . , (y n , x n ), we have

β 0 + β 1 x i 1 + … + β c x i c > 0 , if y i = 1 , and β 0 + β 1 x i 1 + … + β c x i c < 0 , if y i = - 1 .

Using the notation from Section 3.1, we define h(xi)=β0+η(xi). Then a separating hyperplane has the property that yi·h(xi)>0 for all i = 1, . . . , n. The maximal margin classifier then seeks to find β 0 and now defining β = (β 1 , . . . , β c ) defining the hyperplane that maximizes the margin-the distance between the closest points of the training classes with labels 1 and −1. This is achieved by solving the following optimization problem

maximize β 0 , β , M M subject to (3.7.1) ∑ i = 1 c β i 2 = 1 and (3.7.2) y i · h ( x i ) ≥ M (3.7)

for i = 1, . . . , n, where M is the margin to be maximized.

The first constraint, ∑i=1cβi2=1, requires the vector β to have unit norm. This is not a constraint on the hyperplane itself, since if β0+β1xi1+…+βcxic=0 defines a hyperplane, then any scaling γ(β0+β1xi1+…+βcxic)=0 with γ ≠ 0 will also define a hyperplane. However, including this constraint gives (3.7.2) a specific interpretation: it can be shown (see [5, sec. 4.5]) that the perpendicular distance from the i-th sample point to the hyperplane is precisely yi(β0+β1xi1+…+βcxic)=yi·h(xi).

Hence, constraints (3.7.1) and (3.7.2) ensure that each observation lies on the correct side of the hyperplane, each at least a distance M from the hyperplane. This distance M is the margin, which is maximized by choosing optimal values for β 0 and β . Given that constraint (3.7.1) primarily serves a secondary purpose, we can reformulate problem (3.7) without the unit norm constraint on β as follows

minimize β | | β | | subject to y i · h ( x i ) ≥ 1 for i = 1 , … , n ,

where ||β || is the L 2 norm of β . Note that this formulation implies M = 1/||β ||. The maximal margin classifier provides an intuitive approach for classification when a hyperplane can fully separate the classes, which, however, is not always the case for real-world datasets.

When the classes overlap in covariate space, we may still aim to maximize M, but allow some points to fall on the incorrect side of the margin. To achieve this, we introduce non-negative auxiliary variables ε = (ε 1 , . . . , ε n ), known as slack variables. This modifies problem (3.7) to

maximize β 0 , β , M , ε M subject to (3.8.1) ∑ i = 1 c β i 2 = 1 , (3.8.2) y i · h ( x i ) ≥ M ( 1 - ε i ) and (3.8.3) ∑ i = 1 n ε i ≤ constant, ε i ≥ 0 , (3.8)

for i = 1, . . . , n. The variable ε i in constraint (3.8.2) has the following interpretation: if ε i = 0, the i-th sample point is correctly classified and lies on the correct side of the margin; if 0 < ε i ≤ 1, the sample point lies within the margin but is correctly classified and if ε i > 1, the sample point is misclassified. Thus, if yi·h(xi)<0, constraint (3.8.2) implies M(1-εi)≤yi·h(xi)<0 since M > 0.

Thus, constraint (3.8.3) ensures that both the number of misclassifications and the total extent by which points lie on the incorrect side of the margin are limited by a chosen constant. The unit norm constraint on β can be removed again, leading to a reformulation of problem (3.8) as

minimize β | | β | | subject to y i · h ( x i ) ≥ 1 - ε i , ∑ i = 1 n ε i ≤ constant , (3.9)

εi ≥ 0 for i = 1, . . . , n, known as the soft margin classifier, as it allows some points to violate the margin constraint. This can further be rewritten as

minimize β 1 2 | | β | | 2 + Q ∑ i = 1 n ε i , subject to ε i ≥ 0 and y i · h ( x i ) ≥ 1 - ε i (3.10)

for i = 1, . . . , n, where the parameter Q replaces the constant in problem (3.9). This formulation defines the support vector classifier or linear support vector machine, with the separable case as a limit when Q → ∞.

The support vector classifier performs effectively when the boundary between classes is linear, but real-world boundaries are often non-linear. To handle this, 2 applied the principles of the support vector classifier on a transformation of the original covariate space, achieving (soft) linear separation in this transformed space. Therefore, a suitable transformation function ϕ : 𝒳 → ℱ must be chosen such that class labels become linearly separable in the transformed space ϕ(𝒳). The codomain of ϕ, denoted ℱ, is known as the feature space, and may have a high dimension.

Given a transformation ϕ, we can define h(xi)=β0+ϕ(xi)⊤β, where ϕ(xi)=(ϕ1(xi),…,ϕd(xi)), with ϕj (x) as basis functions. Here, β = (β 1 , . . . , β d ), and d is the dimension of the feature space. With this new definition of h, problem (3.10) is solved to obtain the classifier.

As the details in the appendix show, the solution β^0 and β^ provides an optimal classifier based on

h ^ ( x ) = β 0 ^ + ϕ ( x ) ⊤ β ^ = β 0 ^ + ∑ i = 1 n α i ^ · y i · ⟨ ϕ ( x ) , ϕ ( x i ) ⟩ , (3.11)

where ⟨ϕ(x),ϕ(xi)⟩ represents the inner product ϕ(x)⊤·ϕ(xi), and αi^ are derived from the dual formulation of problem (3.10). More details are provided in the appendix.

At first glance, this approach appears to require explicit knowledge of ϕ, but this is avoided through a technique known as the kernel trick. To understand this, we first introduce kernels.

Definition 1 (Mercer kernels). A real-valued function k : X × X → ℝ is called a kernel if it satisfies the following properties:

  1. k(u, v) = k(v, u) for everyu, v ∈ 𝒳 (i.e., it is symmetric), and

  2. matrixk(vi,vj)i,j=1ℓis positive semidefinite for everyv1, . . . , vℓ ∈ 𝒳 and ℓ ∈ ℕ.

The kernel trick relies on the following theorem.

Theorem 1 (Kernel trick).If k is a kernel, then there exists an inner product space ℱ and a transformation function ϕ such thatk(u,v)=⟨ϕ(u),ϕ(v)⟩for any u, v ∈ 𝒳.

Since equation (3.11) shows that the classifier depends on ϕ only through its inner product, the kernel trick theorem guarantees that specifying a kernel function is equivalent to implicitly defining the mapping function ϕ. For our work, we will employ the Gaussian (or RBF) kernel, previously introduced in Section 3.2 in relation to Gaussian processes. Other kernel functions may also be used, with common choices being the polynomial kernel and the neural network or sigmoid kernel. The d-th degree polynomial kernel is defined as k(u,v)=(γ0⟨u,v⟩+γ1)d, while the sigmoid kernel is defined as k(u,v)=tanh(γ0⟨u,v⟩+γ1), where d, γ0, and γ1 are parameters to be specified.

The resulting classifier is thus based on (3.11): for a test sample x*, it is classified as class 1 if h^(x*)>0 and as class −1 if h^(x*)<0. Using the kernel trick, this can be expressed as

C ^ ( x * ) = sign β 0 ^ + ∑ i = 1 n α i ^ · y i · k ( x * , x i ) .

As shown in equation (3.12), SVMs yield predicted labels but do not directly provide probabilistic outputs. To estimate class probabilities, we use Platt’s scaling 8, which applies a logistic transformation to the classifier scores. This approach involves computing parameters A and B such that

P ( y * = 1 ∣ x * ) = 1 1 + exp A h ^ ( x * ) + B , (3.13)

where x∗ is the covariate vector of a test observation. In practice, A and B are estimated by fitting a logistic regression model on the classifier scores, h^(·), from the training set, using maximum likelihood estimation as outlined in Section 3.1.

3.4 Induction by partial exchangeability

An exchangeable sequence of random variables is a (potentially infinite) sequence in which any finite permutation of indices results in a joint probability distribution identical to that of the original sequence. To capture the type of symmetry that characterizes inductive inference in practical applications, Bruno de Finetti 3 generalized this idea by introducing the concept of partial exchangeability.

In de Finetti’s words, partial exchangeability assumes that “‘except for unforeseen circumstances that induce us to change our attitude,’ we shall always use the outcomes of the observations symmetrically and shall apply them symmetrically to all future trials. [...] [This means], for instance, that the observation of an appreciable difference among the outcomes of the trials made under different circumstances will induce us to attribute different probabilities varying with these circumstances. For instance, in a medical experiment, whether on humans or guinea pigs, it might initially be held presumptive that the effect of a given treatment would not be influenced by circumstances varying among individuals of the same species.” [4, p. 217]

In this framework, a sequence of random variables is partially exchangeable if it can be divided into different classes, within which exchangeability holds. Thus, the joint probability distribution remains unchanged under permutations within each class, but not necessarily between classes.

This definition is particularly applicable to binary random variables, such as the target variable in this work, which indicates whether a birth is preterm or not. In the context of partial exchangeability, the sequence of binary random variables is such that the order of preterm births within each class is irrelevant.

A representation theorem exists for partially exchangeable sequences, with a notable special case for binary random variables grouped into only two classes.

Theorem 2 (de Finetti representation theorem3, p. 13).LetYi(g1)i∈ℕandYi(g2)i∈ℕbe random sequences representing binary outcomes (e.g., success or failure) for individuals in group 1 (g1) and group 2 (g2), respectively. Assuming these sequences are partially exchangeable, there exists a unique probability measure µ on the unit square [0, 1]2 such that

P Y 1 ( g 1 ) = z 1 , … , Y c ( g 1 ) = z c , Y 1 ( g 2 ) = w 1 , … , Y ℓ ( g 2 ) = w ℓ = = ∫ 0 1 ∫ 0 1 θ 1 a 1 - θ 1 c - a θ 2 b 1 - θ 2 ℓ - b d μ θ 1 , θ 2

for any binary sequenceszi1≤i≤candwi1≤i≤ℓ, witha=∑i=1cziandb=∑i=1ℓwi.

Applying this theorem, we can build a classifier for our study on classifying childbirths as preterm or not. Consider the sequence (y 1, x 1) , (y 2, x 2) , . . . , (y n , x n ), where each y i ∈ {0, 1} represents the outcome for individual i, and x i ∈ 𝒳 represents the vector of covariates (features) observed for individual i, where i = 1, . . . , n.

Here, 𝒳 is a finite set with cardinality 128, so each x can be viewed as a categorical variable with a finite set of possible levels. Suppose that all birth outcomes Y i with the same covariate vector value (reflecting mother and child characteristics) are exchangeable (within each fixed value of the covariate vector), and the data is part of an infinite sequence with this property. Then, de Finetti’s theorem guarantees the existence of a joint probability measure µ on the unit hypercube 𝒰 = [0, 1]128 such that

P s i preterm births out of n i births of type i , 1 ≤ i ≤ 128 = = ∏ i = 1 128 n i s i ∫ U ∏ i = 1 128 θ i s i 1 - θ i n i - s i d μ θ 1 , … , θ 128 ,

where s i = y(e i ) and n i = n(e i ) are as defined above, and θi=P(Y=1∣x=ei) represents the probability of a preterm birth for covariate level e i . Note that θ i is similar, though not equivalent, to p i defined in Section 3.1 as pi=P(Yi=1∣xi).

Using pre-established notation, we can express the probability of the observed outcomes as

P y ∣ X = ∫ U ∏ i = 1 128 θ i s i 1 - θ i n i - s i d μ θ 1 , … , θ 128 . (3.15)

This result enables us to obtain predictive probabilities as follows

P ( y * = 1 ∣ X , y , x * ) = P ( y * = 1 , y ∣ X , x * ) P y ∣ X ,

where x* ∈ 𝒳 is a new observation’s covariate vector. Note that the numerator also takes the form of an integral like (3.15). For example, if x* = e j , we have

P ( y * = 1 ∣ X , y , x * = e j ) = ∫ U θ j ∏ i = 1 128 θ i s i 1 - θ i n i - s i d μ ( θ 1 , … , θ 128 ) ∫ U ∏ i = 1 128 θ i s i 1 - θ i n i - s i d μ ( θ 1 , … , θ 128 ) = E π n ( θ j ) ,

where πn represents the posterior of θ = (θ1, . . . , θ128) given the training data. Specifically, the posterior is

π n ( θ ∣ X , y ) = μ ( θ ) ∏ i = 1 128 θ i s i ( 1 - θ i ) n i - s i P ( y ∣ X ) ,

where µ(θ) is the prior on θ. Thus, the predictive probability for x* = e j is simply the posterior expected value of θj .

4 RESULTS

In this section, we present the predictive performance of the four models discussed in Section 3, detailing the computational methods used for each model.

Each model was estimated 10 times, with each iteration using a unique training sample composed of 70% of the data points (3542 observations) randomly drawn from the full dataset. Performance metrics were then computed based on probabilistic predictions for the corresponding test set, which consisted of the remaining 30% of the sample (1518 observations).

All models were implemented in Python. Logistic regression and SVM were estimated using the scikit-learn library. We used the default SVM hyperparameter settings-particularly Q = 1-because values selected via five-fold cross-validation delivered essentially identical predictive performance. The partially exchangeable model was implemented in Stan via the Pystan library. As described in Section 3.2, obtaining the Laplace approximation to the posterior density in the Gaussian Process model required maximizing the posterior density, which we accomplished using a Newton-Raphson algorithm. This algorithm, along with the other routines, is available at https://github.com/Dinizmarz/Classifiers-for-preterm-birth.

The performance metrics used in this work are the AUC (area under the curve) of the receiver operating characteristic (ROC) curve, the Brier score, and the logarithmic score.

The ROC curve plots the true positive rate (TPR) on the vertical axis against the false positive rate (FPR) on the horizontal axis at each threshold level of a binary classifier. Each threshold sets the level at which an observation is classified as positive (label 1) or negative (label 0). A model that perfectly predicts all instances for each threshold setting has a TPR of 1 and an FPR of 0 at all thresholds. In contrast, a completely random classifier, which predicts the positive and negative classes with equal probability, produces a diagonal ROC curve from (0,0) to (1,1). For a random classifier, the TPR equals the FPR because it produces an equal number of true and false positive predictions at any threshold.

The closer the ROC curve is to the top-left corner, the better the model’s ability to distinguish between labels. The AUC ranges from 0 to 1, with a score of 1 indicating perfect predictive performance.

The Brier score (BS) is given by

B S = 1 n * ∑ i = 1 n * ( p i * - y i * ) 2 ,

where pi* is the probabilistic prediction, yi* is the actual outcome for observation i (0 if the event does not occur, and 1 if it does), and n ∗ is the size of the test sample. The Brier score can be interpreted as the mean squared error of the forecast, offering a straightforward way to assess the accuracy of probabilistic predictions.

The logarithmic, or cross-entropy, score (LS) is given by

L S = - 1 n * ∑ i = 1 n * y i * ln ( p i * ) + ( 1 - y i * ) ln ( 1 - p i * ) ,

which is calculated as the log of the probability assigned to the observed outcome. The interpretation of this score is based on information theory: given that pi*=P(yi*=1∣x*), the expected value of the LS can be written as -1n*∑i=1n*pi*ln(pi*), closely related to the entropy of the predicted probabilities. One limitation of this metric is that it is undefined when pi* is exactly 0 or 1.

We now provide a rationale for using the RBF kernel as the covariance matrix for the GP prior on f, the vector of latent functions defined in Section 3.2. As explained in Section 3.3, kernels quantify the similarity between vectors, which is essential for defining the covariance matrix of f in terms of the covariance between vectors e 1 , . . . , e 128. A kernel such as the RBF creates a positive semidefinite matrix, satisfying the conditions for a valid covariance matrix.

Given the structure of our dataset, it is reasonable to assume, for instance, that f(e 1) and f(e 2) are correlated, with this correlation being greater than that between f(e 1) and f(e 4) if the Euclidean distance between e 1 and e 2 is smaller than between e 1 and e 4.

The same RBF kernel was used for the SVM model in Section 3.3 because the data are not linearly separable, as shown by the nature of the seven binary covariates, which place data points on the 128 vertices of a hypercube. With sample points on certain vertices having both labels (y i = 1 and y i = 0), the data are clearly not linearly separable. Although other kernels could be employed in this scenario, the RBF kernel offers flexibility and provided strong predictive performance compared to other options.

The RBF kernel is also relevant for the prior used in the partially exchangeable model. Here, the prior is a truncated multivariate normal of dimension 128 with a mean vector of 0.1−which is consistent with m=Φ-1(0.1)1128, the mean function for the GP prior discussed in Section 3.2−and an RBF covariance matrix defined on θ

k θ i , θ j = exp - 1 2 θ i - θ j 2 , i , j = 1 , … , 128 ,

with the distribution constrained to the hypercube [0, 1]128, the parameter space in this model. This choice for the prior covariance matrix is appropriate because kernels like the RBF quantify similarity between vectors and ensure a valid covariance structure.

Table 2 shows that, with the exception of the kernel SVM, the other three models exhibited similar predictive performance in terms of AUC. However, when considering the logarithmic and Brier scores, Tables 3 and 4 demonstrate that the predictive performance of all four models was comparable. Notably, logistic regression outperformed the others on average, though the difference was small.

Table 2:
Models’ AUC for 10 different test samples.

Table 3:
Models’ log scores for 10 different test samples.

Table 4:
Models’ Brier scores for 10 different test samples.

5 DISCUSSION AND FINAL REMARKS

Except for the SVM models, the similar performance of the other three methods can be expected, as they may be considered particular cases of a more general model. The key to understanding this relationship is provided by de Finetti’s Theorem, discussed in Section 3.4. Recalling equation (3.15), if the childbirth outcomes with the same value of the covariate vector are considered exchangeable, the data are partially exchangeable. Thus, the probability of the outcomes, P(y | X), can be written as

P y ∣ X = ∫ 0 1 … ∫ 0 1 ∏ i = 1 128 θ i s i ( 1 - θ i ) n i - s i d μ θ 1 , … , θ 128 ,

where θi=P(Y=1∣x=ei).

De Finetti’s theorem remains valid even when the covariate space 𝒳 has infinite dimension. In this case, expressing θi=θ(xi)=P(Y=1∣xi), the representation of P(y | X) becomes

P y ∣ X = ∫ Θ ( x ) ∏ i = 1 n θ ( x i ) y i ( 1 - θ ( x i ) ) 1 - y i d μ θ ( x 1 ) , … , θ ( x n ) ,

where the covariate values x 1 , . . . , x n are distinct (i.e., there are no ties), and Θ(x) represents the function space of θ (x).

The connection with GPs is direct. Assuming θ(xi)=Φ(f(xi)), the probability becomes

P y ∣ X = ∫ ℝ n ∏ i = 1 n Φ f x i y i 1 - Φ f x i 1 - y i π 0 ( f ∣ X ) d f ,

where the integral is taken over the space of the latent function f.

Alternatively, by specifying θ (x i ), for example, by setting f(x i ) as a linear function of the covariates and using a generic (inverse of) link function instead of Φ, we get

θ ( x i ) = p i = G - 1 ( β 0 + β 1 x i 1 + … + β c x i c ) = G - 1 ( β 0 + η ( x i ) ) ,

where G is the link function, as described in Section 3.1. The prior measure µ is then rewritten as a measure µ 0 relating to the parameters β 0 , . . . , β c , and we have

P y ∣ X = ∫ ℝ c + 1 ∏ i = 1 n p i y i ( 1 - p i ) 1 - y i d μ 0 β 0 , … , β c .

This integral may be recognized as the prior predictive distribution derived from a Bayesian logistic regression model. In fact, the integrand is identical to the likelihood function of frequentist logistic regression, as given by equation (3.3), and µ 0 represents the prior over the parameters β 0 , . . . , β c .

Therefore, assuming a very flat prior on these parameters, it is reasonable to expect that the predictive performance of this model would be similar to that of the frequentist logistic regression. To validate this conjecture, we adopted the same prior for the coefficients β 0 , . . . , β 7 used by 6, where the parameters are considered independent and each follows a normal distribution with mean zero and variance 106.

Table 5 confirms that the conjecture is indeed correct: using the same training samples as in Tables 2−4, the predictive performance of Bayesian logistic regression was, on average, essentially the same as that of frequentist logistic regression. The Bayesian logistic regression was also implemented using Pystan.

Table 5:
Bayesian Logistic regression metrics for 10 different test samples.

Therefore, de Finetti’s theorem demonstrates that logistic regression is a particular case that can be highly effective for predictive classification. Moreover, it is numerically simple and fast to implement, works well with categorical covariates, and provides estimates of the coefficients that directly indicate the influence of variables on the outcome probabilities.

However, despite achieving the best predictive performance in the dataset analyzed in this study, there may be cases where the assumptions of the logistic model are not suitable to describe the data. In such instances, models like SVM and Gaussian process classification may outperform logistic regression, especially when there are highly complex nonlinear relationships between the covariates and the target variable. This is evident when comparing how θ (x i ) is modeled by Gaussian processes versus logistic regression. By assuming θ(xi)=Φ(f(xi)), the model gains more flexibility to capture potential nonlinear relationships.

Data availability

Datasets related to this article are available upon request to the corresponding author.

REFERENCES

  • 1 C.I. Bliss. The Calculation of the Dosage-Mortality Curve. Annals of Applied Biology, 22 (1935), 134-167.
  • 2 B.E. Boser, I.M. Guyon & V.N. Vapnik. A training algorithm for optimal margin classifiers. In “Proceedings of the fifth annual workshop on Computational learning theory - COLT ’92” (1992), p. 144-152.
  • 3 B. de Finetti. Sur la condition d’equivalence partielle. In “Actualite´s Scientifiques et Industrielles”, 739. Hermann, Paris (1938), p. 5-18.
  • 4 B. de Finetti. “Probability, Induction and Statistics: The art of guessing”. Wiley (1972).
  • 5 J. Friedman, T. Hastie & R. Tibshirani. “The Elements of Statistical Learning: Data Mining, Inference and Prediction”. Springer (2009).
  • 6 R. Galo, R.M. Rossi, D.C. Alves & R.R. Oliveira. Bayesian binary regression using power and power reverse link functions: an application to premature birth data. Brazilian Journal of Biometrics, 41 (2023), 131-143.
  • 7 R.R. Oliveira. “Nascimento prematuro no Estado do Paraná e no município de Maringá”. Phd thesis, Universidade Estadual de Maringá, Maringá (2015).
  • 8 J.C. Platt. Probabilistic Outputs for Support Vector Machines and Comparisons to Regularized Likelihood Methods. In “Advances in Large Margin Classifiers” (1999), p. 61-74.
  • 9 C.E. Rasmussen & C.K.I. Williams. “Gaussian Processes for Machine Learning”. MIT Press (2006).
  • 10 V.N. Vapnik. “Statistical Learning Theory”. Wiley (1998).

APPENDIX

The objective of this appendix is to explain how equation (3.11) is obtained as a solution to problem (3.10). Considering the hyperplane in the transformed covariate space, h(xi)=β0+ϕ(xi)⊤β, the primal Lagrangian corresponding to problem (3.10) is

L ( β 0 , β , ε ) = 1 2 | | β | | 2 + Q ∑ i = 1 n ε i - ∑ i = 1 n α i y i · h ( x i ) - ( 1 - ε i ) - ∑ i = 1 n γ i ε i (A.1)

where α i and γ i are Lagrange multipliers. The first order conditions to minimize (A.1) are

∑ i = 1 n α i y i = 0 (A.2)

β = ∑ i = 1 n α i · y i · ϕ ( x i ) (A.3)

α i = Q - γ i (A.4)

α i , γ i , ε i ≥ 0 , (A.5)

for i = 1, . . . , n. Replacing these into (A.1), one obtain the Lagrangian dual function

L D ( α ) = ∑ i = 1 n α i - 1 2 ∑ i = 1 n ∑ j = 1 n α i α j · y i y j · ϕ ( x i ) ⊤ ϕ ( x j )

and if a given kernel is given, it can be written as

L D ( α ) = ∑ i = 1 n α i - 1 2 ∑ i = 1 n ∑ j = 1 n α i α j · y i y j · k ( x i , x j ) . (A.6)

Equation (A.6) gives a lower bound to the objective function of problem (3.10) for any feasible point. Maximizing ℒD subject to 0 ≤ αi ≤ Q and ∑i=1nαiyi=0 the Karush-Kuhn-Tucker conditions are

α i y i · h ( x i ) - ( 1 - ε i ) = 0 (A.7)

γ i ε i = 0 (A.8)

y i · h ( x i ) - ( 1 - ε i ) ≥ 0 , (A.9)

for i = 1, . . . , n, in addition to (5.2) −(5.5). Equations (5.2) −(5.9) characterize the solution of the primal and dual forms. From (5.3) one may see that the solution for β is

β ^ = ∑ i = 1 n α ^ i y i ϕ ( x i )

and, consequently

h ^ ( x ) = β 0 ^ + ϕ ( x ) ⊤ β ^ = β 0 ^ + ∑ i = 1 n α i ^ · y i · ⟨ ϕ ( x ) , ϕ ( x i ) ⟩ = β 0 ^ + ∑ i = 1 n α i ^ · y i · k ( x , x i )

where α^i are non-null only for observations i for which (A.9) are satisfied. These observations compose the support vectors since β^ is written in terms of them. More technical details about SVM’s can be found in [5, ch. 12] and [10, ch. 10].

*

Corresponding author: M. A. Diniz - E-mail: marciodiniz@ufscar.br

Conflict of interest

Authors have no conflict of interest to declare.

Associate editor:

Mário de Castro

Publication Dates

  • Publication in this collection
    01 Dec 2025
  • Date of issue
    2025

History

  • Received
    02 May 2025
  • Accepted
    05 Oct 2025
location_on
Sociedade Brasileira de Matemática Aplicada e Computacional - SBMAC Rua Maestro João Seppe, nº. 900, 16º. andar - Sala 163, Cep: 13561-120 - SP / São Carlos - Brasil, +55 (16) 3412-9752 - São Carlos - SP - Brazil
E-mail: sbmac@sbmac.org.br
rss_feed Stay informed of issues for this journal through your RSS reader
Go to top