Learning

Classify Palmer penguins using machine learning

Classify three Palmer penguin species from field and isotope data

This reproducible classification study encodes sampling island, clutch completion, morphology, recorded sex and stable-isotope measurements in a direct softmax model. The exported classifier labels 67 of 68 held-out records correctly (98.5%; macro-F1 0.981). The result is strong for this internal random split, but it does not establish transfer to other islands, years or measurement protocols.

98.5%held-out accuracy
0.981testing macro-F1
68held-out penguins
36trainable parameters

1. Scientific objective

The objective is to reproduce a three-species classification benchmark for Adelie, Chinstrap and Gentoo penguins observed in the Palmer Archipelago. The model combines collection context, structural measurements and blood stable-isotope values to assign three class scores. It supports teaching, reproducible method comparison and exploration of multivariate ecological data; it is not a field-identification or population-monitoring system.

Connect morphology and context

Combine bill, flipper and body measurements with island, clutch and recorded-sex fields.

Reproduce multiclass inference

Inspect the exact encoding, trained weights, internal split and executable Python export.

Challenge apparent performance

Use the single testing error to examine confounding, score interpretation and limits to transfer.

Ecological data scienceQuantitative biologyField research teamsStatistics education
Scope. Each row describes one adult penguin record collected from three islands during 2007–2009. The page evaluates a benchmark classifier within this table; it does not infer population abundance, ecological mechanism or species identity in new geographic settings.

2. Data and provenance

The downloadable penguin_dataset.csv contains 344 records: 152 Adelie, 68 Chinstrap and 124 Gentoo penguins. The source table includes identifiers and egg dates for traceability; the model uses nine variables that expand to eleven numeric features after island encoding.

CSV fieldModel roleDefinitionUnit or coding
islandInput → 3 featuresSampling islandBiscoe, Dream or Torgersen
clutch_completionInputRecorded clutch-completion fieldNo / Yes
culmen_length_mmInputLength of the dorsal ridge of the billmm
culmen_depth_mmInputDepth of the billmm
flipper_length_mmInputFlipper lengthmm
body_mass_gInputBody massg
sexInputRecorded sexFEMALE / MALE
delta_15_NInputBlood nitrogen stable-isotope value
delta_13_CInputBlood carbon stable-isotope value
speciesTargetSupplied species labelAdelie, Chinstrap or Gentoo
individual_id, date_eggNot modelledSource traceability fieldsIdentifier and date
SubsetRowsAdelieChinstrapGentooPurpose
Training208884278Estimate model parameters
Selection68301523Monitor optimization
Testing68341123Report final internal performance

The project records 46 missing fields across 20 rows: two missing values in each structural measurement, 11 in recorded sex, 14 in δ15N and 13 in δ13C. Neural Designer replaces missing coded or numeric inputs with the corresponding project mean before scaling.

Distribution of Adelie, Chinstrap and Gentoo records
The complete table is moderately imbalanced: Adelie 44.2%, Gentoo 36.0% and Chinstrap 19.8%.
Associations between penguin inputs and an encoded species target
Species is nominal. Pearson coefficients depend on the numerical class encoding and are descriptive associations, not causal or permutation-based importance.
Provenance. The records were collected by Kristen Gorman with the Palmer Station Long Term Ecological Research programme and cover three Pygoscelis species observed on three Palmer Archipelago islands from 2007 to 2009. The palmerpenguins project documents the data, EDI source packages, CC0 licence and recommended citation. The downloadable copy preserves the local source values and semicolon format; it only removes trailing spaces from the three target labels.

3. Model

Island is one-hot encoded as Biscoe, Dream and Torgersen. Clutch completion and recorded sex use binary coding; the six continuous inputs use mean-and-standard-deviation scaling. These transformations produce eleven numeric model features.

A single dense softmax layer connects the eleven scaled features directly to three outputs ordered as Adelie, Chinstrap and Gentoo. The architecture has no hidden layer and contains 36 trainable parameters: 33 weights and three biases.

Output contract. The largest softmax score defines the model label. The scores have not been independently calibrated as probabilities and must not be interpreted as biological confirmation.
Direct Palmer penguin classifier with eleven encoded features connected to three species outputs
Fixed base and final architecture: eleven scaled or encoded features connected directly to three softmax scores. No hidden-layer or neuron-selection experiment was performed.

4. Training strategy

The model minimizes multiclass cross-entropy with the quasi-Newton method and no explicit regularization. The stored run contains 14 epoch values (0–13) and stops when the training loss reaches the configured 0.001 goal.

Training cross-entropy decreases from 1.1359 to 0.000714, while selection cross-entropy decreases from 0.3206 to 0.0215. The larger selection error is the more relevant indication of performance on unseen rows.

Training and selection cross-entropy histories across fourteen stored epoch values
Training and selection cross-entropy for the fixed direct softmax model. The final exported parameters are the same ones used below.

5. Model selection and baseline

No neuron selection, input selection or architecture selection was performed. The direct 11–3 softmax model is both the base and final architecture. The selection subset monitors optimization; it is not evidence that this architecture is optimal.

ReferenceTesting accuracyInterpretation
Largest testing class50.0%Always predict Adelie, represented by 34 of 68 testing rows
Uniform three-class chance33.3% expectedReference for three equally likely labels
Fixed softmax model98.5%67 correct labels from the 68-row internal testing subset

The compact model already separates this random split well. More layers would not resolve the central scientific limitations: island–species association, mean imputation and absence of validation by year, island or external campaign.

6. Scientific validation

The final exported model is evaluated once on 68 held-out records. It correctly classifies every Chinstrap and Gentoo record and 33 of 34 Adelie records. The single error is an Adelie penguin assigned to Chinstrap.

Testing metricValueInterpretation
Accuracy98.5%67 correct labels from 68 records
95% Wilson interval for accuracy92.1–99.7%Sampling uncertainty for this finite testing subset
Macro precision97.2%Unweighted mean across the three species
Macro recall99.0%Unweighted sensitivity across the three species
Macro-F198.1%Class-balanced precision/recall summary
Testing cross-entropy0.0492Calculated from the exact Python export

Confusion matrix

Actual / predictedAdelieChinstrapGentooTotal
Adelie331034
Chinstrap011011
Gentoo002323
Total33122368

The informative error

Testing record N27A2 is labelled Adelie but receives an Adelie score of 3.62% and a Chinstrap score of 96.38%. It was observed on Dream Island and has measurements that resemble the Chinstrap region of this table. The browser demonstration below reproduces this exact error.

Scientific interpretation. The model discriminates the supplied labels very well within a random row split. However, Chinstrap records occur only on Dream and Gentoo records only on Biscoe in this table, so island can act as a strong shortcut. The result does not test performance after moving to another island, year or sampling campaign.

7. Inference and reproducibility

A defensible research workflow starts with a traceable specimen record, verifies the measurement and isotope protocols, checks missingness and units, applies the documented encoding, calculates the three model scores and sends the output to ecological or statistical review.

Traceable penguin record
Measurement and assay QC
Missingness and range checks
Documented encoding
Three species scores
Ecological review

Held-out error as a deployment case

The default browser values reproduce testing record N27A2. Its supplied label is Adelie; the final model assigns its highest score to Chinstrap. Using a known error makes the operational boundary clearer than demonstrating only an easy, high-confidence match.

InputValue
Island / clutchDream / Yes
Bill length / depth44.1 / 19.7 mm
Flipper length / body mass196 mm / 4400 g
Recorded sexMALE
δ15N / δ13C9.2372 / −24.52698 ‰
Supplied speciesAdelie
Highest model scoreChinstrap

Adelie 3.62%; Chinstrap 96.38%; Gentoo <0.0001%. The high score is incorrect for this held-out record.

Try the exported Palmer penguin classifier

The default values reproduce the only misclassified record in the published testing subset: an observed Adelie penguin that the model assigns its highest score to Chinstrap.

Research demonstration. The calculation runs locally with the exact exported weights and preprocessing. It requires complete inputs and rejects values outside the validated domain defined by the training ranges. The softmax scores are not independently calibrated probabilities and do not confirm species identity.








Reproduce the inference

The Python package contains the exact export, ordered eleven-feature schema, held-out error and expected scores. The Neural Designer package preserves the split, trained parameters and regenerated analyses.

from model import NeuralNetwork

inputs = [0, 1, 0, 1, 44.1, 19.7, 196, 4400, 1, 9.2372, -24.52698]
scores = NeuralNetwork().calculate_outputs(inputs)

8. Validity, uncertainty and limitations

  • Internal random split only. The 208/68/68 partition does not test transfer across field season, island, instrument, laboratory or a later population.
  • Geographic shortcut risk. In this table, all Chinstrap records are from Dream and all Gentoo records are from Biscoe. Island can therefore support classification without representing portable morphology.
  • Missing-data assumptions. The project mean-imputes 46 missing fields across 20 rows. This can reduce variation and does not replace a missingness analysis.
  • Laboratory inputs. δ15N and δ13C require stable-isotope measurements. Changes in sample handling, assay calibration or laboratory can shift the model inputs.
  • Small class-specific testing counts. Testing includes only 11 Chinstrap and 23 Gentoo records, so error estimates remain uncertain despite high aggregate accuracy.
  • Uncalibrated scores. Softmax values rank the three labels but have not been independently calibrated as probabilities.
  • Association, not mechanism. The model captures multivariate patterns in the sampled records; it does not establish causal ecological relationships.
  • Research boundary. The classifier is suitable for education and reproducible method work, not authoritative field identification, conservation decisions or population assessment.

References