in Technology by

You are solving a data science problem that is ridden with many missing values. You want to clean the data before fitting your model. What would you do to replace these missing values? Develop your own function.

1 Answer

0 votes
by
Let’s take this vector: arr<-c(1,2,4,NA,NA,11,NA,10) Now, let’s write the function to impute the values: missing_mean <- function(arr){ ifelse(is.na(arr),mean(arr,na.rm = T),arr) }

Related questions

0 votes
    Which technologies and languages would you need to develop a project from scratch?...
asked Jun 13, 2021 in Education by Editorial Staff
0 votes
    I am working with this data set: u...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    You are given a data set consisting of variables with more than 30 percent missing values. How will you deal with them?...
asked Apr 26, 2021 in Technology by JackTerrance
0 votes
    I am training on 970 samples and validating on 243 samples. How big should batch size and number of epochs be ... on data input size? Select the correct answer from above options...
asked Feb 1, 2022 in Education by JackTerrance
0 votes
    What is the added value for learning F# when you are already familiar with LISP? JavaScript questions and ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 17, 2022 in Education by JackTerrance
0 votes
    What will do you with a missing value in an observation? Options 1 from the point of definition onward in the ... the function. Tin Select the correct answer from above options...
asked Nov 28, 2021 in Education by JackTerrance
0 votes
    Can I specify my own distance function using scikit-learn K-Means Clustering? Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    As a preface: I want to do this as a learning exercise. I'm not trying to produce a commercially ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    As a preface: I want to do this as a learning exercise. I'm not trying to produce a commercially ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    You are given a dataset on cancer detection. You have built a classification model and achieved an accuracy of 96 percent ... with your model performance? What can you do about it?...
asked Apr 27, 2021 in Technology by JackTerrance
0 votes
    Which of the following function is used for determining missing values? (a) any (b) all (c) is (d ... questions and answers pdf, Data Science interview questions for beginners...
asked Oct 29, 2021 in Education by JackTerrance
0 votes
    Why do we obtain five missing values from the following lines of code? x <- 1:5 x[NA]...
asked Oct 16, 2020 in Technology by JackTerrance
0 votes
    very quick newbish question here... In the jquery-mobile docs, it says that Note that the refresh() ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    I have a question about how to change web pages with a Chrome extension. After reading some info I ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    How to replace the values of NA with zeros in some column and data frame I have? Select the correct answer from above options...
asked Jan 20, 2022 in Education by JackTerrance
...