Files
G4G0-2/AI & Data Mining/Week 3/Workshop 3.md
2025-01-30 09:27:31 +00:00

6.4 KiB
Executable File

Weather Dataset

Dataset

% This is a comment about the data set. 
% This data describes examples of whether to play 
% a game or not depending on weather conditions. 
@relation letsPlay 
@attribute outlook {sunny, overcast, rainy} 
@attribute temperature real 
@attribute humidity real 
@attribute windy {TRUE, FALSE} 
@attribute play {yes, no} 

@data
sunny,85,FALSE,no
sunny,90,TRUE,no
overcast,86,FALSE,yes
rainy,96,FALSE,yes
rainy,80,FALSE,yes
rainy,70,TRUE,no
overcast,65,TRUE,yes
sunny,95,FALSE,no
sunny,70,FALSE,yes
rainy,80,FALSE,yes
sunny,70,TRUE,yes
overcast,90,TRUE,yes
overcast,75,FALSE,yes
rainy,91,TRUE,no

Output

=== Run information ===

Scheme:       weka.classifiers.bayes.NaiveBayes 
Relation:     letsPlay
Instances:    14
Attributes:   5
              outlook
              temperature
              humidity
              windy
              play
Test mode:    evaluate on training data

=== Classifier model (full training set) ===

Naive Bayes Classifier

                 Class
Attribute          yes      no
                (0.63)  (0.38)
===============================
outlook
  sunny             3.0     4.0
  overcast          5.0     1.0
  rainy             4.0     3.0
  [total]          12.0     8.0

temperature
  mean          72.9697 74.8364
  std. dev.      5.2304   7.384
  weight sum          9       5
  precision      1.9091  1.9091

humidity
  mean          78.8395 86.1111
  std. dev.      9.8023  9.2424
  weight sum          9       5
  precision      3.4444  3.4444

windy
  TRUE              4.0     4.0
  FALSE             7.0     3.0
  [total]          11.0     7.0

Time taken to build model: 0 seconds

=== Evaluation on training set ===

Time taken to test model on training data: 0.01 seconds

=== Summary ===

Correctly Classified Instances          13               92.8571 %
Incorrectly Classified Instances         1                7.1429 %
Kappa statistic                          0.8372
Mean absolute error                      0.2798
Root mean squared error                  0.3315
Relative absolute error                 60.2576 %
Root relative squared error             69.1352 %
Total Number of Instances               14

Medical Dataset

Dataset

```@relation medical
@attribute Temperature {Low,Moderate,High}
@attribute Skin {Pale,Normal,Red}
@attribute BloodPressure {Normal,High}
@attribute BlockedNose {True,False}
@attribute Diagnosis {N,B}

@data
Low, Pale, Normal, True, N
Moderate, Pale, Normal, True, B
High, Normal, High, False, N
Moderate, Pale, Normal, False, B
High, Red, High, False, N
High, Red, High, True, N
Moderate, Red, High, False, B
Low, Normal, High, False, B
Low, Pale, Normal, False, B
Low, Normal, Normal, False, B
High, Normal, Normal, True, B
Moderate, Normal, High, True, B
Moderate, Red, Normal, False, B
Low, Normal, High, True, N```

Output

=== Run information ===

Scheme:       weka.classifiers.bayes.NaiveBayes 
Relation:     diagnosis
Instances:    14
Attributes:   5
              Temperature
              Skin
              BloodPressure
              BlockedNose
              Diagnosis
Test mode:    evaluate on training data

=== Classifier model (full training set) ===

Naive Bayes Classifier

                 Class
Attribute            N      B
                (0.38) (0.63)
==============================
Temperature
  Low               3.0    4.0
  Moderate          1.0    6.0
  High              4.0    2.0
  [total]           8.0   12.0

Skin
  Pale              2.0    4.0
  Normal            3.0    5.0
  Red               3.0    3.0
  [total]           8.0   12.0

BloodPressure
  Normal            2.0    7.0
  High              5.0    4.0
  [total]           7.0   11.0

BlockedNose
  True              4.0    4.0
  False             3.0    7.0
  [total]           7.0   11.0

Time taken to build model: 0 seconds

=== Evaluation on training set ===

Time taken to test model on training data: 0 seconds

=== Summary ===

Correctly Classified Instances          12               85.7143 %
Incorrectly Classified Instances         2               14.2857 %
Kappa statistic                          0.6889
Mean absolute error                      0.2635
Root mean squared error                  0.3272
Relative absolute error                 56.7565 %
Root relative squared error             68.2385 %
Total Number of Instances               14

Using Test Data

Test Data

@relation medical
@attribute Temperature {Low,Moderate,High}
@attribute Skin {Pale,Normal,Red}
@attribute BloodPressure {Normal,High}
@attribute BlockedNose {True,False}
@attribute Diagnosis {N,B}
@data
Low,Normal,High,True,N
Low,?,Normal,True,B
Moderate,Normal,High,True,B

Output

=== Run information ===

Scheme:       weka.classifiers.bayes.NaiveBayes 
Relation:     medical
Instances:    14
Attributes:   5
              Temperature
              Skin
              BloodPressure
              BlockedNose
              Diagnosis
Test mode:    user supplied test set:  size unknown (reading incrementally)

=== Classifier model (full training set) ===

Naive Bayes Classifier

                 Class
Attribute            N      B
                (0.38) (0.63)
==============================
Temperature
  Low               3.0    4.0
  Moderate          1.0    6.0
  High              4.0    2.0
  [total]           8.0   12.0

Skin
  Pale              2.0    4.0
  Normal            3.0    5.0
  Red               3.0    3.0
  [total]           8.0   12.0

BloodPressure
  Normal            2.0    7.0
  High              5.0    4.0
  [total]           7.0   11.0

BlockedNose
  True              4.0    4.0
  False             3.0    7.0
  [total]           7.0   11.0

Time taken to build model: 0 seconds

=== Predictions on test set ===

    inst#     actual  predicted error prediction
        1        1:N        1:N       0.652 
        2        2:B        2:B       0.677 
        3        2:B        2:B       0.706 

=== Evaluation on test set ===

Time taken to test model on supplied test set: 0 seconds

=== Summary ===

Correctly Classified Instances           3              100      %
Incorrectly Classified Instances         0                0      %
Kappa statistic                          1     
Mean absolute error                      0.3215
Root mean squared error                  0.3223
Relative absolute error                 70.1487 %
Root relative squared error             68.0965 %
Total Number of Instances                3