Classifying the Behaviors of Boid Swarms
Total Page:16
File Type:pdf, Size:1020Kb
Classifying the Behaviors of Boid Swarms Zihao Liu, Ryan McArdle, Gianni Orlando 9 December 2020 Institute for Artificial Intelligence University of Georgia Athens, Georgia, USA [email protected], [email protected], [email protected] I.A BSTRACT force that is calculated against each of its neighbors. To achieve alignment, the boid calculates a force which will adjust First presented by Craig Reynolds in 1987, a boid is a class its velocity towards the average velocity of its neighbors. To of bird-like computational objects intended to simulate the achieve cohesion, the boid calculates a force that moves it flocking behavior that can be found in a number of animals. towards the centroid or average position of its neighbors. The While the concept of boids has been well established and behavior which emerges from an appropriate balance of these implemented for some time now in order to generate simu- forces allows a swarm of boids to simulate natural flocking lations of flocking swarms, the project of classifying swarms behavior in a tractable way, allowing one to define behavior of animals and classifying when they are exhibiting certain over the entire class rather than for each instance. The boid behaviors is a newer one, without as much success as of definition is also reliable in that it generates behaviors that yet. We utilize the Swarm Behavior Data Set uploaded by other distributive methods fail to achieve, such as allowing researchers at the University of New South Wales to the UCI a swarm to split to avoid colliding with an obstacle and Machine Learning Repository in order to train a classifier to recombine once they have passed the obstacle. recognize swarms behaviors labeled as Aligned, Flocking, and While boids have been well established for some time Grouped, with the hopes that classification of boid behavior now in order to simulate flocking swarms, the classification will translate nicely into the classification of their counterparts of swarms of animals to identify when they are or are within the animal kingdom. We explore logistic regression, not flocking is a newer task without as much success as random forest, support vector machines, and neural networks. of yet. Although the community has long understood that We find that classifying the Aligned and Grouped behaviors simulation of flocking is achieved through the alignment is rather trivial and narrow our focus onto the single-label and cohesion of individuals, little work has been done to classification problem with respect to Flocking. Noting issues distinguish these characteristics in observation [2]. Much of of generalizability along the way, we transform the data set in the modern analytical work concerning coordinated animal such a way that models trained on the set should more readily movement focuses on dissecting individual roles, such as the and reliably be able to classify other examples of swarm relations of individuals to influential neighbors, rather than behavior. We find the greatest success with the neural network the exhibition of macroscopic behavior [3]. Researchers at the approach trained on our transformed data set, obtaining a University of Tokyo have recently touched on the difficulty maximum accuracy of 88%. We recognize that this seems to of classifying flocking behavior, especially in large groups, as be a theoretical ceiling for the accuracy on this dataset due to flocks tend to “generate and collapse spontaneously,” allowing the nature of its creation and suggest that the problem with for various modes of flocking [4]. classifying Flocking may be an issue of proper collection of The goal of this project is to develop a classifier which training data rather than optimization of an effective model. is reliably successful at classifying three different behaviors of swarms of boids, formalized in our dataset as ‘Aligned,’ II.I NTRODUCTION ‘Grouped,’ and ‘Flocking,’ with the hopes that classification of these boid behaviors will translate nicely into the classification First presented by Craig Reynolds in 1987, a boid is a class of of their counterparts within the animal kingdom. While these bird-like computational objects intended to simulate the flock- classifications come from a survey with many participants, ing behavior that can be found in a number of animals such discussed further in section III. Data Set, one can roughly birds, sheep, fish, and humans [1]. The distributed behavioral understand ‘Aligned’ to describe boids with matching veloctiy, model means that each instance of the boid class that is within ‘Grouped’ to describe boids collected together spatially, and the totality, which we will refer to as a swarm in order to avoid ‘Flocking’ to describe some more complex concept that may confusion of terms, is determining its behavior individually not be as readily summarized, which implies that the boid- at each timestep. Each boid acts only upon its immediate swarm is behaving as one might expect a flock of natural surroundings and neighbors in order to achieve a number of animals to behave. goals. To achieve separation, the boid averages a repulsive In the sections that follow, we discuss the data set as Scalar Value Statistics provided to us and explore initial models including logistic re- Attribute Min. Max. Mean Std. Dev. Median gression and random forests. Finding reasonable performance Speed 1:99 20:00 9:16 3:55 8:74 and indentifying a significant concern with the generalizability Num. Align./Coh. 0:00 171:00 23:68 31:38 9:00 of the model, we focus our classification problem onto the Num. Sep. 0:00 108:00 1:79 6:43 0:00 ‘Flocking’ target label and perform a statistical transformation TABLE I: Statistics describing the scalar quantities included on the data set. This transformation reduces the overall size in the data. Speed has been calculated for human evaluation of the data and model while also allowing us to represent the of the data set and is not used in the training data. problem in a way that allows other swarms to be classified by our models as well. We explore the use of support vector machines and neural networks on this reduced data set, finding attribute. This attribute is unused in the training of the models, similar success and identifying an apparent limit to the accu- as the information is inherent within the velocity vectors, but racy of classificiation on the ‘Flocking’ behavior provided by is presented here for the sake of human understanding. We this data set. see that the speed of the boids ranges from ∼ 2 to 20 spatial units per timestep. The mean of 9:16 and standard deviation of 3:55, along with a median not far from the mean, suggest III.D ATA SET that the speed of the boids is near normally distributed over In order to train our classifier, we utilize the Swarm Behavior this range without any significant outliers. This is what one Data Set uploaded by researchers at the University of New might expect for the speed of individuals and serves as a sanity South Wales to the UCI Machine Learning Repository [5], check that the data set represents at least relatively normative [6]. The data set provides three different .csv files which swarm behavior. contain the same 24; 016 temporal instances of boid-swarms, We next consider the number of boids within the radius with each .csv classifying for one of the three behaviors in of alignment and cohesion, which is involved in determining the associated class label. These class labels were determined the magnitude of the forces which drive the boids to align by a publicly available survey in which participants use three and group. We see here a much greater standard deviation sliders to rate the extent to which they consider a short sample of 31:28 among the data points, with the median value 9:00 of a swarm of boids to be flocking, grouped, or aligned [7]. being far less than the mean of 23:68. This suggests that there Our underrstanding is that these slider values are averaged are a number of outlier instances for which these numbers are over all participants, and the results are rounded to either 0 or abnormally high, which we will indeed see in subsection III-C. 1 for negative and positive labels, respectively. Class Values, where we plot sample instances of the swarm There are 2; 400 attributes for each instance; 12 attributes behaviors where boids aggressively congregrate on a small each for the 200 boids in the swarm. For each boid, the handful of points. attributes include a position vector, a velocity vector, an The number of boids within the radius of separation shows alignmnent force vector, a separation force vector, a cohesion a somewhat similar distribution. This number is involved in force vector, the number of nearby boids within the align- determing the force that prevents the boids from colliding into ment/cohesion radius, and the number of nearby boids within one another and attempting to occupy the same space. We see the separation radius (each vector is split into x and y di- that the mean value 1:79 is quite near the minimum of 0:00, mensions and thus accounts for two attributes). Unfortunately, but the standard deviation of 6:43 suggests that there is a skew these instances are sorted by the x-value of the first boid, and present from some instances that are much greater than the as such, all temporal information relating the instances or their mean, especially coupled with the recognition that the median ordering has been lost. While this is helpful for being able to value is 0:00. This also suggests the instances of aggressive feed arbitrary instances of swarms to a classifier for training, it congregation reference above and discussed later.