Posts

Featured Post

COVID Data Tracking

Image
The worldwide COVID-19 pandemic has hit every corner of the world in unprecedented ways. There exist many data reports, analytics tools, and projections about the virus's current and future state. I, however, wanted to create an easily accessible way to track how the virus is spreading in my area, using the number of new cases every day as a guide. Importing Data It turned out the Virginia Department of Health (VDH) used data management software called Socrata to publish and manage data on COVID-19, which conveniently had a continuously updated .csv file hosted on their servers. I copied older data (that wasn't on the hosted .csv file) into a Google Sheets spreadsheet, and used the powerful IMPORTRANGE() function to pull all new data into the sheet.  Creating the Graph The data import seemed simple enough, so I then combined the static and imported data. After aggregating it a bit (again using Sheets functions to get the number of new cases, average over 7 days, etc.), the cha

Genetic Machine Learning

Image
Genetic Machine Learning is another type of ML, completely separate from Neural Networks. Evolution-Based Evolution is complex. Learning to walk, for example, takes millions upon millions of years of small mutations, and survival of the fittest. If an animal mutates, gains an advantage, and lives longer than others, then it has more kids. Those kids will probably also have that advantage. That is the way genetics-based ML works. It starts with a randomly generated population and calculates the level of Fitness for each individual. The fittest of the bunch move on and have "kids", basically genetically-combined versions of themselves. Landing a Rocket The first part of this project was to create a rocket game - with a gravitational force, the force of the fuel, and graphics (?). The rocket would fall at a certain speed (Gravity) and would be offset by the force of the fuel being used (a level between 0-8). The Genetic Machine Learning algorithm would then figure

Predicting Baseball Scores

Image
Okay... so if I was actually able to do this, I would be rich. So, spoiler alert, this project didn't exactly go as planned. This project was to train a Network on past sports scores, then ask it to predict future scores. The data I used was game number, opposition team, whether the game was a day or night game, whether the game was at home or away, and the number of people in attendance at the stadium. What data are useful? Not all of these data are useful, though, and I learned that through testing this network. Game number, for example, proved to be completely unuseful, even problematic. Audience attendance was actually surprisingly useful. Based on that info, I made the program customizable. The program asks you which data you would like to use. This way, the users can discover for themselves, which maybe could be useful in the future. The program will output the data that it tested, and will show the percent error that it resulted in.

Half Moon Project Part 2 - More Accuracy

Image
This time around, we used the Neuroph library to create a neural network  that can divide the double half-moons more accurately. Neural Networks A Neural Network is a combination of Neurons that feed into each other. Using some really complex math, they can weight each input (from a previous Neuron) differently. Then, after training, they can use backpropagation to calculate which weights should be edited. What this looks like can be seen below. More Accuracy for Half-Moons Since, previously, we were only using one neuron to calculate the line to separate the two moons, we could only draw a linear line. This time, with a more complex neural network, it can separate the two with a function that's super complicated. Theoretically, a human could also derive the equation, but it's so complex that at this point, it's easier to get the Neural Network to do it for us.

NumberVision – Machine Learning Application

Image
The next way we used our Neuron class was to classify digits. Using a UI, our program was assigned to take an input digit (a 5x7 grid, each box has a shade of grey between black and white) and classify the digit as a number between 0 and 9. A Smarter Neuron Graphical depiction of a Neuron receiving more than 2 inputs. Previously, I had only been using a Neuron with two inputs: an X and Y coordinate. Previously, this allowed me to plot my points on a plane like I did with the Half Moon project. However, due to the 5x7 grid of inputs I was getting, I had to alter my Neuron class to be able to take in 35 inputs. Mostly, this involved changing a few numbers.  Applying the Neuron to NumberVision The digit '1', with progressively more noise added from left to right. Good algorithms should be able to generate a result even if the input is a little distorted. I applied the same goal to NumberVision. The flow chart above shows various levels of added distortio

Machine Learning & Half Moon Project

Image
This was our first Machine Learning assignment. Machine Learning is something that I was (and still am) super excited about. Basically, the algorithm 'learns' something, and can then apply it in other situations. Learning & Neurons This was the toughest concept to learn (ha). We started with a Neuron, similar to the neurons in our brains. The neuron can trigger (yes/no) based on a series of inputs, in our case two inputs. The equation for whether or not the neuron triggers is SUMMATION(Weight(n) * Input(n)) > threshold . Each input is weighted differently, and the weights are what we can change to 'train' the neuron. We use this equation:  ΔWeight = learningSpeed * (target - output) * input . For example, if we start with a speed of 0.2, an input of 1, a weight of 0.5, and a target of 0, the weight would change by -0.2 (0.2 * (1 - 0) * 1). Now, with a weight of 0.3, repeat the process. Once each input returns the desired output, the best weights have been fo

Simulating Bird/Fish Flocking (Python)

For my second (and hopefully last) project in Python, we had to simulate flocking behavior , as outlined in Craig Reynolds' post . More Python Challenges Since I don't have much experience with Python, again the majority of this project was learning the language. I used a very helpful graphics library for python called pygame , which has a lot of capability for such a simple library. Also, I discovered that Python is a lot more annoying when it comes to having multiple files and importing the classes in such files into the main class. With some help from my classmates, I learned that Python has support from <File> import <Class> which removed the need to call <File>.<Class>   every time I needed to access an imported class. Flocking Behavior The behavior itself is relatively simple. As Craig outlines in his post listed above, the main behaviors of flocking consist of cohesion, separation, and alignment . Cohesion is the behavior that brings boi