Question

Given a list of predicted values and a list of their corresponding observed values, complete the function FilterOutliers that

0 0
Add a comment Improve this question Transcribed image text
Answer #1

function [] = FilterOutliers(predicted, observed, threshold)
    
    % finding difference between elements and squaring and 
    % finding mean of them
    oldErr = mean(abs(predicted-observed).^2);
    
    % counting outliers if difference between predicted &
    % observed is greater than threshold
    nOutliers = sum(abs(predicted-observed) > threshold(:)==1);
    
    % difference between predicted & observed
    % is less than or equal to threshold
    error = (abs(predicted-observed) <= threshold);
    
    % squaring the error
    error = (predicted(error)-observed(error)).^2;
    % calculating mean of error
    newErr = mean(error);
    % display the oldError, Number of outliers, new Error
    fprintf("oldError    = %d\n",oldErr);
    fprintf("numOutliers = %d\n",nOutliers);
    fprintf("newError    = %.4f\n",newErr);
    
    
end

Code :

Filter Outliers.m X + function [] = FilterOutliers (predicted, observed, threshold) 로 4 о со но си со ме 1 finding difference

Output :

Command Window >> predicted = [8, 2, 5, 9, 2, 2, 8, 3]; >> observed = [3, 5, 15, 5, 7, 0, 9, 5]; >> threshold = 4; >> FilterO

Add a comment
Know the answer?
Add Answer to:
Given a list of predicted values and a list of their corresponding observed values, complete the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Given a set of values representing a complete population, the standard deviation is found by taking...

    Given a set of values representing a complete population, the standard deviation is found by taking the square root of the average of the squared deviations of the values from their average value. For an example of what that means, see the following Wikipedia page; in particular, see the "Basic Example". As discussed in Wikipedia, given the following complete population: 2.0 4.0 4.0 4.0 5.0 5.0 7.0 9.0 then the standard deviation is 2.0 Your task is to write a...

  • Problem overview. There are a number of ways to normalize, or scale, a set of values....

    Problem overview. There are a number of ways to normalize, or scale, a set of values. One common normalization technique scales the values so that the minimum value goes to 0, the maximum value goes to 1, and the other values are scaled accordingly. Using this normalization technique, the values of the array below are normalized. Original Array Values -1 -2 2 Normalized Array Values 0.25 0.01.0 0.5 The equation that computes the normalized value from a value xe in...

  • Given below is a partially completed C program, which you will use as a start to...

    Given below is a partially completed C program, which you will use as a start to complete the given tasks. #define SIZE 9 #include <stdio.h> int compareAndCount (int[], int[]); double averageDifference (int[], int[]); void main() { } int compareAndCount(int arr1[SIZE], int arr2[SIZE]) { int count - @; for (int i = 0; i < SIZE; i++) { if (arri[i] > arr2[i]) count++; return count; Task 1: (10 pts) Show the design of the function compareAndCount() by writing a pseudocode. To...

  • The number 6 is a truly great number. Given two int values, a and b, return...

    The number 6 is a truly great number. Given two int values, a and b, return true if either one is 6. Or if their sum or difference is 6. Note: the function Math.abs(num) computes the absolute value of a number. loveSix(6, 4)  true loveSix(4, 5)  false loveSix(1, 5)  true For example: Test Result System.out.println(loveSix(14, 4)); false

  • Write three functions that compute the square root of an argument using three different methods. The...

    Write three functions that compute the square root of an argument using three different methods. The methods are increasingly sophisticated, and increasingly efficient. The square root of a real number is the values such that x . For us, the values will be double precision variables and so may not be perfectly accurate. Also, for us, assume that is in the range 0.0 to 100.0 You program should have a main() that asks the user for x and an accuracy...

  • PLEASE HELP ME WITH THIS TASK 3.1 (FLOWCHART) AND TASK 3.2 (SOURCE PROGRAM). THANK YOU! Hint:...

    PLEASE HELP ME WITH THIS TASK 3.1 (FLOWCHART) AND TASK 3.2 (SOURCE PROGRAM). THANK YOU! Hint: the number array in task 2 is work for task 3 in figure 1.   Given below is a partially completed C program, which you will use as a start to complete the given tasks. #define SIZE 9 #include <stdio.h> int compareAndCount (int[], int[]); double averageDifference (int[], int[]); void main() { } int compareAndCount(int arr1[SIZE], int arr2[SIZE]) { int count = 0; for (int i...

  • write a complete Java program with comments in main and in each method. Data: The input data for this program is given as two columns of numbers. All data will be entered from a fle named input.t...

    write a complete Java program with comments in main and in each method. Data: The input data for this program is given as two columns of numbers. All data will be entered from a fle named input.txt and all output will go to the screen Assume there will not be more than 100 7 23.56 16 88.12 10 75.1 Design a Java class with a main method that does the following 1) Reads the data into two arrays of doubles,...

  • Need help on C++ (User-Defined Function) Format all numerical decimal values with 4 digits after ...

    need help on C++ (User-Defined Function) Format all numerical decimal values with 4 digits after the decimal point. Process and sample run: a) Function 1: A void function that uses parameters passed by reference representing the name of a data file to read data from, amount of principal in an investment portfolio, interest rate (any number such as 5.5 for 5.5% interest rate, etc.) , number of times the interest is compounded, and the number of years the money is...

  • 5 Mailings Review View Help Design Layout Search Experimental design and procedures: 1. Use the picture...

    5 Mailings Review View Help Design Layout Search Experimental design and procedures: 1. Use the picture provided to count the number of yellow and purple corn kernels. You should count ALL of the kernels visible in the picture. Each kernel is a seed-seeds are baby plants. Therefore, each kernel represents an offspring of the plant cross. Enter these observed Values into Table 1. Page 6 3 f BE 2. Tally the total number of offspring that are yellow and purple...

  • 1. Declare an array of five integers named boxes. 2. what do you type to access...

    1. Declare an array of five integers named boxes. 2. what do you type to access the third element in the boxes array? 3. what do you type to assign the number 10 to the 5th element in the boxes array? 4. Declare an array named cartons that contains these values: 4.2 , 3.1, 6.8 5. what is the subscript value of 6.8 in the cartons array? 6. what will this program output if is in a complete program? cout<<...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT