Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
18 views

Animal Behavior Project Documentation

Machine Learning Animal Behavior Project Documentation
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Animal Behavior Project Documentation

Machine Learning Animal Behavior Project Documentation
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

ANIMAL BEHAVIOR PREDICTION PROJECT DOCUMENTATION

Title: Farm Animal Behavior Prediction


Author: V Premkumar
Starting Date: 21/06/2024
Table of Content:
1. Introduction
2. Background and Literature review
3. Data Description
4. Data Preprocessing
5. Exploratory Data Analysis (EDA)
6. Clustering
7. Behavior Classification
8. Prediction of Rumination time
9. Discussion
10. Conclusion
11. References
12. Appendix
1. Introduction of about the Project:
Ethology is the scientific study of animal behavior. The first modern ethologist was Mr. Charles
Darwin, whose 1872 book “The Expression of the Emotions in man and animal” influenced the study
of ethology. The term Animal behavior is commonly used to describe what an animal does during its
daily life. Animal behavior, when considered over appropriate periods of time, is an important indicator
of health, welfare, and productivity, particularly for livestock. It can also provide valuable information
about animals’ environment, social interactions, and herd dynamics. classifying animal behavior on
wearable devices, such as accelerometers are compact and low-power motion sensors that can measure
acceleration on three orthogonal spatial axes.
Animals’ behavior having different activities like lying, eating, ruminating etc. from these, rumination
time that could be used to monitor the health and reproduction of dairy cattle. In this project we will
deeply classify the animals based on their behaviors and also, we will calculate the rumination time for
an animal. According to Basudeb, farm animals are expressing various behavior according to the
situation, some of them are ingestive behavior (Food & Water intake), thermoregulatory behavior,
communication behavior, sexual behavior, agonistic behavior, care-giving maternal behavior, care-
soliciting behavior, eliminating behavior, gregarious behavior, allelomimetic behavior, avoidance
behavior, territorial behavior, etc. But in this project, we will enquire about a single farm animal
behavior only. In conclusion, rumination time could be used as an indicator of the health status in dairy
cattle. Decreased rumination time has been associated with the stress, anxiety and diseases.
Objective: The primary objective is to monitor and analyze animal behavior to assess well-being,
health, productivity, and reproduction.
2. Background and Related Information:
Overview: Animal Behavior encompasses the actions and reactions of animals in response to their
environment, stimuli and interactions with other animals. Understanding animal behavior helps to
know about its welfare, health and productivity.
Common Behaviors:
1. Feeding
2. Movement
3. Social Interactions
4. Reproductive Behavior
5. Resting.
Methods to Monitoring:
1. Direct Observations: it’s a traditional method.
2. Video surveillance
3. Automated System using latest technology like IOT, sensors, etc.
Health Indicator:
1. Activity Level :- Normal, Abnormal or ill
2. Feeding level :- Normal, High or low intake of food.
3. Social :- Isolated, Normal, Aggressive towards the other animals
Productivity Indicator:
1. Growth Rate: High, Medium or Low level
2. Reproductive rate: High, medium or low breed
3. Milk production: High, medium or low yield
Wearable technology offers advanced solutions for continuous and objective monitoring, providing
valuable data that can lead to improved farm management practices. By integrating these technologies,
farmers can enhance their ability to detect and address health issues early, optimize productivity, and
ensure the well-being of their animals.
3. Data Description:
1. Dataset having 14595853 rows/records and 4 columns/ features.
2. Timestamp: Data and time of data (animal movement) recorded.
3. x-variable: Acceleration in horizontal direction, typically aligned with the animal’s forward and
backward movement.
4. y-variable: Acceleration in vertical direction, typically aligned with animal’s upward and
downward movements.
5. z-variable: Acceleration in lateral direction, typically aligned with animal’s side-to-side
movements.
These features are recorded / collected using accelerometers, which measures the rate of change of
velocity of animal along the axes. Based on this information we can easily find the animal behaviors
like
 If it moves in X- axis, then it is running, walking, etc.
 If it moves in Y-axis, then it is jumping, rearing, etc.
 If it moves in Z-axis, then it might associate with walking or pacing, etc.
4. Data Preprocessing:
After importing / loaded the dataset into the jyupter/colab notebook. We have preprocess the data.
Preprocessing involves the following steps
1. Cleaning the data: Check the quality of data using functions like head(), tile(), sample(), info(),
describe(), etc.
2. Handle the missing values either removal or imputation
3. Check the duplication
4. Handle Outliers: by using Box plot, IQ, etc. It required basic domine knowledge of the field.
5. Data conversion: Find the categorical and numerical data. Convert the categorical data type into
numerical datatype. For machine learning, model will only process the numerical datatype.
6. Feature Engineering:
a. Create a new feature from the existing features. It also required domine knowledge about the
field.
b. Feature Selection: Using correlation analysis, feature importance from model or recursive feature
elimination.
c. Dimensionality reduction: using PCA .
7. Data Integration: Merging Datasets, concatenation.
5. Exploratory Data Analysis (EDA):
It involves the series of steps like clean, understand and visualization of the data. By thoroughly
examining the dataset through various statistical and graphical methods, you can uncover patterns,
detect anomalies, and form hypotheses. This process not only provides insights into the data but also
informs subsequent modeling and decision-making processes.
By using box plot, we can view/ visualize the outlier in the dataset
By using hist plot,count plot,etc. we can understand the distribution of data (Univariate Analysis)
By using scatter plot, we can understand the relationship between two variables. (bivariate Analysis)
By using pair plot, we can understand the relationship between multiple features (Multivariate
Analysis)
By using Correlation matrix/heat map, we can understand the linear relationship.
Timeseries: Analysis the temporal pattern in the data.
7. Clustering Algorithm:
The data set is ready for train the model. As we know the data is unlabeled, so we can use the
unsupervised machine learning algorithms like Clustering, Association, Dimensionality Reduction
technique algorithms. Here we are finding the animal behavior, so we will choose Clustering as a best
algorithm.
Varies cluster Algorithms are
1. K-Mean: Efficient for large dataset & Required number of cluster(k) to be specified.
2. Hierarchical clustering: Building a tree of clusters(dendrogram) & two main types are
Agglomerative and Divisive.
3. DBSCAN: (Density based Spatial clustering of Applications with noise), effective in handling
the outlier. Required minimum points per cluster & distance threshold.
4. Mean Shift Clustering: Shift the points towards the mode (density point) iteratively.
5. Gaussian Mixture Models (GMM): uses the Expectation-Maximization (EM) algorithm to find
the parameters of the Gaussian distribution.
6. Agglomerative Clustering: Each point as its own cluster & mergers clusters iteratively.
For this project we are using K-mean clustering algorithm. We have to create new features for the
existing feature like “magnitude of Acceleration”, “speed”,” velocity of x”, “Velocity of y”, “velocity
of z”. Then we have to find the “Delta value for t”. By using these features, we will form a new feature
called “Cluster”. Now we can visualize the K-mean using seaborn library.
8. Behavior Classification:
1. Labeling Clusters: Interpret and label clusters based on behavioral patterns. We will name these
clusters as behavior A, Behavior B, Behavior C, etc.
2. Evaluating Clustering Quality: such as silhouette score.
9. Predicting Rumination Time:
To find the Rumination Time for a cattle/animal, we will do the feature engineering and find the
“mean_rolling” & “std_rolling” for ‘x’,’y’ &’z’ variables and then set a threshold limit for acceleration
and speed, inorder to find weather the animal is ruminating or not? Then find the rumination time by
grouping is rumination with ‘timestamp’. Now we have created “rumination_time” variable from the
existing features.
We will define the ‘X ‘- variables and ‘y’- variables. Here “rumination_time” as our target variable (ie,
y- variable). We will drop the timestamp variable from X variables.
Then split the data set into train and test sets using sklearn library.
Train the model using Random Forest Classifier Algorithm. Then predict the model and then Evaluate
the model with various metrics like r2, score, etc.
10. Discussion:
They have provided the dataset with four variables like ‘timestamp’, ‘x’, ‘y’ &’z’.(ie, date & time with
the animal movement in varies axes). In order to find the animal behavior, we have created various new
feature for calculating the animal behavior. So, we have to created features like ‘Magnitude of
acceleration’, velocity of animal movement in various axes, from velocity we can find the speed of the
animal. Then we have to aggregate these features based on time window. So that we can find, what is
the movement of an animal at a particular timeframe. During the timeframe, if the animal is in good
posture and good movement, we can consider it as healthy animal at the time. Form that we classify /
cluster the animal behavior. (It required deep domine knowledge to classify or to find the animal what
it is doing?). So, we simply classify the animal behaviors into ‘A’,’B’,’C’,etc. Now in order to calculate
the ‘rumination’, we have to calculate mean value for magnitude of acceleration, speed. Then we will
set a threshold limit for magnitude_acceleartion & speed as minimum as 0.1 & 0.05. Then check
whether the animal is ruminating or not? And calculate the rumination time.
Now train the model using Random Forest Classifier and evaluate the prediction value.
Limitations: We are measured the animal movement only with accelerometer and we get only animal
movement. Because of it, we can’t find the full behavior of animal and we can’t come to conclusion
that a particular animal is in good condition or bad condition. So there is a limit to predict the animal
behavior.
11. Conclusion:
The Farm Animal Behavior Prediction project focuses on understanding and analyzing the daily
behaviors of farm animals to assess their health, welfare, and productivity. The project leverages data
collected from accelerometers, which measure acceleration on three spatial axes, to classify various
behaviors such as lying, eating, and ruminating.
The dataset consists of over 14 million records with features including timestamp, x-axis, y-axis, and z-
axis accelerations. The preprocessing steps involve data cleaning, handling missing values, feature
engineering, and dimensionality reduction to prepare the data for analysis.
Exploratory Data Analysis (EDA) is conducted to uncover patterns and relationships within the data,
followed by the application of clustering algorithms to group similar behaviors. The K-means
clustering algorithm is used to create behavior clusters, which are then labeled and interpreted.
The project also focuses on predicting rumination time, an important health indicator for dairy cattle.
By creating features such as magnitude of acceleration and speed, and setting threshold limits, the
model identifies periods of rumination and calculates the total rumination time.
The Random Forest Classifier is used to train the model, and various evaluation metrics such as R-
squared and mean squared error are used to assess its performance. The project aims to enhance farm
management practices by providing continuous and objective monitoring of animal behaviors.
Advance Technique:
 Improving Features: Add more features like jerk (rate of change of acceleration) or time-based
features (e.g., moving averages).
 Advanced Clustering: Experiment with advanced clustering algorithms like DBSCAN or
hierarchical clustering.
 Behavioral Analysis: Perform detailed analysis on each identified behavior to gain deeper
insights.

** Thank you **

You might also like