# Finding a suitable algorithm for prediction location

I'm wanting to learn about prediction modelling and machine learning but am having difficulty understanding how I can apply it to the problem I've come up with.

So here's my basic example, I want to record some observations of where I see birds in my garden and use that data to predict where they are most likely to be based on analysis of that data.

Is there a better way to record data that will make it easier to apply prediction modelling algorithms?

My thinking so far is that I can use a kMeans algorithm to cluster results and then I have a dataset that represents similar conditions to those I am trying to predict and then I simply take averages of the location (relative in the garden), corner (was the bird in the corner) and tree (was the bird in a tree) to predict where I might see the next bird.

I'm just after some pointers or any feedback you can give that I can take forward and try to apply some more advanced techniques, I guess specifically what algorithms do you think would be well suited to this problem?

Thanks!

• I came across this reference to data management issues as it relates to bird monitoring Data Management Best Practices and Standards for Biodiversity Data Applicable to Bird Monitoring Data While I actually found most of it pretty boring, beginning on page 21 there is a list of references that may be useful. Given your geographic location, one of these resources probably catalogues the types of birds one is likely to find. This kind of information could provide a benchmark for what you actually observe at your location nabci-us.org/aboutnabci/bestdatamanagementpractices.pdf Nov 19, 2015 at 14:10

I propose bellow an easy way to get predictions given your data.

Is there a better way to record data that will make it easier to apply prediction modeling algorithms?

Yes but the way you record it is good enough to get some predictions very straightforwardly using ML. You could always do better: record precise date and time, record your negative observations (i.e. when you see no birds), have more precise locations, record the species and the number of birds, record video for deep learning of individual birds recognition...

My thinking so far is that I can use a kMeans algorithm to cluster results and then I have a dataset that represents similar conditions to those I am trying to predict and then I simply take averages of the location (relative in the garden), corner (was the bird in the corner) and tree (was the bird in a tree) to predict where I might see the next bird.

It's a good idea but it is not as straightforward as the solution I propose below. Your solution involve unsupervised learning and statistical data modeling. Mine is only using supervised learning.

I'm just after some pointers or any feedback you can give that I can take forward and try to apply some more advanced techniques, I guess specifically what algorithms do you think would be well suited to this problem?

As a first approach, I propose to use classification. Each row of your table will now be called a training example. Temperature, Wind speed and season are the features of your training examples. The tree columns: location, corner and tree will be combined to give the label of your training examples. It's mean one label will be: north/yes/yes, and another one will be: north/yes/no. If you use only north and south (and not east and west) it makes 8 different labels. You could add a ninth label for cases where you see no birds at all.

You are now ready to give the training examples to your favorite ML model. It will ask you to give separately the features and the labels. For your case I would recommend the use of decision trees based approaches (like Random Forest or boosted trees) because they are robust and simple to understand and interpret.

The ML algorithm will learn a model that predicts the label given the features. So next time you want to see a bird, you give the current temperature, wind speed and season to the ML model. It will output a probability for each label. The sum of the probabilities will be one and you can interpret the probability for one label as the probability to see a bird in this specific location. Something like: I have 80% chance to see a bird in north/yes/no, 20% in north/yes/yes and 0 in the other locations.

Cheers and beware of bias and probability misinterpretation!

• Thank you for your answer, this explanation really helped, particularly the use of terms like training example, features and labels. Also giving me details of specific algorithms to try will get me well on the way, thanks again!
– cih
Nov 12, 2015 at 22:19

The features I missed in your toy data was ensuring that you record bird species, number of birds, activities (e.g., feeding, roosting, mating, etc.), time of day (not too granular), day of year and weather conditions beyond just temperature, e.g., rain, snow, clouds, sun, barometric reading, as well as position or location. In fact, I would make these latter features "structural" in the sense of a possible study design around which you could build a kind of sampling frame for random viewing times and events. This would be useful since you likely do not have time to watch your garden all day long (maybe you do but I wouldn't assume that). One obvious question concerns how long you run your "observation" period. If you're doing this at your leisure, then in theory you could run it indefinitely.

Bird species seems an important feature to observe and record in and of itself since some birds simply won't "land" anywhere near, e.g., a predatory bird or if such a bird is "circling" overhead, while other bird species share almost symbiotic relationships. Another consideration might be the extent to which there are "interlopers" in your garden such as squirrels or dogs that would interfere with the birds' landing or positioning.

If you really are referring to your garden, then the possible positions or locations should be "mappable" in the sense of height from the ground and, almost like GPS coordinates, distance from the other possible locations in your garden.

Given that information as a baseline and having developed a reasonably dense set of records for analysis, a number of possible methods for insight suggest themselves. One approach would be to leverage contingency table analysis since the "core" of your concerns have to do with species (categorical), location (also categorical) and time -- time of day, week of year, etc. (also discrete or discretizable). This approach would develop a set of parameters against which you could fill in "dummy" observations for prediction of the expected behavior. A good reference for this method, with specific applications to biological and species behaviors, is Stephen Fienberg's The Analysis of Cross-Classified Categorical Data.

Another approach to this could be a network analysis of the interrelationships between the bird species insofar as you can learn which birds "interact" wrt positioning, are "friends" or cooperate (or don't) in some meaningful way. A good reference for this approach is Borgatti, et al, Social Network Analysis.

Finally, a regression analysis would provide additional insight into which of the features you've been collecting information about matters most in terms of understanding where, when and how birds "position" themselves in your garden.

## Edit to original response

This paper recently came to my attention, Experimental resource pulses influence social-network dynamics and the potential for information flow in tool-using crows. While not "spot-on" with respect to the OPs original concerns, it is strongly related and suggestive of both design and analytic issues that are worthy of consideration. As such, I'm sharing it as "grist for the mill."

Here's the abstract:

Social-network dynamics have profound consequences for biological processes such as information flow, but are notoriously difficult to measure in the wild. We used novel transceiver technology to chart association patterns across 19 days in a wild population of the New Caledonian crow—a tool-using species that may socially learn, and culturally accumulate, tool-related information. To examine the causes and consequences of changing network topology, we manipulated the environmental availability of the crows’ preferred toolextracted prey, and simulated, in silico, the diffusion of information across field-recorded time-ordered networks. Here we show that network structure responds quickly to environmental change and that novel information can potentially spread rapidly within multi-family communities, especially when tool-use opportunities are plentiful. At the same time, we report surprisingly limited social contact between neighbouring crow communities. Such scale dependence in information-flow dynamics is likely to influence the evolution and maintenance of material cultures.

• Thanks very much for your answer it's pointed me towards some interesting resources and given me lots to think about!
– cih
Nov 12, 2015 at 22:16