scikit-learn Case Study Professor Patrick McDaniel Jonathan Price - - PowerPoint PPT Presentation

scikit learn case study
SMART_READER_LITE
LIVE PREVIEW

scikit-learn Case Study Professor Patrick McDaniel Jonathan Price - - PowerPoint PPT Presentation

scikit-learn Case Study Professor Patrick McDaniel Jonathan Price Fall 2015 More Advanced Usage Here, we will do a more advanced usage of scikit learn to solve an actual security problem. We will using the Microsoft Malware Classification


slide-1
SLIDE 1

scikit-learn Case Study

Professor Patrick McDaniel Jonathan Price Fall 2015

slide-2
SLIDE 2

Page

More Advanced Usage

  • Here, we will do a more advanced usage of scikit

learn to solve an actual security problem. We will using the Microsoft Malware Classification Kaggle competition as our test case, and examine the solution of Nate Lageman (who has previously given a talk on this subject).

  • You will improve upon one of these learning

methods as an assignment.

slide-3
SLIDE 3

Page

Malware Classification

  • "A difficult challenge of anti-malware is the vast number of

files that need to be examined. As the number of files continues to grow, the need for better malware classification increases. By successfully classifying malware into respective families, we can relieve some of the load caused by the sea of files that need to be

  • classified. Knowing the family of a particular malicious files

allows us to make predictions about that file. For instance, we could sort multiple malicious files, assign threat values, and delegate resources appropriately. The goal of this project is to classify malicious files into their respective families of malicious software. There are 9 malicious families associated with this dataset."

slide-4
SLIDE 4

Page

The Workshop

  • We will walk through a high level design for

classifying the malware data. We will use two prior works as a guide, and gain basic experience in the following:

  • Binary Analysis
  • Feature Engineering
  • Classification methods in scikit-learn
  • This will be a high level discussion, to show what

is possible in this field, rather than designing these solutions from scratch

slide-5
SLIDE 5

Page

The Data

  • Set of known malware files representing a mix of 9

different families.

  • Each malware file has an Id, a 20 character hash

value uniquely identifying the file, and a Class, an integer representing one of 9 family names to which the malware may belong.

  • Raw data contains the hexadecimal representation of

the file's binary content, without the PE header (to ensure sterility).

  • A metadata manifest, which is a log containing

various metadata information extracted from the binary, such as function calls, strings, etc.

slide-6
SLIDE 6

Page

Feature Extraction

  • You’ve looked at sample data as pre-work, lets do

some feature engineering

  • What features does the data have that you can

think of?

  • What did Nate use?
slide-7
SLIDE 7

Page

Feature Extraction

  • You’ve looked at sample data as pre-work, lets do

some feature engineering

  • What features does the data have that you can

think of?

  • What did Nate use?
  • Byte Frequency
  • First 10k bytes
  • Keyword frequency (metadata)
slide-8
SLIDE 8

Page

Feature Extraction

slide-9
SLIDE 9

Page

Feature Extraction

slide-10
SLIDE 10

Page

Classification

  • We will go over the implementation and

effectiveness of five different classification methods:

  • Random Forests
  • Support Vector Machines
  • K-Nearest Neighbor
  • Gradient Boosting
slide-11
SLIDE 11

Page

Random Forest

  • Ensemble learning method
  • (This means it uses multiple learning methods)
  • Collection of decision trees, outputs the mode of

the decided class

  • We control:
  • Max depth of trees
  • # of Trees
  • Features per tree
slide-12
SLIDE 12

Page

Random Forest

  • Effect of # Of Trees:
slide-13
SLIDE 13

Page

Random Forest: Results

  • 100-Tree forest with no pruning, using 5-fold cross

validation

slide-14
SLIDE 14

Page

Support Vector Machine

  • Basically the SVC we talked about last lecture
  • We control:
  • Kernel
  • Linear
  • Polynomial
  • Exponential (rbf)
  • Degree
slide-15
SLIDE 15

Page

SVM: Results

  • Rbf:
  • Polynomial:
slide-16
SLIDE 16

Page

K-Nearest Neighbor

  • Classified as the majority vote of an objects k-

nearest neighbors

  • We control:
  • Weights (Uniform, distance)
  • K
  • Build model by increasing k by 1, stop when log-

loss stops improving.

slide-17
SLIDE 17

Page

KNN

  • From Wiki:
  • With uniform weights, what class would the new
  • bject be at k=1, 2, 3, 4...?
slide-18
SLIDE 18

Page

KNN: Results

  • K = 7
slide-19
SLIDE 19

Page

Gradient Boosting

  • Another ensemble classifier
  • Also uses decision trees
  • But regression trees this time
  • We control:
  • Tree #
  • Learning Rate
  • Max Depth of trees
slide-20
SLIDE 20

Page

Gradient Boosting: Results

slide-21
SLIDE 21

Page

Conclusion

  • Random Forest and Gradient Boosting preformed

the best (why?)

  • Counting and frequency features preformed the

best (why?)

slide-22
SLIDE 22

Page

Assignment

  • Improve this!
  • Take the script code and improve (one) of the

methods we went over. Pick your favorite.

  • Use the modified dataset distributed to the class

(Its smaller, this will take less time)

  • Bonus: Read the report of the winning Kaggle

entry and compare it to the methods we went over.