Multi-task learning framework oriented to galaxy classification and gas metal abundance regression and implementation method thereof

By combining a multi-task learning framework with shared feature extraction and attention mechanisms, the collaborative optimization problem of galaxy classification and gas metallicity regression tasks was solved, achieving efficient galaxy spectral data analysis, improving prediction accuracy and computational efficiency, and being applied to the study of galaxy chemical evolution.

CN121787472APending Publication Date: 2026-04-03DEZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-19
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies for galaxy classification and gas metallicity regression suffer from problems such as inefficiency due to task separation, lack of collaborative optimization, and difficulty in handling diverse needs. In particular, the computational efficiency and accuracy in large-scale spectral data processing are insufficient to meet the demands of modern astronomy.

Method used

A multi-task learning framework is adopted, which combines a shared feature extraction module, an attention mechanism module, a classification task output module, and a regression task output module. It extracts spectral data features through a convolutional neural network, and enhances key feature information by using an attention mechanism and dynamically weighted feature channels. Combined with channel attention and conditional masking techniques, it achieves collaborative optimization of classification and regression tasks.

Benefits of technology

It significantly improves the prediction accuracy and computational efficiency of galaxy classification and gas metallicity regression, and is suitable for automated analysis of large-scale galaxy spectral data, especially having important application value in the study of galaxy chemical evolution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121787472A_ABST
    Figure CN121787472A_ABST
Patent Text Reader

Abstract

The invention discloses a galaxy classification and gas metal abundance regression-oriented multi-task learning framework and an implementation method thereof, and the framework comprises a shared feature extraction module, an attention mechanism module, a classification task output module, and a regression task output module. Inputting the data into a shared feature extraction module, and extracting global features; the extracted features are further input to an attention mechanism module; the features processed by the attention mechanism module are input into a classification task output module and a regression task output module in parallel, the classification task output module outputs probability distribution of galaxy categories, and the regression task output module outputs gas metal abundance. According to the method, classification and regression tasks can be processed at the same time through a shared feature extraction module and a joint optimization strategy, so that prediction precision and calculation efficiency of galaxy classification and gas metal abundance regression are improved, and the method has great potential in automatic analysis of large-scale galaxy spectral data and galaxy chemical evolution law research.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of astronomical data processing technology, specifically to a multi-task learning framework for galaxy classification and gas metallicity regression, and its implementation method. Background Technology

[0002] Galaxies are among the most important celestial structures in the universe, composed of billions of stars, gas, and dust, forming complex systems of stars, interstellar matter, and other materials. The formation and evolution of galaxies are accompanied by a series of complex physical and chemical changes, typically described by various parameters such as stellar mass, star formation rate, gas metallicity, and morphological structure. Among these, gas metallicity, as a key indicator of the heavy element abundance in a galaxy, is an important parameter for studying its chemical evolution. The level of gas metallicity is closely related to the history of star formation and supernova explosions in a galaxy, providing crucial clues for exploring the processes of galaxy formation and evolution.

[0003] With the rapid development of modern astronomical observation technology, large-scale spectroscopic surveys (such as the Large Sky Area Multi-Object Fiber Spectroscopic Telescope (LAMOST) and the Sloan Digital Sky Survey (SDSS)) have provided massive amounts of data for galaxy spectroscopic research. These data have laid the foundation for galaxy spectral classification and gas metallicity measurement, becoming core topics for revealing the mechanisms of galaxy formation and evolution.

[0004] Galaxietypology tasks typically rely on spectral data, classifying galaxies by analyzing emission line intensity ratios (such as BPT classification). They are primarily categorized into star-forming galaxies (SFG), composite galaxies, active galactic nuclei (AGN), and passive galaxies. However, traditional classification methods often depend on rule-based classifiers or independent supervised learning models. These methods fail to fully extract high-dimensional features from spectral data, resulting in limited classification accuracy. Particularly in large-scale data processing scenarios, the computational efficiency of these methods is insufficient to meet the demands of modern astronomy.

[0005] Gas metallicity regression estimation is a crucial task in studying the chemical evolution of galaxies, as its levels reflect the abundance of heavy elements within them. Traditional estimation methods primarily rely on physical models or empirical formulas, such as deriving metallicity through theoretical fitting of emission line intensities. However, these methods have limited processing capabilities for high-dimensional spectral data and are insufficient for automated analysis of large-scale data, failing to meet the dual requirements of efficiency and accuracy in modern scientific research.

[0006] Meanwhile, current research often models galaxy classification and gas metallicity regression separately, which has the following significant drawbacks: First, task separation leads to inefficiency: when classification and regression tasks are processed independently, feature extraction processes cannot be shared, and repeated computations increase processing time, making it difficult to meet the needs of rapid analysis of large-scale spectral data. Second, there is a lack of inter-task collaborative optimization: the potential correlation between classification and regression tasks is not fully explored, resulting in low data utilization efficiency and limiting the improvement of overall model performance. Third, it is difficult to handle diverse needs: traditional methods struggle to simultaneously balance computational efficiency and prediction accuracy when dealing with high-dimensional and complex spectral data.

[0007] In summary, there is still a lack of a multi-task learning framework and related applications in the fields of galaxy classification and gas metallicity regression that can simultaneously perform classification and regression tasks, and possess efficient computing power and task collaborative optimization capabilities. Summary of the Invention

[0008] The purpose of this invention is to provide a multi-task learning framework and its implementation method for galaxy classification and gas metallicity regression. This multi-task learning framework combines the galaxy classification task with the gas metallicity prediction task, achieving synergistic optimization of the classification and regression tasks. It significantly improves the prediction accuracy and computational efficiency of galaxy classification and gas metallicity regression, and can be widely used in the automated analysis of large-scale galaxy spectral data. In particular, it has important application value in the study of galaxy chemical evolution.

[0009] To achieve the above objectives, on the one hand, the present invention provides a multi-task learning framework for galaxy classification and gas metallicity regression, wherein the multi-task learning framework includes a shared feature extraction module, an attention mechanism module, a classification task output module, and a regression task output module;

[0010] The galaxy spectral data is first input into the shared feature extraction module to extract global features. The extracted features are then input into the attention mechanism module, which effectively enhances key feature information related to the classification and regression tasks through dynamic weighted feature channels. The features processed by the attention mechanism module are input in parallel into the classification task output module and the regression task output module. The classification task output module outputs the probability distribution of galaxy categories, while the regression task output module outputs gas metallicity.

[0011] In this invention, preferably, galaxy spectral data is input into the shared feature extraction module, and global features of the spectral data are extracted sequentially through convolutional and pooling operations of a convolutional neural network (CNN); the pooling operation is preferably max pooling. For example, in this invention, a one-dimensional convolutional neural network (1D CNN) is used to extract global spectral features; each convolutional module contains two convolutional layers (kernel size 3, stride 1) and one max pooling layer (pooling kernel size 3, stride 3). Global features related to classification and regression tasks in the spectrum are extracted through layer-by-layer convolution and pooling operations.

[0012] In this invention, preferably, the attention mechanism module dynamically adjusts feature weights based on channel attention, enabling the model to focus on key feature information relevant to classification and regression tasks, thereby further improving model performance. For example, in this invention, global information is first extracted using adaptive average pooling, then channel weighting coefficients are generated through two fully connected layers, the weighting coefficients are normalized using a sigmoid activation function, and finally, the coefficients are multiplied point-by-point with the original features to complete feature reweighting.

[0013] In this invention, preferably, the classification task output module consists of multiple fully connected layers and Dropout layers, and finally outputs the probability distribution of each category through a Softmax activation function. The multiple fully connected layers can be three fully connected layers.

[0014] In this invention, preferably, the regression task output module consists of multiple fully connected layers and a Dropout layer, and finally outputs the predicted value of gas metallicity. The multiple fully connected layers can be three fully connected layers.

[0015] In a specific embodiment of this invention, when the classification task outputs, the classification label is generated by matching the galSpecExtra and emissionLinesPort star catalogs, and only samples with consistent classification are retained. When the regression task outputs, the regression label is the median gas metallicity (oh_p50) provided in the galSpecExtra star catalog; samples with reliability criteria (such as reliable=1 and zWarning=0) are selected.

[0016] In this invention, the galaxy spectral data is acquired from the Sloan Digital Sky Survey (SDSS) project and... Uniform sampling is performed at intervals, with a wavelength range of [wavelength range missing]. It provides sufficient input features for classification and regression tasks.

[0017] On the other hand, the present invention also provides a method for implementing the above-mentioned multi-task learning framework for galaxy classification and gas metallicity regression in galaxy classification and gas metallicity regression prediction, which includes the following steps:

[0018] Step 1: Create galaxy spectral data, classification labels, and regression labels;

[0019] Step 2: Build the multi-task learning framework for galaxy classification and gas metallicity regression as described above, and input the galaxy spectral data from Step 1 into the multi-task learning framework, and output the results;

[0020] Step 3: Evaluate the results of the multi-task learning framework, analyze the performance of classification and regression tasks, and output the results of galaxy classification and metallicity prediction.

[0021] In this invention, to ensure consistency in the dimensions of the input data, the galaxy spectral data is acquired from the Sloan Digital Sky Survey (SDSS) project and... Uniform sampling is performed at intervals, with a wavelength range of [wavelength range missing]. This provides sufficient input features for classification and regression tasks. To enhance the stability of model training, the spectral data is processed using the Smean normalization method. This method normalizes the original flux of each spectrum by mean normalization, scaling it to a uniform numerical scale to reduce the impact of flux amplitude differences between different spectra on model training. Specifically, each spectrum consists of flux values ​​at m wavelengths, which can be represented as an m-dimensional vector:

[0022] x = (x1, x2, ..., x) m ) T

[0023] The formula for calculating the standardized flow vector x′ is as follows:

[0024]

[0025] in, This represents the average flow rate of the spectrum.

[0026] In this invention, in order to ensure a balanced distribution of samples for the classification task, a data balance sampling operation can also be performed. For example, 25,000 samples can be sampled from each of the following types of galaxies: Passive, Star-forming Galaxy (SFG), Composite, and Active Galactic Nucleus (AGN), to ensure a balanced distribution of samples for the classification task.

[0027] This invention also includes a step of training and optimizing the multi-task learning framework in step 2. Preferably, the training process employs a joint loss function and optimizes the tasks using a dynamic weighting strategy, as shown in the following formula:

[0028] L total =λ1·L class +λ2·L regress

[0029] Among them, L class For the loss of the classification task, L regress λ1 and λ2 are the loss values ​​for the classification and regression tasks, respectively.

[0030] L class Using FocalLoss as the classification loss function assigns higher weights to samples that are difficult to classify, allowing the model to pay more attention to these samples and thus improving the accuracy of classification predictions. The formula is as follows:

[0031]

[0032] Where N is the total number of samples, and C is the total number of categories (C = 4); p i,c y is the predicted probability of the correct class for the i-th sample; i,c α indicates whether category c is the label value of sample i; if yes, it is 1, otherwise it is 0. c It is a balance factor, with a value range of 0 ≤ α. c ≤1, used to adjust the loss weights for positive and negative samples. In this invention, preferably, α c =0.25; γ is an adjustment factor with a value range of γ>0, used to reduce the loss contribution of easily classified samples. In this invention, preferably, γ=2.

[0033] To improve the accuracy of predicting gas metallicity in star-forming galaxies (SFGs), this invention incorporates regression loss L... regress The model employs Mean Absolute Error (MAE) loss and further proposes a conditional masking mechanism. This mechanism determines whether the regression loss participates in gradient updates based on the sample's category, preventing the model from being affected by non-star-forming galaxy samples and allowing it to focus more on learning from effective data. Specifically, a conditional mask variable M is introduced into the regression loss calculation for each sample. i When the i-th sample belongs to a star-forming galaxy (SFG), M is set to... i =1, and its regression error is accumulated normally; when the sample belongs to a non-star-forming galaxy, then M i=0, this sample does not contribute to gradient updates for the regression task. The loss function for the regression task is defined as follows:

[0034]

[0035] Among them, M i y is a condition mask variable. true,i and y pred,i These are the regression label value and the model prediction value, respectively.

[0036] By using conditional masking, the model effectively avoids interference from other types of data on the regression task, allowing the regression task to focus more on learning the relevant data.

[0037] In the preferred embodiment, λ1 and λ2 are the loss weights for the classification and regression tasks, respectively, employing a Dynamic Weight Average (DWA) strategy. This method calculates the weight λ for each task at the end of each training epoch based on the relative change in the rate of loss descent. k (t):

[0038]

[0039] Where k=1 represents the weight of the classification task, k=2 represents the weight of the regression task, K represents the number of tasks (K=2), and T is a temperature coefficient that controls the smoothness of the weight distribution (e.g., T=1).

[0040] The rate of decrease w of task k k (t) is defined as:

[0041]

[0042] Where L k (t) represents the average loss value of task k in the t-th training round. This formula is used to measure the learning speed of each task—tasks that decrease more slowly will be assigned higher weights in the next round.

[0043] In this invention, preferably, the optimization process is implemented through gradient pruning and the Adam optimizer, with the learning rate adjusted by the ReduceLROnPlateau scheduler. The training set, validation set, and test set are divided in a 6:2:2 ratio, and standardization is used to ensure uniform data distribution. Preferably, gradient pruning (max_grad_norm = 1.0) is applied to avoid gradient explosion, and the learning rate is dynamically adjusted using the ReduceLROnPlateau scheduler to accelerate convergence.

[0044] In this invention, the evaluation metrics for the classification task include accuracy, precision, recall, and F1 score; the evaluation metrics for the regression task include mean squared error (MSE), standard deviation (Std Dev), and coefficient of determination (R²). 2 ).

[0045] The model significantly improves the prediction accuracy of galaxy classification and gas metallicity regression by combining classification and regression tasks, and provides an efficient solution. It can be widely used in the automated analysis of large-scale galaxy spectral data, and has important application value, especially in the study of galaxy chemical evolution.

[0046] According to a specific embodiment of the present invention, the present invention provides a method for implementing a multi-task learning framework for galaxy classification and gas metallicity regression in galaxy classification and gas metallicity prediction, comprising the following steps:

[0047] Step 1: Create a dataset containing galaxy spectral data, classification labels, and regression labels;

[0048] Step 2: Construct a multi-task learning framework for galaxy classification and gas metallicity regression; train and optimize the multi-task learning framework.

[0049] Step 3: Evaluate the results of the multi-task learning framework, analyze the performance of classification and regression tasks, and output the results of galaxy classification and metallicity prediction.

[0050] In step 1, galaxy spectral data are acquired from the Sloan Digital Sky Survey (SDSS) project, and the wavelength range of the spectral data is standardized to 3840–8000 angstroms. by Uniform sampling is performed at intervals to form complete full-spectrum data. This process ensures the consistency of the model's input dimensions, providing sufficient input features for classification and regression tasks.

[0051] Classification and regression labels: Classification and regression labels were obtained from the MPA-JHU Galactic Physics Database and the galSpecExtra and emissionLinesPort catalogues provided by the Portsmouth Group. Classification labels were generated based on the optical emission line ratio discriminant method, specifically by performing consistency processing on the bptclass labels provided in the galSpecExtra and emissionLinesPort catalogues, retaining only spectral samples with consistent classification results. Regression label values ​​were taken from the median gas metallicity (oh_p50) in the galSpecExtra catalogue.

[0052] In this invention, to make the data more reliable, balanced, and accurate, galaxy spectral data can undergo data filtering, data balancing, and data standardization. The methods for data filtering, data balancing, and data standardization can be as follows:

[0053] Data filtering: Samples with a bptclass of 1 (star-forming galaxies) and oh_p50 = -9999 were removed. Samples meeting the following criteria were also filtered: reliable = 1 (reliable spectral data quality); zWarning = 0 (no warnings from redshift measurements); redshift z range between 0.002 and 0.3; signal-to-noise ratio snMedian_r ≥ 5. After this filtering, 419,468 spectral samples were retained.

[0054] Data Balancing: To ensure a balanced distribution of samples across all categories in the classification task, 25,000 data points were sampled from each of the four categories: Passive, Star-forming Galaxies (SFG), Composite Galaxies, and Active Galactic Nuclei (AGN). This balanced distribution not only improved the accuracy of the classification task but also reduced model bias that could result from class imbalance.

[0055] Data standardization: Data standardization helps improve model convergence, enhances prediction accuracy, and prevents certain features from disproportionately influencing the model during training. In this invention, the Smean standardization method is used to process the spectral data. This method normalizes the original flow rate of each spectrum by mean normalization, scaling it to a uniform numerical scale to reduce the impact of differences in flow rate amplitude between different spectra on model training. Assuming each spectrum consists of flow rate values ​​at m wavelengths, it can be represented as an m-dimensional vector:

[0056] x = (x1, x2, ..., x) m ) T

[0057] The formula for calculating the standardized flow vector x′ is as follows:

[0058]

[0059] in, This represents the average flow rate of the spectrum.

[0060] Dataset partitioning: The cleaned data was divided into training, validation, and test sets in a 6:2:2 ratio. The training set was used for model parameter learning, the validation set for hyperparameter tuning, and the test set for model performance evaluation. During data partitioning, it was ensured that the distribution of classification and regression labels was consistent across the subsets to guarantee the fairness and reliability of the model evaluation results.

[0061] In step 2, the framework of this invention is established, including the following key modules: a shared feature extraction module, a classification task output module, a regression task output module, and a collaborative optimization of channel attention mechanism and conditional masking technology. Within the multi-task learning framework of deep learning, this model achieves collaborative optimization of galaxy classification and gas metallicity prediction, effectively improving the computational efficiency and prediction accuracy of both tasks.

[0062] Shared Feature Extraction Module: This module extracts global features from full-spectrum galaxy data to support classification and regression tasks. It consists of multiple convolutional and pooling layers, with the following structure:

[0063] Convolutional structure: The module contains five convolutional modules, each of which includes two convolutional layers with a kernel size of 3, a stride of 1, and padding of 1, and the activation function is ReLU.

[0064] Pooling structure: Each convolutional module is followed by a max pooling layer (pooling kernel size is 3, stride is 3).

[0065] Channel number changes: The number of input and output channels for each convolution module are as follows: 1→16, 16→32, 32→64, 64→128, 128→256.

[0066] Through layer-by-layer convolution and pooling operations, this module progressively compresses the feature dimensions of the input data while retaining key information in the full spectral spectrum, thereby generating a global feature representation suitable for classification and regression tasks.

[0067] Attention Mechanism: To further enhance the model's ability to focus on task-relevant features, this invention introduces a channel attention mechanism. This mechanism dynamically adjusts feature weights, enabling the model to focus on the features that contribute most to the classification and regression tasks. The specific process of the attention module is as follows:

[0068] Adaptive average pooling is applied to shared features to extract global statistical information;

[0069] Use two fully connected layers to reduce the number of channels from 256 to 16, and then increase the dimension back to 256.

[0070] Generate channel weighted coefficients, and normalize the weighted coefficients using the Sigmoid activation function;

[0071] The normalized weighted coefficients are multiplied point by point with the original features to complete the feature reweighting.

[0072] The formula is expressed as:

[0073] Attention(x)=x·σ(W2·ReLU(W1·Pool(x)))

[0074] Where W1 and W2 are learnable parameter matrices, Pool(x) represents the adaptive average pooling operation, and σ is the Sigmoid activation function.

[0075] After the attention mechanism completes feature reweighting, the model introduces adaptive average pooling to further aggregate important features. Adaptive average pooling extracts the average value across all spatial locations, compressing high-dimensional features into a fixed-length vector, which serves as input for classification and regression tasks.

[0076] Classification Task Output Module: This module predicts galaxy types (e.g., star-forming galaxies, complex galaxies, active galactic nuclei). It consists of a three-layer fully connected network and a Dropout layer to enhance the model's regularization and prevent overfitting. For example, its specific structure is as follows:

[0077] The first fully connected layer has an input feature dimension of 256 and an output dimension of 128, with a Dropout layer (Dropout(0.2)). The second fully connected layer has an input feature dimension of 128 and an output dimension of 64, using the ReLU activation function. The third fully connected layer has an input feature dimension of 64 and an output dimension equal to the dimension of the classification label space, using the Softmax activation function. The Softmax activation function normalizes the class probabilities, and the galaxy's class is ultimately determined based on the maximum probability value.

[0078] Regression Task Output Module: The regression task output module is used to predict the gas metallicity (oh_p50) of star-forming galaxies. The module consists of a three-layer fully connected network and a Dropout layer, for example, the specific structure is as follows:

[0079] The first fully connected layer has an input feature dimension of 256 and an output dimension of 128, with a Dropout layer (Dropout(0.2)) added; the second fully connected layer has an input feature dimension of 128 and an output dimension of 64, using the ReLU activation function; the third fully connected layer has an input feature dimension of 64 and an output dimension of 1, which is the predicted value of gas metallicity.

[0080] In step 2, the model training process includes data loading and preprocessing, definition of the loss function and optimization strategy, specific steps of the training process, and validation and evaluation. Through joint optimization of classification and regression tasks, the model can simultaneously complete galaxy classification and gas metallicity regression, ensuring synergistic optimization of tasks and performance improvement.

[0081] Data Loading and Preprocessing: The training, validation, and test datasets were divided in the same 6:2:2 ratio as before. The raw flux of each spectrum was mean-normalized to scale it to a uniform numerical scale. The processed data was then input into the model in batches, iteratively processed using a DataLoader. The batch size was set to 128 to ensure computational efficiency and optimized memory management during training.

[0082] Loss in Classification Tasks: The goal of classification tasks is to predict galaxy types. This invention employs the Focal Loss function in classification tasks. By assigning greater loss weights to hard-to-classify samples, the model can pay more attention to these samples, thereby improving the accuracy of classification predictions. The formula is as follows:

[0083]

[0084] Where N is the total number of samples, and C is the total number of categories (C = 4); p i,c y is the predicted probability of the correct class for the i-th sample; i,c α indicates whether category c is the label value of sample i; if yes, it is 1, otherwise it is 0. c It is a balance factor, with a value range of 0 ≤ α. c ≤1, used to adjust the loss weights for positive and negative samples. In this invention, preferably, α c =0.25; γ is an adjustment factor with a value range of γ>0, used to reduce the loss contribution of easily classified samples. In this invention, preferably, γ=2.

[0085] Regression Loss and Conditional Masking Techniques: In regression tasks, to improve the accuracy of predicting the metallicity of gas in star-forming galaxies (SFGs), this invention employs regression loss L... regress The model employs Mean Absolute Error (MAE) loss and further proposes a conditional masking mechanism. This mechanism determines whether the regression loss participates in gradient updates based on the sample's category, preventing the model from being affected by non-star-forming galaxy samples and allowing it to focus more on learning from effective data. Specifically, a conditional mask variable M is introduced into the regression loss calculation for each sample. i When the i-th sample belongs to a star-forming galaxy (SFG), M is set to... i =1, and its regression error is accumulated normally; when the sample belongs to a non-star-forming galaxy, then M i =0, this sample does not contribute to gradient updates for the regression task. The loss function for the regression task is defined as follows:

[0086]

[0087] Among them, M i y is a condition mask variable. true,i and y pred,i These are the regression label value and the model prediction value, respectively.

[0088] By using conditional masking, the model effectively avoids interference from other types of data on the regression task, allowing the regression task to focus more on learning the relevant data.

[0089] Joint Loss Function: To achieve synergistic optimization of classification and regression tasks, this invention employs a joint loss function, where the classification loss and regression loss are combined using a dynamic weight adjustment strategy. The specific formula is as follows:

[0090] L total =λ1·L class +λ2·L regress

[0091] Among them, L class L represents the loss of the classification task. regress Let λ1 and λ2 represent the loss for the regression task, respectively, and be the loss weights for the classification and regression tasks, used to dynamically adjust the learning balance between the two tasks during training. To achieve this dynamic adjustment, this invention employs a Dynamic Weight Average (DWA) strategy. At the end of each training round, this method calculates the weight λ for each task based on the relative change in the rate of loss descent. k (t):

[0092]

[0093] Where k=1 represents the weight of the classification task, k=2 represents the weight of the regression task, K represents the number of tasks (K=2), and T is a temperature coefficient that controls the smoothness of the weight distribution (T=1).

[0094] The rate of decrease w of task k k (t) is defined as:

[0095]

[0096] Where L k (t) represents the average loss value of task k in the t-th training round. This formula is used to measure the learning speed of each task—tasks that decrease more slowly will be assigned higher weights in the next round.

[0097] Finally, the weights λ1 and λ2 in each round of the joint loss function are determined by λ kThe formula (t) is updated in real time, thereby achieving a dynamic balance between classification and regression tasks during the training process, avoiding one task from dominating the optimization process, and promoting coordinated convergence among tasks.

[0098] Gradient clipping and optimization strategy: To prevent gradient explosion or vanishing problems, this invention applies gradient clipping after each backpropagation, limiting the gradient norm to max_grad_norm = 1.0. Gradient clipping can improve training stability in complex high-dimensional feature spaces and accelerate the convergence process.

[0099] The optimizer employs the Adam optimization algorithm with an initial learning rate of 0.001. Combined with the ReduceLROnPlateau learning rate scheduler, the learning rate is automatically reduced to 10% of its original value if the validation set loss does not improve within 10 epochs. This learning rate adjustment strategy further improves the model's convergence efficiency and generalization ability.

[0100] Training and Validation Process: During the training phase, the model performs forward propagation on each batch of data sequentially, calculating classification and regression outputs. The joint loss function is used to calculate the total loss, backpropagation is performed, and gradient pruning is applied to update the model parameters.

[0101] In step 3, for the galaxy classification task, this invention conducted a detailed evaluation of the samples in the test set and introduced the following metrics to quantify the classification performance: accuracy, precision, recall, and F1 score. The specific formulas and meanings of these metrics are as follows:

[0102] Classification accuracy measures the proportion of samples correctly predicted by the model out of the total samples, reflecting the overall predictive ability of the model. The formula is as follows:

[0103]

[0104] Precision: For a given category, the proportion of samples that the model predicts belong to that category, but which actually belong to that category. The formula is as follows:

[0105]

[0106] Here, True Positives represent the number of samples correctly predicted as belonging to that class, and False Positives represent the number of samples incorrectly predicted as belonging to that class. Precision reflects the accuracy of the model when predicting a particular class.

[0107] Recall: Calculates the proportion of samples that actually belong to a certain class, which are correctly predicted as belonging to that class by the model. The formula is as follows:

[0108]

[0109] False Negatives represent the number of samples that actually belong to the category but were not predicted as belonging to that category. Recall reflects the model's ability to cover samples of a certain category.

[0110] F1 Score: The harmonic mean of precision and recall, which comprehensively measures the model's performance on classification tasks. The formula is as follows:

[0111]

[0112] Among them, the F1 score strikes a balance between precision and recall, making it suitable for classification tasks with imbalanced classes.

[0113] For regression tasks, this invention focuses on estimating the gas metallicity (oh_p50) of star-forming galaxies (SFGs) using mean squared error (MSE), standard deviation (Std Dev), and coefficient of determination (R²). 2 The regression performance of the model is evaluated using indicators such as [insert indicators here]. The specific formulas and explanations are as follows:

[0114] Mean Squared Error (MSE): Measures the squared mean of the error between the predicted and the true values. The formula is as follows:

[0115]

[0116] Among them, y pred,i and y true,i , where are the predicted value and the actual value of the i-th sample, respectively, and N is the total number of samples. The smaller the MSE value, the better the regression performance of the model.

[0117] Standard Deviation (Std Dev): Measures the range of fluctuation in prediction error, and is expressed by the following formula:

[0118]

[0119] in, The mean of the prediction error is represented by the standard deviation, which reflects the stability of the model's predictions.

[0120] Coefficient of determination (R) 2 Score: An indicator that evaluates the model's fit, ranging from [0,1]. A value closer to 1 indicates a better model fit. The formula is as follows:

[0121]

[0122] in, This is the mean of the true values.

[0123] Compared to existing technologies, this invention achieves collaborative optimization of galaxy classification and gas metallicity prediction tasks through a unified multi-task learning framework, and has the following technical advantages:

[0124] 1. Enhanced Task Collaborative Optimization Capability: This invention designs a shared feature extraction module, a joint loss function, and an attention mechanism to achieve information sharing and optimization balance between classification and regression tasks. Through inter-task collaborative learning, the overall performance of the model is significantly improved.

[0125] 2. Improved computational efficiency: Integrating galaxy classification and gas metallicity prediction tasks into the same model avoids redundant calculations between independent models, significantly improving the computational efficiency of large-scale spectral data analysis and meeting the needs of modern astronomy for rapid analysis.

[0126] 3. Enhanced prediction accuracy: The dynamic attention mechanism guides the model to focus on task-related features; the conditional masking technique effectively filters out samples related to the regression task, significantly improving the prediction accuracy of classification and regression tasks.

[0127] 4. High practical application value: This invention provides an efficient solution for the automated analysis of large-scale astronomical spectroscopic data. This method can be widely applied to studying the chemical evolution of galaxies, the physical processes of galaxy life cycles, and other fields requiring the coordinated optimization of classification and regression tasks.

[0128] Other features and advantages of the present invention will be described in detail in the following detailed description section. Attached Figure Description

[0129] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the following detailed description to explain the invention, but do not constitute a limitation thereof. In the drawings:

[0130] Figure 1 : A schematic diagram of a multi-task learning framework according to an embodiment of the present invention.

[0131] Figure 2 : A schematic diagram of the shared feature extraction module structure according to one embodiment of the present invention.

[0132] Figure 3 : A schematic diagram of the attention mechanism according to one embodiment of the present invention.

[0133] Figure 4 : A schematic diagram of the classification output module structure according to one embodiment of the present invention.

[0134] Figure 5 : A schematic diagram of the regression output module structure according to one embodiment of the present invention.

[0135] Figure 6 : A schematic diagram illustrating the dynamic adjustment of loss weights λ1 and λ2 for classification and regression tasks in the joint loss function according to one embodiment of the present invention.

[0136] Figure 7 : A schematic diagram of the confusion matrix of galaxy classification results according to one embodiment of the present invention.

[0137] Figure 8 : A schematic diagram of the error distribution between the regression task prediction result and the true value in one embodiment of the present invention.

[0138] exist Figure 1 The structure of a multi-task learning model for galaxy classification and gas metallicity regression is shown in the figure. Figure 2 The text demonstrates the network architecture of a 1D Convolutional Neural Network (CNN) and how it extracts global features from spectral data, showcasing convolution and pooling operations. Figure 3 The paper demonstrates how to dynamically adjust feature weights through a channel attention mechanism to improve the expressive power of task-related features. Figure 4 The design of the three-layer fully connected network and the Dropout layer is shown, along with how to output galaxy classification results. Figure 5 The text demonstrates how conditional masks and fully connected networks can be used to predict the gas metallicity of star-forming galaxies (SFGs). Figure 6 The figure illustrates the dynamic adjustment process of weights λ1 and λ2 when the joint loss function employs a dynamic weight averaging strategy. As can be seen from the figure, around the 70th round, these two weight values ​​tend to stabilize and converge to 1, indicating that the dynamic weight averaging strategy achieves a dynamic balance between classification and regression tasks during training, preventing one task from dominating the optimization process. Figure 7 The results demonstrate the predictive performance of the classification task across different galaxy types, achieving an overall classification accuracy of 96.95%. Figure 8 The error distribution diagram of the regression task prediction results and the true values ​​in one embodiment of the present invention shows the accuracy performance of the regression task in predicting the abundance of gaseous metals. As can be seen from the figure, the deviation achieved in the regression task is 0.0001 dex, the standard deviation is 0.0388 dex, and the predicted median line (red line) is highly coincident with the ideal 1:1 reference line (black line), which has a good fitting effect. Detailed Implementation

[0139] The following provides a detailed description of specific embodiments of the present invention. It should be understood that the specific embodiments described herein are for illustrative and explanatory purposes only and are not intended to limit the scope of the invention.

[0140] The present invention will now be described in detail through examples and comparative examples.

[0141] All experiments were conducted on a computing platform equipped with an NVIDIA GeForce RTX 3080 Ti (12GB VRAM) and an 11th-generation Intel Core i7-11700F processor. The software environment included Python 3.11, NumPy 2.2.2, Pandas 2.2.3, Scikit-learn 1.6.1, PyTorch 2.3.1, and CUDA 12.1.

[0142] Example

[0143] like Figure 1-7 An application of a multi-task learning framework for galaxy classification and gas metallicity regression in galaxy classification and gas metallicity prediction includes the following steps:

[0144] Step 1: Create galaxy spectral data, classification labels, and regression labels;

[0145] Step 2: Build the multi-task learning framework for galaxy classification and gas metallicity regression as described above, and input the galaxy spectral data from Step 1 into the multi-task learning framework, and output the results;

[0146] Step 3: Evaluate the results of the multi-task learning framework, analyze the performance of classification and regression tasks, and output the results of galaxy classification and metallicity prediction.

[0147] In step 1, galaxy spectral data are acquired from the Sloan Digital Sky Survey (SDSS) project, and the wavelength range of the spectral data is standardized to 3840–8000 angstroms. by Uniform sampling is performed at intervals to form complete full-spectrum data. This process ensures the consistency of the model's input dimensions, providing sufficient input features for classification and regression tasks.

[0148] Classification and regression labels: Classification and regression labels were obtained from the MPA-JHU Galactic Physics Database and the galSpecExtra and emissionLinesPort catalogues provided by the Portsmouth Group. Classification labels were generated based on the optical emission line ratio discriminant method, specifically by performing consistency processing on the bptclass labels provided in the galSpecExtra and emissionLinesPort catalogues, retaining only spectral samples with consistent classification results. Regression label values ​​were taken from the median gas metallicity (oh_p50) in the galSpecExtra catalogue.

[0149] To ensure more reliable, balanced, and accurate data, galaxy spectral data can undergo data filtering, balancing, and standardization. Specifically:

[0150] Data Filtering: Samples with a bptclass of 1 and oh_p50 = -9999 were removed. Samples meeting the following criteria were also filtered: reliable = 1 (reliable spectral data quality); zWarning = 0 (no warnings from redshift measurements); redshift z range between 0.002 and 0.3; signal-to-noise ratio snMedian_r ≥ 5. After this filtering, 419,468 spectral samples were retained. Data Balancing: To ensure a balanced distribution of samples across all categories in the classification task, 25,000 data points were sampled from each of the four categories: Passive, Star-forming Galaxy (SFG), Composite, and Active Galactic Nuclei (AGN). A balanced sample distribution not only improves the accuracy of the classification task but also reduces model bias that may result from class imbalance. Data Standardization: Data standardization helps improve model convergence, enhances prediction accuracy, and prevents certain features from disproportionately influencing the model during training. In this invention, the spectral data was processed using the Smean standardization method. This method normalizes the original flux of each spectrum by mean normalization, scaling it to a uniform numerical scale to reduce the impact of flux amplitude differences between different spectra on model training. Assuming each spectrum consists of flux values ​​at m wavelengths, it can be represented as an m-dimensional vector:

[0151] x = (x1, x2, ..., x) m ) T

[0152] The formula for calculating the standardized flow vector x′ is as follows:

[0153]

[0154] in, This represents the average flow rate of the spectrum.

[0155] Dataset partitioning: The filtered data was divided into training, validation, and test sets in a 6:2:2 ratio. The training set was used for model parameter learning, the validation set for hyperparameter tuning, and the test set for model performance evaluation. During data partitioning, it was ensured that the distribution of classification and regression labels was consistent across each subset to guarantee the fairness and reliability of the model evaluation results.

[0156] In step 2, the framework of this invention is established, including the following key modules: a shared feature extraction module, a classification task output module, a regression task output module, and collaborative optimization through channel attention mechanism and conditional masking technology. Within the multi-task learning framework of deep learning, this model achieves collaborative optimization of galaxy classification and gas metallicity prediction, effectively improving the computational efficiency and prediction accuracy of both tasks.

[0157] Shared Feature Extraction Module: This module extracts global features from full-spectrum galaxy data to support classification and regression tasks. It consists of multiple convolutional and pooling layers, with the following structure:

[0158] Convolutional structure: The module contains five convolutional modules, each of which includes two convolutional layers with a kernel size of 3, a stride of 1, and padding of 1, and the activation function is ReLU.

[0159] Pooling structure: Each convolutional module is followed by a max pooling layer (pooling kernel size is 3, stride is 3).

[0160] Channel number changes: The number of input and output channels for each convolution module are as follows: 1→16, 16→32, 32→64, 64→128, 128→256.

[0161] Through layer-by-layer convolution and pooling operations, this module progressively compresses the feature dimensions of the input data while retaining key information in the full spectral spectrum, thereby generating global features suitable for classification and regression tasks.

[0162] Attention Mechanism: To further enhance the model's ability to focus on task-relevant features, this invention introduces a channel attention mechanism. This mechanism dynamically adjusts feature weights, enabling the model to focus on the features that contribute most to the classification and regression tasks, while suppressing interference from irrelevant features or noise. The specific process of the attention module is as follows:

[0163] Adaptive average pooling is applied to shared features to extract global statistical information;

[0164] Use two fully connected layers to reduce the number of channels from 256 to 16, and then increase the dimension back to 256.

[0165] Generate channel weighted coefficients, and normalize the weighted coefficients using the Sigmoid activation function;

[0166] The normalized weighted coefficients are multiplied point by point with the original features to complete the feature reweighting.

[0167] The formula is expressed as:

[0168] Attention(x)=x·σ(W2·ReLU(W1·Pool(x)))

[0169] Where W1 and W2 are learnable parameter matrices, Pool(x) represents the adaptive average pooling operation, and σ is the Sigmoid activation function.

[0170] After the attention mechanism completes feature reweighting, the model introduces adaptive average pooling to further aggregate important features. Adaptive average pooling extracts the average value across all spatial locations, compressing high-dimensional features into a fixed-length vector, which serves as input for classification and regression tasks.

[0171] Classification Task Output Module: This module predicts galaxy types (e.g., old galaxies, star-forming galaxies, composite galaxies, active galactic nuclei). It consists of a three-layer fully connected network and a Dropout layer to enhance the model's regularization and prevent overfitting. The specific structure is as follows:

[0172] The first fully connected layer has an input feature dimension of 256 and an output dimension of 128, and adds a Dropout layer (Dropout(0.2)).

[0173] The second fully connected layer has an input feature dimension of 128 and an output dimension of 64, and uses the ReLU activation function.

[0174] The third fully connected layer has an input feature dimension of 64 and an output dimension equal to the dimension of the classification label space. The activation function is Softmax. The Softmax activation function normalizes the class probabilities, and the galaxy's class is ultimately determined based on the maximum probability value.

[0175] Regression Task Output Module: The regression task output module is used to predict the gas metallicity (oh_p50) of star-forming galaxies. The module consists of a three-layer fully connected network and a Dropout layer, with the following structure:

[0176] The first fully connected layer has an input feature dimension of 256 and an output dimension of 128, and adds a Dropout layer (Dropout(0.2)).

[0177] The second fully connected layer has an input feature dimension of 128 and an output dimension of 64, and uses the ReLU activation function.

[0178] The third fully connected layer has an input feature dimension of 64 and an output dimension of 1, which is the predicted value of gas metallicity.

[0179] In step 3, the model training process includes data loading and preprocessing, definition of the loss function and optimization strategy, specific steps of the training process, and validation and evaluation. Through joint optimization of classification and regression tasks, the model can simultaneously complete galaxy classification and gas metallicity regression, ensuring synergistic optimization of tasks and performance improvement.

[0180] Data Loading and Preprocessing: The training, validation, and test datasets were divided in the same 6:2:2 ratio as before. The raw flux of each spectrum was mean-normalized to scale it to a uniform numerical scale. The processed data was then input into the model in batches, iteratively processed using a DataLoader. The batch size was set to 128 to ensure computational efficiency and optimized memory management during training.

[0181] Loss in Classification Tasks: The goal of classification tasks is to predict galaxy types. This invention employs the Focal Loss function in classification tasks. By assigning greater loss weights to hard-to-classify samples, the model can pay more attention to these samples, thereby improving the accuracy of classification predictions. The formula is as follows:

[0182]

[0183] Where N is the total number of samples, and C is the total number of categories (C = 4); p i,c y is the predicted probability of the correct class for the i-th sample; i,c α indicates whether category c is the label value of sample i; if yes, it is 1, otherwise it is 0. c It is a balance factor, with a value range of 0 ≤ α. c ≤1, used to adjust the loss weights for positive and negative samples. In this invention, preferably, α c =0.25; γ is an adjustment factor with a value range of γ>0, used to reduce the loss contribution of easily classified samples. In this invention, preferably, γ=2.

[0184] Regression Loss and Conditional Masking Techniques: In regression tasks, to improve the accuracy of predicting the metallicity of gas in star-forming galaxies (SFGs), this invention employs regression loss L... regress The model employs Mean Absolute Error (MAE) loss and further proposes a conditional masking mechanism. This mechanism determines whether the regression loss participates in gradient updates based on the sample's category, preventing the model from being affected by non-star-forming galaxy samples and allowing it to focus more on learning from effective data. Specifically, a conditional mask variable M is introduced into the regression loss calculation for each sample. iWhen the i-th sample belongs to a star-forming galaxy (SFG), M is set to... i =1, and its regression error is accumulated normally; when the sample belongs to a non-star-forming galaxy, then M i =0, this sample does not contribute to gradient updates for the regression task. The loss function for the regression task is defined as follows:

[0185]

[0186] Among them, M i y is a condition mask variable. true,i and y pred,i These are the regression label value and the model prediction value, respectively.

[0187] By using conditional masking, the model effectively avoids interference from other types of data on the regression task, allowing the regression task to focus more on learning the relevant data.

[0188] Joint Loss Function: To achieve synergistic optimization of classification and regression tasks, this invention employs a joint loss function, where the classification loss and regression loss are combined using a dynamic weight adjustment strategy. The specific formula is as follows:

[0189] L total =λ1·L class +λ2·L regress

[0190] Among them, L class L represents the loss of the classification task. regress Let λ1 and λ2 represent the loss for the regression task, respectively, and be the loss weights for the classification and regression tasks, used to dynamically adjust the learning balance between the two tasks during training. To achieve this dynamic adjustment, this invention employs a Dynamic Weight Average (DWA) strategy. At the end of each training round, this method calculates the weight λ for each task based on the relative change in the rate of loss descent. k (t):

[0191]

[0192] Where k=1 represents the weight of the classification task, k=2 represents the weight of the regression task, K represents the number of tasks (K=2), and T is a temperature coefficient that controls the smoothness of the weight distribution (T=1).

[0193] The rate of decrease w of task k k (t) is defined as:

[0194]

[0195] Where L k(t) represents the average loss value of task k in the t-th training round. This formula is used to measure the learning speed of each task—tasks that decrease more slowly will be assigned higher weights in the next round.

[0196] Finally, the weights λ1 and λ2 in each round of the joint loss function are determined by λ k (t) The formula is updated in real time, such as Figure 6 As shown, as training progresses, around the 70th round, the two weight values ​​tend to stabilize and converge to 1. This convergence indicates that the model is equally important for learning the two tasks. Thus, the DWA strategy achieves a dynamic balance between classification and regression tasks during training, avoids one task dominating the optimization process, and promotes coordinated convergence among the tasks.

[0197] Gradient clipping and optimization strategy: To prevent gradient explosion or vanishing problems, this invention applies gradient clipping after each backpropagation, limiting the gradient norm to max_grad_norm = 1.0. Gradient clipping can improve training stability in complex high-dimensional feature spaces and accelerate the convergence process.

[0198] The optimizer employs the Adam optimization algorithm with an initial learning rate of 0.001. Combined with the ReduceLROnPlateau learning rate scheduler, the learning rate is automatically reduced to 10% of its original value if the validation set loss does not improve within 10 epochs. This learning rate adjustment strategy further improves the model's convergence efficiency and generalization ability.

[0199] Training and Validation Process: During the training phase, the model performs forward propagation on each batch of data sequentially, calculating classification and regression outputs. The joint loss function is used to calculate the total loss, backpropagation is performed, and gradient pruning is applied to update the model parameters.

[0200] In step 3, for the galaxy classification task, this study conducted a detailed evaluation of the samples in the test set and introduced the following metrics to quantify the classification performance: accuracy, precision, recall, and F1 score. The specific formulas and meanings of these metrics are as follows:

[0201] Classification accuracy measures the proportion of samples correctly predicted by the model out of the total samples, reflecting the overall predictive ability of the model. The formula is as follows:

[0202]

[0203] Precision: For a given category, the proportion of samples that the model predicts belong to that category, but which actually belong to that category. The formula is as follows:

[0204]

[0205] Here, True Positives represent the number of samples correctly predicted as belonging to that class, and False Positives represent the number of samples incorrectly predicted as belonging to that class. Precision reflects the accuracy of the model when predicting a particular class.

[0206] Recall: Calculates the proportion of samples that actually belong to a certain class, which are correctly predicted as belonging to that class by the model. The formula is as follows:

[0207]

[0208] False Negatives represent the number of samples that actually belong to the category but were not predicted as belonging to that category. Recall reflects the model's ability to cover samples of a certain category.

[0209] F1 Score: The harmonic mean of precision and recall, which comprehensively measures the model's performance on classification tasks. The formula is as follows:

[0210]

[0211] Among them, the F1 score strikes a balance between precision and recall, making it suitable for classification tasks with imbalanced classes.

[0212] Classification Results: Analysis of the classification results using the confusion matrix revealed that this model performs exceptionally well in classifying four galaxy types (star-forming galaxies, composite galaxies, active galactic nuclei, and old galaxies). The classification accuracy on the test set was 96.95%, with the best performance in classifying old galaxies and star-forming galaxies, while the classification performance for composite galaxies and active galactic nuclei was relatively lower.

[0213] Table 1 Evaluation of classification results for different galaxy types

[0214]

[0215] Further analysis using the confusion matrix, such as Figure 7 The model achieves accurate classification results on most samples, with only a few composite galaxies and active galactic nuclei showing classification confusion.

[0216] Analysis of gaseous metal abundance prediction results

[0217] For regression tasks, this model focuses on estimating the gas metallicity (oh_p50) of star-forming galaxies (SFGs) using mean squared error (MSE), standard deviation (Std Dev), and coefficient of determination (R²). 2The regression performance of the model is evaluated using indicators such as [insert indicators here]. The specific formulas and explanations are as follows:

[0218] Mean Squared Error (MSE): Measures the squared mean of the error between the predicted and the true values. The formula is as follows:

[0219]

[0220] Among them, y pred,i and y true,i , where are the predicted value and the actual value of the i-th sample, respectively, and N is the total number of samples. The smaller the MSE value, the better the regression performance of the model.

[0221] Standard Deviation (Std Dev): Measures the range of fluctuation in prediction error, and is expressed by the following formula:

[0222]

[0223] in, The mean of the prediction error is represented by the standard deviation, which reflects the stability of the model's predictions.

[0224] Coefficient of determination (R) 2 Score: An indicator that evaluates the model's fit, ranging from [0,1]. A value closer to 1 indicates a better model fit. The formula is as follows:

[0225]

[0226] in, This is the mean of the true values.

[0227] Table 2 Evaluation of Gas Metal Abundance Prediction Results

[0228]

[0229] The results show that the model has an excellent fit in the task of predicting gaseous metal abundance, with a determination coefficient R0. 2 The value reached 0.9719, with a standard deviation of only 0.0388.

[0230] Collaborative optimization analysis of class and regression tasks

[0231] Comparative Example

[0232] To further verify the collaborative optimization effect of the multi-task learning framework, this study trained the classification and regression tasks separately and compared their performance. To this end, we conducted experiments on the classification and regression tasks (regression prediction using approximately 25,000 samples with bptclass=1 selected from star-forming galaxies) using the original model structure and training process. The following are the training results of the single-task model:

[0233] For the standalone classification task, the model achieved a classification accuracy of 96.99% on the test set. The accuracy for each category is as follows:

[0234] Table 3 Evaluation of classification results for different galaxy types in a single task

[0235]

[0236] For a single regression task, the model evaluation results are as follows:

[0237] Table 4 Evaluation of Gas Metal Abundance Prediction Results in Single Task

[0238]

[0239] For a single classification task, the model achieved a classification accuracy of 96.99% on the test set, while the multi-task learning framework achieved 96.95%, indicating that the performance of the multi-task classification is very close to that of the single-task task. On the regression task, the model's performance was significantly improved, with the mean squared error (MSE) decreasing from 0.0035 to 0.0015, the standard deviation decreasing from 0.0590 to 0.0388, and R0.05. 2 It increased from 0.9341 to 0.9719.

[0240] To further evaluate the computational efficiency advantages of the multi-task learning framework, we conducted a comparative experiment on training duration, calculating the total time required to complete the same number of training epochs (e.g., 100 epochs) under the same hardware and software environment. The training times for each model are as follows:

[0241] Table 5 Comparison of Model Training Time

[0242]

[0243] As shown in the table above, the multi-task model, when simultaneously performing classification and regression tasks, has a total training time of approximately 510 seconds. This represents a 12.7% reduction in computational overhead compared to the total training time of the single-task model (approximately 584 seconds), significantly improving training efficiency. Furthermore, because the multi-task model shares a feature extraction module, redundant computational operations are avoided, reducing resource consumption during model deployment. Especially when dealing with large-scale astronomical spectral data, a single model completing two tasks simultaneously not only reduces training and inference time costs but also simplifies the engineering deployment process.

[0244] In summary, multi-task learning frameworks not only guarantee or improve task performance, but also have significant time efficiency advantages, making them more practical and promising for engineering applications.

[0245] By comparing the results of single-task models and multi-task learning models, it is clear that the advantage of multi-task learning models lies in feature sharing and collaborative optimization between tasks. Multi-task learning models not only significantly improve prediction accuracy in regression tasks but also maintain high performance in classification tasks, effectively reducing redundant use of computational resources. Through shared feature extraction modules and joint optimization strategies, the model can simultaneously handle classification and regression tasks, thereby improving the prediction accuracy and computational efficiency of galaxy classification and gas metallicity regression. This advantage validates the enormous potential of multi-task learning in the automated analysis of large-scale galaxy spectral data and the study of galaxy chemical evolution.

[0246] The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific details in the above embodiments. Within the scope of the technical concept of the present invention, various simple modifications can be made to the technical solution of the present invention, and these simple modifications all fall within the protection scope of the present invention.

[0247] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction.

[0248] Furthermore, various different embodiments of the present invention can be combined in any way, as long as they do not violate the spirit of the present invention, they should also be regarded as the content disclosed by the present invention.

Claims

1. A multi-task learning framework for galaxy classification and gas metallicity regression, characterized in that, The multi-task learning framework includes a shared feature extraction module, an attention mechanism module, a classification task output module, and a regression task output module. The galaxy spectral data is first input into the shared feature extraction module to extract global features. The extracted features are then input into the attention mechanism module, which effectively enhances key feature information related to the classification and regression tasks through dynamic weighted feature channels. The features processed by the attention mechanism module are input in parallel into the classification task output module and the regression task output module. The classification task output module outputs the probability distribution of galaxy categories, while the regression task output module outputs gas metallicity.

2. The multi-task learning framework according to claim 1, characterized in that, The shared feature extraction module extracts global features from spectral data through a convolutional neural network, followed by a max pooling operation.

3. The multi-task learning framework according to claim 1, characterized in that, The attention mechanism module dynamically adjusts feature weights based on channel attention, extracts global information through adaptive average pooling, generates channel weighted coefficients through two fully connected layers, and finally multiplies them point by point with the original features.

4. The multi-task learning framework according to claim 1, characterized in that, The classification task output module consists of multiple fully connected layers and Dropout layers, and finally outputs the probability distribution of galaxy categories through the Softmax activation function.

5. The multi-task learning framework according to claim 1, characterized in that, The regression task output module consists of multiple fully connected layers and Dropout layers, and finally outputs the predicted value of gas metallicity.

6. The method for implementing the multi-task learning framework for galaxy classification and gas metallicity regression as described in any one of claims 1-5, characterized in that, Includes the following steps: Step 1: Create galaxy spectral data, classification labels, and regression labels; Step 2: Build the multi-task learning framework for galaxy classification and gas metallicity regression as described in any one of claims 1-5, and input the galaxy spectral data from Step 1 into the multi-task learning framework, and output the results; Step 3: Evaluate the results of the multi-task learning framework, analyze the performance of classification and regression tasks, and output the results of galaxy classification and metallicity prediction.

7. The multi-task learning framework and its implementation method according to claim 6, characterized in that, It also includes the steps of training and optimizing the multi-task learning framework in step 2; the training process uses a joint loss function and optimizes between tasks through a dynamic weighting strategy, the specific formula of which is: L total =λ1·L class +λ2·L regress Among them, L class For the loss of the classification task, L regress For the loss of the regression task, λ1 and λ2 are the loss weights for the classification and regression tasks, respectively. At the end of each training epoch, this method calculates the weight λ for each task based on the relative change in the rate of loss descent. k (t): Where k=1 represents the weight of the classification task, k=2 represents the weight of the regression task, K represents the number of tasks, and T is a temperature coefficient that controls the smoothness of the weight distribution. The rate of decline w of task k k (t) is defined as: Where L k (t) represents the average loss value of task k in the t-th training round.

8. The implementation method of the multi-task learning framework according to claim 7, characterized in that, Introducing a condition mask variable M when calculating the loss of a regression task i This ensures that the regression loss is only calculated when the sample belongs to a star-forming galaxy (SFG), and the regression loss is zero when the sample is not a star-forming galaxy, thus avoiding interference from invalid samples on the regression task; Its regression loss is defined as: Among them, M i y is a condition mask variable. true,i and y pred,i These are the regression label value and the model prediction value, respectively.

9. The implementation method of the multi-task learning framework according to claim 7, characterized in that, In step 2, the optimization process is implemented through gradient pruning and the Adam optimizer, and the learning rate is adjusted by the ReduceLROnPlateau scheduler; the training set, validation set and test set are divided in a 6:2:2 ratio, and standardization is used to ensure uniform distribution of the data.

10. The implementation method of the multi-task learning framework according to claim 6, characterized in that, In step 1, the galaxy spectral data is acquired from the Sloan Digital Sky Survey and... Uniform sampling is performed at intervals, with a wavelength range of [wavelength range missing].