• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Testing with Math::Combinatorics
 

Testing with Math::Combinatorics

on

  • 1,394 views

 

Statistics

Views

Total Views
1,394
Views on SlideShare
1,357
Embed Views
37

Actions

Likes
0
Downloads
11
Comments
0

2 Embeds 37

http://profiles.ucsf.edu 36
http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Testing with Math::Combinatorics Testing with Math::Combinatorics Presentation Transcript

    • Testing with Math::Combinatorics Anirvan Chatterjee www.chatterjee.net
    • We run a comparison shopping site for new and used books
    • Booksellers give us icky data
      • Henry Wadsworth Longfellow
      • Henry, Wadsworth Longfellow
      • Longfellow. H
      • H.W.Longfellow
      • Henri Longfellow
      • LONGFELLOW, HENRY WA.
      • Longfellow, Henry Wadssworth.
    • Lots and lots of icky data
      • Longfellow, Henry Wadsworth.
      • LONGFELLOW, HENRY WADSWORTH.
      • Longfellow, Henry
      • Longfellow, Henry Wadworth
      • Longfellow, Henry Wadsworth. Edited By Anna H. Smith
      • Longfellow, H. W.
      • LONGFELLOW, H.W.,
      • LONGFELLOW, Henry Wadsworth, edited by
      • Henry W. Longfellow
      • Longfellow. H
      • Longfellow, H. W
      • Henry Wadsworth Longfellow, et al
      • Longfellow, Henrry Wadsworth
      • LONGFELLOW, HENRY WADSWORTH
      • Longfellow, H.
      • Longfellow Henry Wadsworth
      • Henry Longfellow
      • Longfellow H. W.
      • Longfellow, Wadsworth Henry
      Longfellow, Henry Wadsworth Longfellow, Henry Wadsworth [Signed] Longfellow, Henry W. Longfellow,Henry Wadsworth Henry Wadsworth Longfellow Henry, Wadsworth Longfellow Henry, Wadsworth Longfellow Longfellow, Henry Wadsworh LONGFELLOW, H.W. LONGFELLOW WADSWORTH, Henry LONGFELLOW,H.W. LONGFELLOW, Henry Longfellow H. W Longfellow, H.W. LONGFELLOW Henry Wadsworth H.W.Longfellow Longfellow, Henry, W. LONGFELLOW, Henry Wadsworrth Longfellow, Henry Wadsworth [1807 - 1882]., Longfellow. H. LONGFELLOW, Henry Wadsworth Longfellow, Henry Wadsworth (translated) Henry Wadworth Longfellow Longfellow Henry W Henri Longfellow Longfellow, (Henry Wadsworth) Longfellow, Henry Wadsworth; LONGFELLOW, H. W Longfellow. H.W Longfellow Henry W. Longfellow, Henry Wadsworth, H.W. LONGFELLOW LONGFELLOW, HENRY WA. Longfellow, Henry W.[adsworth] Longfellow, H.W Longfellow, (H. W.) Longfellow, Henry Wadsworth" HENRY WADSWORTH LONGFELLOW LONGFELLOW, H. W. longfellow, Henry Wadsworth Longfellow, Henry W Longfellow, Henry Longfellow HENRY W. LONGFELLOW Longfellow, , Henry W Longfellow, Henry. Wadsworth. Longfellow , Henry Wadsworth Longfellow, Henry Wadsworth [Signed], Longfellow, Henry W., Wadsworth Longfellow, Henry WADSWORTH LONGFELLOW, HENRY LONGFELLOW, Henry W. Longfellow, Henry, Wadsworth LONGFELLOW, (HENRY WADSWORTH) Longfellow, Henry Wadssworth. Longfellow H LONGFELLOW, H.W
    • We use clustering algorithms
      • my @authors =
      • author_cluster (
      • ‘ Henry Longfellow’
      • ‘ H.W.Longfellow (1807-82)’,
      • ‘ Henri Longfelow’);
      • # one single author cluster
      • is @authors, 1 ;
    • Testing is critical
      • use Test::More tests => 2;
      • @authors = author_cluster (
      • ‘ Isaac Asimov’, ‘ASIMOV, Isaac’);
      • is @authors, 1 ;
      • @authors = author_cluster (
      • ‘ Isaac Asimov’, ‘Issac Asimov’);
      • is @authors, 1 ;
    • We want to test combinations
      • author_cluster( A )
      • author_cluster( B )
      • author_cluster( C )
      • author_cluster( A , B )
      • author_cluster( A , C )
      • author_cluster( B , C )
      • author_cluster( A , B , C )
    • We want to test permutations
      • author_cluster( A , B , C )
      • author_cluster( A , C , B )
      • author_cluster( B , A , C )
      • author_cluster( B , C , A )
      • author_cluster( C , A , B )
      • author_cluster( C , B , A )
    • Math::Combinatorics makes things easy
    • Iterate through combinations
      • my @data =
      • qw( A B C );
      • for my $i (1..@data) {
      • my $c = new Math::Combinatorics data => @data, count => $i;
      • while (my @combination = $c->next_combination ) {
      • print @combination, q{ };
      • }
      • }
      • # A B C AB AC BC ABC
    • Add every permutation
      • my @data =
      • qw( A B C );
      • for my $i (1..@data) {
      • my $c = new Math::Combinatorics data => @data, count => $i;
      • while (my @combination = $c->next_combination ) {
      • my $p = new Math::Combinatorics data => @combination;
      • while (my @permutation = $p->next_permutation ) {
      • print @permutation, q{ };
      • }
      • }
      • }
      • # A B C AB BA AC CA BC CB ABC ACB BAC BCA CAB CBA
    • Plug in the tests
      • my @data =
      • (‘Longfellow, Henry ’, ‘ H.W.Longfellow ’, etc. )
      • for my $i (1..@data) {
      • my $c = new Math::Combinatorics data => @data, count => $i;
      • while (my @combination = $c->next_combination) {
      • my $p = new Math::Combinatorics data => @combination;
      • while (my @permutation = $p->next_permutation) {
      • test_author_clustering(@permutations);
      • }
      • }
      • }
    • Tested code means happier users. Yay, testing.