Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSC570 Lecture 07

CSC570 Lecture 07

Applied Affective Computing
Ensemble Methods
(202304)

Javier Gonzalez-Sanchez
PRO

April 23, 2023
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Research

Transcript

  1. jgs
    CSC 570
    Current Topics in Computer Science
    Applied Affective Computing
    Lecture 07:
    Ensemble Methods
    Dr. Javier Gonzalez-Sanchez
    [email protected]
    www.javiergs.com
    Building 14 -227
    Office Hours: By appointment

    View Slide

  2. jgs
    Previously …

    View Slide

  3. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 3
    Homework
    • Open or Closed Eyes VS. Brain
    • 5 diverse stimulation scenarios VS. Brain
    • 5 diverse stimulation scenarios VS. Affect
    Follow 2 approaches:
    a) Clustering as described today (EM, K-means, Density)
    b) Explore another solution to the best of your knowledge
    (Machine Learning, Data mining, Statistics)
    Due: Monday (April 24)

    View Slide

  4. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 4
    Thoughts?
    Clustering was easy,
    What about something more precise for our data
    (such as a RandomForest) ?

    View Slide

  5. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 5
    Machine Learning
    EM

    View Slide

  6. jgs
    Classification
    Decision Tree

    View Slide

  7. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 7
    Data

    View Slide

  8. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 8
    Example

    View Slide

  9. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 9
    Example
    Which Attribute Should be the ROOT?

    View Slide

  10. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 10
    Entropy
    Entropy is defined as the measurement of degree of randomness or
    in other words, it is the increase in the disorganization within a system.

    View Slide

  11. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 11
    Gain
    Information gain is the reduction in entropy or surprise by transforming
    a dataset

    View Slide

  12. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 12
    Next

    View Slide

  13. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 13
    Solution

    View Slide

  14. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 14
    Weka | J48
    CSV file

    View Slide

  15. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 15
    Evaluation (using 99% or 66% of training)

    View Slide

  16. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 16
    Dataset 2

    View Slide

  17. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 17
    Only 01 and 02

    View Slide

  18. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 18
    Only 01 and 02

    View Slide

  19. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 19
    All 14 EEG columns

    View Slide

  20. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 20
    All 14 EEG columns

    View Slide

  21. jgs
    Ensemble Machine Learning Algorithms
    Random Forest

    View Slide

  22. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 22
    Definition
    § Ensemble algorithms combine the predictions from multiple models.

    View Slide

  23. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 23
    Random Forest
    § Random Forest is bagging for decision trees that can be used for
    classification or regression.
    § Decision trees are constructed using a greedy algorithm that selects the
    best split point at each step in the tree building process
    § Random Forest disrupts the greedy splitting algorithm during tree creation
    so that split points can only be selected from a random subset of the input
    attributes.

    View Slide

  24. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 24
    Random Forest

    View Slide

  25. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 25
    Notes
    § Random forest classifier is only to be used when the data set is huge. If data
    set is not very huge the accuracy by Random forest classifier is less than
    accuracy by a normal single tree.

    View Slide

  26. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 26
    How many Trees?
    § Default 10
    § Suggest a number of trees between 64 - 128 trees.

    View Slide

  27. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 27
    Weka

    View Slide

  28. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 28
    Evaluation

    View Slide

  29. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 29
    Dataset 2

    View Slide

  30. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 30
    Only 01 and 02

    View Slide

  31. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 31
    All 14 EEG columns

    View Slide

  32. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 32
    Lab 1
    RandomForest
    for our CSV dataset with 5 categories
    (we have 20 files to combine in one dataset)

    View Slide

  33. jgs
    Eyes

    View Slide

  34. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 34
    How it Works
    https://connect.tobii.com/s/article/How-do-Tobii-eye-trackers-work

    View Slide

  35. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 35
    Eye

    View Slide

  36. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 36
    Eye
    Timestamp GPX GPY Pupil Left Validity L Pupil Right Validity R Fixation Event AOI
    101124162405582 636 199 2.759313 0 2.88406 0 48 Content
    101124162405599 641 207 2.684893 0 2.855817 0 48 Content
    101124162405615 659 211 2.624458 0 2.903861 0 48 Content
    101124162405632 644 201 2.636186 0 2.916132 0 48 Content
    101124162405649 644 213 2.690685 0 2.831013 0 48 Content
    101124162405666 628 194 2.651784 0 2.869714 0 48 Content
    101124162405682 614 177 2.829281 0 2.899828 0 48 Content
    101124162405699 701 249 2.780344 0 2.907665 0 49 Content
    101124162405716 906 341 2.853761 0 2.916398 0 49 Content
    101124162405732 947 398 2.829427 0 2.889944 0 49 Content
    101124162405749 941 400 2.826602 0 2.881179 0 49 Content
    101124162405766 938 403 2.78699 0 2.87948 0 49 KeyPress Content
    101124162405782 937 411 2.803387 0 2.821803 0 49 Content
    101124162405799 934 397 2.819166 0 2.871547 0 49 Content
    101124162405816 941 407 2.811687 0 2.817927 0 49 Content
    101124162405832 946 405 2.857419 0 2.857427 0 49 Content
    101124162405849 0 0 -1 4 -1 4 49 Content

    View Slide

  37. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 37
    Eye
    30 o 60 frames per second
    30 o 60 inferences per second
    1,800 o 3,600 values per minute
    108,000 o 216, 000 values per hour

    View Slide

  38. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 38
    Eye

    View Slide

  39. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 39
    Affect Recognition
    BCI and Gaze Points engagement

    View Slide

  40. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 40
    Affect Recognition
    BCI and Gaze Points frustration

    View Slide

  41. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 41
    Affect Recognition
    BCI and Gaze Points engagement

    View Slide

  42. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 42
    Affect Recognition
    BCI and Gaze Points frustration

    View Slide

  43. jgs
    Gaze Tracking
    Low Cost

    View Slide

  44. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 44
    Do you know JavaScript?

    View Slide

  45. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 45
    § https://webgazer.cs.brown.edu
    § eye tracking library using common webcams to infer the eye-gaze locations
    of web visitors on a page in real-time.
    § written in JavaScript
    § can be integrated into a website
    § runs entirely in the client browser, so no video data needs to be sent to a
    server, and it requires the user's consent to access their webcam.
    WebGazer

    View Slide

  46. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 46
    § https://github.com/brownhci/WebGazer/blob/master/www/calibration.html
    Callibration

    View Slide

  47. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 47
    § asynchronous data store with a simple API
    § allows developers to store many types of data instead of just strings.
    localforage

    View Slide

  48. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 48






    <br/>webgazer.resume();<br/>webgazer.setGazeListener(function(data, elapsedTime) {<br/>if (data != null) {<br/>var x = data.x;<br/>var y = data.y;<br/>document.getElementById("gazeData").innerHTML = "Gaze coordinates: x=" + x + ", y=" + y;<br/>}<br/>}).begin();<br/>

    Template

    View Slide

  49. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 49

    <br/>html, body {height: 100%;margin: 0; padding: 0; }<br/>table {width: 100%;height: 100%;border-collapse: collapse;}<br/>td {border: 1px solid black;}<br/>


    Cell 1
    Cell 2
    Cell 3


    Cell 4
    Cell 5
    Cell 6


    Cell 7
    Cell 8
    Cell 9


    View Slide

  50. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 50
    Example

    View Slide

  51. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 51
    Thoughts?
    For a Low-Cost, Low-Resolution approach,
    Could it be possible to
    After a while
    To cluster?
    What could be the result of doing that?
    Which approach could work better (K-mean,
    DBSCAN, EM)?

    View Slide

  52. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 52
    Thoughts?
    How to connect this info with EEG?
    timestamp in JS?
    Save local data in JS?

    View Slide

  53. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 53
    Questions

    View Slide

  54. jgs
    Javier Gonzalez-Sanchez | CSC 309 | Winter 2023 | 54
    Office Hours
    Tuesday and Thursday 3 - 5 pm
    But an appointment required
    Sent me an email – [email protected]

    View Slide

  55. jgs
    CSC 570 Applied Affective Computing
    Javier Gonzalez-Sanchez, Ph.D.
    [email protected]
    Spring 2023
    Copyright. These slides can only be used as study material for the class CSC308 at Cal Poly.
    They cannot be distributed or used for another purpose.

    View Slide