Question: Write a function that finds anomalous attribute values for the mammal sleeping dataset. Use Python for programming. Use built-in functions such as mean() or stdev()

Write a function that finds anomalous attribute values for the mammal sleeping dataset. Use Python for programming. Use built-in functions such as mean() or stdev() in order to write less code. Use the steps below as a guide.1. Read the mammal sleeping dataset file and store it into various arrays, one array for each attribute.2. Compute the mean and standard deviation for each attribute.3. For each attribute, scan its values and check whether it is an anomaly based on this condition: if an attribute has a value v, mean m and standard deviation s such that v > m + 2s OR v

Write a function that finds anomalous attribute
Dataset Description This is a description of the dataset that will be used in this lab. Dataset File: * mammal sleep 1.txtDownload mammal sleep 1.txt The mammal sleeping dataset contains information about sleeping habits of various mammals. The attributes include * Mammialtype, * Body weight in kilograms, Brain weight in grams, + Life spanin years, + Gestation time in days, * Sleeping time in hours per day Predation and danger indices measured on a scale of 1 ta 5 with being most preyed on or mast dangerous. The dataset was downloaded originally from http://lib.stat.cmu.edu/datasets/sleepLinks to an external site.. Python Script This is the base python script that you will use for this lab. * an anomaly. Statistical Anomaly Detection One simple way to detect anomalies is to find out haw different the attribute value of a given data point is from the attribute values of other data points. This can be accomplished by following these steps: 1. You are given a data set that contains n data points, and each point is described using m attributes. Assume that all attributes are of a ratio type. 2. Foreach attribute in the dataset, compute the mean and the standard deviation. See the table below for a visual example. 3. Then you determine that an attribute value is an anomaly as follows: Given an attribute value v, mean m and standard deviation s such that vem-2*s OR v>m+2"*s, then vis considered an anomalous value. That is, if vis way far from the mean, either below or above it, then itis considered an anomalaus value. Data point Attribute 1 Attribute 2 | Attribute 3 (Just an ID) 1 pe x x 2 3 x x 3 4 ex x 4 7 x x Mean Mean = (2+3+4+7}/4=4 Mean/std div |Mean/std div Std div =sqrt [ ((2-4)*2+(3-4)*2+(4- /over Attribute |over Attribute std div Ays2+ (7-24) 2 3 This is a simple statistical method for identifying anomalous attribute values. You will apply this method to detect anomalous attribute values ina mammal sleeping dataset. Lab Steps In this lab, you are required to read in the mammal dataset, and use the simple statistical technique described above to find anomalous attribute values. In the context of the give dataset, anomalous attribute values correspond to mammal features that are different from those of other mammal types

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!