Data Preprocessing

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

In data preprocessing, what is the primary characteristic of 'useless' data?

  • Contains a high number of decimal places.
  • Represents continuous values within a specific range.
  • Is temporal in nature.
  • Has no statistical relevance to the problem being solved. (correct)

How can a data domain expert contribute to the detection of useless data?

  • By converting data into binary format.
  • By calculating the mean and median of the dataset.
  • By normalizing the dataset to a standard scale.
  • By using specialized knowledge to identify irrelevant features. (correct)

What type of data is best described as having only two possible values?

  • Continuous data
  • Binary data (correct)
  • Categorical data
  • Temporal data

Which method is most effective for detecting binary variables in a dataset?

<p>Counting the unique values. (A)</p> Signup and view all the answers

Which term best describes 'interval data' that is measured on a continuous quantified scale?

<p>Continuous (D)</p> Signup and view all the answers

Which of the following is a common characteristic of continuous data that aids in its detection?

<p>Having a high count of unique values. (A)</p> Signup and view all the answers

How does ordinal data differ from nominal data regarding the 'distance' between values?

<p>The order of the data matters for ordinal data, 'distance' between values is not quantified. (B)</p> Signup and view all the answers

What is a key distinction between categorical ordinal and categorical nominal data?

<p>Ordinal data has a meaningful order, while nominal data does not. (C)</p> Signup and view all the answers

What is the primary characteristic of text data in the context of machine learning preprocessing?

<p>Text data consists of words, sentences, or documents, requiring additional processing. (D)</p> Signup and view all the answers

Which preprocessing tasks are commonly associated with Natural Language Processing (NLP)?

<p>Tokenization, stemming, and stop words removal. (C)</p> Signup and view all the answers

What does 'tokenization' refer to in the context of Natural Language Processing (NLP)?

<p>Dividing a text into individual words or terms. (B)</p> Signup and view all the answers

What is the main purpose of 'stemming' in Natural Language Processing (NLP)?

<p>Reducing words to their root form. (B)</p> Signup and view all the answers

What characteristic defines temporal data?

<p>It is related to dates, times, or sequences. (A)</p> Signup and view all the answers

What must be done to raw data to make it useable for machine learning algorithms?

<p>It must be preprocessed. (B)</p> Signup and view all the answers

What is the first step in data preprocessing?

<p>Acquire data. (C)</p> Signup and view all the answers

What is the role of Pandas in importing libraries? Select all that apply.

<p>Pandas read and manage the data. (B)</p> Signup and view all the answers

What is the iloc[ ] method?

<p>Extract the independent variables. (D)</p> Signup and view all the answers

What should be considered when deciding to delete the data? Select all that apply.

<p>More then 75% of the data missing. (A)</p> Signup and view all the answers

Why is it important to handle the missing values?

<p>Can draw inaccurate conclusions. (D)</p> Signup and view all the answers

What is the process of imputing the data?

<p>Replacing with median, mean, or constant value. (C)</p> Signup and view all the answers

How One Hot Encoding impacts the ML model?

<p>It can cause issue of correlation between variables, therefore producing a faulty output. (A)</p> Signup and view all the answers

What does dummy data equal?

<p>The number of categories. (D)</p> Signup and view all the answers

What is the use for LabelEncoder()?

<p>Used when data only has 2 categories. (D)</p> Signup and view all the answers

What is an aspect of the data set in a training set?

<p>Already aware of output. (A)</p> Signup and view all the answers

What are the 2 types of datasets to be split?

<p>training and test set. (A)</p> Signup and view all the answers

What is a typical ratio that the dataset gets split into?

<p>70:30 or 80:20. (B)</p> Signup and view all the answers

For skilearn.model_selection, what does train_test_split import?

<p>train_test_split (C)</p> Signup and view all the answers

What type of encoding is typically used for encoding continuous data?

<p>Normalizing (B)</p> Signup and view all the answers

Why do we use feature scaling?

<p>All of the above. (D)</p> Signup and view all the answers

What does feature scaling accomplish?

<p>Decreases influence of higher values. (A)</p> Signup and view all the answers

What would influence delivering incorrect results?

<p>If values do not have the same scale. (A)</p> Signup and view all the answers

What are the feature scaling methods?

<p>Standardization and Normalization. (A)</p> Signup and view all the answers

During data processing when should standardization code and transform functions should be used?

<p>No data leaking. (B)</p> Signup and view all the answers

What does data binning/bucketing acomplish?

<p>Groups data. (C)</p> Signup and view all the answers

When can binning be applied to numeric values?

<p>To convert numeric values to categorical values. (D)</p> Signup and view all the answers

What does data smoothing accomplish?

<p>Removes noise from data. (C)</p> Signup and view all the answers

What method is used to calculate the size for each bin?

<p>Binning by frequency. (D)</p> Signup and view all the answers

What is an alternative technique of data binning?

<p>Sampling. (B)</p> Signup and view all the answers

Flashcards

Useless Data

Data that has no statistical relevance to the problem being solved, often with high cardinality.

Binary Data

Data with only two possible values.

Continuous Data

Data measured on a continuous, quantified scale; also called 'interval data'.

Categorical Ordinal Data

Categorical data where the order of categories matters, but the 'distance' between values is not quantified.

Signup and view all the flashcards

Categorical Nominal Data

Categorical data where the order of categories is irrelevant.

Signup and view all the flashcards

Text Data

A word, sentence, or document; requires text encoding for analysis.

Signup and view all the flashcards

Natural Language Processing (NLP)

Applying machine learning to linguistics.

Signup and view all the flashcards

Tokenization

Dividing text into individual units.

Signup and view all the flashcards

Bag of Words

Technique to represent text data, where the frequency of words is identified.

Signup and view all the flashcards

Stemming

Reducing words to their root form.

Signup and view all the flashcards

Stop Words Removal

Removing commonly used words from the data, such as 'the'.

Signup and view all the flashcards

Temporal Data

Data with a time component.

Signup and view all the flashcards

Data Preprocessing

Preparing raw data to make it suitable for machine learning.

Signup and view all the flashcards

Acquiring the Dataset

The first step in data preprocessing, which involves gathering data from various sources.

Signup and view all the flashcards

Libraries NumPy, Pandas, Matplotlib

Essential python libraries used for data manipulation, mathermatical operations and plotting.

Signup and view all the flashcards

Handling Missing Values

Addressing missing entries in your data

Signup and view all the flashcards

Imputing Data

Techniques for using domain knowledge, statistics, or models to replace missing data entries

Signup and view all the flashcards

Deleting Rows

Omitting rows where there are missing values

Signup and view all the flashcards

Unbalanced Data

The target dataset doesn't contain a proportional representation of the classes.

Signup and view all the flashcards

Encoding Categorical Data

Numerical label for categories so that machines understand it.

Signup and view all the flashcards

Mapping ordinal values

Label categories for machines if there is an underlying order to your classes.

Signup and view all the flashcards

One Hot Encoding

Creating new features (columns) to represent categorical variables, each column represents a category.

Signup and view all the flashcards

Splitting the dataset

Divides a dataset into two groups of data to train and assess performance.

Signup and view all the flashcards

Feature scaling

Transforms data within the same scale.

Signup and view all the flashcards

Standardization

Method to standardize independent variables of a dataset within a specific range.

Signup and view all the flashcards

Min-Max normalization

Scales and translates each feature individually such that it is in the range of zero and one.

Signup and view all the flashcards

Data binning

Groups data in bins/buckets by replacing values into intervals.

Signup and view all the flashcards

Binning by distance

Define edges and labels to compute value ranges associated to a category.

Signup and view all the flashcards

Binning by frquency

Calculate sizes of each bind by including the same amount of observations.

Signup and view all the flashcards

Data sampling

Each bin's value is replaced by the mean, median or max/min.

Signup and view all the flashcards

Study Notes

  • Data preprocessing prepares raw data for machine learning.
  • It is the first and crucial step while creating a machine learning model.

Why Data Preprocessing Is Needed

  • Real-world data often contains noises, missing values, or unusable formats.
  • These issues prevent the data from being directly used for machine learning models.

Steps for Data Preprocessing

  • Acquire the dataset.
  • Import relevant libraries (e.g., Numpy, Pandas, Matplotlib).
  • Import the dataset into the working environment or notebook.
  • Identify and handle missing values.
  • Encode categorical data.
  • Split the dataset into training and testing sets.
  • Apply feature scaling.

Acquiring the Dataset

  • Involves gathering data from multiple sources into a combined format.
  • Dataset formats vary based on the use case (e.g., business or medical).
  • Datasets are typically stored in CSV, HTML, or XLSX file formats.

Data Types

  • Useless data has no statistical relevance to the problem being solved.
  • Indexes, IDs, account numbers, names, and email addresses can be considered useless data.
  • Binary data has only two possible values and may include binary classification labels.
  • Data domain experts and unique value counts can be used for binary data detection.
  • Continuous, or 'interval', data is measured on a continuous quantified scale, such as temperature or value.
  • Categorical data, the order of the data matters, but the 'distance' between values is not quantified
  • Color, species and drink preference are included as nominal categorical data.
  • Temporal data includes entries such as dates, time or order.

Importing Libraries

  • Numpy: Fundamental package for scientific calculation in Python, used for mathematical operations and multidimensional arrays.
  • Pandas: Open-source Python library for data manipulation and analysis, used for importing and managing datasets.
  • Matplotlib: Python 2D plotting library for creating various types of charts.

Sample Dataset Characteristics

  • Features three independent variables: Country, Age, Salary.
  • Features one dependent variable: Purchased.
  • Contains missing values in Age and Salary
  • Includes a categorical variable: Country

Importing the Dataset

  • It's recommended to save the Python file in the directory with the dataset.
  • read_csv() from Pandas imports a CSV file.
  • It is necessary to separate the data in the dataset into independent and dependent variables .
  • Employ the iloc[] feature in the Pandas library to isolate the independent variables.

Handling Missing Values

  • Identify and correctly handle missing values to avoid inaccurate inferences.
  • Methods include:
    • Deleting rows: removing rows with missing values, but use with caution.
    • Imputing data: replacing missing values using mean, median, or constant values.

Imputing Data (Handling Missing Values)

  • Imputation can add variance but negates data loss.
  • Often yields better results as compared to omitting rows or columns.

Encoding Categorical Data

  • Converts categorical information into numerical data.
  • Machine learning models rely on numerical calculations.

Ordinal Data Mapping

  • The column satisfaction is ordinal.
  • Because order matters in this column, the mapping should reflect this order.

One-Hot Encoding (Nominal Data)

  • Nominal Data is not ordered.
  • Dummy Encoding is used to eliminate this issue, generating dummy variables with 0 or 1 to represent the presence of a category.

Encoding Continuous Data

  • Binning.
  • Mapping
  • OneHotEncoding (nominal data)

Splitting the Dataset

  • Datasets are divided into training and test sets.

Purpose of Splitting

  • Improves model performance.
  • Training sets "teach" the model.
  • Test sets evaluate the model's ability to generalize.

Train Test Split

  • Datasets are commonly split using a 70:30 or 80:20 ratio between the training and testing sets.
  • Four elements are present in the code.
    • X_train displays features for training data.
    • X_test displays features for testing data.
    • y_train is for dependent variables during training.
    • and y_test is and independent variables for testing.

Feature Scaling (Normalization) and Binning

  • Marks the end of data preprocessing in machine learning.

Feature Scaling

  • Standardizes independent variables within a specific range.
  • Limits the range of variables for comparison.
  • Prevents algorithms from being unduly influenced by higher values.

Standardisation and Normalisation Methods

  • Standardization applies transformations.
  • Normalization scales values between 0 and 1.

Feature Scaling in Specific Sample Datasets

  • Age and salary columns might not have the same scale so feature scaling addresses this as salary values can easily dominate age values and deliver incorrect results.

Data Binning

  • A type of data smoothing.
  • Groups data into bins or buckets, replacing values within a interval with single representative value for interval to convert numeric values to categorical value.
  • Improves accuracy in models.

Binning Techniques

  • Binning by distance: Define the edges of each bin.
  • Binning by frequency: Calculates the size of each bin so that each bin contains the same number of observations by dividing the dataset into equal portions.
  • *Binning by sampling (mean, median, boundary)**: Each is employed to reduce samples, by grouping similar values of contiguous values.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Data Pre-processing Techniques Quiz
18 questions

Data Pre-processing Techniques Quiz

AppreciatedBlackTourmaline2280 avatar
AppreciatedBlackTourmaline2280
Data Cleaning in Machine Learning
40 questions

Data Cleaning in Machine Learning

UnselfishChrysoprase2896 avatar
UnselfishChrysoprase2896
Data Preprocessing Techniques
44 questions

Data Preprocessing Techniques

MarvellousCarnelian9842 avatar
MarvellousCarnelian9842
Data Preprocessing for Machine Learning
40 questions
Use Quizgecko on...
Browser
Browser