Classify six educational stellar categories from tabular properties
This reproducible tutorial expands six physical and categorical fields into 22 model features and assigns one of six labels with a fixed softmax classifier. The final export classifies 47 of 48 held-out rows correctly, with 97.9% accuracy and a macro-F1 of 0.974. These are internal results on a small curated data set.
1. Scientific objective
The objective is to demonstrate multiclass classification from temperature, luminosity, radius, absolute magnitude, colour and spectral class. The output can support teaching, software checks and reproducible comparisons on this specific table. It is not a substitute for spectral analysis, catalogue classification or stellar-evolution inference.
Demonstrate categorical encoding, scaling, softmax classification and class-level evaluation in a compact example.
Relate temperature, luminosity, radius and magnitude to visibly separated regions of an educational stellar table.
Inspect the exact split, regenerated figures, executable Python export and Neural Designer project used for the reported result.
2. Data and provenance
The updated stars.csv contains 240 complete and non-duplicated rows. Each of the six target labels occurs exactly 40 times, an intentionally balanced prevalence that is unlikely to represent an astronomical survey.
| CSV field | Meaning in this data set | Unit or encoding |
|---|---|---|
temperature | Stellar effective/surface temperature | K |
luminosity | Luminosity relative to the Sun | L/L☉ |
relative_radius | Radius relative to the Sun | R/R☉ |
absolute_magnitude | Absolute visual magnitude used by the source table | MV |
color | Eleven qualitative colour categories | nominal category |
spectral_class | One of O, B, A, F, G, K or M | nominal category |
type | Target: Brown Dwarf, Hypergiants, Main Sequence, Red Dwarf, Supergiants or White Dwarf | six-class category |
Source fields and model features
| Source field group | Source columns | Model features | Preprocessing |
|---|---|---|---|
| Physical values | 4 | 4 | Mean-and-standard-deviation scaling |
| Colour | 1 | 11 | One-hot encoding and minimum–maximum scaling |
| Spectral class | 1 | 7 | One-hot encoding and minimum–maximum scaling |
| Total | 6 | 22 | Ordered schema required by the export |
| Subset | Rows | Purpose |
|---|---|---|
| Training | 144 | Estimate the fixed model parameters |
| Selection | 48 | Monitor generalization during training |
| Testing | 48 | Report final internal performance |


3. Model
The four numeric inputs are standardized. The eleven colour categories and seven spectral classes are one-hot encoded, producing 22 features. A single dense layer connects those features directly to six softmax outputs ordered as Brown Dwarf, Hypergiants, Main Sequence, Red Dwarf, Supergiants and White Dwarf.
The model contains no hidden layer and has 138 trainable parameters. It is a multiclass logistic classifier represented in Neural Designer’s neural-network framework.
This is both the base and final architecture. No neuron-selection or architecture-selection experiment is used.

4. Training strategy
The model minimizes multiclass cross-entropy with the quasi-Newton method and no explicit regularization. Training stopped at the configured loss goal after 20 completed epochs (21 stored iterations). Training cross-entropy decreased from 1.8483 to 0.0006.
Selection cross-entropy fell from 1.2338 to its minimum of 0.342 at epoch 7, then increased to 0.6664 while training error continued to fall. The downloadable export is the stored final model at epoch 20; the earlier checkpoint was not restored.

5. Model selection and baseline
No neuron selection was performed, and no architecture selection was performed. The direct 22–6 softmax model was fixed before training and retained as the final model. This demonstrates that a larger network is unnecessary for separating this small curated table, but it does not establish that the architecture is optimal.
| Reference | Expected/test accuracy | Interpretation |
|---|---|---|
| Uniform six-class guess | 16.7% expected | Chance reference under the deliberately balanced full data set |
| Fixed softmax model | 97.9% testing | Strong internal separation of the curated labels |
6. Scientific validation
The random testing subset contains 48 rows. The final exported model correctly classifies 47; one Supergiants row is assigned to Main Sequence. Because every class has only 4–12 testing examples, each error changes the class-level metrics substantially.
| Testing metric | Value | Interpretation |
|---|---|---|
| Accuracy | 97.92% | 47 correct labels from 48 testing rows |
| Macro precision | 96.67% | Unweighted mean across the six labels |
| Macro recall | 98.61% | Unweighted mean sensitivity across labels |
| Macro-F1 | 97.42% | Class-balanced summary of precision and recall |
| Testing cross-entropy | 0.322 | Calculated from the exact final Python export |
Confusion matrix
| Actual / predicted | Brown dwarf | Hypergiants | Main sequence | Red dwarf | Supergiants | White dwarf | Total |
|---|---|---|---|---|---|---|---|
| Brown dwarf | 9 | 0 | 0 | 0 | 0 | 0 | 9 |
| Hypergiants | 0 | 9 | 0 | 0 | 0 | 0 | 9 |
| Main sequence | 0 | 0 | 4 | 0 | 0 | 0 | 4 |
| Red dwarf | 0 | 0 | 0 | 7 | 0 | 0 | 7 |
| Supergiants | 0 | 0 | 1 | 0 | 11 | 0 | 12 |
| White dwarf | 0 | 0 | 0 | 0 | 0 | 7 | 7 |
| Total | 9 | 9 | 5 | 7 | 11 | 7 | 48 |
Per-class performance
| Label | Testing rows | Precision | Recall | F1 |
|---|---|---|---|---|
| Brown dwarf | 9 | 100.0% | 100.0% | 100.0% |
| Hypergiants | 9 | 100.0% | 100.0% | 100.0% |
| Main sequence | 4 | 80.0% | 100.0% | 88.9% |
| Red dwarf | 7 | 100.0% | 100.0% | 100.0% |
| Supergiants | 12 | 100.0% | 91.7% | 95.7% |
| White dwarf | 7 | 100.0% | 100.0% | 100.0% |
7. Inference and reproducibility
A credible application would begin with traceable photometric or spectroscopic measurements, apply quality and uncertainty filters, derive physically documented quantities, validate the six-field schema, encode the two categorical fields, calculate six model scores and submit the result to astronomical review.
Held-out white-dwarf example
The following record belongs to the testing subset and is reproduced with the exact Python export. It replaces the previous artificial input combination with one internally consistent row from the published table.
| Input | Value |
|---|---|
| Temperature | 9,675 K |
| Luminosity | 0.00045 L/L☉ |
| Relative radius | 0.0109 R/R☉ |
| Absolute magnitude | 13.98 MV |
| Colour | Blue-White |
| Spectral class | A |
| Recorded target | White Dwarf |
White Dwarf 69.34%; Main Sequence 30.65%; every other score is below 0.01%. The predicted label matches the stored testing target, but the score margin also shows why the output should not be presented as certainty.
Try the exported stellar classifier
Provide the four numeric fields and select the qualitative colour and spectral class. The browser reproduces the 22-feature encoding used by Neural Designer.
Reproduce the inference
The Python package contains the exact exported model, the 22-feature encoding schema, the held-out case and its expected scores. The project package preserves the split, trained parameters and regenerated analyses.
from model import NeuralNetwork
# Four numeric values + 11 colour indicators + 7 spectral indicators
scores = NeuralNetwork().calculate_outputs(encoded_inputs)8. Validity, uncertainty and limitations
- External provenance is incomplete. The source page does not identify the stars, instruments, surveys, measurement methods or uncertainties behind the 240 rows.
- The taxonomy mixes different concepts. Brown dwarfs are substellar objects; white dwarfs are remnants; red dwarfs are normally main-sequence stars; and supergiant/hypergiant terminology describes luminosity or evolutionary state.
- The class balance is artificial. Exactly 40 rows per target is useful for teaching but does not represent astronomical prevalence.
- Inputs are physically redundant. Temperature, luminosity, radius, magnitude, colour and spectral class are related. Strong performance partly reflects repeated information rather than independent evidence.
- The random row split is only internal validation. It does not test transfer across instruments, surveys, sky regions, extinction regimes or observing conditions.
- Training overfits after epoch 7. The published final export reaches lower training loss but higher selection loss than the best stored epoch.
- The test set is small. With 4–12 rows per label, confidence intervals would be wide and one mistake materially changes a class metric.
- Scores are not calibrated. They are ranking values for this model and data set, not posterior class probabilities.
References
- D. Baidya, Star dataset to predict star types, Kaggle, accessed August 2026.
- ESA/Gaia, The Hertzsprung–Russell diagram.
- ESA/Gaia, Gaia Data Release 2 Hertzsprung–Russell diagrams.
- NASA Science, Stars and the O–B–A–F–G–K–M main-sequence classification.
