Loading in 5 sec....

Data Mining Final ProjectPowerPoint Presentation

Data Mining Final Project

- 316 Views
- Updated On :
- Presentation posted in: Education / Career

Data Mining Final Project. Nick Foti Eric Kee. Topic: Author Identification. Author Identification Given writing samples, can we determine who wrote them? This is a well studied field See also: “stylometry” This has been applied to works such as The Bible Shakespeare

Data Mining Final Project

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Data Mining Final Project

Nick Foti

Eric Kee

- Author Identification
- Given writing samples, can we determine who wrote them?
- This is a well studied field
- See also: “stylometry”

- This has been applied to works such as
- The Bible
- Shakespeare
- Modern texts as well

- A corpus is:
- A body of text used for linguistic analysis

- Used Project Gutenberg to create corpus
- The corpus was designed as follows
- Four authors of varying similarity
- Anne Brontë
- Charlotte Brontë
- Charles Dickens
- Upton Sinclair

- Multiple books per author

- Four authors of varying similarity
- Corpus size: 90,000 lines of text

- Extracted features common in literature
- Word Length
- Frequency of “glue” words
- See Appendix A and [1,2] for list of glue words

- Note: corpus was processed using
- C#, Matlab, Python

- Data set parameters are
- Number of dimensions: 309
- Word length and 308 glue words

- Number of observations: ≈ 3,000
- Each obervation ≈ 30 lines of text from a book

- Number of dimensions: 309

- Tested classifier with test data
- Used testing and training data sets
- 70% for training, 30% for testing

- Used cross-validation

- Used testing and training data sets
- Analyzed Classifier Performance
- Used ROC plots
- Used confusion matrices

- Used common plotting scheme (right)

Red Dots Indicate

True-Positive Cases

E X A M P L E

78%

55%

45%

22%

Anne B.

FP

Anne B.

TP

Charlotte B.

FP

Charlotte B.

TP

Binary Classification

- Calculated average word length for each observation
- Computed gaussian kernel density from word length samples
- Used ROC curve to calculate cutoff
- Optimized sensitivity and specificity with equal importance

Anne Brontë

Charlotte Brontë

100%

100%

0%

0%

Anne B.

F P

Upton Sinclair

F P

Upton Sinclair

T P

Anne B.

T P

Anne Brontë

Charlotte Brontë

100%

78.1%

21.9%

0%

Anne B.

T P

Anne B.

F P

Charlotte B.

F P

Charlotte B.

T P

- Used PCA to find a better axis
- Notice: distribution similar to word length distribution
- Is word lengththe only usefuldimension?

Anne Brontë vs. Upton Sinclair

Word Length Density

PCA Density

Without word length

- It appears that word length is the most useful axis
- We’ll come back to this…

Anne Brontë vs. Upton Sinclair

PCA Density

- Used K-means to find dominant patterns
- Unnormalized
- Normalized

- Trained K-means on training set
- To classify observations in test set
- Calculate distance of observation to each class mean
- Assign observation to the closest class

- Performed cross-validation to estimate performance

Anne Brontë vs. Upton Sinclair

98.1%

92.1%

7.9%

1.9%

Anne B.

T P

Anne B.

F P

Upton Sinclair

F P

Upton Sinclair

T P

Anne Brontë vs. Charlotte Brontë

95.7%

74.7%

25.3%

4.3%

Anne B.

T P

Anne B.

F P

Charlotte B.

F P

Charlotte B.

T P

Anne Brontë vs. Upton Sinclair

53.3%

50.6%

49.4%

46.7%

Anne B.

T P

Anne B.

F P

Upton Sinclair

F P

Upton Sinclair

T P

Anne Brontë vs. Charlotte Brontë

86.7%

84.2%

15.8%

13.3 %

Anne B.

T P

Anne B.

F P

Charlotte B.

F P

Charlotte B.

T P

- Peformed discriminant analysis
- Computed with equal covariance matrices
- Used average Omega of class pairs

- Computed with unequal covariance matrices
- Quadratic discrimination fails because covariance matrices have 0 determinant (see equation below)

- Computed theoretical misclassification probability

- Computed with equal covariance matrices
- To perform quadratic discriminant analysis
- Compute Equation 1 for each class
- Choose class with minimum value

(1)

Anne Brontë vs. Upton Sinclair

Empirical P(err) = 0.116

Theoretical P(err) = 0.149

96.2%

92.2%

3.8%

7.8%

Anne B.

T P

Anne B.

F P

Upton Sinclair

F P

Upton Sinsclair

T P

Anne Brontë vs. Charlotte Brontë

Empirical P(err) = 0.152

Theoretical P(err) = 0.181

92.7%

89.2%

10.8%

7.3%

Anne B.

T P

Anne B.

F P

Charlotte B.

F P

Charlotte B.

T P

- Fit linear model to training data on all dimensions
- Threw out singular dimensions
- Left with ≈ 298 coefficients + intercept

- Projected training data onto synthetic variable
- Found threshold by minimizing error of misclassification

- Projected testing data onto synthetic variable
- Used threshold to classify points

Anne Brontë vs Charlotte Brontë

Anne Brontë

Charlotte Brontë

92%

89.5%

8%

10.5%

Anne B

TP

Anne B

TP

Charlotte B

TP

Charlotte B

TP

Anne Brontë vs Upton Sinclair

Anne Brontë

Upton Sinclair

98%

99%

2%

2%

Anne B

TP

Anne B

FP

Upton S

TP

Upton S

FP

4-Class Classification

- Used K-means to find patterns among all classes
- Unnormalized
- Normalized

- Trained using a training set
- Tested performance as in 2-class K-means
- Performed cross-validation to estimate performance

4-Class Confusion Matrix

Anne Brontë

Charles Dickens

Charlotte Brontë

Upton Sinclair

88%

87%

59%

54%

34%

22%

CD

FP

AB

FP

CB

TP

US

FP

CD

FP

AB

FP

CB

FP

US

FP

US

FP

CD

TP

AB

FP

CB

FP

US

FP

CD

FP

AB

TP

CB

FP

4-Class Confusion Matrix

Anne Brontë

Charles Dickens

Charlotte Brontë

Upton Sinclair

70%

67%

67%

67%

27%

26%

20%

CD

FP

AB

FP

CB

TP

US

FP

CD

FP

AB

FP

CB

FP

US

FP

CD

TP

AB

FP

CB

FP

US

FP

CD

FP

AB

TP

CB

FP

US

FP

- Also tested K-means without word length
- Recall that we had perfect classification with 1D word length (see plot below)
- Is K-means using only 1 dimension to classify?
Note: perfect classification only occurs between Anne B. and Sinclair

Anne Brontë vs. Upton Sinclair

- K-means can classify without word length

4-Class Confusion Matrix

Anne Brontë

Charles Dickens

Charlotte Brontë

Upton Sinclair

72%

44%

43%

35%

35%

33%

29%

CD

FP

AB

FP

CB

TP

US

FP

CD

FP

AB

FP

CB

FP

US

FP

US

FP

CD

TP

AB

FP

CB

FP

US

FP

CD

FP

AB

TP

CB

FP

- Multinomial distribution
- Extension of binomial distribution
- Random variable is allowed to take on n values

- Extension of binomial distribution
- Used multinom(…) to fit log-linear model for training
- Used 248 dimensions (max limit on computer)
- Returns 3 coefficients per dimension and 3 intercepts

- Found probability that observations belongs to each class

- Multinomial Logit Function is
where jare the coefficients and cj are the intercepts

- To classify
- Compute probabilities
- Pr(yi = Dickens), Pr(yi = Anne B.), …

- Choose class with maximum probability

- Compute probabilities

4-Class Confusion Matrix

Anne Brontë

Charles Dickens

Charlotte Brontë

Upton Sinclair

86%

83%

93%

78%

AB

FP

CD

FP

CD

TP

US

FP

AB

TP

CB

FP

CB

FP

CD

FP

AB

FP

CB

TP

US

FP

CD

FP

AB

FP

CB

FP

US

FP

CB

FP

(Without Word Length)

- Multinomial regression does not require word length

4-Class Confusion Matrix

Anne Brontë

Charles Dickens

Charlotte Brontë

Upton Sinclair

79%

79%

91%

76%

AB

FP

CD

FP

CD

TP

US

FP

AB

TP

CB

FP

CB

FP

CD

FP

AB

FP

CB

TP

US

FP

CD

FP

AB

FP

CB

FP

US

FP

CB

FP

I a aboard about above across after again against ago ahead all almost along alongside already also although always am amid amidst among amongst an and another any anybody anyone anything anywhere apart are aren't around as aside at away back backward backwards be because been before beforehand behind being below between beyond both but by can can't cannot could couldn't dare daren't despite did didn't directly do does doesn't doing don't done down during each either else elsewhere enough even ever evermore every everybody everyone everything everywhere except fairly farther few fewer for forever forward from further furthermore had hadn't half hardly has hasn't have haven't having he hence her here hers herself him himself his how however if in indeed inner inside instead into is isn't it its itself just keep kept later least less lest like likewise little low lower many may mayn't me might mightn't mine minus more moreover most much must mustn't my myself near need needn't neither never nevertheless next no no-one nobody none nor not nothing notwithstanding now nowhere of off often on once one ones only onto opposite or other others otherwise ought oughtn't our ours ourselves out outside over own past per perhaps please plus provided quite rather really round same self selves several shall shan't she should shouldn't since so some somebody someday someone something sometimes somewhat still such than that the their theirs them themselves then there therefore these they thing things this those though through throughout thus till to together too towards under underneath undoing unless unlike until up upon upwards us versus very via was wasn't way we well were weren't what whatever when whence whenever where whereas whereby wherein wherever whether which whichever while whilst whither who whoever whom with whose within why without will won't would wouldn't yet you your yours yourself yourselves

- Authors can be identified by their word usage frequencies
- Word length may be used to distingush between the Brontë sisters
- Word length does not, however, extend to all authors (See Appendix C)

- The glue words describe genuine differences between all four authors
- K-means distinguishes the same patterns that multinomial regression classifies
- This indicates that supervised training finds legitimate patterns, rather than artifacts

- K-means distinguishes the same patterns that multinomial regression classifies
- The Brontë sisters are the most similar authors
- Upton Sinclair is the most different author

- See Attached .R files

Classification using Multinomial Regression

4-Class Confusion Matrix

Anne Brontë

Charles Dickens

Charlotte Brontë

Upton Sinclair

96%

94%

54%

46%

22%

11%

6%

3%

CD

FP

AB

FP

CB

TP

US

FP

CD

FP

AB

FP

CB

FP

US

FP

US

FP

CD

TP

AB

FP

CB

FP

US

FP

CD

FP

AB

TP

CB

FP

[1] Argamon, Saric, Stein, “Style Mining of Electronic Messages for Multiple Authorship Discrimination: First Results,” SIGKDD 2003.

[2] Mitton, “Spelling checkers, spelling correctors and the misspellings of poor spellers,” Information Processing and Management, 1987.