06 · TK-101 · Projects
Soft computing in Python: a fuzzy fan-speed controller and a neural network from scratch
Computational intelligence coursework: a fuzzy logic controller that sets fan speed from temperature and humidity with rules and centroid defuzzification, and a one-hidden-layer neural network written in plain NumPy with backpropagation.

The problem
Many control decisions are not a precise equation: "if it is hot, run the fan fast". Fuzzy logic turns that kind of expert wording into a controller, and a neural network learns the relation from examples instead of having it written by hand.
Solution and data flow
- Fuzzy controller: temperature (0 to 40), humidity (0 to 100) and fan speed (0 to 100) each have low, medium and high membership functions, triangular and trapezoidal. Rule one: if temperature is low or humidity is high, speed is low; rules two and three map medium and high temperature to medium and high speed. Results are combined with max–min and the speed is computed by the
centroidmethod, with the membership functions plotted in Matplotlib. - Neural network from scratch: a
NeuralNetclass with two inputs, three hidden neurons and one output, asigmoidactivation, a forward pass and backpropagation that updates theWandVweight matrices, printing the loss each epoch and saving the weights to text files.
Implementation and challenges
Writing backpropagation by hand instead of calling a library shows where every weight update comes from, and normalising inputs and outputs to 0 to 1 is what lets the sigmoid work. These are university coursework exercises on small learning data, not production models.
Skills developed
Membership functions, fuzzy rules and defuzzification, building a neural network and backpropagation in NumPy, and normalising and plotting data.