Technology · Applied Machine Learning Report

Practical Data Science and Machine Learning PRT565 -- Balance Scale Classification Machine Learning Exercise Report

Sample paper

Word Count: approximately 2,200 words

Problem Description

The Balance Scale experiment is a classic cognitive psychology study investigating how children learn to reason about the relationship between weight and distance on a balance scale (Siegler, 1976). The machine learning task is to predict whether a balance scale tips left, tips right, or balances, based on the weights and distances of objects placed on each side -- a problem well suited to classification algorithms that can learn decision rules from labelled examples.

Dataset Description

The dataset contains 625 instances with four categorical attributes (leftweight, leftdistance, rightweight, rightdistance, each ranging 1-5) and a target class (L: tips left, R: tips right, B: balanced), with no missing values. The true underlying rule compares torque (weight x distance) on each side: greater left torque tips the scale left, greater right torque tips it right, and equal torque balances it. Class distribution is markedly imbalanced: 46.08% left, 46.08% right, and only 7.84% balanced.

Choice of Algorithms

Four algorithms were selected to represent distinct approaches: Logistic Regression (linear, interpretable, well suited to linearly separable classes but prone to struggle with non-linear boundaries); Decision Tree (interpretable, handles categorical features natively, but prone to overfitting if grown too deep); Random Forest (an ensemble reducing overfitting through bootstrap and feature-subset randomness, at some interpretability cost); and K-Nearest Neighbors (a non-parametric, instance-based method handling non-linear patterns, sensitive to K and distance metric choice, and computationally costly at scale).

Description of Key Steps

The pipeline proceeded through library and dataset import, data preview, missing-value checking (none found), label encoding of the categorical target, feature scaling, correlation analysis, and an 80/20 train-test split, followed by model-specific training and evaluation: Logistic Regression (including regularisation), Decision Tree (including visualisation and feature importance extraction), Random Forest (including out-of-bag evaluation), and KNN (including distance metric consideration).

Results and Discussion

Model performance comparison: Logistic Regression achieved the highest accuracy, closely followed by Random Forest and KNN, with Decision Tree performing somewhat lower, suggesting the dataset contains meaningful linear structure alongside patterns the other approaches can also learn effectively.

Feature importance: Random Forest analysis found left and right distance more predictive of balance state than the corresponding weights, consistent with distance's wider effective range in the underlying torque calculation.

Confusion matrix: The best-performing Logistic Regression model achieved perfect classification of the left-tipping class, strong classification of the right-tipping class (with some misclassification as left), and complete failure on the balanced class (all instances misclassified as left or right), attributed to the severe 7.84% class imbalance -- suggesting oversampling techniques such as SMOTE or class-weighted training as directions for future improvement.

Conclusions

The analysis demonstrates successful application of four machine learning algorithms to a classic cognitive psychology classification problem, with all models learning the underlying torque-based decision pattern to varying degrees, and Logistic Regression emerging as the top performer overall while all models struggled with the severely underrepresented balanced class.

References

Siegler, R. (1976). Balance Scale [Dataset]. UCI Machine Learning Repository. Siegler, 1976 Waskom, M. (2024). seaborn: statistical data visualisation. Waskom, 2024

Commission similar work

Tell us the brief - we’ll match a specialist.