skip to main content

gaia data release 4 documentation

16.4 Results and Quality Assessment

16.4.7 Products in the ap_class and ap_class_ir tables

Author(s): Sara Jamal, Lara Pallas-Quintela, Daniel Garabato

16.4.7.1 DSC products

DSC is a collection of six classifiers trained on the Gaia astrometry, photometry and low-resolution spectra to identify a source as a quasar, a galaxy or a star: three trained neural networks (Allosmod, Specmod, and Specmod-Supp) and three combinations of their outputs (Combmod, Combmod-α and Combmod-Supp).

DSC produces probabilities of the three target classes for each classifier, as well as one class label derived from the maximum probability level and a flag array summarising the classification performance. DSC outputs are described in Section 16.3.2.4 in Table 16.9.

DSC results are provided in the Gaia DR4 tables ap_class, ap_class_ir, gaia_source, as well as the extragalactic tables qso_candidates and galaxy_candidates.

In the ap_class and ap_class_ir, DSC provides the probabilities of all six DSC classifiers for the three target classes, one class label and one flag array, for a total of 20 fields. No quality filtering is applied to the sources from the DSC contribution in the tables ap_class and ap_class_ir. In comparison, the gaia_source table provides the probabilities of the DSC Combmod classifier per target class for sources with a number of observations contributing to the BP/RP photometry phot_[bp;rp]_n_obs≥6.

Metrics to assess classification performance
The full scope of DSC performance in Gaia DR4 is presented in Jamal et al. (2026). Further analysis of the methods and the classifications is available in the technical note Jamal and Bailer-Jones (2026). We summarize here just the key results.
We assess the classification performance via completeness and purity. These measures indicate the model’s ability to retrieve the true labels and reject false detections. We additionally compute what we call the geometric score, defined as the geometric mean of the completeness and purity of the two extragalactic classes. The metrics are defined as follows.

completenessk=TPkTPk+FNk,purityk=TPkTPk+FPk, (16.78a)
scoregeometric=(completenessquasar×completenessgalaxy×purityquasar×puritygalaxy)1/4. (16.78b)

where k indicates the class, and TP, FN and FP stand for the counts of the true positives, the false negatives, and the false positives, respectively, in a sample. For all of these metrics, values range from 0 to 1, with values closer to 1 indicating the ideal case. However, one must acknowledge the compromise between completeness and purity. High completeness but low purity indicates a model that can identify the true classes but introduces many false positives, whereas low completeness but high purity indicates a model that can reject false positives but at the cost of missing many true positives.

When evaluated on a controlled test set, classification results are not indicative of performance on the overall distribution across the sky because extragalactic sources are rare compared to stars. When stars are under-represented in the test set, the purity of the extragalactic samples is overestimated. We therefore adjust the confusion matrix to scale the test set to the overall class distribution in the sky and then compute the completeness and purity (see Bailer-Jones et al. 2019 for details). This adjustment affects only the purities and not the completenesses.

When comparing results below, we use percentage points (p⁢p) to express the difference between two percentages.

Overall classification performance
Table 16.40 reports the DSC performance on the test set. We assess hereafter the performance of quasars and galaxies, respectively. Allosmod achieves high completenesses of 87% and 77% and purities of 73% and 70%. By comparison, Specmod achieves 16 pp and 5 pp reductions in completeness, and 5 pp and 9 pp reductions in purity. Specmod-Supp has a performance similar to Allosmod, with only a 5 pp drop in completeness and a 7 pp increase in purity for the galaxy class. Combmod attains the highest completeness of 97% and 94%, but the lowest purity (37%) for the galaxy class. Combmod-α and Specmod-Supp show the best compromise in terms of completeness versus purity for the two target classes (highest geometric score).

These results can be compared with DSC performance in Gaia DR3, evaluated on a cleaned test set that excludes the LMC and SMC (Jamal and Bailer-Jones 2024; Jamal et al. 2026). For Combmod, the completeness and purity of quasars increase by 6 pp and 12 pp, respectively, while the improvement for galaxies is small (∼1 pp). Compared to Gaia DR3, the improvement in purity is significant. In Gaia DR4, amongst the classifiers, Combmod reaches the best completenesses (>94%) but the lowest purities, particularly for the galaxies. The new classifiers Specmod-Supp and Combmod-α achieve the best score, meaning the best compromise between completeness and purity. The two models achieve average completenesses over 84% and 76% and average purities over 75% and 74% for quasars and galaxies, respectively.

Table 16.40: Summary of the overall performance of DSC evaluated on the test set excluding the LMC and SMC.
Dataset Classifiers Overall completeness Overall purity Geometric
quasar galaxy quasar galaxy score
Specmod 0.702 0.722 0.691 0.618 0.682
Gaia-only mode Allosmod 0.869 0.773 0.737 0.703 0.768
Test set Specmod-Supp 0.862 0.723 0.749 0.778 0.776
(q:135 323 , g:22 447 ) Combmod 0.972 0.941 0.608 0.373 0.675
Combmod-α 0.843 0.762 0.762 0.741 0.776

Notes. The number of quasars (q) and galaxies (g) in the dataset is indicated.

Classification performance as a function of the brightness and galactic latitudes of the sources
As explained in Jamal and Bailer-Jones (2024), single metrics do not fully describe the range of classification performance. We compute completeness and purity as a function of the source galactic latitude and G-band apparent magnitude, as shown in Figure 16.102 for Combmod and Figure 16.103 for Combmod-α. Classification results show stellar contamination is more dominant at fainter magnitudes and, for some classifiers, detectable at latitudes close to the Galactic plane. To summarise the 2D performance, we compute the weighted average of completeness and purity in Table 16.41 for two magnitude bins, where each bin is weighted by the number of true classes for completeness and by the number of predictions for purity.

The classifiers perform best at magnitudes G<20, achieving average 2D completeness of 87-99% and purity of 96-98% for extragalactic classes. At 20<G≤20.5, purity drops due to an inability to filter out false positives. Here, also, Allosmod and the combined classifiers maintain ≥75% quasar completeness, but galaxy completeness is reduced. At magnitudes fainter than G=20.5, both metrics decrease. In this faint regime, Specmod underperforms relative to other classifiers, indicating limited utility for XP spectra. While Combmod prioritizes completeness, Combmod-α and Specmod-Supp aim to improve purity at G≥20. Specifically, compared to Combmod at 20<G≤20.5, they improve purity by 5 pp (quasars) and 15 pp (galaxies) but reduce completeness by 13 pp and 50 pp, respectively. At magnitudes fainter than G=20.5, they significantly reduce stellar contamination by 18 to 20 pp at the cost of missing true classes, especially galaxies.

Classifications using the Gaia data and infrared photometry
The Allosmod(*) and Specmod-Supp(*) models are trained on the Gaia photometry and astrometry, along with two new features derived from the infrared photometry of the CatWISE catalogue (G−W⁢1 and W⁢1−W⁢2). Supplementing the infrared photometry with the Gaia data improves the completeness of the quasar sample.

Table 16.41 reports the performance evaluated on the reduced test set with valid infrared data. The percentage points report the difference in performance with the models trained solely on Gaia data on the same dataset. Here, the highest increase in completeness occurs at G≥20 mag and reaches at most 29 pp and 25 pp for quasars and galaxies, respectively. The drop in purity remains small in comparison to the gain in quasar completeness. These results mean that the classifiers can identify more true quasars (and galaxies) at the faint end, despite introducing a small proportion of stellar false detections.

Quasar and galaxy candidates identified by DSC in Gaia DR4
DSC is run on the full Gaia dataset (2.8 billion sources). Because the module requires valid BP and RP spectra, it generated classifications for 1 791 382 242  sources in the Gaia-only mode and for 533 490 385  sources in the Gaia-IR mode.

Properties of the DSC extragalactic candidates are presented in detail in (Jamal et al. 2026) and (Jamal and Bailer-Jones 2026). All-sky distributions of the extragalactic candidates exhibit Galactic contamination patterns close to the Galactic plane aligned with high dust extinction and stellar density, especially around the bulge. Far from the Galactic plane, the quasar distributions are smooth, and galaxies exhibit a distinct clustering pattern. To correct for the Gaia scanning law artefacts and reduce stellar contamination, a quality cut on the number of photometric observations in BP and RP (phot_[bp,rp]_n_obs≥ 10, or 6 for a less restrictive cut) can be highly effective, especially at faint limits (G≥20.5). Also, applying a quality cut to select sources at higher Galactic latitudes and with reliable astrometry (using the flag unreliable_astrometry) has also proven to improve candidate selection.

Overall, the quasar and galaxy candidates identified in Gaia DR4 by the DSC exhibit physical properties close to those of our controlled training set. Any deviations from the training set are due to either noisy measurements or classifier limitations that lead to false stellar detections. In the Gaia-IR mode, the extragalactic candidates, exclusively identified by the DSC when combining Gaia data with infrared photometry from CatWISE, also display feature distributions that align with our training set, which confirms them as plausible candidates despite a moderate increase in stellar contamination. However, at magnitudes fainter than G=20.5, the quasar selection reveals redder sources, indicating misclassification between AGN-type quasars and redder galaxies, though affecting only a few sources. We also identified a small fraction of bright, high proper-motion stars that are also erroneously identified, which aligns with our assessment of increased completeness but a slight reduction in purity.

Using Gaia data, the completeness-oriented classifier Combmod identifies 3.32M quasar and 2.35M galaxy candidates across the full sky. Excluding the LMC and SMC and imposing a magnitude limit of G<20.5 alongside a photometric quality cut (phot_[bp,rp]_n_obs≥10), the list of candidates is refined into a more reliable subset of 1.51M quasars and 1.03M galaxies. Conversely, the purity-driven Combmod-α model, as more conservative, yields an all-sky catalogue of 2.16M quasar and 1.36M galaxy candidates refined into a higher-purity population of 1.23M quasars and 526k galaxies. Similarly, the candidate list exclusively identified in the Gaia-IR mode is refined using similar quality cuts.

Table 16.42 reports the number of quasar and galaxy candidates identified from maximum probability by DSC in Gaia DR4.

Refer to caption
Figure 16.102: Representation of the classification performance of DSC Combmod as function of the sources galactic latitudes and brightness. Bright colours indicate high values close to 1, while darker colours refer to lower values close to 0. Stellar contamination correlates with lower purities, mainly at G>20. Loss in completeness is seen at fainter magnitudes.
Refer to caption
Figure 16.103: Similar to Figure 16.102 for the DSC Combmod-α classifier.
Table 16.41: Summary of the performance of DSC evaluated on the test set excluding the LMC and SMC, as a function of the galactic latitudes and brightness of the sources.
Dataset Classifiers w⁢A⁢v⁢g completeness w⁢A⁢v⁢g purity Geometric
quasar galaxy quasar galaxy score
Specmod 0.879 0.885 0.969 0.986 0.929
Gaia only mode Allosmod 0.964 0.875 0.968 0.987 0.947
Test set, G<20 mag Specmod-Supp 0.965 0.881 0.961 0.987 0.948
(q:70 425 , g:13 632 ) Combmod 0.994 0.965 0.963 0.963 0.971
Combmod-α 0.966 0.893 0.964 0.988 0.952
Specmod 0.633 0.550 0.811 0.957 0.721
Gaia only mode Allosmod 0.885 0.701 0.750 0.964 0.818
Test set, 20≤G<20.5 mag Specmod-Supp 0.878 0.557 0.739 0.982 0.772
(q:38 027 , g:6 824 ) Combmod 0.982 0.958 0.711 0.832 0.864
Combmod-α 0.855 0.646 0.762 0.972 0.800
Specmod 0.337 0.190 0.845 0.936 0.474
Gaia only mode Allosmod 0.596 0.326 0.750 0.959 0.611
Test set, G≥20.5 mag Specmod-Supp 0.569 0.215 0.785 0.961 0.551
(q:26 871 , g:1 991 ) Combmod 0.902 0.713 0.607 0.770 0.740
Combmod-α 0.504 0.267 0.799 0.965 0.568
Specmod 0.881 (−) 0.910 (−) 0.977 (−) 0.992 (−) 0.939 (−)
Gaia-IR mode Allosmod(*) 0.981 (+2⁢pp) 0.930 (+4⁢pp) 0.967 (−1⁢pp) 0.991 (−) 0.967 (+1⁢pp)
Test set, G<20 mag SpecmodSupp(*) 0.974 (+1⁢pp) 0.951 (+5⁢pp) 0.973 (−) 0.992 (−) 0.972 (+1⁢pp)
(q:62 819 , g:10 600 ) Combmod 0.996 (−) 0.987 (−) 0.973 (−) 0.975 (−) 0.983 (−)
Combmod-α 0.984 (+2⁢pp) 0.929 (+1⁢pp) 0.973 (−) 0.991 (−) 0.969 (+1⁢pp)
Specmod 0.636 (−) 0.544 (−) 0.862 (−) 0.972 (−) 0.734 (−)
Gaia-IR mode Allosmod(*) 0.959 (+7⁢pp) 0.717 (+2⁢pp) 0.837 (+1⁢pp) 0.983 (−) 0.867 (+2⁢pp)
Test set, 20≤G<20.5 mag SpecmodSupp(*) 0.952 (+7⁢pp) 0.800 (+25⁢pp) 0.851 (+2⁢pp) 0.959 (−3⁢pp) 0.888 (+10⁢pp)
(q:55 687 , g:32 893 ) Combmod(*) 0.992 (+1⁢pp) 0.970 (−) 0.804 (−) 0.857 (−1⁢pp) 0.902 (−)
Combmod-α(*) 0.949 (+9⁢pp) 0.650 (+1⁢pp) 0.826 (−1⁢pp) 0.993 (−) 0.843 (+2⁢pp)
Specmod 0.338 (−) 0.177 (−) 0.876 (−) 0.931 (−) 0.470 (−)
Gaia-IR mode Allosmod(*) 0.862 (+27⁢pp) 0.268 (−1⁢pp) 0.733 (−7⁢pp) 0.959 (−) 0.635 (+4⁢pp)
Test set, G≥20.5 mag SpecmodSupp(*) 0.862 (+29⁢pp) 0.259 (+8⁢pp) 0.743 (−9⁢pp) 0.962 (−) 0.632 (+10⁢pp)
(q:22 794 , g:1 241 ) Combmod(*) 0.954 (+5⁢pp) 0.699 (−) 0.658 (−5⁢pp) 0.786 (−2⁢pp) 0.766 (−1⁢pp)
Combmod-α(*) 0.789 (+29⁢pp) 0.213 (−2⁢pp) 0.747 (−9⁢pp) 0.959 (−) 0.589 (+4⁢pp)

Notes. w⁢A⁢v⁢g designates weighted average values. The number of quasars (q) and galaxies (g) in the test set is indicated. (*) indicates the models trained with Gaia data and CatWISE photometry. The numbers in percentage points (pp) are equal to the difference between the performance of models trained with Gaia data and CatWISE and that of models trained with Gaia data only, on the baseline test dataset with valid infrared data. (−) indicates no change. Performance of the CombmodSupp is equal to SpecmodSupp on the test dataset given the availability of the input data.

Table 16.42: Quasar and galaxy candidates identified by DSC in DR4 from maximum probability.
Identified in Identified in Exclusive to
Datasets Classifiers Gaia-only mode Gaia-IR mode Gaia-IR mode
quasar galaxy quasar galaxy quasar galaxy
Specmod 2 470 312 1 938 986 1 112 680 772 599 - -
Allosmod 1 724 735 633 830 1 742 499 391 041 425 199 80 689
All sky Specmod-Supp 1 678 759 561 679 1 771 719 416 261 545 789 141 548
Combmod 3 320 701 2 356 500 2 024 593 1 211 304 156 340 127 944
Combmod-α 2 156 372 1 358 849 1 617 253 445 265 370 009 44 877
Combmod-Supp 2 295 842 1 268 026 1 800 892 471 934 - -
Specmod 2 108 425 1 885 485 1 084 516 763 629 - -
Allosmod 1 692 662 623 087 1 726 112 386 739 420 567 79 638
Excluding the Specmod-Supp 1 651 764 551 551 1 755 423 413 421 540 010 141 003
LMC and SMC Combmod 3 010 203 2 302 881 1 995 096 1 196 593 150 774 125 606
Combmod-α 2 021 603 1 326 305 1 600 652 440 195 366 773 44 283
Combmod-Supp 2 156 151 1 236 203 1 782 062 468 333 - -

Notes. Detections exclusive to the Gaia-IR mode refer to quasars and galaxies identified only in Gaia-IR mode and not in the Gaia-only mode.

16.4.7.2 UCA products

UCA classifies each source having a valid BP/RP spectrum into one of four categories: star, galaxy, quasar, or outlier. For each of the three former types, a more specific subtype is also derived, as shown in Table 16.31. This classification relies on a method based on pre-trained Self-Organising Maps (see Section 16.3.13.5).

The information from UCA is published in the Gaia DR4 tables ap_class, uca_neuron_information and uca_neuron_xp_spectra (see Section 16.3.13.4). ap_class contains the classification results for each source, where, if applicable, it lists the best matching map and neuron, as well as the class label of the neuron and the distance to the prototype of this neuron. uca_neuron_information and uca_neuron_xp_spectra in turn, publish the information describing the training maps.

Table 16.43 shows the main results from the UCA module. The majority of the sources are classified as stars. Less than 5% are classified as extragalactic sources, although we find that most of these are actually stellar contaminants (as shown in Figure 16.104 and Figure 16.105), so an additional flag-based filtering was applied to the data.

Table 16.43: UCA classification results in Gaia DR4.
Subset Source Type Number of sources Percentage
All sources Stars 1 074 919 117 85.43%
Galaxies 42 765 626 3.40%
Quasars 11 732 402 0.93%
Outliers 128 901 404 10.24%
Good quality sources Stars 55 138 865 5.12%
Galaxies 996 959 2.33%
Quasars 851 800 7.26%

Notes. The percentage of the good quality subset is calculated with respect to the total number of sources of that source type, while the percentage of unfiltered sources is calculated with respect to the total dataset.

The performance of the method is evaluated through a validation dataset, held out from the training sample and composed of approximately 8 million stars, 4 000  galaxies and 20 000  quasars, using the purity and completeness metrics defined in Equation 16.79. These metrics represent, respectively, the reliability of the assigned labels and the coverage of the true sources:

PurityK=T⁢PKT⁢PK+F⁢PKCompletenessK=T⁢PKT⁢PK+F⁢NK (16.79)

where K denotes the class, and T⁢P, F⁢P and F⁢N represent, respectively, the number of true positive, false positive and false negative values. Note that purity depends on the class composition of the validation dataset, since F⁢PK is built from the sources of the classes other than K that are assigned to K, whereas the denominator of completeness only involves sources of class K.

Table 16.44 shows the classification performance both at the source-type and at the subtype level. Stars achieve a high performance at both levels: at source-type level this is expected given their dominance in the validation dataset, whereas at subtype level the stellar sources compete among the 16 stellar subtypes, where such dominance plays a smaller role. The main exception in the stellar dataset is the confusion between the hotter stars and white dwarfs, which occurs in both directions and is expected, as their normalised spectra are barely distinguishable. Moreover, the ultra-cool dwarf (UCDs) subtype shows a pattern similar to that of the coolest stars: despite a high completeness, a significant number of M-type stars are misclassified as UCDs, artificially inflating the occupancy of this subtype. For galaxies, sources can be reliably identified as such, but assigning a more specific subtype is less reliable. For quasars, the source-type classification performance is limited due to a high confusion between quasars and stars, specifically extragalactic sources of redshift 1.5<z<2.5 and K-type stars.

Table 16.44: Classification results of the UCA validation dataset
Source Type Subtype
Purity Completeness Purity Completeness
Star 99.97% 99.99% 85.00% 89.49%
Galaxy 96.95% 90.65% 65.17% 58.03%
Quasar 96.54% 76.28% 84.74% 62.18%
Notes. The source-type columns denote the performance of the model when assigning the source to any of the three types. The subtype columns denote the performance of the model when assigning a more specific subtype for the given source type.

Rather than treating extragalactic sources contaminated by stars as outliers, a flag-based filtering was applied based on the distance to the Best Matching Unit (BMU) and on astrometric criteria, as described in Section 16.3.13.7. As a result, less than 2 million sources are finally retained as good-quality extragalactic objects, as shown in Figure 16.104 and Figure 16.105. Note that the LMC and SMC still stand out in the filtered subset, especially in the case of quasars.

Refer to caption
Figure 16.104: Sources classified as galaxies by UCA before and after filtering by the quality flags. See the archive query example further below for how the high-quality sample of galaxies is retrieved by filtering. See Table 16.43 for the number of sources in each sample.
Refer to caption
Figure 16.105: Same as Figure 16.104, for quasars.

10.24% of the sources are classified as outliers. As explained in Section 16.3.13.5, a source can be flagged as an outlier under two criteria: a) its distance to the BMU exceeds the threshold of the map, or b) the distances to the first and the second BMU are too similar. Table 16.45 shows the distribution of outliers per source type and according to the two criteria described above. Stars show the lowest outlier rate, while quasars are the most affected by the outlier detection mechanism. For stars and galaxies, the two rejection criteria are evenly distributed. For quasars, however, most outliers are rejected due to the similarity to the second BMU, which is mostly driven by the confusion with stars.

Table 16.45: UCA outlier rates and rejection criteria by source type in Gaia DR4
Outlier Rate Distance-based Similarity-based
Star 06.89% 49.02% 50.98%
Galaxy 35.52% 49.65% 50.35%
Quasar 68.76% 29.78% 70.22%

Notes. The outlier rate represents, for a given source type, the fraction of sources that were finally detected as outliers. The distance-based and similarity-based columns represent, respectively, the fraction of outliers of a given type rejected due to their distance to the BMU, or due to the similarity between the distances to the first and second BMU.

16.4.7.2.1 UCA Archive queries

The following queries provide examples of how to access source-level UCA information. Example queries for retrieving information about the training maps are provided in Section 16.4.11.1.

  • •

    Get information on sources that were processed by UCA  

    SELECT source_id,
        classlabel_uca,
        som_uca_id,
        neuron_uca_id,
        neuron_uca_dist,Ψ
        flags_uca
    FROM gaiadr4.ap_class
    WHERE som_uca_id is NOT NULL
        
    
  • •

    Retrieve sources classified in a given map, by the map prefix (see Section 16.3.13.4). This example shows how to access sources that were classified as stars.

    SELECT source_id
    FROM gaiadr4.ap_class
    WHERE CAST(som_uca_id AS VARCHAR) LIKE ’2%’
        
    
  • •

    Get the good quality sources of a given type (see Section 16.3.13.7). The following example retrieves the high-quality galaxies:

    SELECT  source_id
    FROM gaiadr4.ap_class
    WHERE classlabel_uca LIKE ’GAL%’
        AND flags_uca LIKE ’%0’
        
    

16.4.7.3 OA products

In Gaia DR4, OA processed around 139 million outliers from DSC and UCA (see Section 16.3.2 and Section 16.3.13 for further details). Of these, 20 million were provided exclusively by DSC, 102 million exclusively by UCA and 17 million by both modules. For more information about the performance of the module, see Section 16.4.11.2.

16.4.7.3.1 OA Archive queries

The following queries provide examples of how to retrieve source-level OA information:

  • •

    Retrieve sources that were classified in OA:

    SELECT source_id,
    classlabel_oa,
    neuron_oa_id,
    neuron_oa_dist,
    neuron_oa_dist_percentile_rank,
    flags_oa
    FROM gaiadr4.ap_class
    WHERE neuron_oa_id IS NOT NULL
    
  • •

    Retrieve the sources that were grouped in a given neuron:

    SELECT source_id
    FROM gaiadr4.ap_class
    WHERE neuron_oa_id = 2025080521450000
    
  • •

    Get the sources with the label ‘UNKNOWN’ that were processed in OA:

    SELECT source_id
    FROM gaiadr4.ap_class
    WHERE classlabel_oa = ’UNKNOWN’
        AND neuron_oa_id IS NOT NULL
    

    Note that the default value of classlabel_oa is ‘UNKNOWN’, even for sources that were not processed by OA. For this reason, the condition on neuron_oa_id shown above is required to restrict the query to the sources actually processed by the module.