필터 지우기
필터 지우기

How can I replace the value of an outlier rather than delete it?

조회 수: 6 (최근 30일)
HelpAStudent
HelpAStudent 2022년 5월 17일
답변: Nihal Reddy 2022년 6월 3일
Hi! I have used this method to find and eliminate the outliers from a gaussian feature of my data set:
figure;
plot(Fetal_table.mean_value_of_short_term_variability) %Fetal_table is the table of all the features in the data set and table.mean_value_of_short_term_variability is the gaussian features in which I want to work on the outliers
histogram(Fetal_table.mean_value_of_short_term_variability)
figure;
vec_out = isoutlier(Fetal_table.mean_value_of_short_term_variability,"grubbs");
figure
plot(Fetal_table.mean_value_of_short_term_variability, "og"); hold on;
Fetal_table(vec_out,:)=[]; %with that I'm deleting the outliers but I want to substitute them with a value of interest
  댓글 수: 1
Mathieu NOE
Mathieu NOE 2022년 5월 17일
hello
simply put the required value instead of [] (obvious answer)
it depends of course of what you mean by "value of interest" (interpolation, fixed value ,...)
is it a fixed value computed from somewhere else in your code ? if that is the case , doing the substitution is rather straigthforward
Fetal_table(vec_out,:) = new_value(s); % I want to substitute outliers with a value of interest

댓글을 달려면 로그인하십시오.

답변 (1개)

Nihal Reddy
Nihal Reddy 2022년 6월 3일
I understand you want to eliminate the outliers from a gaussian feature of the data set.
Fetal_table(vec_out,:) = [];
In the above line of code you can just replace the “[]” with variable “value_of_interest” like this
Fetal_table(vec_out,:) = value_of_interest;
The variable “value_of_interest” can be scalar or vector depending on your need.

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by