Reference no: EM133013034
SRT521 Advanced Data Analysis - Seneca College
Objective
In this lab we will explore several ways to handle imbalanced datasets, feature selection methods and classifier implementation.
Tasks
Task 0: Create a report
1. Create a word document, and write the details of your lab completion in it. This will serve as proof that the lab was satisfactorily completed.
2. Each heading should be a task (Task 1, Task 2, etc), with screenshots and descriptions that prove the task was completed satisfactorily. Fill these headings out as you complete the lab.
Task 1: Dealing with imbalanced datasets
1. Install the imbalanced-Learn library on the Ubuntu monitoring server you deployed in lab 1.
2. Create a python script to perform the following:
a) Calculate how many instances of each class are on the dataset created in lab 2? (Take screenshot)
b) Transform the base dataset using random oversampling to increase the number of samples of the minority class (malware).
i. How many instances of each class are present on the transformed set? (Take screenshot)
c) Transform the base dataset using SMOTE to increase the number of samples of the minority class.
i. What is the difference between SMOTE and random oversampling?
ii. How many instances of each class are present on the transformed set? (Take screenshot)
d) Transform the base dataset using random under sampling to reduce the number of samples of the majority class.
i. How many instances of each class are present on the transformed set?
Task 2: Feature Selection
There are several methods to select which features to use for a model.
1. What is a wrapper method? give some examples, what is a filter method? Give some examples.
2. Fill the following table on the following page with an appropriate feature selection method for the type of data of the model.
Type of feature
|
Type of prediction
/ classification
|
Feature selection method
|
Numerical
|
Numerical
|
|
Numerical
|
Categorical
|
|
Categorical
|
Numerical
|
|
Categorical
|
Categorical
|
|
3. When applying a feature selection method, should we apply it to the training dataset or the complete dataset? Why?
4. Create 1 or more Python scripts to perform the following:
a) Select 15 features using scikit-learn's SelectKBest function with chi2 and mutual information.
i. Which features were selected?
b) Select features using scikit-learn's SelectPercentile function with chi2 and mutual information.
i. How many features were selected? What are these features?
ii. What is the difference between using SelectKBest and SelectPercentile?
c) Use scikit-learn recursive feature elimination to select 15 features using the SVC classifier1.
i. Which features were selected?
d) Use scikit-learn recursive feature elimination to select 15 features using BernoulliNB model2, then compare the results with the previous method.
i. Which method did you select?
ii. Which features were selected?
Attachment:- Advanced Data Analysis.rar