Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: cma0232/mind-reading
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: yanbin-niu/mind-reading
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Jan 28, 2021

  1. Add files via upload

    cma0232 authored Jan 28, 2021
    Copy the full SHA
    91ae76f View commit details

Commits on Jan 29, 2021

  1. Copy the full SHA
    795de01 View commit details
  2. Copy the full SHA
    cd28e4d View commit details

Commits on Feb 9, 2021

  1. Copy the full SHA
    93b2116 View commit details
  2. Changed file name

    CamachoBry committed Feb 9, 2021
    Copy the full SHA
    b909722 View commit details

Commits on Feb 11, 2021

  1. Merge pull request #7 from NDCLab/bryan/package

    Bryan/package
    CamachoBry authored Feb 11, 2021
    Copy the full SHA
    115f175 View commit details

Commits on Feb 15, 2021

  1. testing script

    CamachoBry committed Feb 15, 2021
    Copy the full SHA
    fd5d272 View commit details
  2. testing script

    CamachoBry committed Feb 15, 2021
    Copy the full SHA
    1a8c436 View commit details
  3. Merge pull request #8 from NDCLab/bryan/script

    Bryan/script
    CamachoBry authored Feb 15, 2021
    Copy the full SHA
    08ef27e View commit details

Commits on Feb 16, 2021

  1. added comments

    CamachoBry committed Feb 16, 2021
    Copy the full SHA
    861ed7c View commit details
  2. Merge pull request #9 from NDCLab/bryan/script

    added comments
    CamachoBry authored Feb 16, 2021
    Copy the full SHA
    3689d95 View commit details
  3. Copy the full SHA
    6a61dc1 View commit details
  4. Merge pull request #10 from NDCLab/bryan/script

    changed prepare_ml to default to False for scaling
    CamachoBry authored Feb 16, 2021
    Copy the full SHA
    78c6507 View commit details

Commits on Feb 19, 2021

  1. Add files via upload

    kiaraafarias authored Feb 19, 2021
    Copy the full SHA
    47191e3 View commit details

Commits on Feb 22, 2021

  1. added graphing function

    CamachoBry committed Feb 22, 2021
    Copy the full SHA
    11786f3 View commit details

Commits on Feb 23, 2021

  1. removed duplicate file

    CamachoBry committed Feb 23, 2021
    Copy the full SHA
    4204f83 View commit details
  2. removed DS_Store file

    CamachoBry committed Feb 23, 2021
    Copy the full SHA
    9aab311 View commit details

Commits on Feb 24, 2021

  1. Copy the full SHA
    2fede48 View commit details

Commits on Feb 28, 2021

  1. added cross_val_scoring

    CamachoBry committed Feb 28, 2021
    Copy the full SHA
    e35ae58 View commit details
  2. Copy the full SHA
    3a31567 View commit details

Commits on Mar 1, 2021

  1. Add files via upload

    kiaraafarias authored Mar 1, 2021
    Copy the full SHA
    3bf5f5b View commit details
  2. Add files via upload

    kiaraafarias authored Mar 1, 2021
    Copy the full SHA
    b1f4c00 View commit details

Commits on Mar 22, 2021

  1. Create python-app.yml

    yanbin-niu authored Mar 22, 2021
    Copy the full SHA
    aeb5bda View commit details
  2. Update python-app.yml

    yanbin-niu authored Mar 22, 2021
    Copy the full SHA
    9dc851f View commit details
30 changes: 30 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Pylint

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
flake8 . --ignore=E501,W503,W504

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions multi_participants/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions multi_participants/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions multi_participants/.idea/multi_participants.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 52 additions & 0 deletions multi_participants/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions multi_participants/Graphing functions (2).py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python
# coding: utf-8

# In[1]:


from matplotlib import pyplot as plt
from matplotlib import rc
import pylab as plb
import pandas as pd
import numpy as np


# In[2]:


data = pd.read_csv('/Users/kf/Downloads/case_4_accuracy.csv')


# In[3]:


standErr = np.std(data, ddof=1, axis=1) / np.sqrt(np.size(data, axis =1))


# In[4]:


data['mean'] = data.mean(axis=1)


# In[15]:


plt.figure(figsize=(7,8))
plt.errorbar( data['Unnamed: 0'], data['mean'], yerr=standErr, fmt='o', color='Black', elinewidth=1,capthick=1,errorevery=1, alpha=1, ms=1, capsize = 3)
plt.bar(data['Unnamed: 0'], data['mean'],tick_label = data['Unnamed: 0'], color = ['mediumpurple', 'cyan', 'b','r'],edgecolor='black')##Bar plot
plt.yticks(rotation = 90)
plt.xticks(size = 12)
plt.yticks(size = 12)
plt.xlabel("Classifier Type", size = 15)
plt.ylabel("Accuracy", size = 15)
ax = plt.gca()
yticks = ax.yaxis.get_major_ticks()
yticks[0].label1.set_visible(False)
plt.show()


# In[ ]:




53 changes: 53 additions & 0 deletions multi_participants/Graphing functions (3).py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env python
# coding: utf-8

# In[1]:


from matplotlib import pyplot as plt
from matplotlib import rc
import pylab as plb
import pandas as pd
import numpy as np


# In[2]:


data = pd.read_csv('/Users/kf/Downloads/case_4_accuracy.csv')


# In[3]:


standErr = np.std(data, ddof=1, axis=1) / np.sqrt(np.size(data, axis =1))


# In[4]:


data['mean'] = data.mean(axis=1)


# In[16]:


plt.figure(figsize=(7,8))
plt.errorbar( data['Unnamed: 0'], data['mean'], yerr=standErr, fmt='o', color='Black', elinewidth=1,capthick=1,errorevery=1, alpha=1, ms=1, capsize = 3)
plt.bar(data['Unnamed: 0'], data['mean'],tick_label = data['Unnamed: 0'], color = ['mediumpurple', 'cyan', 'b','r'],edgecolor='black')##Bar plot
plt.yticks(rotation = 90)
plt.xticks(size = 12)
plt.yticks(size = 12)
plt.xlabel("Classifier Type", size = 15)
plt.ylabel("Precision", size = 15)
ax = plt.gca()
yticks = ax.yaxis.get_major_ticks()
yticks[0].label1.set_visible(False)
plt.show()


# In[ ]:




65 changes: 65 additions & 0 deletions multi_participants/case_3/case_3_accuracy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import os
from mind_reading_package import mind_reading as mr
import pandas as pd

# list all folders' name
participants = os.listdir('path')

# remove the 'cha' folder we don't need
participants = participants.remove('cha')

# create the initial dataframe
df = pd.DataFrame(index = ['SVC', 'DTC', 'NB', 'NN'])

for participant in participants:
# iterate all the folders

for file in os.listdir(participant):
# iterate all files in every folder, find out the one end with 'Cong.csv' and 'Incong.csv' as input data

if file.endswith('Cong.csv'): file1 = f"{participant}/{file}"
if file.endswith('Incong.csv'): file2 = f"{participant}/{file}"

# load in cong and incong data for them
df1 = mr.load_data(file1)
df2 = mr.load_data(file2)

# concatenate such data
data = mr.concatenate_data(df1, df2)

# find trials to later separate
trials_index = mr.find_trials(data)

# separate trials
trials = mr.separate_trials(data, trials_index)

# create the label column
labels = mr.create_binary_labels(data)

# Go through each trial, reset the columns, we split from 100-300ms ((308th sample to 513th sample))
pro_trials = mr.process_trials(trials)

# Find the mean across channels
avg_trials = mr.average_trials(pro_trials)

# concatenates the average trials dataframe with labels
ml_df = mr.create_ml_df(avg_trials, labels)

# train models
X_train, X_test, y_train, y_test = mr.prepare_ml_df(ml_df)

acc_svc, precision_svc = mr.train_svc(X_train, X_test, y_train, y_test)

acc_dtc, precision_dtc = mr.train_dtc(X_train, X_test, y_train, y_test)

acc_nb, precision_nb = mr.train_nb(X_train, X_test, y_train, y_test)

acc_nn, precision_nn = mr.train_nn(64, X_train, X_test, y_train, y_test)

# add every participant's accuracy together
acc_list = [f"{acc_svc:.2f}", f"{acc_dtc:.2f}", f"{acc_nb:.2f}", f"{acc_nn:.2f}"]

df = mr.res_df(df, acc_list, participant)

# generate result .csv file
df.to_csv('case_3_accuracy.csv')
66 changes: 66 additions & 0 deletions multi_participants/case_3/case_3_precision.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import os
from mind_reading_package import mind_reading as mr
import pandas as pd

# list all folders' name
participants = os.listdir('path')

# remove the 'cha' folder we don't need
participants = participants.remove('cha')

# create the initial dataframe
df = pd.DataFrame(index = ['SVC', 'DTC', 'NB', 'NN'])

for participant in participants:
# iterate all the folders

for file in os.listdir(participant):
# iterate all files in every folder, find out the one end with 'Cong.csv' and 'Incong.csv' as input data

if file.endswith('Cong.csv'): file1 = f"{participant}/{file}"
if file.endswith('Incong.csv'): file2 = f"{participant}/{file}"

# load in cong and incong data for them
df1 = mr.load_data(file1)
df2 = mr.load_data(file2)

# concatenate such data
data = mr.concatenate_data(df1, df2)

# find trials to later separate
trials_index = mr.find_trials(data)

# separate trials
trials = mr.separate_trials(data, trials_index)

# create the label column
labels = mr.create_binary_labels(data)

# Go through each trial, reset the columns, we split from 100-300ms ((308th sample to 513th sample))
pro_trials = mr.process_trials(trials)

# Find the mean across channels
avg_trials = mr.average_trials(pro_trials)

# concatenates the average trials dataframe with labels
ml_df = mr.create_ml_df(avg_trials, labels)

# train models
X_train, X_test, y_train, y_test = mr.prepare_ml_df(ml_df)

acc_svc, precision_svc = mr.train_svc(X_train, X_test, y_train, y_test)

acc_dtc, precision_dtc = mr.train_dtc(X_train, X_test, y_train, y_test)

acc_nb, precision_nb = mr.train_nb(X_train, X_test, y_train, y_test)

acc_nn, precision_nn = mr.train_nn(64, X_train, X_test, y_train, y_test)

# add every participant's precision together
precision_list = [f"{precision_svc:.2f}", f"{precision_dtc:.2f}", f"{precision_nb:.2f}", f"{precision_nn:.2f}"]

df = mr.res_df(df, precision_list, participant)

# generate result .csv file
df.to_csv('case_3_accuracy.csv')

Loading