PREVENTIVE DIAGNOSIS OF DAIRY COW LAMENESS

This research aimed to develop a Fuzzy inference based on expert system to help preventing lameness in dairy cattle. Hoof length, nutritional parameters and floor material properties (roughness) were used to build the Fuzzy inference system. The expert system architecture was defined using Unified Modelling Language (UML). Data were collected in a commercial dairy herd using two different subgroups (H1 and H2), in order to validate the Fuzzy inference functions. The numbers of True Positive (TP), False Positive (FP), True Negative (TN), and False Negative (FN) responses were used to build the classifier system up, after an established gold standard comparison. A Lesion Incidence Possibility (LIP) developed function indicates the chances of a cow becoming lame. The obtained lameness percentage in H1 and H2 was 8.40% and 1.77%, respectively. The system estimated a Lesion Incidence Possibility (LIP) of 5.00% and 2.00% in H1 and H2, respectively. The system simulation presented 3.40% difference from real cattle lameness data for H1, while for H2, it was 0.23%; indicating the system efficiency in decision-making.


INTRODUCTION
Lameness control in dairy cattle is a critical issue, as it directly impacts the herd management, economics, and welfare (ARCHER et al., 2011).The greatest economic loss caused by lameness comes from fertility reduction and culling increase that may lead animals to stress and pain (ETTEMA et al., 2010).Lameness is only visually detected at later stages when the animal already has its welfare severely affected.
The majority lameness incidences initiate from hoof disorders, and there are different causal factors associated with the pathology.Hoof lesions are a key cause for lameness (TADICH et al., 2010) and their development are associated with housing conditions, feeding strategy, and management factors (KNOTT et al., 2007).Distinct factors such as interaction between floor surface and hoof (HAUFE et al., 2009), floor physical properties (FRANCK et al., 2007), and diet (O'DRISCOLL et al., 2010) have been associated with hoof lesions and lameness in dairy cattle.
In milk production research, mathematical tools have been used to predict milk yield (LALONI et al., 2004).Machine vision systems have been reported to analyse confined dairy cattle behaviour (SOUZA et al., 2011) and also the use of non-classic logic tools to evaluate livestock slaughtering is found in current literature (GABRIEL FILHO et al., 2011).
There have been several attempts to increase the precision of lameness early detection in dairy cattle using distinct technological approaches: the prediction in the farm by using data on hoof track and visual locomotion scores (SONG et al., 2008); mat made of electromechanical film, for detecting dynamic forces exerted by cow hooves during milking (PASTELL et al., 2008); image analysis (SONG et al., 2008;POURSABERI et al., 2010); system based on ground reaction force measurements as the animal walks freely through the system (DYER et al., 2007), and Fuzzy pertinence functions for generating diet-dependent, hoof length and environmental condition scenarios (O'DRISCOLL et al., 2010).
This study aimed to develop an expert system to predict the lameness incidence risk in dairy cattle applying Fuzzy pertinence functions.

MATERIAL AND METHODS
The proposed system describes the quantitative assessment based on a multidimensional Fuzzy set theory to indicate the lameness lesion incidence risk in dairy cattle.
Data were obtained from monitoring a commercial dairy herd during the South hemisphere cold months (May to August) and warm months (November to February) throughout the year.Two cow groups were randomly selected and used in the trial.Herd 1 (H 1 ) had 178 animals and Herd 2 (H 2 ) had 790 animals.Data were organized based on literature review, and a veterinary specialist in locomotion disorders was consulted to help building up the Fuzzy inference rules (BOBILLO et al., 2009), in which hoof length, floor material, nutrition parameters and rearing environment were considered.

Fuzzy algorithm development
A set of Fuzzy pertinence functions was done using the If -Then concept; and the rule bases were organized using Multi-Inputs Multi-Output (MIMO) model (PRECUP & HELLENDOORN, 2011), as shown in eq.( 1) and eq.( 2):  Bij (iZ1,.,m;jZ1,.,r)and Di (iZ1,., s) are Fuzzy sub-groups of the linguistic whole U1, U2,…, Ur, and V1, V2,… Vs of X1, X2, ..., Xr and Y1, Y2,... Ys, respectively.The inference engine was based on Fuzzy rules as an input and generated a Fuzzy output.Visual Basic was used to build conditional operators and logical connectors up.The Fuzzy controller was processed by setting the membership functions (input and output variables) to determine the lesion incidence possibilities, and it was implemented using conformity tests in the Fuzzy logic toolbox of Matlab® (v.6.1)software.

Procedures
Data analysis used GRAI model (SALEM et al., 2008), which is based on system theory, hierarchical theory and activity theory, using a structured approach based on collaboration and participation among the system designer, a qualified veterinary, and the dairy farmer.An interface was developed to provide a dialog with customer using data from the source of rules as inputoutput, and Visual Basic ® 6.0 was adopted as a tool.A set of diagrams is generated to show how the process operates.
After the system coding and implementation, the developed software was validated using two randomly selected herds from a commercial dairy farm (H 1 and H 2 ).GRAI model was applied (MOSQUEIRA-REY et al., 2008) to compare field data and results from the expert system outputs, using pathological incidence potential in certain degrees during the experimental period of cold months (May to August) and warm months (November to February) in the South Hemisphere.
Two cow groups were selected from commercial herd based on method used by GLORIA (2010).Herd 1 (H 1 ) had 178 animals and Herd 2 (H 2 ), 790 animals.The system was designed to identify lame cattle through system result comparison with a nominal gold standard (diagnosed lame cow).The system specified true-positive when cows were diagnosed lame and true-negative if they were healthy.The expert system result analysis, obtained by the classifier, was made considering the number of true-positive (TP), false positive (FP), true-negative (TN) and false negative (FN) responses, according to the comparison criteria with the gold standard.The preview performance was made through contingency table pair that shows classifier results (Fuzzy system) compared to the gold standard.
The Fuzzy system output was analysed using performance means such as accuracy, error, sensitivity and specificity.The result accuracy of a classifier system is the ratio of number of system success and number of evaluated cases (BRUNASSI, 2010;eq.[3]).(3) The sensitivity (Sens) and specificity (Spec) analysis was performed as suggested by FIRK et al. (2002), shown in eq.( 4): (4) The sensitivity was described as the probability of proper cow lameness detection also known as detection rate (FIRK et al., 2002).Only lame cows were taken into account [eq.( 4)] according to the gold standard, which received alerts of being lame (TP) and healthy (FN) from the Fuzzy system.Then, TP sensitivity results were compared to all lame cow data.The eq.( 5) was used to evaluate the system performance for non-lame cow cases.(5) The specificity is related to the probability of lameness negative alert when cows were not truly lame.The sensitivity compares non-lameness cases (TN) with healthy cow data.The error rate [eq.( 6)] is called false positive occurrence rate, corresponding to alerts of healthy cow incorrect information.The system reliability is related to the amount of error that automatic lameness detection may cause.The larger the error, the more the producer receives false warnings about lame cows.The Fuzzy approach is useful when sensitivity and specificity are close to 100%, and the error rate is close to zero.
The Receiver Operating Characteristic (ROC) method was used to determine sensitivity and specificity values (BRUNASSI et al., 2010).It refers to a graphical representation in Cartesian plane of true positive selection (sensitivity) and false positive fraction (1-specificity), providing a cut-off point that allows precise separation of "Lame" and "Possible Lame" or "Healthy".The ranges of TP, FP, TN and FN are shown in Table 1.The alerts were checked for accuracy, and then reclassified within the ranges.The field validation tests were performed in a commercial Holstein free-stall dairy farm, in two herd groups (H 1 and H 2 ) with similar lactation level based on method used by GLORIA (2010).The cattle were milked three times a day after being feed with commercial fodder, during 8 min each, and the average milk yield was 28.7 kg day -1 .Data on breeding, insemination, and health status were continuously registered.Weather data as local air temperature and relative humidity were obtained from meteorological stations located in the farm throughout the year.

RESULTS AND DISCUSSION
The system generated a solution, which was developed in three stages: 1) Fuzzy pertinence function development; 2) Base construction knowledge; and 3) Software validation.

Development of Fuzzy pertinence functions
Data, which effectively led to the pathology development, were subdivided into linguistic terms in order to build the Fuzzy inference functions up.A set of rules was organized to describe the relation between independent and dependent variables (BOBILLO et al., 2009).The independent variables that included basis for pathology development were hoof length (mm), neutral detergent fibre (NDF, %), non-fibre carbohydrates (NFC, %), temperature-humidity index (THI), and floor roughness.
The linguistic variable "hoof length" was set within the interval [60,130]   To calculate the estimated total NFC and NDF values in rumen, the output values of dry matter intake (DMI, kg day -1 ) were calculated based on the method presented by TYLUTKI (2008) using Fat-Corrected Milk (FCM %), Body Weight (BW, kg) and Week of Lactation (WOL, day), [eq.( 7)].DMI = (0.372 * FCM+ 0.0968 * BW 0.75) * (1 -e (-0.192*(WOL+3.67))) (7) The nutrient composition was built based on an individual component list of dry matter (DM), crude protein (CP), ethereal extract (EE), and ash.Crude fibre (CF) and nitrogen-free extract (NFE) were replaced by NDF and NFC, respectively.NFC calculation was made using the difference between nutrients (COOK & NORDLUND, 2009) as shown in eq.( 8): The concentrate was registered in an internal table of the expert system as result of the average composition, depending on the crude protein content of various commercial concentrate types.The user may either report the crude protein content to determine the used concentrate (by calculating NDF and NFC estimate of the diet) or the system will infer the NDF and NFC final content.For calculation development, user may input information regarding the diet composition (kg of fodder) stating ad libitum administration.The system will calculate the amount of NDF and NFC.
From DMI calculation, the system further calculates the difference between DMI and DM (dry matter from the concentrate and roughage in the diet).
The application was based on data collection and simple user input of variable values related to milk yield during milking (kg), animal weight (kg), lactation week, and environment temperature.The algorithm processes the correction factors by the corrected values of milk yield, cattle body weight and lactation week (NRC, 2001), [eqs.(9) and ( 10 The system determined the total dry matter intake by animal (DMI) after data inserting and pre-processing.The NDF and NFC values are used to build them up as linguistic variables.For the linguistic variable NDF, the range of [21, 39] was adopted, representing percentages of <25, 28-32, >35 with the linguistic terms of Low, Medium and High, respectively.For the NFC, the range was [23,52] represented by percentages <30, 35-42, >45 through the terms of Low, Medium and High, respectively (CARVALHO et al., 2005;COOK & NORDLUND, 2009).Current literature was used (GARCÍA-ISPIERTO et al., 2007;NARDONE et al., 2010) to establish independent variable thresholds, and "temperature-humidity index"-THI.THI [eq.( 11)] was calculated as described in CRESCIO et al. (2010).A particular THI range was adopted based on NARDONE et al. (2010) in which the given linguistic information was: Normal, Alert, Danger and Emergency as shown in Table 2.The "Roughness" variable was characterized by the time cattle remained standing or walking on the floor.Some studies indicated a positive correlation between prolonged time on concrete floors increasing the risk of hoof lesions (BOYLE et al., 2007;COOK & KENNETH, 2009, DIPPEL et al., 2011).In addition, hygiene maintenance and floor moisture are fundamental elements in hoof disease etiology (FJELDAAS et al., 2011;VISHWANATH et al., 2011). A FRANCK et al. (2007) study helped to build relevant linguistic terms and functions up by different kinds of surface structure obtained by varying the surfacing method, such as: "Very Smooth" for those surfaced with a metal tool; "Smooth" surfaced with wooden tool; "Intermediate" for brushing concrete surface; "Rough" for mildly washing surface; and "Very rough" for heavy concrete with sandblasted surface.The system also allows inputting material roughness coefficient or choosing pictures of selected floor materials (Table 3).
being real numbers.In a Fuzzy if-then rule, the antecedents and consequences of both are Fuzzy.The deduction rule is Generalized Modus Ponens: Given the rule "if A then B", where A and B are Fuzzy propositions, it is possible from premise "A'" which matches A to some degree, to deduce "B'" which is similar to B. The output variables were defuzzified into the centroid of gravity (COG), which can be determined using the moment of area method defined as in Eq. 12.
Where, ) (χ µ B -the aggregated value of the Fuzzy variable B over the universe of discourse Z.The obtained final value is the numerical representation of lesion incidence percentage (% LIP) in the hoof.

Knowledge base construction
The expert system configuration parameters were developed out of the programming body (GIARRATANO & RILEY, 1998), and replaced by variables.While the expert system is being processed, it will search the parameters in a "ini" file type, editable in text mode, generated externally to the configuration without the need for changes in programming.

Software validation
The developed Fuzzy system was tested on two commercial dairy herd cow groups (H 1 and H 2 ).The system responses are presented in accordance with the criteria recommended by GIARRATANO &RILEY (1998), andBRUNASSI et al. (2010).TP represents true-positive; FP the false-positive; TN true-negative, and the FN false-negative responses.Based on field data recorded by the dairy farm veterinary, the possibilities which led cows to lameness were analysed and could be identified, generating the TP, FP, TN, FN responses.The Contingency obtained for H1 is presented in Table 5 and contingency for H2 is presented in Table 6.Hoof trimming was periodically carried out during the trial removing of 10 mm layers per toe, in order to keep it in 80-mm-long.The fodder was given within the TYLUTKI ( 2008) recommendations.The percentage of affected animals during data record was informed by the farm's veterinary for later comparison with the diagnostics given by the system.
According to the H 1 data, 15 cows out of 178 were affected (8.40%), and in H 2 , 14 out of 790 cows were (1.77%); their diet composition (NFC and NDF) were different and the hoof trimming made at different values (80 mm and 75mm, respectively).
The worst free-stall floor roughness had a factor near 0.68 for H 1 and near 0.79 for H 2 ; cattle had stepped on that at least four times a day when left milking parlour to return to the free-stall building.In the defuzzification step, the linguistic variables were transformed into crisp values; thus, from the data entry, system returns a Fuzzy value between 0 and 1.The closer the value is to 1; the more certainty of being a lame cow, and the opposite when the value is close to zero.The 0.5 crisp value is the cut-off point that separates the identification.However, verifying the effect of sensitivity and specificity cut-off values, for each chosen value, the variables changed, reducing the cut value.In this way, cattle that had already been classified as "Lame" became "Possible lame" or "Healthy"."Possible lame" alerts were not considered in cases when milk producer is supposed to verify lameness status.
The construction of the ROC curves (ENG, 2013) for H 1 and H 2 (Fig. 2a and Fig. 2b) was performed by choosing different cut-off points and checking their sensitivity and specificity.Each point on the curve corresponds to a cut-off point.It was intended to choose an optimal cut-off point, in which true positive and false positive cases were relevant to the test purpose.The area under the ROC curve gave a decisive clue about the Fuzzy system ability to identify the lameness considering the FP breadth.Similar procedure was adopted by BRUNASSI et al (2010) to detect oestrus in dairy cattle.
The area under the ROC curve interpretation was given as follows: it can take values between 0 and 1; when it is equal to 0.5 and the curve approaches to a 45-degree-straight line; it means that the classifier system (Fuzzy) is not a valid classifier, as classifications is randomly done.This might be required in this case, which such straight line presents a 1:1 relationship between right and wrong estimates.The goal was to increase the hit numbers, what is only done by approaching the curve of the y-axis (increasing the relationship between sensitivity and error).Therefore, the closer to 1 is the area; the better is the classifier (BRUNASSI et al., 2010).The analysis for both groups by building the ROC curves generated the results shown in Table 7.It is noteworthy that if only the "Lame" alerts, taking the warnings "Possible lame" in the same way that the warnings "Healthy", the sensitivity is lower (fewer hoof pathologies identified), and the errors are smaller (greater specificity).Moreover, considering the warnings "Possible lame" as a warning of lameness, the sensitivity increased to 92.1%; however, the error also increased (less specificity).The calculation of the total accuracy is of low utility; it is a calculation masked.This is due to the predominance in case numbers where lameness is absent.The accuracy for the alerts "Lame" is only higher due to the smaller number of FP alerts.The sensitivity is among the most relevant findings (60.0%), what means that if the dairy farmer had only used the automated system to detect the pathology, 60.0% of cases were not properly identified, missing 40.0% of lame cows.The specificity was of 95.1%; so the farmer has 4.9% of the chance of receiving wrong information (error rate).The scenarios were processed by the expert system assuming the input variables from Table 8.
After processing, the expert system emits some recommendations on hoof trimming and fiber concentration (Figure 3) related to floor type, environmental conditions, and diet ingredient concentration.Other authors (SONG et al., 2008;KAMPHUIS et al., 2013) recommend monitoring regarding the lameness detection; however, their proposal does not include immediate actions towards problem solving.In the first part of the research (H 1 ), the actual herd lameness detection was 8.40% (farm veterinary data), and the expert system estimate was a lesion incidence possibility of 5%.In the second part of the research (H 2 ), the actual lameness incidence was 1.77% (farm veterinary data), and the expert system estimate was a lesion incidence possibility of 2%.The difference of 3.40% (H 1 ) and 0.23% (H 2 ) between the actual and system values is justified by the use of data average values, not the real daily monitoring data.Similar results of lameness prediction were obtained by KAMPHUIS et al. ( 2013) using a probabilistic model based on the cow movement sensor data.Nevertheless, the authors indicate that detection performance was not high enough to be implemented in large, pasture-based dairy farms.In the present study, the diagnostics and recommendations that follow the scenarios can be further adjusted through changes in parameters related to environmental conditions, feeding diet and management, by inserting a configuration file of editable text format.The advantage of this algorithm use relies on the low data gathering complexity, different from other techniques, which require continuous data processing (SONG et al., 2008;POURSABERI et al. 2010;CHAPINAL & TUCKER, 2012).Similarly, behavioural observations are not required to be input in the system as it was already been considered by other authors in the independent variables construction (KNOTT et al., 2007;HAUFE et al., 2009;FRANCK et al., 2007;O'DRISCOLL et al., 2010;COOK & NORDLUND, 2009;CARVALHO et al., 2005).

TABLE 1 .
Ranges considered getting the answers TP, FP, TN and FN.

TABLE 2 .
Linguistic terms used for the THI range.

TABLE 3 .
Linguistic terms used for flooring material.The dependent variable output that represents the incidence risk of lameness resulting from floor condition is Lameness Incidence Possibility (% LIP) shown in Table4.

TABLE 4 .
Linguistic terms used for Lameness Incidence Possibility.

TABLE 5 .
Contingency obtained in herd H 1.

TABLE 8 .
Input variables of processed particular scenarios.