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](http://img.homeworklib.com/questions/eba144d0-bf67-11eb-aaeb-93944b1d56f5.png?x-oss-process=image/resize,w_560)
Output :
![Command Window >> predicted = [8, 2, 5, 9, 2, 2, 8, 3]; >> observed = [3, 5, 15, 5, 7, 0, 9, 5]; >> threshold = 4; >> FilterO](http://img.homeworklib.com/questions/ec013a40-bf67-11eb-a44e-cf22fa634a8d.png?x-oss-process=image/resize,w_560)
Given a list of predicted values and a list of their corresponding observed values, complete the...
In a regression analysis, if the predicted value of y is 5 and the corresponding observed value of y is 7, the residual (error) equal to 2. TRUE OR FALSE ?
for this assignment you will be creating a series of functions for manipulating an array of data. The data will consist of randomly generated doubles. You should make the following functions: generate() - This function fills an array with random doubles in a specified range. This function takes four inputs: an array of doubles, an integer representing the size of the array, and two doubles representing the lower an upper bounds of the range random values. For example, the function...
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. 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 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...
a) Write a function called print_doubles that prints the first n elements of an array of doubles. Assume the array is long enough. Example: double v[5] = {1,2,3,4,5}; print_doubles(v, 5); // prints [1,2,3,4,5] b) Write a function with the following signature: void get_min_max(const double values[], int n, double *pmin, double *pmax); that returns in output parameters *pmin the value of the minimum element in array values and in *pmax the maximum element. Parameter n represents the size of array values....
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 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: 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.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,...