Skip to content

mdcramer/Apple2-ML

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apple ][+ ML

Machine learning on a 1.023 MHz processor, 64KB of RAM and a pair of 140KB floppy drives.

Motivation

Modern AI has transformed industries from medicine to agriculture, but global chip shortages have put a real squeeze on available compute. As Wired reported, "Carmakers are using semiconductors taken from washing machines, rewriting code to use less silicon and even shipping their products without some chips while promising to add them in later."

In times like these, we have to be creative. The Apple ][+ may be old, but it can add and multiply arrays of numbers. As such, it can do machine learning.

It is our duty, for the betterment of humanity, to make our best effort to deploy these machines in the service of artificial intelligence.

What This Is

A K-Means clustering implementation written entirely in Applesoft BASIC, running on a refurbished Apple ][+ from 1983. The program:

  • Generates synthetic 2D data sampled from bivariate Gaussian distributions
  • Runs K-Means clustering to convergence
  • Visualizes the result — data points, centroids, and decision boundaries — in Apple II+ high-resolution graphics (280×160 pixels)

Everything fits in a single ml.bas file.

Implementation Notes

Rather than Box-Muller (which requires transcendental functions — expensive on a 6502), normal samples are generated using the Irwin-Hall approximation: sum 12 uniform random variables and shift by −6. It's fast and good enough.

Convergence is declared when the sum of squared centroid displacements drops below 0.01.

Background

This is part of a larger project to bring an Apple ][+ back to life. The full story — hardware restoration, data recovery attempts, and the road to getting ML running in BASIC — is documented at mdcramer.github.io/apple-2-blog.

About

Machine learning on the Apple ][+

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages