Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #3

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
2a0b77b
Add files via upload
yiminchen1999 Mar 21, 2023
f01dc0a
1
yiminchen1999 Mar 21, 2023
de857d5
Add files via upload
yiminchen1999 Mar 21, 2023
edd0660
2
yiminchen1999 Mar 21, 2023
57b550b
3
yiminchen1999 Mar 21, 2023
ebb3e02
3
yiminchen1999 Mar 21, 2023
42e26d2
3
yiminchen1999 Mar 21, 2023
05e69e2
4
yiminchen1999 Mar 24, 2023
6dbeb15
5
yiminchen1999 Mar 24, 2023
b360582
6
yiminchen1999 Mar 24, 2023
af7455c
My dash app
yiminchen1999 Mar 24, 2023
e37d375
6
yiminchen1999 Mar 24, 2023
b9f34d7
6
yiminchen1999 Mar 24, 2023
ba6185d
6
yiminchen1999 Mar 24, 2023
e1abff3
6
yiminchen1999 Mar 24, 2023
a2d8b43
6
yiminchen1999 Mar 24, 2023
e168c4a
6
yiminchen1999 Mar 24, 2023
656eaf4
6
yiminchen1999 Mar 24, 2023
bebcf9f
6
yiminchen1999 Mar 24, 2023
d0e7406
6
yiminchen1999 Mar 24, 2023
3d26a2f
6
yiminchen1999 Mar 24, 2023
1ad5fb1
7
yiminchen1999 Mar 28, 2023
2f083b8
8
yiminchen1999 Mar 28, 2023
e442dd4
9
yiminchen1999 Mar 28, 2023
cfece48
10
yiminchen1999 Mar 30, 2023
6d58937
11
yiminchen1999 Mar 30, 2023
78f1b73
12
yiminchen1999 Mar 31, 2023
43ebdfd
14
yiminchen1999 Mar 31, 2023
d4fdd52
15
yiminchen1999 Mar 31, 2023
a222d41
16
yiminchen1999 Mar 31, 2023
7fac671
17
yiminchen1999 Mar 31, 2023
df56028
18
yiminchen1999 Mar 31, 2023
6a83af6
19
yiminchen1999 Mar 31, 2023
149c8dc
19
yiminchen1999 Mar 31, 2023
db017a8
20
yiminchen1999 Mar 31, 2023
36e0e58
21
yiminchen1999 Mar 31, 2023
f338c5d
22
yiminchen1999 Mar 31, 2023
da9ce2d
23
yiminchen1999 Mar 31, 2023
1b06e08
24
yiminchen1999 Mar 31, 2023
566bedd
25
yiminchen1999 Mar 31, 2023
b21dfe3
27
yiminchen1999 Mar 31, 2023
3a637f7
28
yiminchen1999 Mar 31, 2023
431908e
29
yiminchen1999 Mar 31, 2023
1432499
30
yiminchen1999 Apr 1, 2023
9131c8e
31
yiminchen1999 Apr 1, 2023
69559d4
32
yimin1019 Apr 16, 2023
955ffc7
33
yimin1019 Apr 16, 2023
dde64e3
34
yimin1019 Apr 16, 2023
998dd14
change the layout ; add page 2
yimin1019 Apr 18, 2023
9f7c6db
change the layout ; add page 2 pic
yimin1019 Apr 18, 2023
13a64f0
negative & positive
yimin1019 Apr 18, 2023
b753c3a
update individual aggregate
yimin1019 Apr 18, 2023
850f26a
update individual aggregate
yimin1019 Apr 18, 2023
53955b3
update layout
yimin1019 Apr 21, 2023
cbbc87d
update layout
yimin1019 Apr 21, 2023
cac6a95
update layout
yimin1019 Apr 21, 2023
185c5fe
update layout
yimin1019 Apr 21, 2023
bf98663
update layout
yimin1019 Apr 21, 2023
2565040
update
yimin1019 Apr 26, 2023
4daf6c8
update
yimin1019 Apr 26, 2023
913606a
update
yimin1019 Apr 26, 2023
c47ba4f
Update README.md
yiminchen1999 May 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
133 changes: 4 additions & 129 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,129 +1,4 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
venv
*.pyc
.DS_Store
.env
3 changes: 3 additions & 0 deletions .idea/.gitignore

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

12 changes: 12 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

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

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

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

12 changes: 12 additions & 0 deletions .idea/knowledge-map-demo.iml

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

7 changes: 7 additions & 0 deletions .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 .idea/modules.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

180 changes: 180 additions & 0 deletions Negative_Sentiment_Knowledge_Map_Class_Weekly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
#!/usr/bin/env python
# coding: utf-8

# In[22]:


from pyvis.network import Network
import pandas as pd


# In[23]:


path = "/Users/stephanielin/Desktop/TLTLab/"


# In[24]:


keyword_category = pd.read_excel( "assets/dictionary 2.0.xlsx",index_col=0).iloc[:,0:1]


# In[25]:


keywords = pd.read_excel("assets/dictionary 2.0.xlsx")["traget n-gram"].tolist()


# In[26]:


negative_file_names_2021 = ['Student1_Negative_SA','Student2_Negative_SA','Student3_Negative_SA','Student4_Negative_SA','Student5_Negative_SA','Student6_Negative_SA','Student7_Negative_SA']
year2021_df = []
for i in range(len(negative_file_names_2021)):
temp_df = pd.read_csv("Sentiment_Map/Negative_Map/2021/"+negative_file_names_2021[i]+".csv",index_col=0)
temp_df.reset_index(drop=True, inplace=True)
year2021_df.append(temp_df)


# In[27]:


student_names_2021 = ['Student1','Student2','Student3','Student4','Student5','Student6','Student7']


# In[28]:


negative_file_names_2022 = ['Student1_Negative_SA','Student2_Negative_SA','Student3_Negative_SA','Student4_Negative_SA','Student5_Negative_SA','Student6_Negative_SA','Student7_Negative_SA','Student8_Negative_SA','Student9_Negative_SA','Student10_Negative_SA','Student11_Negative_SA','Student12_Negative_SA']
year2022_df = []
for i in range(len(negative_file_names_2022)):
temp_df = pd.read_csv("Sentiment_Map/Negative_Map/2022/"+negative_file_names_2022[i]+".csv",index_col=0)
temp_df.reset_index(drop=True, inplace=True)
year2022_df.append(temp_df)


# In[29]:


student_names_2022 = ['Student1','Student2','Student3','Student4','Student5','Student6','Student7','Student8','Student9','Student10','Student11','Student12']


# In[30]:


negative_file_names_2023 = ['Student1_Negative_SA','Student2_Negative_SA','Student3_Negative_SA','Student4_Negative_SA','Student5_Negative_SA','Student6_Negative_SA','Student7_Negative_SA','Student8_Negative_SA','Student9_Negative_SA','Student10_Negative_SA','Student11_Negative_SA','Student12_Negative_SA']
year2023_df = []
for i in range(len(negative_file_names_2023)):
temp_df = pd.read_csv("Sentiment_Map/Negative_Map/2023/"+negative_file_names_2023[i]+".csv",index_col=0)
temp_df.reset_index(drop=True, inplace=True)
year2023_df.append(temp_df)


# In[31]:


student_names_2023 = ['Eury','Sadia','Helen','Xichen','Zhanlan','Katie','Andrea','Ana Maria','Heidi','Mariana','Inara','Kiki']


# In[32]:


# the number shows which category the keyword belongs to
keywords_group = keyword_category.iloc[:, 0].to_numpy()


# In[33]:


category_color = []
for i in keywords_group:
if i == 1:
category_color.append('#e3342f')
if i == 2:
category_color.append('#f6993f')
if i == 3:
category_color.append('#ffed4a')
if i == 4:
category_color.append('#38c172')
if i == 5:
category_color.append('#4dc0b5')
if i == 6:
category_color.append('#3490dc')
if i == 7:
category_color.append('#6574cd')
if i == 8:
category_color.append('#9561e2')
if i == 9:
category_color.append('#f66d9b')


# In[34]:


def class_collective_negative_sensitive_map(class_df, student_names_year):
nets = []
for i in range(class_df[0].shape[0]):
net = Network(notebook=True)
student_names = []
occurence = []

for n in range(len(keywords)):
student_names.append([])
occurence.append(0)
for number, student_df in enumerate(class_df):
for s, value in enumerate(student_df.iloc[i]):
if value == 1:
#student_names[s].append("student"+str(number+1))
student_names[s].append(student_names_year[number])
occurence = [sum(x) for x in zip(occurence, student_df.iloc[i])]
for student_df in class_df:
for p, value in enumerate(student_df.iloc[i]):
if value == 1:
net.add_node(p, label=keywords[p], title='unset',size=(int(occurence[p])+1)*3, color=category_color[p])

# add names of student who use the knowledge to corresponding knowledge node's tittle in the map
for node in net.nodes:
node['title'] = ', '.join(student_names[int(node['id'])])

net_id = [dic['id'] for dic in net.nodes]

for o in net_id:
for u in net_id:
if o != u and keywords_group[o] == keywords_group[u]:
net.add_edge(o,u,hidden=True)

net.repulsion(central_gravity=0.9,spring_length=50)

nets.append(net)

return nets


# In[35]:


class_negative_map_2021 = class_collective_negative_sensitive_map(year2021_df,student_names_2021)
class_negative_map_2022 = class_collective_negative_sensitive_map(year2022_df,student_names_2022)
class_negative_map_2023 = class_collective_negative_sensitive_map(year2023_df,student_names_2023)


# In[36]:


#class_negative_map_2023[0].show("social_network.html")


# In[37]:


class_negative_map_2023[0].nodes



for i in range(len(class_negative_map_2023)):
class_negative_map_2023[i].show(f"assets/class_negative_map_2023_{i+1}.html")




Loading