K Means Clustering for EEG

Supervised Vs. Unsupervised Learning

Unsupervised machine learning is separated into two types. Cluster analysis.

1. Throw a bunch of data at the machine and wait for it to come up with an answer for you

2. Throw a bunch of data at the machine and specify a number of X categories

ex. throw a bunch of pictures of males and females, and have the machine separate out into different genders. This is an example of flat clustering.

Flat vs Hierarchical.

Hierarchical means throwing the data at a machine then having the machine figure out how many categories are possible.

Male vs Female face would use flat clustering.

Hierarchical clustering would be used in genomics because we don’t really know how the genes work with each other, and gather insights.

How do we weigh each of these features in importance? We can simplify into 2-3 features that are important.

CODE:


import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
style.use(“ggplot”)
from sklearn.cluster import KMeans

x = [1, 5, 1.5, 8, 1, 9]
y = [2, 8, 1.8, 8, 0.6, 11]

plt.scatter(x,y)
plt.show()

X = np.array([1, 2],
[5, 8],
[1.5, 1.8],
[8, 8],
[1, 0.6],
[9, 11])

kmeans = KMeans(n clusters=3)
kmeans.fit(X)

centroids = kmeans.cluster_centers_
labels = kmeans.labels_

print(centroids)
print(labels)

colors = ["g.", "r.", "c.", "y."]

for i in range(len(X)):
    print("coordinate:", X[i], "label:", labels[i])
    plt.plot(X[i][0], X[i][1], colors[labels[i]], markersize = 10)

plt.scatter(centroids[:, 0], centroids[:, 1], marker = "x", s=150, linewidths = 5, zorder = 10)

plt.show()

Sometimes we use unsupervised machine learning to visualize a dataset with a lot of features to break it down simply and get the feeling that we are on the right track.

*we group the centroids according to variance. The centroid would be the ideal plot

Sign up for Initial Consultation

Scientific Challenges in BCI

The field of Brain Computer Interfaces reach out to signal processing, machine learning, computational intelligence, neuroscience, and cognitive science. The problems that people experience in BCI are similar to pattern recognition, time-series analysis, control systems, and robotics. Processing of the data depends on unknown parameters which can be person-specific or task-specific. You need to adapt to each specific person. The cortex folds differently for each individual person. This happens even in monozygotic twins. The functional map differs across individuals. Sensor locations can also differ across recording sessions. The brain dynamics are non-stationary at all time scales. They vary minute to minute, or day to day.

There’s a very difficult to deal with signal-to-noise ratio making sense measures hard to obtain. The relevant brain activity is small compared to it’s interfering artifacts and compared to brain background activity.

Large collections of neurons are involved in a lot of different activities, not just one. One functional area of neurons may also be acting for another cognitive function.

There’s also a lot of uncertainty about the brain’s functioning. EEG signals are also mathematically more complicated to handle, because all the sensors record almost the same signal due to the superposition of all brain activity. The signals need to be computationally disentangled for optimum performance. Everything that you need to do needs to be statistical. Sophisticated signal processing is needed to accurately portray the data. BCI systems should also be calibrated before it can be used. Calibration should use as much example data, databases, and prior knowledge about that person that we can get.

Sign up for our Beta at http://unfetter.com/signup

What is a Brain Computer Interface?

A brain computer interface takes a biosignal measured from EEG and predicts cognitive state.  There are 3 types of BCI.

1. Active BCI – You control by conscious voluntary thought, like consciously moving a limb.

2. Reactive BCI – Utilizes brain responses to outside events, like a flickering light.

3. Passive BCI – Picks up any brain processes, utilizes the information to add to your life. Can have many passive BCI’s running in parallel.

The key modality is EEG is because it’s relatively cheap to measure. Functional Near-Infrared Spectroscopy(fNIRS) is another modality. BCI experiments are also happening with invasive sensors, microarrays, neurotics, ECoG. Magnetoencephalography(MEG) and functional Magnetic Resonance Imaging(fMRI) are other methods. fMRI has the benefit of very high resolution. Non-brain signals can also be very useful. Motion capture can show you artifacts. Any aspect of the physical brain sate can be measured with sufficient single-trial reliability.

Tonic state: slow changing brain states such as cognitive load and degree of relaxation

Phasic state: switching attention, and imagined movement

Event-related state: surprised/not surprised, committed error, event noticed/not noticed

Sign up for the Unfetter Beta at http://unfetter.com/signup

Neural Processes in EEG

The largest contributors to the EEG are the pyramidal cells. They’re aligned. It’s about whether it goes above the noise floor. Has to fire at the same time. Why would 50,000 neurons fire at the same time. An external event like detection of light, can trigger a cascade of related near processes. This is known as a perception. Internally generated events happen such as an aha! moment. Neural populations can enter a synchronized steady state firing pattern. Idle oscillations are an example of this. Alpha waves. It happens when neurons become idle. There are mechanisms that give rise to coactivated firings. Event Related Potentials and Oscillatory Process are the two major BCI-detectable EEG/MEG phenomena.

Signal Detectability Cortical correlates can indicate chemical changes, not electrical. Dopaminergic systems in the deep brain structures can be a cause of a signal. Widely scattered populations of neurons are unlikely to exhibit synchrony unless its connected via fiber tracts. Propagation from one to another, just takes way too long. More likely that spatially compact neurons fire together. There are also cases where compact clusters fire, and the electromagnetic fields cancel each other out such as in the Amygdala.

Signup for our Beta at http://unfetter.com/signup

Alpha Gamma Synchrony

Certain forms of neurofeedback are targetted at the default mode network. The Default-mode-network is a group of brain regions that is associated with self-referential thought. There have been reports of neurofeedback practitioners who have experienced improved novelty detection, higher emotional range, more flexibility of thought, and a greater balance between narrative and experiential consciousness. Certain neurofeedback protocols that target the Default-Mode-Network focus on the epsilon, alpha, theta, and gamma frequency bands. Synchrony in all those frequency bands has been argued to be a neural signature for awareness.

Selfing Brain

Biofeedback involves a learning process in which the brain recognizes certain subjective brain states. The aim of Unfetter is to gain insight and regulatory control. By being repeatedly plunged into the subjective state of no-self, the individual trains themself to exist in that state as part of everyday waking life.

Neurobiology Basics: Posterior Cingulate Cortex

The Posterior Cingulate Cortex forms a central node in the “default mode network” of the brain. The PCC along with the precuneus is implicated as a neural substrate for human awareness. In numerous studies on attention and awareness, the PCC has been found to be activated during self-related thinking. Distracted and controlled awareness corresponded with PCC activation.

Neurobiology Basics: Anterior Cingulate Cortex

The anterior cingulate cortex is speculated to monitor and control the attention and impulse centers of the brain. It is frontal part of the cingulate cortex which resembles a collar. It effectively keeps us motivated and on task. This is where the primary and secondary motor cortices are located. They control movement and activity. Children with ADD/ADHD often exhibit difficulty in understanding the consequences of their behavior.  Research has also shown that the ACC is correlated with emotional awareness.