1 / 43

Data Preprocessing Outlier Detection & Feature Selection

Data Preprocessing Outlier Detection & Feature Selection. Slides adapted from Richard Souvenir and David Kauchak. Where are Features from. Gene expression data. Expression Microarray. Where are Features from. Face image data. Terms. Web Pages. Emails. T 1 T 2 ….…… T N. C.

henriettal
Télécharger la présentation

Data Preprocessing Outlier Detection & Feature Selection

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data Preprocessing Outlier Detection & Feature Selection Slides adapted from Richard Souvenir andDavid Kauchak

  2. Where are Features from Gene expression data Expression Microarray

  3. Where are Features from Face image data

  4. Terms Web Pages Emails T1 T2 ….…… TN C Sports 12 0….…… 6 D1 Travel D2 3 10….…… 28 Documents … … … … DM 0 11….…… 16 Jobs Internet PubMed ACM Portal IEEE Xplore Digital Libraries Where are Features from Text/Document Data • Task: To classify unlabeled documents into categories • Challenge: thousands of terms 5

  5. UCI Machine Learning Repository http://archive.ics.uci.edu/ml/datasets.html

  6. Provided features Predicting the age of abalone from physical measurements Name / Data Type / Measurement Unit / Description ----------------------------- Sex / nominal / -- / M, F, and I (infant) Length / continuous / mm / Longest shell measurement Diameter / continuous / mm / perpendicular to length Height / continuous / mm / with meat in shell Whole weight / continuous / grams / whole abalone Shucked weight / continuous / grams / weight of meat Viscera weight / continuous / grams / gut weight (after bleeding) Shell weight / continuous / grams / after being dried Rings / integer / -- / +1.5 gives the age in years

  7. Provided features Predicting breast cancer recurrence 1. Class: no-recurrence-events, recurrence-events 2. age: 10-19, 20-29, 30-39, 40-49, 50-59, 60-69, 70-79, 80-89, 90-99. 3. menopause: lt40, ge40, premeno. 4. tumor-size: 0-4, 5-9, 10-14, 15-19, 20-24, 25-29, 30-34, 35-39, 40-44, 45-49, 50-54, 55-59. 5. inv-nodes: 0-2, 3-5, 6-8, 9-11, 12-14, 15-17, 18-20, 21-23, 24-26, 27-29, 30-32, 33-35, 36-39. 6. node-caps: yes, no. 7. deg-malig: 1, 2, 3. 8. breast: left, right. 9. breast-quad: left-up, left-low, right-up, right-low, central. 10. irradiated: yes, no.

  8. Provided features vs. Extracted features • Provided features • Data has been collected (biology, medicine) • Usually cannot collect more features • We can often just use these provided features • Extracted features (given raw data, extract/generate features) • Certain image data • text data • audio data • … Soft tissue found in T-rex fossil Find may reveal details about cells and blood vessels of dinosaurs Thursday, March 24, 2005 Posted: 3:14 PM EST WASHINGTON (AP) -- For more than a century, the study of dinosaurs has been limited to fossilized bones. Now, researchers have recovered 70-million-year-old soft tissue, including what may be blood vessels and cells, from a Tyrannosaurus rex. Health may be concern when giving kids cell phones Wednesday, March 23, 2005 Posted: 11:14 AM EST SEATTLE, Washington (AP) -- Parents should think twice before giving in to a middle-schooler's demands for a cell phone, some scientists say, because potential long-term health risks remain unclear. Wall Street gears up for jobsSaturday, March 26, 2005: 11:41 AM EST NEW YORK (CNN/Money) - Investors on Inflation Watch 2005 have a big week to look forward to -- or be wary of -- depending on how you look at it. Probe finds atmosphere on Saturn moon Thursday, March 17, 2005 Posted: 11:17 AM EST LOS ANGELES, California (Reuters) -- The space probe Cassini discovered a significant atmosphere around Saturn's moon Enceladus during two recent passes close by, the Jet Propulsion Laboratory said on Wednesday

  9. Current learning model X1 X2 X3 X4 … … … … Xn training data (labeled examples) learn model/ classifier

  10. Pre-process training data training data (labeled examples) pre-process data learn model/ classifier “better” training data What types of preprocessing might we want to do?

  11. Outlier detection vs feature selection Relevant features X1 X2 X3 X4 … … … … Xn outliers outliers

  12. Outlier detection What is an outlier?

  13. Outlier detection An example that is inconsistent with the other examples What types of inconsistencies?

  14. Outlier detection • An example that is inconsistent with the other examples • extreme feature values (or far away from other samples) • examples with the same feature values but different labels

  15. Outlier detection • An example that is inconsistent with the other examples • extreme feature values (or far away from other samples) • examples with the same feature values but different labels Fix?

  16. Outlier detection • An example that is inconsistent with the other examples • extreme feature values (or far away from other samples) • examples with the same feature values but different labels

  17. Removing extreme outliers • Throw out examples with extreme values in one dimension • Throw out examples very far away from any other example • Say, from its neighbors • Train a probabilistic model on the data and throw out “very unlikely” examples • This is an entire field of study by itself! • Called outlier or anomaly detection.

  18. Quick statistics recap What are the mean, standard deviation, and variance of data?

  19. Univariate data x1 Quick statistics recap x2 multivariate data xn mean: average value, often written variance: a measure of how much variation there is in the data. Calculated as: standard deviation: square root of the variance (written as σ) How can these help us with outliers?

  20. Outlier detection Outside 3 times variance Probability smaller than 0.3% If we know the data is distributed normally, then we can estimate the Gaussian function ( ,). Any sample x can be plugged in to compute its “probability”

  21. Outliers in a single dimension Even if the data isn’t actually distributed normally, this is still often reasonable

  22. Kernel bandwidth Density

  23. Outliers for machine learning Some good practices: • Throw out conflicting examples • Throw out any examples with obviously extreme feature values (i.e. many, many standard deviations away) • Check for erroneous feature values (e.g. negative values for a feature that can only be positive) • Let the learning algorithm/other pre-processing handle the rest

  24. So far… • Throw out outlier examples • Which features to us

  25. Feature selection Good features provide us information that helps predict labels. However, not all features are good • Feature pruning is the process of removing “bad” features • Feature selection is the process of selecting “good” features Why we need feature selection? - to help build more accurate, faster, and easier to understand classifiers. • Performance: enhancing generalization ability • alleviating curse of dimensionality • Efficiency: speeding up learning process • Interpretability: model that is easier to understand

  26. Removing Noisy/useless features • What are useless features? • Binary features: • remove “rare” features, i.e. features that only occur (or don’t occur) a very small number of times • Real-valued features: • remove features that have low variance • In both cases, can either use thresholds, throw away lowest x%, use development data, etc. X1 X2 X3 X4 … … … … Xn

  27. So far… • Throw out outlier examples • Remove noisy features • Pick “good” features

  28. Feature selection Let’s look at the problem from the other direction, that is, selecting good features. What are good features? How can we pick/select them?

  29. Good features A good feature correlates well with the label F3 label F1 F2 1 1 1 1 0 0 1 0 0 1 1 0 1 1 0 How can we identify this? 1 0 1 1 0 • training error (like for DT) • correlation model • statistical test • probabilistic test • … …

  30. Filter method for feature selection • for each feature f, determine its relevance score by: • calculate the training error (only feature f is used) • Or calculate the correlation of feature (f) with the label (y) • Or calculate the class separability of this feature (classification problems) • rank each feature by this value • pick top k, top x%, etc. • can use a development set to help pick k or x

  31. Scatter plots showing the correlation between feature(f) and label(y). y f X2 X1

  32. So far… • Throw out outlier examples • Remove noisy features • Pick “good” features

  33. Feature normalization Would our classifiers (k-NN and perceptron) learn the same models on these two data sets? What about for linear regression?

  34. Feature normalization k-NN: NO! The distances are biased based on feature magnitude.

  35. Feature normalization Which of the two examples are closest to the first?

  36. Feature normalization

  37. Feature normalization perceptron: NO! The classification and weight update are based on the magnitude of the feature value

  38. Feature normalization Linear regression: Yes! The model coefficient W naturally absorbs the re-scaling

  39. Feature normalization Modify all values for a given feature

  40. Normalize each feature For each feature (over all examples): Center: adjust the values so that the mean of that feature is 0. How do we do this?

  41. Normalize each feature For each feature (over all examples): Center: adjust the values so that the mean of that feature is 0: subtract the mean from all values Rescale/adjust feature values to avoid magnitude bias. Ideas?

  42. Normalize each feature For each feature (over all examples): Center: adjust the values so that the mean of that feature is 0: subtract the mean from all values Rescale/adjust feature values to avoid magnitude bias: • Variance scaling: divide each value by the std dev (also called zscore function) • Absolute scaling: divide each value by the largest value

  43. So far… • Throw out outlier examples • Remove noisy features • Pick “good” features • Normalize feature values • center data • scale data (either variance or absolute)

More Related