Spaces:
Sleeping
Sleeping
Delete pages
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- pages/Module_01.py +0 -26
- pages/Module_02.py +0 -26
- pages/Module_03.py +0 -26
- pages/Module_04.py +0 -26
- pages/Module_05.py +0 -26
- pages/Module_06.py +0 -26
- pages/Module_07.py +0 -26
- pages/Module_08.py +0 -26
- pages/Module_09.py +0 -26
- pages/Module_10.py +0 -26
- pages/Module_11.py +0 -26
- pages/Overview.py +0 -27
- pages/__init__.py +0 -14
- pages/assets/ascend.mp4 +0 -3
- pages/assets/juicy_fruit.mp3 +0 -3
- pages/assets/logo.jpg +0 -0
- pages/assets/overview.txt +0 -56
- pages/assets/profile.txt +0 -17
- pages/assets/progress.txt +0 -116
- pages/assets/sample_formula_text.txt +0 -60
- pages/assets/sample_formula_text_01.txt +0 -42
- pages/load_pages.py +0 -212
- pages/modules/Module_01/Module_01.ipynb +0 -90
- pages/modules/Module_01/Overview.jpg +0 -3
- pages/modules/Module_01/Overview.txt +0 -13
- pages/modules/Module_02/Module_02.ipynb +0 -158
- pages/modules/Module_02/Overview.jpg +0 -3
- pages/modules/Module_02/Overview.txt +0 -12
- pages/modules/Module_03/Module_03.ipynb +0 -122
- pages/modules/Module_03/Overview.jpg +0 -3
- pages/modules/Module_03/Overview.txt +0 -12
- pages/modules/Module_04/Module_04.ipynb +0 -116
- pages/modules/Module_04/Overview.jpg +0 -3
- pages/modules/Module_04/Overview.txt +0 -10
- pages/modules/Module_05/Module_05.ipynb +0 -107
- pages/modules/Module_05/Overview.jpg +0 -3
- pages/modules/Module_05/Overview.txt +0 -12
- pages/modules/Module_06/Module_06.ipynb +0 -144
- pages/modules/Module_06/Overview.jpg +0 -3
- pages/modules/Module_06/Overview.txt +0 -15
- pages/modules/Module_07/Module_07.ipynb +0 -91
- pages/modules/Module_07/Overview.jpg +0 -3
- pages/modules/Module_07/Overview.txt +0 -12
- pages/modules/Module_08/Module_08.ipynb +0 -124
- pages/modules/Module_08/Overview.jpg +0 -3
- pages/modules/Module_08/Overview.txt +0 -17
- pages/modules/Module_09/Module_09.ipynb +0 -157
- pages/modules/Module_09/Overview.jpg +0 -3
- pages/modules/Module_09/Overview.txt +0 -18
- pages/modules/Module_10/Module_10.ipynb +0 -119
pages/Module_01.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_01"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Module_02.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_02"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Module_03.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_03"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Module_04.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_04"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Module_05.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_05"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Module_06.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_06"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Module_07.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_07"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Module_08.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_08"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Module_09.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_09"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Module_10.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_10"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Module_11.py
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Module_11"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Overview.py
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
CURRENT_MODULE = "Overview"
|
| 2 |
-
|
| 3 |
-
# Imports
|
| 4 |
-
|
| 5 |
-
import streamlit as st
|
| 6 |
-
import streamlit.components.v1 as components
|
| 7 |
-
from pages import load_pages
|
| 8 |
-
|
| 9 |
-
if "logged_in" not in st.session_state:
|
| 10 |
-
pass
|
| 11 |
-
else:
|
| 12 |
-
load_pages.load_page(CURRENT_MODULE)
|
| 13 |
-
|
| 14 |
-
if __name__ == "__main__":
|
| 15 |
-
load_pages.test_load()
|
| 16 |
-
print("<<< Module [", CURRENT_MODULE, "] Compile Successful >>>")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/__init__.py
DELETED
|
@@ -1,14 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
if __name__ == "__main__":
|
| 3 |
-
print("<<< __init__ Compile Successful >>>")
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/assets/ascend.mp4
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:47da52ba29d9ec1dd51515d57a9e44077fdb555f381c7489d0579a5986d072d1
|
| 3 |
-
size 9958440
|
|
|
|
|
|
|
|
|
|
|
|
pages/assets/juicy_fruit.mp3
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:d6b27c967e75704148a1ebc0df70dd4fb13d5571ce2af02e87334139acb3ef3a
|
| 3 |
-
size 735859
|
|
|
|
|
|
|
|
|
|
|
|
pages/assets/logo.jpg
DELETED
|
Binary file (86.7 kB)
|
|
|
pages/assets/overview.txt
DELETED
|
@@ -1,56 +0,0 @@
|
|
| 1 |
-
# Welcome to ASCEND: Your Comprehensive AI Learning Solution
|
| 2 |
-
|
| 3 |
-
**ASCEND** is an innovative, highly integrated learning platform designed to empower users in mastering Artificial Intelligence (AI). Combining theoretical foundations with practical, interactive experiences, ASCEND provides a structured, engaging, and robust learning environment tailored for beginners and advanced AI enthusiasts alike.
|
| 4 |
-
|
| 5 |
-
### Key Features of ASCEND:
|
| 6 |
-
- **Real-World Use Cases:** Work on practical projects and case studies to apply your AI knowledge on realistic scenarios and problems.
|
| 7 |
-
- **Interactive Learning Modules:** Learn essential AI concepts such as machine learning, deep learning, natural language processing, and computer vision.
|
| 8 |
-
- **Sandbox Environments:** Safely experiment with algorithms, data sets, and AI models within virtual environments.
|
| 9 |
-
- **Comprehensive AI Toolkit:** Access a rich repository of AI tools and resources integrated within the learning environment.
|
| 10 |
-
- **Community-driven Support:** Engage with a vibrant community of learners, mentors, and AI experts to enhance your learning journey.
|
| 11 |
-
|
| 12 |
-
---
|
| 13 |
-
|
| 14 |
-
## Sample AI Questions to try in Our Chat
|
| 15 |
-
|
| 16 |
-
Copy and paste these questions to deepen your understanding of AI.
|
| 17 |
-
|
| 18 |
-
```markdown
|
| 19 |
-
Can you explain the key differences between supervised, unsupervised, and reinforcement learning?
|
| 20 |
-
```
|
| 21 |
-
|
| 22 |
-
```markdown
|
| 23 |
-
What are some common techniques used to prevent overfitting in machine learning models?
|
| 24 |
-
```
|
| 25 |
-
|
| 26 |
-
```markdown
|
| 27 |
-
How do neural networks work, and can you provide a simple, step-by-step example?
|
| 28 |
-
```
|
| 29 |
-
|
| 30 |
-
```markdown
|
| 31 |
-
What's the difference between convolutional neural networks (CNNs) and recurrent neural networks (RNNs)?
|
| 32 |
-
```
|
| 33 |
-
|
| 34 |
-
```markdown
|
| 35 |
-
How does Natural Language Processing (NLP) simplify the interaction between humans and machines?
|
| 36 |
-
```
|
| 37 |
-
|
| 38 |
-
```markdown
|
| 39 |
-
Can you guide me through the process of training and validating a machine learning model step by step?
|
| 40 |
-
```
|
| 41 |
-
|
| 42 |
-
```markdown
|
| 43 |
-
What are large language models, and how do they work to generate text?
|
| 44 |
-
```
|
| 45 |
-
|
| 46 |
-
```markdown
|
| 47 |
-
Could you provide an overview of ethical considerations when developing and deploying AI systems?
|
| 48 |
-
```
|
| 49 |
-
|
| 50 |
-
```markdown
|
| 51 |
-
What tools and software libraries would you recommend for beginning AI practitioners?
|
| 52 |
-
```
|
| 53 |
-
|
| 54 |
-
```markdown
|
| 55 |
-
How does computer vision enable machines to interpret visual data, and can you give an example application?
|
| 56 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/assets/profile.txt
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
# 🚀 ASCEND Program: Student Profile
|
| 2 |
-
|
| 3 |
-
- **Student Name:** Charlie B
|
| 4 |
-
- **Department:** BMO Wealth
|
| 5 |
-
- **Expertise:** Intermediate
|
| 6 |
-
|
| 7 |
-
## 🎯 Interests:
|
| 8 |
-
- Data science and analytics
|
| 9 |
-
- Predictive models
|
| 10 |
-
- Capital market applications
|
| 11 |
-
|
| 12 |
-
## 🎯 Goals for Next Review:
|
| 13 |
-
- Complete topics in **Supervised Learning**.
|
| 14 |
-
- Begin study on Advanced Optimization Methods.
|
| 15 |
-
- Initiate **Computer Vision** topics.
|
| 16 |
-
|
| 17 |
-
**🚀 Keep up the excellent work 🚀**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/assets/progress.txt
DELETED
|
@@ -1,116 +0,0 @@
|
|
| 1 |
-
# 🚀 ASCEND Program: AI Learning Progress Report
|
| 2 |
-
|
| 3 |
-
- **Student Name:** Charlie B
|
| 4 |
-
- **Enrollment Date:** Sept 15, 2025
|
| 5 |
-
- **Report Date:** Nov 2, 2025
|
| 6 |
-
|
| 7 |
-
---
|
| 8 |
-
|
| 9 |
-
# 📚 Progress Overview
|
| 10 |
-
Completed topics are marked with a checkmark (✔️),
|
| 11 |
-
while incomplete or pending topics remain unchecked.
|
| 12 |
-
|
| 13 |
-
## 📈 Overall Progress Summary
|
| 14 |
-
|
| 15 |
-
| Curriculum Area | Completion (%) |
|
| 16 |
-
|------------------------------|----------------|
|
| 17 |
-
| Statistics & Probability | 67% |
|
| 18 |
-
| Linear Algebra | 80% |
|
| 19 |
-
| Calculus & Optimization | 83% |
|
| 20 |
-
| Python for ML | 100% |
|
| 21 |
-
| Supervised Learning | 60% |
|
| 22 |
-
| Unsupervised Learning | 75% |
|
| 23 |
-
| Deep Learning | 40% |
|
| 24 |
-
| NLP | 25% |
|
| 25 |
-
| Computer Vision | 0% |
|
| 26 |
-
|
| 27 |
-
---
|
| 28 |
-
|
| 29 |
-
## ✅ Python Programming
|
| 30 |
-
| Subtopic | Status |
|
| 31 |
-
|------------------------------------|---------|
|
| 32 |
-
| Python Fundamentals | ✔️ |
|
| 33 |
-
| NumPy & Arrays | ✔️ |
|
| 34 |
-
| Pandas & Data Manipulation | ✔️ |
|
| 35 |
-
| Data Visualization with Matplotlib| ✔️ |
|
| 36 |
-
|
| 37 |
-
---
|
| 38 |
-
|
| 39 |
-
## 🔄 Supervised Learning
|
| 40 |
-
| Subtopic | Status |
|
| 41 |
-
|---------------------------------|---------|
|
| 42 |
-
| Regression Analysis | ✔️ |
|
| 43 |
-
| Classification Algorithms | ✔️ |
|
| 44 |
-
| Decision Trees | ✔️ |
|
| 45 |
-
| Ensemble Methods (Random Forest)| |
|
| 46 |
-
|
| 47 |
-
---
|
| 48 |
-
|
| 49 |
-
## 🔄 Unsupervised Learning
|
| 50 |
-
| Subtopic | Status |
|
| 51 |
-
|-------------------------------|---------|
|
| 52 |
-
| Clustering Methods (K-means) | ✔️ |
|
| 53 |
-
| Dimensionality Reduction | ✔️ |
|
| 54 |
-
| Principal Component Analysis (PCA)| ✔️ |
|
| 55 |
-
| t-SNE and Embeddings | |
|
| 56 |
-
|
| 57 |
-
---
|
| 58 |
-
|
| 59 |
-
## 🔄 Deep Learning
|
| 60 |
-
| Subtopic | Status |
|
| 61 |
-
|----------------------------------------|---------|
|
| 62 |
-
| Neural Networks Basics | ✔️ |
|
| 63 |
-
| Neural Network Training | ✔️ |
|
| 64 |
-
| Convolutional Neural Networks (CNNs) | |
|
| 65 |
-
| Recurrent Neural Networks (RNNs & LSTM)| |
|
| 66 |
-
| Introduction to Transformers | |
|
| 67 |
-
|
| 68 |
-
---
|
| 69 |
-
|
| 70 |
-
## ⏩ Natural Language Processing (NLP)
|
| 71 |
-
| Subtopic | Status |
|
| 72 |
-
|-----------------------------------------|---------|
|
| 73 |
-
| Tokenization & Text Preprocessing | ✔️ |
|
| 74 |
-
| Sentiment Analysis | |
|
| 75 |
-
| Text Classification Techniques | |
|
| 76 |
-
| Introduction to Large Language Models | |
|
| 77 |
-
|
| 78 |
-
---
|
| 79 |
-
|
| 80 |
-
## ✅ Statistics and Probability
|
| 81 |
-
| Subtopic | Status |
|
| 82 |
-
|----------------------------------------|---------|
|
| 83 |
-
| Measures of Central Tendency | ✔️ |
|
| 84 |
-
| Variance and Standard Deviation | ✔️ |
|
| 85 |
-
| Probability Distributions | ✔️ |
|
| 86 |
-
| Central Limit Theorem & Applications | ✔️ |
|
| 87 |
-
| Hypothesis Testing | |
|
| 88 |
-
| Bayesian Statistics | |
|
| 89 |
-
|
| 90 |
-
---
|
| 91 |
-
|
| 92 |
-
## ✅ Linear Algebra & Matrix Math
|
| 93 |
-
| Subtopic | Status |
|
| 94 |
-
|-----------------------------|---------|
|
| 95 |
-
| Matrix Operations | ✔️ |
|
| 96 |
-
| Eigenvalues and Eigenvectors| ✔️ |
|
| 97 |
-
| Matrix Factorization | |
|
| 98 |
-
| Vector Spaces | ✔️ |
|
| 99 |
-
| Linear Transformations | ✔️ |
|
| 100 |
-
|
| 101 |
-
---
|
| 102 |
-
|
| 103 |
-
## 🔄 Calculus & Optimization
|
| 104 |
-
| Subtopic | Status |
|
| 105 |
-
|-------------------------------|---------|
|
| 106 |
-
| Differential Calculus Basics | ✔️ |
|
| 107 |
-
| Partial Derivatives | ✔️ |
|
| 108 |
-
| Gradients and Directional Derivatives | ✔️ |
|
| 109 |
-
| Optimization Techniques | ✔️ |
|
| 110 |
-
| Gradient Descent Overview | ✔️ |
|
| 111 |
-
| Advanced Optimization Methods (Momentum, RMSProp, Adam)| |
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
---
|
| 115 |
-
|
| 116 |
-
**Keep up the excellent work, you're well on your way to AI mastery! 🚀**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/assets/sample_formula_text.txt
DELETED
|
@@ -1,60 +0,0 @@
|
|
| 1 |
-
The normal distribution, often called the Gaussian distribution, is among the most important probability distributions in statistics. Here's the formula for its probability density function and its moment-generating function:
|
| 2 |
-
|
| 3 |
-
1. **Normal Distribution Probability Density Function (PDF):**
|
| 4 |
-
|
| 5 |
-
The formula for the PDF of a normal distribution with mean \( \mu \) and standard deviation \( \sigma \) is:
|
| 6 |
-
|
| 7 |
-
\[
|
| 8 |
-
f(x) = \frac{1}{\sigma \sqrt{2\pi}} e^{-\frac{(x - \mu)^2}{2\sigma^2}}
|
| 9 |
-
\]
|
| 10 |
-
|
| 11 |
-
- \( x \) is a value for which we're finding the probability density.
|
| 12 |
-
- \( \mu \) is the mean of the distribution.
|
| 13 |
-
- \( \sigma \) is the standard deviation.
|
| 14 |
-
- \( \pi \) is a constant approximately equal to 3.14159.
|
| 15 |
-
- \( e \) is Euler's number, approximately equal to 2.71828.
|
| 16 |
-
|
| 17 |
-
This formula describes the familiar bell-shaped curve that characterizes the normal distribution, showing how probabilities are distributed over the range of possible values.
|
| 18 |
-
|
| 19 |
-
2. **Moment Generating Function (MGF) for a Normal Distribution:**
|
| 20 |
-
|
| 21 |
-
The MGF of a normal distribution can be derived and is given by:
|
| 22 |
-
|
| 23 |
-
\[
|
| 24 |
-
M_X(t) = e^{\mu t + \frac{1}{2} \sigma^2 t^2}
|
| 25 |
-
\]
|
| 26 |
-
|
| 27 |
-
- \( M_X(t) \) is the moment-generating function of the random variable \( X \) with mean \( \mu \) and standard deviation \( \sigma \).
|
| 28 |
-
- \( t \) is the point at which the MGF is evaluated.
|
| 29 |
-
|
| 30 |
-
The MGF for the normal distribution uniquely characterizes the distribution. It's especially useful in deriving properties such as the mean and variance, and it simplifies working with sums of independent normal random variables, thanks to the aforementioned product property of MGFs.The normal distribution, often called the Gaussian distribution, is among the most important probability distributions in statistics. Here's the formula for its probability density function and its moment-generating function:
|
| 31 |
-
|
| 32 |
-
1. **Normal Distribution Probability Density Function (PDF):**
|
| 33 |
-
|
| 34 |
-
The formula for the PDF of a normal distribution with mean \( \mu \) and standard deviation \( \sigma \) is:
|
| 35 |
-
|
| 36 |
-
\[
|
| 37 |
-
f(x) = \frac{1}{\sigma \sqrt{2\pi}} e^{-\frac{(x - \mu)^2}{2\sigma^2}}
|
| 38 |
-
\]
|
| 39 |
-
|
| 40 |
-
- \( x \) is a value for which we're finding the probability density.
|
| 41 |
-
- \( \mu \) is the mean of the distribution.
|
| 42 |
-
- \( \sigma \) is the standard deviation.
|
| 43 |
-
- \( \pi \) is a constant approximately equal to 3.14159.
|
| 44 |
-
- \( e \) is Euler's number, approximately equal to 2.71828.
|
| 45 |
-
|
| 46 |
-
This formula describes the familiar bell-shaped curve that characterizes the normal distribution, showing how probabilities are distributed over the range of possible values.
|
| 47 |
-
|
| 48 |
-
2. **Moment Generating Function (MGF) for a Normal Distribution:**
|
| 49 |
-
|
| 50 |
-
The MGF of a normal distribution can be derived and is given by:
|
| 51 |
-
|
| 52 |
-
\[
|
| 53 |
-
M_X(t) = e^{\mu t + \frac{1}{2} \sigma^2 t^2}
|
| 54 |
-
\]
|
| 55 |
-
|
| 56 |
-
- \( M_X(t) \) is the moment-generating function of the random variable \( X \) with mean \( \mu \) and standard deviation \( \sigma \).
|
| 57 |
-
- \( t \) is the point at which the MGF is evaluated.
|
| 58 |
-
|
| 59 |
-
The MGF for the normal distribution uniquely characterizes the distribution. It's especially useful in deriving properties such as the mean and variance, and it simplifies working with sums of independent normal random variables, thanks to the aforementioned product property of MGFs.
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/assets/sample_formula_text_01.txt
DELETED
|
@@ -1,42 +0,0 @@
|
|
| 1 |
-
sample_formula_text
|
| 2 |
-
|
| 3 |
-
The equation for linear regression in matrix form is expressed as:
|
| 4 |
-
|
| 5 |
-
\[
|
| 6 |
-
\mathbf{y} = \mathbf{X}\mathbf{\beta} + \mathbf{\epsilon}
|
| 7 |
-
\]
|
| 8 |
-
|
| 9 |
-
Here's what each component represents:
|
| 10 |
-
- \(\mathbf{y}\) is an \(n \times 1\) vector of the response variables (dependent variable) for \(n\) observations.
|
| 11 |
-
- \(\mathbf{X}\) is an \(n \times (p+1)\) matrix of the predictors (independent variables), where \(p\) is the number of predictors. The first column of \(\mathbf{X}\) usually consists of ones to account for the intercept term.
|
| 12 |
-
- \(\mathbf{\beta}\) is a \((p+1) \times 1\) vector of the coefficients, including the intercept and the slopes of the predictors.
|
| 13 |
-
- \(\mathbf{\epsilon}\) is an \(n \times 1\) vector of the error terms.
|
| 14 |
-
|
| 15 |
-
The estimated coefficients \(\mathbf{\hat{\beta}}\) are usually calculated using the Ordinary Least Squares (OLS) method, which minimizes the sum of the squared differences between the observed responses \(\mathbf{y}\) and the predicted responses \(\mathbf{X}\mathbf{\beta}\). The formula for the OLS estimate of \(\mathbf{\beta}\) is:
|
| 16 |
-
|
| 17 |
-
\[
|
| 18 |
-
\mathbf{\hat{\beta}} = (\mathbf{X}^T \mathbf{X})^{-1} \mathbf{X}^T \mathbf{y}
|
| 19 |
-
\]
|
| 20 |
-
|
| 21 |
-
This equation allows for the estimation of the beta coefficients that best fit the data according to the least squares criterion.
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
This equation mixes text with a formula
|
| 25 |
-
|
| 26 |
-
\[
|
| 27 |
-
\text{Let } x = \var{number of cats} \text{, and also } \var{Overlap Area} = \frac{\Area(\var{Detection} \cap \var{Ground Truth})} {\Area(\var{Detection} \cup \var{Ground Truth})}
|
| 28 |
-
\]
|
| 29 |
-
|
| 30 |
-
The formula for the normal distribution, also known as the Gaussian distribution, is given by the probability density function (PDF):
|
| 31 |
-
|
| 32 |
-
\[ f(x \mid \mu, \sigma) = \frac{1}{\sigma \sqrt{2\pi}} e^{-\frac{1}{2} \left( \frac{x - \mu}{\sigma} \right)^2} \]
|
| 33 |
-
|
| 34 |
-
where:
|
| 35 |
-
- \( \mu \) is the mean,
|
| 36 |
-
- \( \sigma \) is the standard deviation,
|
| 37 |
-
- \( x \) is the variable,
|
| 38 |
-
- \( e \) is the base of the natural logarithm (approximately equal to 2.71828).
|
| 39 |
-
|
| 40 |
-
In Python, you can work with the normal distribution using libraries like NumPy and SciPy. Here are a few examples of how one might use the normal distribution in Python:
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/load_pages.py
DELETED
|
@@ -1,212 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
# Imports
|
| 3 |
-
|
| 4 |
-
import os, time, re, sys
|
| 5 |
-
import numpy as np
|
| 6 |
-
from openai import OpenAI
|
| 7 |
-
|
| 8 |
-
import streamlit as st
|
| 9 |
-
import streamlit.components.v1 as components
|
| 10 |
-
|
| 11 |
-
# --------------------------------------------------------------------------
|
| 12 |
-
# Symbolic Lookup Table - Greek (lower and upper, math and equality signs)
|
| 13 |
-
# --------------------------------------------------------------------------
|
| 14 |
-
|
| 15 |
-
SYMBOLS: dict[str, str] = {
|
| 16 |
-
r"\alpha": "α", r"\beta": "β", r"\gamma": "γ", r"\delta": "δ",r"\epsilon": "ε",r"\zeta": "ζ", r"\eta": "η", r"\theta": "θ", r"\iota": "ι", r"\kappa": "κ", r"\lambda": "λ", r"\mu": "μ", r"\nu": "ν", r"\xi": "ξ", r"\omicron": "ο", r"\pi": "π", r"\rho": "ρ", r"\sigma": "σ", r"\tau": "τ", r"\upsilon": "υ", r"\phi": "φ", r"\chi": "χ", r"\psi": "ψ", r"\omega": "ω",
|
| 17 |
-
r"\Alpha": "Α", r"\Beta": "Β", r"\Gamma": "Γ", r"\Delta": "Δ", r"\Epsilon": "Ε",r"\Zeta": "Ζ", r"\Eta": "Η", r"\Theta": "Θ", r"\Iota": "Ι", r"\Kappa": "Κ", r"\Lambda": "Λ", r"\Mu": "Μ", r"\Nu": "Ν", r"\Xi": "Ξ", r"\Omicron": "Ο", r"\Pi": "Π", r"\Rho": "Ρ", r"\Sigma": "Σ", r"\Tau": "Τ", r"\Upsilon": "Υ", r"\Phi": "Φ", r"\Chi": "Χ", r"\Psi": "Ψ", r"\Omega": "Ω",
|
| 18 |
-
r"\pm": "±", r"\times": "×", r"\div": "÷", r"\cdot": "·", r"\sqrt": "√", r"\sum": "∑", r"\prod": "∏", r"\int": "∫", r"\infty": "∞", r"\partial": "∂", r"\nabla": "∇", r"\le": "≤", r"\ge": "≥", r"\neq": "≠", r"\approx": "≈",
|
| 19 |
-
r"\and": "∧", r"\or": "∨", r"\neg": "¬", r"\in": "∈", r"\notin": "∉", r"\subset": "⊂", r"\subseteq": "⊆",r"\supset": "⊃", r"\supseteq": "⊇", r"\cup": "∪", r"\cap": "∩", r"\angle": "∠", r"\triangle": "△",
|
| 20 |
-
r"\therefore": "∴", r"\because": "∵", r"\propto": "∝", r"\parallel": "∥",r"\perp": "⊥", r"\degree": "°", r"\bullet": "•", r"\rightarrow": "→", r"\leftarrow": "←", r"\uparrow": "↑",
|
| 21 |
-
r"\downarrow": "↓", r"\leftrightarrow": "↔", r"\ell": "ℓ", r"\Re": "ℜ", r"\Im": "ℑ", r"\aleph": "ℵ", r"\wp": "℘"
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
# =====================================================
|
| 25 |
-
# Functions - to convert symbol tags to symbols
|
| 26 |
-
# =====================================================
|
| 27 |
-
|
| 28 |
-
FORMULA_REGEX = re.compile(r'\\[A-Za-z]+')
|
| 29 |
-
BOLD_TXT_REGEX = re.compile(r'\\[A-Za-z]+{([^{}]*)}')
|
| 30 |
-
|
| 31 |
-
def test_load():
|
| 32 |
-
print("load_pages - testing external call")
|
| 33 |
-
|
| 34 |
-
def latex_to_unicode(text: str, table: dict[str, str] = SYMBOLS) -> str:
|
| 35 |
-
return FORMULA_REGEX.sub(lambda m: table.get(m.group(0), m.group(0)), text)
|
| 36 |
-
|
| 37 |
-
def latex_bold_to_markdown(text: str) -> str:
|
| 38 |
-
return BOLD_TXT_REGEX.sub(r'**\1**', text)
|
| 39 |
-
|
| 40 |
-
def format_text(input_text):
|
| 41 |
-
|
| 42 |
-
input_text = input_text.replace("\\[\n",'st.latex("')
|
| 43 |
-
input_text = input_text.replace("\\[",'st.latex("')
|
| 44 |
-
input_text = input_text.replace("\n\\]\n",'")\n')
|
| 45 |
-
input_text = input_text.replace("\\]\n",'")\n')
|
| 46 |
-
|
| 47 |
-
# print(input_text)
|
| 48 |
-
|
| 49 |
-
for line in input_text.split("\n"):
|
| 50 |
-
line = line.strip()
|
| 51 |
-
if line[:len("st.latex(")]=="st.latex(":
|
| 52 |
-
if line[-2:]=='")':
|
| 53 |
-
st.latex(line[len("st.latex(")+1:-2]) # closed expression
|
| 54 |
-
else:
|
| 55 |
-
st.latex(line[len("st.latex(")+1:]) # open expression
|
| 56 |
-
elif line[:2]=='")': # closed expression notation - ignore
|
| 57 |
-
pass
|
| 58 |
-
else:
|
| 59 |
-
line_unicode = latex_to_unicode(line)
|
| 60 |
-
line_bold = latex_bold_to_markdown(line_unicode)
|
| 61 |
-
st.markdown(line_bold)
|
| 62 |
-
|
| 63 |
-
def chat_response(prompt):
|
| 64 |
-
pass
|
| 65 |
-
|
| 66 |
-
##if prompt := st.chat_input("I would like to learn about ..."):
|
| 67 |
-
##
|
| 68 |
-
## st.session_state.messages.append({"role": "user", "content": prompt})
|
| 69 |
-
##
|
| 70 |
-
## with st.chat_message("user"):
|
| 71 |
-
## st.markdown(prompt)
|
| 72 |
-
##
|
| 73 |
-
## with st.chat_message("assistant"):
|
| 74 |
-
##
|
| 75 |
-
## full_text = []
|
| 76 |
-
##
|
| 77 |
-
## client = st.session_state["openai_client"]
|
| 78 |
-
##
|
| 79 |
-
## stream = client.chat.completions.create(
|
| 80 |
-
## model=st.session_state["openai_model"],
|
| 81 |
-
## messages=[
|
| 82 |
-
## {"role": m["role"], "content": m["content"]}
|
| 83 |
-
## for m in st.session_state.messages
|
| 84 |
-
## ],
|
| 85 |
-
## stream=True,
|
| 86 |
-
## )
|
| 87 |
-
##
|
| 88 |
-
## for chunk in stream: # chunk is a ChatCompletionChunk
|
| 89 |
-
## delta = chunk.choices[0].delta # “what changed since the prev. chunk”
|
| 90 |
-
## if delta.content: # sometimes None (e.g. first chunk)
|
| 91 |
-
## print(delta.content, end="", flush=True) # live printing
|
| 92 |
-
## full_text.append(delta.content) # keep it if you need it
|
| 93 |
-
## response = "".join(full_text) # the entire response as one string
|
| 94 |
-
##
|
| 95 |
-
## print(response)
|
| 96 |
-
## format_text(response)
|
| 97 |
-
##
|
| 98 |
-
## # response = st.write_stream(stream)
|
| 99 |
-
##
|
| 100 |
-
## st.session_state.messages.append({"role": "assistant", "content": response})
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
def load_content(module):
|
| 104 |
-
|
| 105 |
-
tab_list = ["📈 Slides", "🗃 Overview","🖥 Coding"]
|
| 106 |
-
tab0, tab1, tab2 = st.tabs(tab_list)
|
| 107 |
-
|
| 108 |
-
with tab0:
|
| 109 |
-
st.header(tab_list[0])
|
| 110 |
-
st.image(os.path.join(st.session_state["start_dir"],"pages","modules",module,"Overview.jpg"))
|
| 111 |
-
|
| 112 |
-
with tab1:
|
| 113 |
-
st.header(tab_list[1])
|
| 114 |
-
overview_str = open(os.path.join(st.session_state["start_dir"],"pages","modules",module,"Overview.txt"), "r", encoding="UTF-8").read()
|
| 115 |
-
st.markdown(overview_str)
|
| 116 |
-
|
| 117 |
-
with tab2:
|
| 118 |
-
st.header(tab_list[2])
|
| 119 |
-
st.link_button("Go to Lab", r"https://colab.research.google.com/#scrollTo=GDDWVkmPoN7M&fileId=https%3A//huggingface.co/spaces/mswhite/Project_ASCEND/blob/main/Lorenz.ipynb") # iframe did not work
|
| 120 |
-
|
| 121 |
-
return
|
| 122 |
-
|
| 123 |
-
def load_page(module):
|
| 124 |
-
|
| 125 |
-
# =================================================
|
| 126 |
-
# Top of Page / Sidebar Configuration
|
| 127 |
-
# =================================================
|
| 128 |
-
|
| 129 |
-
st.header("🚀 Project ASCEND 🚀")
|
| 130 |
-
|
| 131 |
-
# st.title() | st.header() | st.subheader() | st.logo()
|
| 132 |
-
# st.subheader("AI Supplemented Cognitive Enrichment and Development\n🤖 Ask the ChatBot 🤖")
|
| 133 |
-
|
| 134 |
-
# =================================================
|
| 135 |
-
# Sidebar
|
| 136 |
-
# =================================================
|
| 137 |
-
|
| 138 |
-
with st.sidebar:
|
| 139 |
-
|
| 140 |
-
with st.expander("Lessons"):
|
| 141 |
-
|
| 142 |
-
st.page_link("pages/Overview.py",label="Will They Buy It - Project Overview", icon="🛍")
|
| 143 |
-
st.page_link("pages/Module_01.py",label="Introduction to Machine Learning and E-Commerce Context", icon="🛒")
|
| 144 |
-
st.page_link("pages/Module_02.py",label="Basics of Python Programming", icon="💻")
|
| 145 |
-
st.page_link("pages/Module_03.py",label="Understanding the Data", icon="🔎")
|
| 146 |
-
st.page_link("pages/Module_04.py",label="Data Preprocessing & Feature Engineering", icon="🛠")
|
| 147 |
-
st.page_link("pages/Module_05.py",label="Introduction to Classification and XGBoost", icon="🤖")
|
| 148 |
-
st.page_link("pages/Module_06.py",label="Building the Predictive Model", icon="📈")
|
| 149 |
-
st.page_link("pages/Module_07.py",label="Feature Importance and Model Interpretation", icon="💡")
|
| 150 |
-
st.page_link("pages/Module_08.py",label="Dimensionality Reduction and Feature Selection", icon="🪄")
|
| 151 |
-
st.page_link("pages/Module_09.py",label="Clustering and User Segmentation", icon="👪")
|
| 152 |
-
st.page_link("pages/Module_10.py",label="Model Improvement and Ethical Considerations", icon="⚖️")
|
| 153 |
-
st.page_link("pages/Module_11.py",label="Real-World Deployment and Use Cases", icon="🌐")
|
| 154 |
-
|
| 155 |
-
with st.expander("Your Profile", expanded=False, icon=":material/settings_accessibility:"):
|
| 156 |
-
profile_str = open(os.path.join(st.session_state["start_dir"],"pages","assets","profile.txt"), "r", encoding="UTF-8").read()
|
| 157 |
-
st.markdown(profile_str)
|
| 158 |
-
|
| 159 |
-
with st.expander("Your Progress",expanded=False, icon=":material/preliminary:"):
|
| 160 |
-
progress_str = open(os.path.join(st.session_state["start_dir"],"pages","assets","progress.txt"), "r", encoding="UTF-8").read()
|
| 161 |
-
st.markdown(progress_str)
|
| 162 |
-
|
| 163 |
-
with st.expander("Sample Math Equations", expanded=False, icon=":material/calculate:"):
|
| 164 |
-
overview_str = open(os.path.join(st.session_state["start_dir"],"pages","assets","sample_formula_text.txt"), "r", encoding="UTF-8").read()
|
| 165 |
-
#st.markdown(overview_str)
|
| 166 |
-
format_text(overview_str)
|
| 167 |
-
|
| 168 |
-
with st.expander("Level of Expertise", expanded=False, icon=":material/signal_cellular_alt:"):
|
| 169 |
-
st.slider("Level of Expertise", 0, 1000, 450, key="slide")
|
| 170 |
-
st.radio("Your thoughts", ["I agree", "I disagree"], key="radio")
|
| 171 |
-
st.text_input("Thoughts", placeholder="Add your thoughts", label_visibility="collapsed")
|
| 172 |
-
st.button("Submit")
|
| 173 |
-
|
| 174 |
-
with st.expander("Logout", expanded=False, icon=":material/logout:"):
|
| 175 |
-
if st.button("Logout"):
|
| 176 |
-
del st.session_state["logged_in"]
|
| 177 |
-
st.rerun()
|
| 178 |
-
|
| 179 |
-
# smart_toy (robot)
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
# END Sidebar
|
| 183 |
-
|
| 184 |
-
# =================================================
|
| 185 |
-
# Main Screen Content - e.g. Tabs
|
| 186 |
-
# =================================================
|
| 187 |
-
|
| 188 |
-
if "logged_in" not in st.session_state: # User has logged out
|
| 189 |
-
st.title("🚀 Project ASCEND 🚀")
|
| 190 |
-
st.image(os.path.join(st.session_state["start_dir"],"pages","assets","logo.jpg"), width=450)
|
| 191 |
-
st.write("You have left Project Ascend ... Thank You.")
|
| 192 |
-
|
| 193 |
-
else:
|
| 194 |
-
load_content(module)
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
# =================================================
|
| 198 |
-
# Standalone Code if run as Main
|
| 199 |
-
# =================================================
|
| 200 |
-
|
| 201 |
-
if __name__ == "__main__":
|
| 202 |
-
print("<<< Load Pages - Compile Successful >>>")
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_01/Module_01.ipynb
DELETED
|
@@ -1,90 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"id": "46688de2",
|
| 6 |
-
"metadata": {},
|
| 7 |
-
"source": [
|
| 8 |
-
"# Module 1: Introduction to Machine Learning and E-Commerce Context\n",
|
| 9 |
-
"\n",
|
| 10 |
-
"## Lesson 1.1: What is Machine Learning?\n",
|
| 11 |
-
"\n",
|
| 12 |
-
"- **Machine Learning (ML)** is a technique that enables computers to learn patterns from data and make predictions or decisions without being explicitly programmed.\n",
|
| 13 |
-
"- Types of ML:\n",
|
| 14 |
-
" - *Supervised Learning*: Learn from labeled data (e.g. classification, regression).\n",
|
| 15 |
-
" - *Unsupervised Learning*: Find patterns without labels (e.g. clustering).\n",
|
| 16 |
-
" - *Reinforcement Learning*: Learn by trial and error with rewards.\n",
|
| 17 |
-
"- Real-world examples:\n",
|
| 18 |
-
" - Email spam detection\n",
|
| 19 |
-
" - Product recommendations\n",
|
| 20 |
-
" - Image recognition"
|
| 21 |
-
]
|
| 22 |
-
},
|
| 23 |
-
{
|
| 24 |
-
"cell_type": "code",
|
| 25 |
-
"execution_count": null,
|
| 26 |
-
"id": "fa78899d",
|
| 27 |
-
"metadata": {},
|
| 28 |
-
"outputs": [],
|
| 29 |
-
"source": [
|
| 30 |
-
"# Pseudo-code example: Simple spam detection\n",
|
| 31 |
-
"\n",
|
| 32 |
-
"def train_supervised_model(features, labels):\n",
|
| 33 |
-
" # Imagine this trains a model\n",
|
| 34 |
-
" return 'trained_model'\n",
|
| 35 |
-
"\n",
|
| 36 |
-
"# Dummy data (for explanation only)\n",
|
| 37 |
-
"features = ['email features']\n",
|
| 38 |
-
"labels = ['spam', 'not spam']\n",
|
| 39 |
-
"model = train_supervised_model(features, labels)\n",
|
| 40 |
-
"\n",
|
| 41 |
-
"new_email = 'Some new email data'\n",
|
| 42 |
-
"prediction = 'spam' # Dummy prediction\n",
|
| 43 |
-
"\n",
|
| 44 |
-
"if prediction == 'spam':\n",
|
| 45 |
-
" print(\"This email is spam\")\n",
|
| 46 |
-
"else:\n",
|
| 47 |
-
" print(\"This email is not spam\")"
|
| 48 |
-
]
|
| 49 |
-
},
|
| 50 |
-
{
|
| 51 |
-
"cell_type": "markdown",
|
| 52 |
-
"id": "13f0169f",
|
| 53 |
-
"metadata": {},
|
| 54 |
-
"source": [
|
| 55 |
-
"## Lesson 1.2: Business Problem — Predicting Purchase from Browsing Behavior\n",
|
| 56 |
-
"\n",
|
| 57 |
-
"- E-commerce sites want to understand if users will buy now, later, or possibly never.\n",
|
| 58 |
-
"- Benefits include: personalized marketing, better inventory control, targeted ads.\n",
|
| 59 |
-
"- Typical purchase intent labels:\n",
|
| 60 |
-
" - **Purchase Now**: User makes a purchase during session.\n",
|
| 61 |
-
" - **Purchase Later**: User did not buy now but buys within a time window later.\n",
|
| 62 |
-
" - **No Purchase**: User only browses with no buying intent detected.\n",
|
| 63 |
-
"\n",
|
| 64 |
-
"### Exercise:\n",
|
| 65 |
-
"- Think of 3 behaviors on a website that might indicate buying intent."
|
| 66 |
-
]
|
| 67 |
-
}
|
| 68 |
-
],
|
| 69 |
-
"metadata": {
|
| 70 |
-
"kernelspec": {
|
| 71 |
-
"display_name": "Python 3 (ipykernel)",
|
| 72 |
-
"language": "python",
|
| 73 |
-
"name": "python3"
|
| 74 |
-
},
|
| 75 |
-
"language_info": {
|
| 76 |
-
"codemirror_mode": {
|
| 77 |
-
"name": "ipython",
|
| 78 |
-
"version": 3
|
| 79 |
-
},
|
| 80 |
-
"file_extension": ".py",
|
| 81 |
-
"mimetype": "text/x-python",
|
| 82 |
-
"name": "python",
|
| 83 |
-
"nbconvert_exporter": "python",
|
| 84 |
-
"pygments_lexer": "ipython3",
|
| 85 |
-
"version": "3.12.4"
|
| 86 |
-
}
|
| 87 |
-
},
|
| 88 |
-
"nbformat": 4,
|
| 89 |
-
"nbformat_minor": 5
|
| 90 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_01/Overview.jpg
DELETED
Git LFS Details
|
pages/modules/Module_01/Overview.txt
DELETED
|
@@ -1,13 +0,0 @@
|
|
| 1 |
-
Module 1: Introduction to Machine Learning and E-Commerce Context
|
| 2 |
-
|
| 3 |
-
Lesson 1.1: What is Machine Learning?
|
| 4 |
-
|
| 5 |
-
o Brief overview of ML concepts
|
| 6 |
-
o Types of ML (supervised, unsupervised, reinforcement)
|
| 7 |
-
o Real-world ML applications
|
| 8 |
-
|
| 9 |
-
Lesson 1.2: Business Problem — Predicting Purchase from Browsing Behavior
|
| 10 |
-
|
| 11 |
-
o Understanding e-commerce purchase funnels
|
| 12 |
-
o Why predict purchase intent?
|
| 13 |
-
o Types of user outcomes: purchase now, purchase later, no intent to purchase
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_02/Module_02.ipynb
DELETED
|
@@ -1,158 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"id": "fde9e65f",
|
| 6 |
-
"metadata": {},
|
| 7 |
-
"source": [
|
| 8 |
-
"# Module 2: Basics of Python Programming\n",
|
| 9 |
-
"\n",
|
| 10 |
-
"## Lesson 2.1: Python Essentials for ML\n",
|
| 11 |
-
"\n",
|
| 12 |
-
"- Variables, data types, basic functions\n",
|
| 13 |
-
"- Control flow: loops and conditionals\n",
|
| 14 |
-
"- Using Jupyter Notebook for interactive coding"
|
| 15 |
-
]
|
| 16 |
-
},
|
| 17 |
-
{
|
| 18 |
-
"cell_type": "code",
|
| 19 |
-
"execution_count": null,
|
| 20 |
-
"id": "17367a18",
|
| 21 |
-
"metadata": {},
|
| 22 |
-
"outputs": [],
|
| 23 |
-
"source": [
|
| 24 |
-
"# Example: Variables and types\n",
|
| 25 |
-
"user_name = \"Alice\"\n",
|
| 26 |
-
"pages_visited = 5\n",
|
| 27 |
-
"average_time_on_page = 12.5 # minutes\n",
|
| 28 |
-
"is_returning_visitor = True\n",
|
| 29 |
-
"\n",
|
| 30 |
-
"print(\"User:\", user_name)\n",
|
| 31 |
-
"print(\"Pages Visited:\", pages_visited)\n",
|
| 32 |
-
"print(\"Avg Time per Page:\", average_time_on_page)\n",
|
| 33 |
-
"print(\"Returning Visitor?\", is_returning_visitor)"
|
| 34 |
-
]
|
| 35 |
-
},
|
| 36 |
-
{
|
| 37 |
-
"cell_type": "code",
|
| 38 |
-
"execution_count": null,
|
| 39 |
-
"id": "e0bda962",
|
| 40 |
-
"metadata": {},
|
| 41 |
-
"outputs": [],
|
| 42 |
-
"source": [
|
| 43 |
-
"# Example: Conditional statements\n",
|
| 44 |
-
"if pages_visited > 3:\n",
|
| 45 |
-
" print(user_name + \" is engaged with the website.\")\n",
|
| 46 |
-
"else:\n",
|
| 47 |
-
" print(user_name + \" is casually browsing.\")"
|
| 48 |
-
]
|
| 49 |
-
},
|
| 50 |
-
{
|
| 51 |
-
"cell_type": "code",
|
| 52 |
-
"execution_count": null,
|
| 53 |
-
"id": "ebf9beb3",
|
| 54 |
-
"metadata": {},
|
| 55 |
-
"outputs": [],
|
| 56 |
-
"source": [
|
| 57 |
-
"# Example: Loop to print page numbers visited\n",
|
| 58 |
-
"for page in range(1, pages_visited + 1):\n",
|
| 59 |
-
" print(f\"Visited page {page}\")"
|
| 60 |
-
]
|
| 61 |
-
},
|
| 62 |
-
{
|
| 63 |
-
"cell_type": "markdown",
|
| 64 |
-
"id": "da881d36",
|
| 65 |
-
"metadata": {},
|
| 66 |
-
"source": [
|
| 67 |
-
"## Lesson 2.2: Libraries for Data Science\n",
|
| 68 |
-
"\n",
|
| 69 |
-
"Introduction to essential Python libraries:\n",
|
| 70 |
-
"- **NumPy**: numerical computing\n",
|
| 71 |
-
"- **Pandas**: data manipulation and analysis\n",
|
| 72 |
-
"- **Matplotlib** and **Seaborn**: data visualization"
|
| 73 |
-
]
|
| 74 |
-
},
|
| 75 |
-
{
|
| 76 |
-
"cell_type": "code",
|
| 77 |
-
"execution_count": null,
|
| 78 |
-
"id": "2b8d230c",
|
| 79 |
-
"metadata": {},
|
| 80 |
-
"outputs": [],
|
| 81 |
-
"source": [
|
| 82 |
-
"import pandas as pd\n",
|
| 83 |
-
"import matplotlib.pyplot as plt\n",
|
| 84 |
-
"import seaborn as sns\n",
|
| 85 |
-
"\n",
|
| 86 |
-
"# Create a simple sample dataset\n",
|
| 87 |
-
"data = {\n",
|
| 88 |
-
" 'session_id': [1, 2, 3, 4, 5],\n",
|
| 89 |
-
" 'pages_visited': [5, 3, 8, 2, 7],\n",
|
| 90 |
-
" 'session_duration': [45, 25, 80, 15, 60] # in minutes\n",
|
| 91 |
-
"}\n",
|
| 92 |
-
"\n",
|
| 93 |
-
"df = pd.DataFrame(data)\n",
|
| 94 |
-
"print(df.head())"
|
| 95 |
-
]
|
| 96 |
-
},
|
| 97 |
-
{
|
| 98 |
-
"cell_type": "code",
|
| 99 |
-
"execution_count": null,
|
| 100 |
-
"id": "68d69205",
|
| 101 |
-
"metadata": {},
|
| 102 |
-
"outputs": [],
|
| 103 |
-
"source": [
|
| 104 |
-
"# Plotting number of pages visited per session\n",
|
| 105 |
-
"plt.figure(figsize=(8, 5))\n",
|
| 106 |
-
"sns.barplot(x=df['session_id'], y=df['pages_visited'], palette='viridis')\n",
|
| 107 |
-
"plt.title('Pages Visited per Session')\n",
|
| 108 |
-
"plt.xlabel('Session ID')\n",
|
| 109 |
-
"plt.ylabel('Pages Visited')\n",
|
| 110 |
-
"plt.show()"
|
| 111 |
-
]
|
| 112 |
-
},
|
| 113 |
-
{
|
| 114 |
-
"cell_type": "markdown",
|
| 115 |
-
"id": "9bb97233",
|
| 116 |
-
"metadata": {},
|
| 117 |
-
"source": [
|
| 118 |
-
"## Exercises:\n",
|
| 119 |
-
"1. Write a function `engagement_label(pages)` that returns \"High engagement\" if pages > 4, else \"Low engagement\".\n",
|
| 120 |
-
"2. Load a CSV file called `sample_browsing_data.csv` (you can create one or I can provide sample data later) and print basic statistics.\n",
|
| 121 |
-
"3. Plot a histogram of session durations from the loaded data."
|
| 122 |
-
]
|
| 123 |
-
},
|
| 124 |
-
{
|
| 125 |
-
"cell_type": "markdown",
|
| 126 |
-
"id": "079950e5",
|
| 127 |
-
"metadata": {},
|
| 128 |
-
"source": [
|
| 129 |
-
"## Potential Student Questions:\n",
|
| 130 |
-
"- What are the differences between Python data types?\n",
|
| 131 |
-
"- When do we use for loops versus while loops?\n",
|
| 132 |
-
"- How does Jupyter Notebook help with data science?\n",
|
| 133 |
-
"- Why do we import libraries and what are they used for?"
|
| 134 |
-
]
|
| 135 |
-
}
|
| 136 |
-
],
|
| 137 |
-
"metadata": {
|
| 138 |
-
"kernelspec": {
|
| 139 |
-
"display_name": "Python 3 (ipykernel)",
|
| 140 |
-
"language": "python",
|
| 141 |
-
"name": "python3"
|
| 142 |
-
},
|
| 143 |
-
"language_info": {
|
| 144 |
-
"codemirror_mode": {
|
| 145 |
-
"name": "ipython",
|
| 146 |
-
"version": 3
|
| 147 |
-
},
|
| 148 |
-
"file_extension": ".py",
|
| 149 |
-
"mimetype": "text/x-python",
|
| 150 |
-
"name": "python",
|
| 151 |
-
"nbconvert_exporter": "python",
|
| 152 |
-
"pygments_lexer": "ipython3",
|
| 153 |
-
"version": "3.12.4"
|
| 154 |
-
}
|
| 155 |
-
},
|
| 156 |
-
"nbformat": 4,
|
| 157 |
-
"nbformat_minor": 5
|
| 158 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_02/Overview.jpg
DELETED
Git LFS Details
|
pages/modules/Module_02/Overview.txt
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
Module 2: Basics of Python Programming
|
| 2 |
-
|
| 3 |
-
Lesson 2.1: Python Essentials for ML
|
| 4 |
-
|
| 5 |
-
o Data types, variables, functions
|
| 6 |
-
o Control structures (loops, conditionals)
|
| 7 |
-
o Introduction to Jupyter Notebooks
|
| 8 |
-
|
| 9 |
-
Lesson 2.2: Libraries for Data Science
|
| 10 |
-
|
| 11 |
-
o NumPy and Pandas for data manipulation
|
| 12 |
-
o Matplotlib and Seaborn for data visualization
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_03/Module_03.ipynb
DELETED
|
@@ -1,122 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"metadata": {},
|
| 6 |
-
"source": [
|
| 7 |
-
"# Module 3: Understanding the Data\n",
|
| 8 |
-
"\n",
|
| 9 |
-
"## Lesson 3.1: Exploring Web Browsing Behavior Data\n",
|
| 10 |
-
"\n",
|
| 11 |
-
"- Discuss typical features in browsing datasets:\n",
|
| 12 |
-
" - session_duration (seconds or minutes)\n",
|
| 13 |
-
" - pages_visited\n",
|
| 14 |
-
" - time_per_page\n",
|
| 15 |
-
" - bounce_rate\n",
|
| 16 |
-
" - cart_additions\n",
|
| 17 |
-
"- Introduce the target variable: purchase intent\n",
|
| 18 |
-
" - 'purchase_now', 'purchase_later', 'no_purchase'\n",
|
| 19 |
-
"- Understand data collection methods conceptually (cookies, session logs)"
|
| 20 |
-
]
|
| 21 |
-
},
|
| 22 |
-
{
|
| 23 |
-
"cell_type": "markdown",
|
| 24 |
-
"metadata": {},
|
| 25 |
-
"source": [
|
| 26 |
-
"## Lesson 3.2: Data Loading and Exploration\n",
|
| 27 |
-
"\n",
|
| 28 |
-
"In this lesson, we will load a sample browsing dataset and explore it using basic pandas operations."
|
| 29 |
-
]
|
| 30 |
-
},
|
| 31 |
-
{
|
| 32 |
-
"cell_type": "code",
|
| 33 |
-
"metadata": {},
|
| 34 |
-
"execution_count": null,
|
| 35 |
-
"outputs": [],
|
| 36 |
-
"source": [
|
| 37 |
-
"# Import libraries\n",
|
| 38 |
-
"import pandas as pd\n",
|
| 39 |
-
"import matplotlib.pyplot as plt\n",
|
| 40 |
-
"\n",
|
| 41 |
-
"# Load sample data (replace with your path or URL)\n",
|
| 42 |
-
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 43 |
-
"\n",
|
| 44 |
-
"# Display first 5 rows\n",
|
| 45 |
-
"print(data.head())"
|
| 46 |
-
]
|
| 47 |
-
},
|
| 48 |
-
{
|
| 49 |
-
"cell_type": "code",
|
| 50 |
-
"metadata": {},
|
| 51 |
-
"execution_count": null,
|
| 52 |
-
"outputs": [],
|
| 53 |
-
"source": [
|
| 54 |
-
"# Show data info and summary statistics\n",
|
| 55 |
-
"print(\"\\nData Info:\")\n",
|
| 56 |
-
"print(data.info())\n",
|
| 57 |
-
"\n",
|
| 58 |
-
"print(\"\\nSummary Statistics:\")\n",
|
| 59 |
-
"print(data.describe())"
|
| 60 |
-
]
|
| 61 |
-
},
|
| 62 |
-
{
|
| 63 |
-
"cell_type": "code",
|
| 64 |
-
"metadata": {},
|
| 65 |
-
"execution_count": null,
|
| 66 |
-
"outputs": [],
|
| 67 |
-
"source": [
|
| 68 |
-
"# Count unique values in target variable\n",
|
| 69 |
-
"print('\\nPurchase Intent Distribution:')\n",
|
| 70 |
-
"print(data['purchase_intent'].value_counts())"
|
| 71 |
-
]
|
| 72 |
-
},
|
| 73 |
-
{
|
| 74 |
-
"cell_type": "code",
|
| 75 |
-
"metadata": {},
|
| 76 |
-
"execution_count": null,
|
| 77 |
-
"outputs": [],
|
| 78 |
-
"source": [
|
| 79 |
-
"# Visualize distribution of purchase intent\n",
|
| 80 |
-
"data['purchase_intent'].value_counts().plot(kind='bar', title='Purchase Intent Distribution')\n",
|
| 81 |
-
"plt.xlabel('Purchase Intent')\n",
|
| 82 |
-
"plt.ylabel('Number of Sessions')\n",
|
| 83 |
-
"plt.show()"
|
| 84 |
-
]
|
| 85 |
-
},
|
| 86 |
-
{
|
| 87 |
-
"cell_type": "markdown",
|
| 88 |
-
"metadata": {},
|
| 89 |
-
"source": [
|
| 90 |
-
"## Exercises:\n",
|
| 91 |
-
"1. Load the `sample_browsing_data.csv` file.\n",
|
| 92 |
-
"2. Use `.info()` and `.describe()` to understand your dataset.\n",
|
| 93 |
-
"3. Count how many sessions belong to each purchase intent category.\n",
|
| 94 |
-
"4. Plot the distribution of a numeric feature (e.g., `session_duration`)."
|
| 95 |
-
]
|
| 96 |
-
},
|
| 97 |
-
{
|
| 98 |
-
"cell_type": "markdown",
|
| 99 |
-
"metadata": {},
|
| 100 |
-
"source": [
|
| 101 |
-
"## Potential Student Questions:\n",
|
| 102 |
-
"- What do the different columns represent?\n",
|
| 103 |
-
"- Why do we look at both `.info()` and `.describe()`?\n",
|
| 104 |
-
"- How is purchase intent labeled if the user doesn't buy immediately?\n",
|
| 105 |
-
"- How can we trust the quality of collected web browsing data?"
|
| 106 |
-
]
|
| 107 |
-
}
|
| 108 |
-
],
|
| 109 |
-
"metadata": {
|
| 110 |
-
"kernelspec": {
|
| 111 |
-
"display_name": "Python 3",
|
| 112 |
-
"language": "python",
|
| 113 |
-
"name": "python3"
|
| 114 |
-
},
|
| 115 |
-
"language_info": {
|
| 116 |
-
"name": "python",
|
| 117 |
-
"version": "3.x"
|
| 118 |
-
}
|
| 119 |
-
},
|
| 120 |
-
"nbformat": 4,
|
| 121 |
-
"nbformat_minor": 5
|
| 122 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_03/Overview.jpg
DELETED
Git LFS Details
|
pages/modules/Module_03/Overview.txt
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
Module 3: Understanding the Data
|
| 2 |
-
|
| 3 |
-
Lesson 3.1: Exploring Web Browsing Behavior Data
|
| 4 |
-
|
| 5 |
-
o Typical data fields: session duration, pages visited, time on page, bounce rate, cart additions
|
| 6 |
-
o Data collection methods (cookies, session logs — conceptual)
|
| 7 |
-
|
| 8 |
-
Lesson 3.2: Data Loading and Exploration
|
| 9 |
-
|
| 10 |
-
o Loading sample browsing data into Pandas
|
| 11 |
-
o Basic descriptive statistics and visualization
|
| 12 |
-
o Identifying target variable and features
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_04/Module_04.ipynb
DELETED
|
@@ -1,116 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"metadata": {},
|
| 6 |
-
"source": [
|
| 7 |
-
"# Module 4: Data Preprocessing & Feature Engineering\n",
|
| 8 |
-
"\n",
|
| 9 |
-
"## Lesson 4.1: Handling Missing Data and Data Cleaning\n",
|
| 10 |
-
"\n",
|
| 11 |
-
"- Identify missing values in dataset\n",
|
| 12 |
-
"- Techniques for handling missing data: dropping, imputing\n",
|
| 13 |
-
"- Cleaning inconsistent or noisy data"
|
| 14 |
-
]
|
| 15 |
-
},
|
| 16 |
-
{
|
| 17 |
-
"cell_type": "code",
|
| 18 |
-
"metadata": {},
|
| 19 |
-
"execution_count": null,
|
| 20 |
-
"outputs": [],
|
| 21 |
-
"source": [
|
| 22 |
-
"import pandas as pd\n",
|
| 23 |
-
"\n",
|
| 24 |
-
"# Load sample data\n",
|
| 25 |
-
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 26 |
-
"\n",
|
| 27 |
-
"# Check for missing values\n",
|
| 28 |
-
"print(\"Missing values per column:\")\n",
|
| 29 |
-
"print(data.isnull().sum())"
|
| 30 |
-
]
|
| 31 |
-
},
|
| 32 |
-
{
|
| 33 |
-
"cell_type": "code",
|
| 34 |
-
"metadata": {},
|
| 35 |
-
"execution_count": null,
|
| 36 |
-
"outputs": [],
|
| 37 |
-
"source": [
|
| 38 |
-
"# Fill missing 'session_duration' values with median\n",
|
| 39 |
-
"median_duration = data['session_duration'].median()\n",
|
| 40 |
-
"data['session_duration'].fillna(median_duration, inplace=True)\n",
|
| 41 |
-
"\n",
|
| 42 |
-
"# Verify no missing values remain in 'session_duration'\n",
|
| 43 |
-
"print(\"Missing values in 'session_duration' after fill:\", data['session_duration'].isnull().sum())"
|
| 44 |
-
]
|
| 45 |
-
},
|
| 46 |
-
{
|
| 47 |
-
"cell_type": "markdown",
|
| 48 |
-
"metadata": {},
|
| 49 |
-
"source": [
|
| 50 |
-
"## Lesson 4.2: Feature Engineering\n",
|
| 51 |
-
"\n",
|
| 52 |
-
"- Creating new features from existing data\n",
|
| 53 |
-
"- Example: Average time spent per page\n",
|
| 54 |
-
"- Encoding categorical variables with one-hot encoding"
|
| 55 |
-
]
|
| 56 |
-
},
|
| 57 |
-
{
|
| 58 |
-
"cell_type": "code",
|
| 59 |
-
"metadata": {},
|
| 60 |
-
"execution_count": null,
|
| 61 |
-
"outputs": [],
|
| 62 |
-
"source": [
|
| 63 |
-
"# Create average time spent per page feature\n",
|
| 64 |
-
"data['avg_time_per_page'] = data['session_duration'] / data['pages_visited']\n",
|
| 65 |
-
"print(data[['session_duration', 'pages_visited', 'avg_time_per_page']].head())"
|
| 66 |
-
]
|
| 67 |
-
},
|
| 68 |
-
{
|
| 69 |
-
"cell_type": "code",
|
| 70 |
-
"metadata": {},
|
| 71 |
-
"execution_count": null,
|
| 72 |
-
"outputs": [],
|
| 73 |
-
"source": [
|
| 74 |
-
"# One-hot encode 'device_type' categorical feature\n",
|
| 75 |
-
"data = pd.get_dummies(data, columns=['device_type'], drop_first=True)\n",
|
| 76 |
-
"\n",
|
| 77 |
-
"# Show new columns resulting from one-hot encoding\n",
|
| 78 |
-
"print(data.columns)"
|
| 79 |
-
]
|
| 80 |
-
},
|
| 81 |
-
{
|
| 82 |
-
"cell_type": "markdown",
|
| 83 |
-
"metadata": {},
|
| 84 |
-
"source": [
|
| 85 |
-
"## Exercises:\n",
|
| 86 |
-
"1. Identify columns with missing values and decide how to handle them.\n",
|
| 87 |
-
"2. Engineer a new feature: \"cart_additions_per_session\" (if you have cart additions data).\n",
|
| 88 |
-
"3. Convert any other categorical variables in your dataset to one-hot encoded columns."
|
| 89 |
-
]
|
| 90 |
-
},
|
| 91 |
-
{
|
| 92 |
-
"cell_type": "markdown",
|
| 93 |
-
"metadata": {},
|
| 94 |
-
"source": [
|
| 95 |
-
"## Potential Student Questions:\n",
|
| 96 |
-
"- When should I fill missing data vs remove rows?\n",
|
| 97 |
-
"- What are some common strategies for feature engineering?\n",
|
| 98 |
-
"- Why do we need to one-hot encode categorical variables?\n",
|
| 99 |
-
"- How can feature engineering improve model performance?"
|
| 100 |
-
]
|
| 101 |
-
}
|
| 102 |
-
],
|
| 103 |
-
"metadata": {
|
| 104 |
-
"kernelspec": {
|
| 105 |
-
"display_name": "Python 3",
|
| 106 |
-
"language": "python",
|
| 107 |
-
"name": "python3"
|
| 108 |
-
},
|
| 109 |
-
"language_info": {
|
| 110 |
-
"name": "python",
|
| 111 |
-
"version": "3.x"
|
| 112 |
-
}
|
| 113 |
-
},
|
| 114 |
-
"nbformat": 4,
|
| 115 |
-
"nbformat_minor": 5
|
| 116 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_04/Overview.jpg
DELETED
Git LFS Details
|
pages/modules/Module_04/Overview.txt
DELETED
|
@@ -1,10 +0,0 @@
|
|
| 1 |
-
Module 4: Data Preprocessing & Feature Engineering
|
| 2 |
-
|
| 3 |
-
Lesson 4.1: Handling Missing Data and Data Cleaning
|
| 4 |
-
o Identifying missing or inconsistent data
|
| 5 |
-
o Imputing missing values
|
| 6 |
-
|
| 7 |
-
Lesson 4.2: Feature Engineering
|
| 8 |
-
o Creating new features from raw browsing data (e.g., average time per page, number of product page visits)
|
| 9 |
-
o Encoding categorical variables
|
| 10 |
-
o Feature scaling for ML algorithms
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_05/Module_05.ipynb
DELETED
|
@@ -1,107 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"metadata": {},
|
| 6 |
-
"source": [
|
| 7 |
-
"# Module 5: Introduction to Classification and XGBoost\n",
|
| 8 |
-
"\n",
|
| 9 |
-
"## Lesson 5.1: Classification Problem\n",
|
| 10 |
-
"\n",
|
| 11 |
-
"- Difference between classification and regression\n",
|
| 12 |
-
"- Introduction to multi-class classification (3 classes: purchase now, purchase later, no purchase)\n",
|
| 13 |
-
"- Encoding categorical labels as numbers for ML models"
|
| 14 |
-
]
|
| 15 |
-
},
|
| 16 |
-
{
|
| 17 |
-
"cell_type": "code",
|
| 18 |
-
"metadata": {},
|
| 19 |
-
"execution_count": null,
|
| 20 |
-
"outputs": [],
|
| 21 |
-
"source": [
|
| 22 |
-
"import pandas as pd\n",
|
| 23 |
-
"from sklearn.preprocessing import LabelEncoder\n",
|
| 24 |
-
"\n",
|
| 25 |
-
"# Assume data loaded previously\n",
|
| 26 |
-
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 27 |
-
"\n",
|
| 28 |
-
"# Show unique classes in target\n",
|
| 29 |
-
"print(\"Purchase intent classes:\", data['purchase_intent'].unique())\n",
|
| 30 |
-
"\n",
|
| 31 |
-
"# Encode target labels numerically\n",
|
| 32 |
-
"le = LabelEncoder()\n",
|
| 33 |
-
"data['purchase_intent_encoded'] = le.fit_transform(data['purchase_intent'])\n",
|
| 34 |
-
"print(data[['purchase_intent', 'purchase_intent_encoded']].head())"
|
| 35 |
-
]
|
| 36 |
-
},
|
| 37 |
-
{
|
| 38 |
-
"cell_type": "markdown",
|
| 39 |
-
"metadata": {},
|
| 40 |
-
"source": [
|
| 41 |
-
"## Lesson 5.2: Introduction to XGBoost\n",
|
| 42 |
-
"\n",
|
| 43 |
-
"- What is XGBoost? Tree boosting algorithm often effective for tabular data\n",
|
| 44 |
-
"- Installation and import\n",
|
| 45 |
-
"- Basic concepts: boosting, trees, objective function"
|
| 46 |
-
]
|
| 47 |
-
},
|
| 48 |
-
{
|
| 49 |
-
"cell_type": "code",
|
| 50 |
-
"metadata": {},
|
| 51 |
-
"execution_count": null,
|
| 52 |
-
"outputs": [],
|
| 53 |
-
"source": [
|
| 54 |
-
"# Install XGBoost if not already installed (uncomment to run in Jupyter)\n",
|
| 55 |
-
"# !pip install xgboost\n",
|
| 56 |
-
"\n",
|
| 57 |
-
"import xgboost as xgb\n",
|
| 58 |
-
"print(\"XGBoost version:\", xgb.__version__)\n"
|
| 59 |
-
]
|
| 60 |
-
},
|
| 61 |
-
{
|
| 62 |
-
"cell_type": "markdown",
|
| 63 |
-
"metadata": {},
|
| 64 |
-
"source": [
|
| 65 |
-
"### Summary:\n",
|
| 66 |
-
"- We prepare features and labels\n",
|
| 67 |
-
"- Encode labels for multi-class classification\n",
|
| 68 |
-
"- Use XGBoost as an effective classifier for predicting purchase intent"
|
| 69 |
-
]
|
| 70 |
-
},
|
| 71 |
-
{
|
| 72 |
-
"cell_type": "markdown",
|
| 73 |
-
"metadata": {},
|
| 74 |
-
"source": [
|
| 75 |
-
"## Exercises:\n",
|
| 76 |
-
"1. Explore your dataset target classes.\n",
|
| 77 |
-
"2. Encode the purchase intent column using LabelEncoder.\n",
|
| 78 |
-
"3. Try installing and importing XGBoost on your system or notebook.\n",
|
| 79 |
-
"4. Read about XGBoost's key concepts (boosting, trees) from official docs or tutorials."
|
| 80 |
-
]
|
| 81 |
-
},
|
| 82 |
-
{
|
| 83 |
-
"cell_type": "markdown",
|
| 84 |
-
"metadata": {},
|
| 85 |
-
"source": [
|
| 86 |
-
"## Potential Student Questions:\n",
|
| 87 |
-
"- Why do we convert labels to numbers?\n",
|
| 88 |
-
"- What makes XGBoost powerful compared to other classifiers?\n",
|
| 89 |
-
"- Can XGBoost handle multi-class problems?\n",
|
| 90 |
-
"- Do we need to preprocess data differently for XGBoost?"
|
| 91 |
-
]
|
| 92 |
-
}
|
| 93 |
-
],
|
| 94 |
-
"metadata": {
|
| 95 |
-
"kernelspec": {
|
| 96 |
-
"display_name": "Python 3",
|
| 97 |
-
"language": "python",
|
| 98 |
-
"name": "python3"
|
| 99 |
-
},
|
| 100 |
-
"language_info": {
|
| 101 |
-
"name": "python",
|
| 102 |
-
"version": "3.x"
|
| 103 |
-
}
|
| 104 |
-
},
|
| 105 |
-
"nbformat": 4,
|
| 106 |
-
"nbformat_minor": 5
|
| 107 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_05/Overview.jpg
DELETED
Git LFS Details
|
pages/modules/Module_05/Overview.txt
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
Module 5: Introduction to Classification and XGBoost
|
| 2 |
-
|
| 3 |
-
Lesson 5.1: Classification Problems
|
| 4 |
-
|
| 5 |
-
o Defining classification vs regression
|
| 6 |
-
o Multi-class classification explanation (purchase now, later, no purchase)
|
| 7 |
-
|
| 8 |
-
Lesson 5.2: Introduction to XGBoost
|
| 9 |
-
|
| 10 |
-
o What is XGBoost and why use it?
|
| 11 |
-
o Boosting concepts and decision trees (simple intuition)
|
| 12 |
-
o Installing and importing XGBoost in Python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_06/Module_06.ipynb
DELETED
|
@@ -1,144 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"metadata": {},
|
| 6 |
-
"source": [
|
| 7 |
-
"# Module 6: Building the Predictive Model\n",
|
| 8 |
-
"\n",
|
| 9 |
-
"## Lesson 6.1: Splitting Data into Train and Test Sets\n",
|
| 10 |
-
"\n",
|
| 11 |
-
"- Importance of splitting data to evaluate generalization\n",
|
| 12 |
-
"- Use scikit-learn's `train_test_split`"
|
| 13 |
-
]
|
| 14 |
-
},
|
| 15 |
-
{
|
| 16 |
-
"cell_type": "code",
|
| 17 |
-
"metadata": {},
|
| 18 |
-
"execution_count": null,
|
| 19 |
-
"outputs": [],
|
| 20 |
-
"source": [
|
| 21 |
-
"import pandas as pd\n",
|
| 22 |
-
"from sklearn.model_selection import train_test_split\n",
|
| 23 |
-
"\n",
|
| 24 |
-
"# Load dataset and encode target if needed\n",
|
| 25 |
-
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 26 |
-
"from sklearn.preprocessing import LabelEncoder\n",
|
| 27 |
-
"le = LabelEncoder()\n",
|
| 28 |
-
"data['purchase_intent_encoded'] = le.fit_transform(data['purchase_intent'])\n",
|
| 29 |
-
"\n",
|
| 30 |
-
"# Define features and target\n",
|
| 31 |
-
"X = data.drop(columns=['purchase_intent', 'purchase_intent_encoded'])\n",
|
| 32 |
-
"y = data['purchase_intent_encoded']\n",
|
| 33 |
-
"\n",
|
| 34 |
-
"# Split data\n",
|
| 35 |
-
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
|
| 36 |
-
"\n",
|
| 37 |
-
"print(f\"Training samples: {len(X_train)}\")\n",
|
| 38 |
-
"print(f\"Test samples: {len(X_test)}\")"
|
| 39 |
-
]
|
| 40 |
-
},
|
| 41 |
-
{
|
| 42 |
-
"cell_type": "markdown",
|
| 43 |
-
"metadata": {},
|
| 44 |
-
"source": [
|
| 45 |
-
"## Lesson 6.2: Training the XGBoost Classifier\n",
|
| 46 |
-
"\n",
|
| 47 |
-
"- Initialize XGBoost classifier for multi-class\n",
|
| 48 |
-
"- Fit model on training data"
|
| 49 |
-
]
|
| 50 |
-
},
|
| 51 |
-
{
|
| 52 |
-
"cell_type": "code",
|
| 53 |
-
"metadata": {},
|
| 54 |
-
"execution_count": null,
|
| 55 |
-
"outputs": [],
|
| 56 |
-
"source": [
|
| 57 |
-
"import xgboost as xgb\n",
|
| 58 |
-
"\n",
|
| 59 |
-
"# Initialize model with parameters for multi-class\n",
|
| 60 |
-
"model = xgb.XGBClassifier(objective='multi:softmax', num_class=3, eval_metric='mlogloss', use_label_encoder=False, seed=42)\n",
|
| 61 |
-
"\n",
|
| 62 |
-
"# Train model\n",
|
| 63 |
-
"model.fit(X_train, y_train)"
|
| 64 |
-
]
|
| 65 |
-
},
|
| 66 |
-
{
|
| 67 |
-
"cell_type": "markdown",
|
| 68 |
-
"metadata": {},
|
| 69 |
-
"source": [
|
| 70 |
-
"## Lesson 6.3: Evaluating Model Performance\n",
|
| 71 |
-
"\n",
|
| 72 |
-
"- Predict on test set\n",
|
| 73 |
-
"- Calculate accuracy and classification report\n",
|
| 74 |
-
"- Plot confusion matrix"
|
| 75 |
-
]
|
| 76 |
-
},
|
| 77 |
-
{
|
| 78 |
-
"cell_type": "code",
|
| 79 |
-
"metadata": {},
|
| 80 |
-
"execution_count": null,
|
| 81 |
-
"outputs": [],
|
| 82 |
-
"source": [
|
| 83 |
-
"from sklearn.metrics import accuracy_score, classification_report, confusion_matrix\n",
|
| 84 |
-
"import matplotlib.pyplot as plt\n",
|
| 85 |
-
"import seaborn as sns\n",
|
| 86 |
-
"\n",
|
| 87 |
-
"# Predictions\n",
|
| 88 |
-
"y_pred = model.predict(X_test)\n",
|
| 89 |
-
"\n",
|
| 90 |
-
"# Accuracy\n",
|
| 91 |
-
"acc = accuracy_score(y_test, y_pred)\n",
|
| 92 |
-
"print(f\"Accuracy on test set: {acc:.2f}\")\n",
|
| 93 |
-
"\n",
|
| 94 |
-
"# Classification report\n",
|
| 95 |
-
"print(\"Classification Report:\")\n",
|
| 96 |
-
"print(classification_report(y_test, y_pred, target_names=le.classes_))\n",
|
| 97 |
-
"\n",
|
| 98 |
-
"# Confusion matrix\n",
|
| 99 |
-
"cm = confusion_matrix(y_test, y_pred)\n",
|
| 100 |
-
"plt.figure(figsize=(7,5))\n",
|
| 101 |
-
"sns.heatmap(cm, annot=True, fmt='d', cmap='Blues', xticklabels=le.classes_, yticklabels=le.classes_)\n",
|
| 102 |
-
"plt.xlabel('Predicted Label')\n",
|
| 103 |
-
"plt.ylabel('True Label')\n",
|
| 104 |
-
"plt.title('Confusion Matrix')\n",
|
| 105 |
-
"plt.show()"
|
| 106 |
-
]
|
| 107 |
-
},
|
| 108 |
-
{
|
| 109 |
-
"cell_type": "markdown",
|
| 110 |
-
"metadata": {},
|
| 111 |
-
"source": [
|
| 112 |
-
"## Exercises:\n",
|
| 113 |
-
"1. Split your dataset into train/test sets with 80/20 ratio.\n",
|
| 114 |
-
"2. Initialize and train an XGBoost classifier with multi-class support.\n",
|
| 115 |
-
"3. Compute test accuracy and plot the confusion matrix.\n",
|
| 116 |
-
"4. Experiment with different random states and observe accuracy changes."
|
| 117 |
-
]
|
| 118 |
-
},
|
| 119 |
-
{
|
| 120 |
-
"cell_type": "markdown",
|
| 121 |
-
"metadata": {},
|
| 122 |
-
"source": [
|
| 123 |
-
"## Potential Student Questions:\n",
|
| 124 |
-
"- Why do we split data and not train on the entire set?\n",
|
| 125 |
-
"- What is the confusion matrix and how do we interpret it?\n",
|
| 126 |
-
"- What is multi-class softmax objective in XGBoost?\n",
|
| 127 |
-
"- How do parameters like `random_state` affect results?"
|
| 128 |
-
]
|
| 129 |
-
}
|
| 130 |
-
],
|
| 131 |
-
"metadata": {
|
| 132 |
-
"kernelspec": {
|
| 133 |
-
"display_name": "Python 3",
|
| 134 |
-
"language": "python",
|
| 135 |
-
"name": "python3"
|
| 136 |
-
},
|
| 137 |
-
"language_info": {
|
| 138 |
-
"name": "python",
|
| 139 |
-
"version": "3.x"
|
| 140 |
-
}
|
| 141 |
-
},
|
| 142 |
-
"nbformat": 4,
|
| 143 |
-
"nbformat_minor": 5
|
| 144 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_06/Overview.jpg
DELETED
Git LFS Details
|
pages/modules/Module_06/Overview.txt
DELETED
|
@@ -1,15 +0,0 @@
|
|
| 1 |
-
Module 6: Building the Predictive Model
|
| 2 |
-
|
| 3 |
-
Lesson 6.1: Splitting Data into Train and Test Sets
|
| 4 |
-
|
| 5 |
-
o Purpose of train-test split
|
| 6 |
-
o Using scikit-learn’s train_test_split
|
| 7 |
-
|
| 8 |
-
Lesson 6.2: Training the XGBoost Classifier
|
| 9 |
-
o Configuring XGBoost parameters for multi-class classification
|
| 10 |
-
o Fitting the model to training data
|
| 11 |
-
|
| 12 |
-
Lesson 6.3: Evaluating Model Performance
|
| 13 |
-
o Accuracy, precision, recall, F1-score basics
|
| 14 |
-
o Confusion matrix explanation and visualization
|
| 15 |
-
o Introduction to cross-validation (concept overview)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_07/Module_07.ipynb
DELETED
|
@@ -1,91 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"metadata": {},
|
| 6 |
-
"source": [
|
| 7 |
-
"# Module 7: Feature Importance and Model Interpretation\n",
|
| 8 |
-
"\n",
|
| 9 |
-
"## Lesson 7.1: Understanding Feature Importance\n",
|
| 10 |
-
"\n",
|
| 11 |
-
"- Why feature importance matters\n",
|
| 12 |
-
"- How XGBoost calculates feature importance (weight, gain, cover)\n",
|
| 13 |
-
"- Visualizing feature importance"
|
| 14 |
-
]
|
| 15 |
-
},
|
| 16 |
-
{
|
| 17 |
-
"cell_type": "code",
|
| 18 |
-
"metadata": {},
|
| 19 |
-
"execution_count": null,
|
| 20 |
-
"outputs": [],
|
| 21 |
-
"source": [
|
| 22 |
-
"import pandas as pd\n",
|
| 23 |
-
"import xgboost as xgb\n",
|
| 24 |
-
"import matplotlib.pyplot as plt\n",
|
| 25 |
-
"\n",
|
| 26 |
-
"# Load dataset and train model (reuse from Module 6)\n",
|
| 27 |
-
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 28 |
-
"from sklearn.preprocessing import LabelEncoder\n",
|
| 29 |
-
"le = LabelEncoder()\n",
|
| 30 |
-
"data['purchase_intent_encoded'] = le.fit_transform(data['purchase_intent'])\n",
|
| 31 |
-
"X = data.drop(columns=['purchase_intent', 'purchase_intent_encoded'])\n",
|
| 32 |
-
"y = data['purchase_intent_encoded']\n",
|
| 33 |
-
" \n",
|
| 34 |
-
"from sklearn.model_selection import train_test_split\n",
|
| 35 |
-
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
|
| 36 |
-
"\n",
|
| 37 |
-
"model = xgb.XGBClassifier(objective='multi:softmax', num_class=3, use_label_encoder=False, eval_metric='mlogloss', seed=42)\n",
|
| 38 |
-
"model.fit(X_train, y_train)\n",
|
| 39 |
-
"\n",
|
| 40 |
-
"# Plot feature importance\n",
|
| 41 |
-
"xgb.plot_importance(model, max_num_features=10, importance_type='gain')\n",
|
| 42 |
-
"plt.title('Top 10 Feature Importances (Gain)')\n",
|
| 43 |
-
"plt.show()"
|
| 44 |
-
]
|
| 45 |
-
},
|
| 46 |
-
{
|
| 47 |
-
"cell_type": "markdown",
|
| 48 |
-
"metadata": {},
|
| 49 |
-
"source": [
|
| 50 |
-
"## Lesson 7.2: Using Feature Importance for Insights\n",
|
| 51 |
-
"\n",
|
| 52 |
-
"- Understand which features drive purchase intent predictions\n",
|
| 53 |
-
"- Discuss practical applications of feature importance (marketing, product design)"
|
| 54 |
-
]
|
| 55 |
-
},
|
| 56 |
-
{
|
| 57 |
-
"cell_type": "markdown",
|
| 58 |
-
"metadata": {},
|
| 59 |
-
"source": [
|
| 60 |
-
"## Exercises:\n",
|
| 61 |
-
"1. Plot the feature importance of your dataset’s model.\n",
|
| 62 |
-
"2. Identify the top 5 features and suggest why they might be important.\n",
|
| 63 |
-
"3. Write a short paragraph explaining how you’d use these insights in a business context."
|
| 64 |
-
]
|
| 65 |
-
},
|
| 66 |
-
{
|
| 67 |
-
"cell_type": "markdown",
|
| 68 |
-
"metadata": {},
|
| 69 |
-
"source": [
|
| 70 |
-
"## Potential Student Questions:\n",
|
| 71 |
-
"- What does 'gain' mean in feature importance?\n",
|
| 72 |
-
"- Are feature importance scores always reliable?\n",
|
| 73 |
-
"- Can feature importance tell us about causality?\n",
|
| 74 |
-
"- How to handle features that appear unimportant?"
|
| 75 |
-
]
|
| 76 |
-
}
|
| 77 |
-
],
|
| 78 |
-
"metadata": {
|
| 79 |
-
"kernelspec": {
|
| 80 |
-
"display_name": "Python 3",
|
| 81 |
-
"language": "python",
|
| 82 |
-
"name": "python3"
|
| 83 |
-
},
|
| 84 |
-
"language_info": {
|
| 85 |
-
"name": "python",
|
| 86 |
-
"version": "3.x"
|
| 87 |
-
}
|
| 88 |
-
},
|
| 89 |
-
"nbformat": 4,
|
| 90 |
-
"nbformat_minor": 5
|
| 91 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_07/Overview.jpg
DELETED
Git LFS Details
|
pages/modules/Module_07/Overview.txt
DELETED
|
@@ -1,12 +0,0 @@
|
|
| 1 |
-
Module 7: Feature Importance and Model Interpretation
|
| 2 |
-
|
| 3 |
-
Lesson 7.1: Understanding Feature Importance
|
| 4 |
-
|
| 5 |
-
o Why feature importance matters
|
| 6 |
-
o How XGBoost calculates feature importance (gain, cover, weight)
|
| 7 |
-
o Plotting feature importance with XGBoost built-in functions and external libraries (Matplotlib, SHAP overview)
|
| 8 |
-
|
| 9 |
-
Lesson 7.2: Using Feature Importance for Insights
|
| 10 |
-
|
| 11 |
-
o Identifying key drivers of purchase intent
|
| 12 |
-
o Practical implications for marketing strategies or UI improvements
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_08/Module_08.ipynb
DELETED
|
@@ -1,124 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"metadata": {},
|
| 6 |
-
"source": [
|
| 7 |
-
"# Module 8: Dimensionality Reduction and Feature Selection\n",
|
| 8 |
-
"\n",
|
| 9 |
-
"## Lesson 8.1: Why Reduce Features?\n",
|
| 10 |
-
"- Discuss curse of dimensionality and computational cost\n",
|
| 11 |
-
"- Benefits: faster training, reduced noise, easier visualization"
|
| 12 |
-
]
|
| 13 |
-
},
|
| 14 |
-
{
|
| 15 |
-
"cell_type": "markdown",
|
| 16 |
-
"metadata": {},
|
| 17 |
-
"source": [
|
| 18 |
-
"## Lesson 8.2: Principal Component Analysis (PCA)\n",
|
| 19 |
-
"- Introduce PCA concept: transform features into uncorrelated principal components\n",
|
| 20 |
-
"- Apply PCA to scaled data\n",
|
| 21 |
-
"- Plot explained variance to identify how many components to keep"
|
| 22 |
-
]
|
| 23 |
-
},
|
| 24 |
-
{
|
| 25 |
-
"cell_type": "code",
|
| 26 |
-
"metadata": {},
|
| 27 |
-
"execution_count": null,
|
| 28 |
-
"outputs": [],
|
| 29 |
-
"source": [
|
| 30 |
-
"import pandas as pd\n",
|
| 31 |
-
"import numpy as np\n",
|
| 32 |
-
"from sklearn.decomposition import PCA\n",
|
| 33 |
-
"from sklearn.preprocessing import StandardScaler\n",
|
| 34 |
-
"import matplotlib.pyplot as plt\n",
|
| 35 |
-
"\n",
|
| 36 |
-
"# Load dataset\n",
|
| 37 |
-
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 38 |
-
"X = data.drop(columns=['purchase_intent'])\n",
|
| 39 |
-
"\n",
|
| 40 |
-
"# Some preprocessing: handle missing, drop non-numeric if needed\n",
|
| 41 |
-
"X = X.select_dtypes(include=[np.number])\n",
|
| 42 |
-
"X.fillna(X.median(), inplace=True)\n",
|
| 43 |
-
"\n",
|
| 44 |
-
"# Scale features\n",
|
| 45 |
-
"scaler = StandardScaler()\n",
|
| 46 |
-
"X_scaled = scaler.fit_transform(X)\n",
|
| 47 |
-
"\n",
|
| 48 |
-
"# Apply PCA\n",
|
| 49 |
-
"pca = PCA()\n",
|
| 50 |
-
"pca.fit(X_scaled)\n",
|
| 51 |
-
"\n",
|
| 52 |
-
"# Plot cumulative explained variance\n",
|
| 53 |
-
"plt.figure(figsize=(8,5))\n",
|
| 54 |
-
"plt.plot(np.cumsum(pca.explained_variance_ratio_))\n",
|
| 55 |
-
"plt.xlabel('Number of Principal Components')\n",
|
| 56 |
-
"plt.ylabel('Cumulative Explained Variance')\n",
|
| 57 |
-
"plt.title('PCA - Explained Variance vs Number of Components')\n",
|
| 58 |
-
"plt.grid(True)\n",
|
| 59 |
-
"plt.show()"
|
| 60 |
-
]
|
| 61 |
-
},
|
| 62 |
-
{
|
| 63 |
-
"cell_type": "markdown",
|
| 64 |
-
"metadata": {},
|
| 65 |
-
"source": [
|
| 66 |
-
"## Lesson 8.3: The Elbow Method for Feature Selection\n",
|
| 67 |
-
"- Use the \"elbow\" in explained variance plot to decide how many components to keep\n",
|
| 68 |
-
"- Dimensionality reduction improves model speed and may improve accuracy"
|
| 69 |
-
]
|
| 70 |
-
},
|
| 71 |
-
{
|
| 72 |
-
"cell_type": "code",
|
| 73 |
-
"metadata": {},
|
| 74 |
-
"execution_count": null,
|
| 75 |
-
"outputs": [],
|
| 76 |
-
"source": [
|
| 77 |
-
"# Example: choose number of components that explain at least 90% variance\n",
|
| 78 |
-
"cumulative_variance = np.cumsum(pca.explained_variance_ratio_)\n",
|
| 79 |
-
"n_components_90 = np.argmax(cumulative_variance >= 0.90) + 1\n",
|
| 80 |
-
"print(f\"Number of components to explain 90% variance: {n_components_90}\")\n",
|
| 81 |
-
"\n",
|
| 82 |
-
"# Transform data with selected components\n",
|
| 83 |
-
"pca_selected = PCA(n_components=n_components_90)\n",
|
| 84 |
-
"X_reduced = pca_selected.fit_transform(X_scaled)\n",
|
| 85 |
-
"print(f\"Shape of reduced data: {X_reduced.shape}\")"
|
| 86 |
-
]
|
| 87 |
-
},
|
| 88 |
-
{
|
| 89 |
-
"cell_type": "markdown",
|
| 90 |
-
"metadata": {},
|
| 91 |
-
"source": [
|
| 92 |
-
"## Exercises:\n",
|
| 93 |
-
"1. Perform PCA on your dataset features.\n",
|
| 94 |
-
"2. Plot and interpret the explained variance curve.\n",
|
| 95 |
-
"3. Choose the number of components using the elbow method.\n",
|
| 96 |
-
"4. Transform your dataset into the reduced PCA space."
|
| 97 |
-
]
|
| 98 |
-
},
|
| 99 |
-
{
|
| 100 |
-
"cell_type": "markdown",
|
| 101 |
-
"metadata": {},
|
| 102 |
-
"source": [
|
| 103 |
-
"## Potential Student Questions:\n",
|
| 104 |
-
"- What does each principal component represent?\n",
|
| 105 |
-
"- Should we always reduce dimensionality?\n",
|
| 106 |
-
"- How to decide how many components to keep?\n",
|
| 107 |
-
"- Does PCA guarantee better model accuracy?"
|
| 108 |
-
]
|
| 109 |
-
}
|
| 110 |
-
],
|
| 111 |
-
"metadata": {
|
| 112 |
-
"kernelspec": {
|
| 113 |
-
"display_name": "Python 3",
|
| 114 |
-
"language": "python",
|
| 115 |
-
"name": "python3"
|
| 116 |
-
},
|
| 117 |
-
"language_info": {
|
| 118 |
-
"name": "python",
|
| 119 |
-
"version": "3.x"
|
| 120 |
-
}
|
| 121 |
-
},
|
| 122 |
-
"nbformat": 4,
|
| 123 |
-
"nbformat_minor": 5
|
| 124 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_08/Overview.jpg
DELETED
Git LFS Details
|
pages/modules/Module_08/Overview.txt
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
Module 8: Dimensionality Reduction and Feature Selection
|
| 2 |
-
|
| 3 |
-
Lesson 8.1: Why Reduce Features?
|
| 4 |
-
|
| 5 |
-
o Curse of dimensionality and model complexity
|
| 6 |
-
o Benefits of dimensionality reduction
|
| 7 |
-
|
| 8 |
-
Lesson 8.2: Principal Component Analysis (PCA)
|
| 9 |
-
|
| 10 |
-
o Intuition of PCA—capturing variance in fewer dimensions
|
| 11 |
-
o Applying PCA to browsing features
|
| 12 |
-
o Visualizing principal components
|
| 13 |
-
|
| 14 |
-
Lesson 8.3: The Elbow Method for Feature Selection
|
| 15 |
-
|
| 16 |
-
o Concept of the elbow method to decide number of components or clusters
|
| 17 |
-
o Plotting explained variance ratio to select dimension count
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_09/Module_09.ipynb
DELETED
|
@@ -1,157 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"metadata": {},
|
| 6 |
-
"source": [
|
| 7 |
-
"# Module 9: Clustering and User Segmentation\n",
|
| 8 |
-
"\n",
|
| 9 |
-
"## Lesson 9.1: Introduction to Unsupervised Learning and Clustering\n",
|
| 10 |
-
"\n",
|
| 11 |
-
"- Difference between supervised and unsupervised learning\n",
|
| 12 |
-
"- Why cluster users? To find natural groupings for marketing and personalization"
|
| 13 |
-
]
|
| 14 |
-
},
|
| 15 |
-
{
|
| 16 |
-
"cell_type": "markdown",
|
| 17 |
-
"metadata": {},
|
| 18 |
-
"source": [
|
| 19 |
-
"## Lesson 9.2: K-Means Clustering\n",
|
| 20 |
-
"\n",
|
| 21 |
-
"- How K-Means works: Iterative cluster assignment and centroid updates\n",
|
| 22 |
-
"- Choosing number of clusters (k) using elbow method"
|
| 23 |
-
]
|
| 24 |
-
},
|
| 25 |
-
{
|
| 26 |
-
"cell_type": "code",
|
| 27 |
-
"metadata": {},
|
| 28 |
-
"execution_count": null,
|
| 29 |
-
"outputs": [],
|
| 30 |
-
"source": [
|
| 31 |
-
"import pandas as pd\n",
|
| 32 |
-
"import numpy as np\n",
|
| 33 |
-
"from sklearn.cluster import KMeans\n",
|
| 34 |
-
"from sklearn.preprocessing import StandardScaler\n",
|
| 35 |
-
"import matplotlib.pyplot as plt\n",
|
| 36 |
-
"\n",
|
| 37 |
-
"# Load dataset\n",
|
| 38 |
-
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 39 |
-
"\n",
|
| 40 |
-
"# Select numeric features for clustering\n",
|
| 41 |
-
"X = data.select_dtypes(include=[np.number])\n",
|
| 42 |
-
"X.fillna(X.median(), inplace=True)\n",
|
| 43 |
-
"\n",
|
| 44 |
-
"# Scale features\n",
|
| 45 |
-
"scaler = StandardScaler()\n",
|
| 46 |
-
"X_scaled = scaler.fit_transform(X)\n",
|
| 47 |
-
"\n",
|
| 48 |
-
"# Elbow method to find optimal k\n",
|
| 49 |
-
"inertia = []\n",
|
| 50 |
-
"k_range = range(1, 11)\n",
|
| 51 |
-
"for k in k_range:\n",
|
| 52 |
-
" kmeans = KMeans(n_clusters=k, random_state=42)\n",
|
| 53 |
-
" kmeans.fit(X_scaled)\n",
|
| 54 |
-
" inertia.append(kmeans.inertia_)\n",
|
| 55 |
-
"\n",
|
| 56 |
-
"plt.figure(figsize=(8,5))\n",
|
| 57 |
-
"plt.plot(k_range, inertia, 'bo-')\n",
|
| 58 |
-
"plt.xlabel('Number of clusters k')\n",
|
| 59 |
-
"plt.ylabel('Inertia (Sum of squared distances)')\n",
|
| 60 |
-
"plt.title('Elbow Method For Optimal k')\n",
|
| 61 |
-
"plt.show()"
|
| 62 |
-
]
|
| 63 |
-
},
|
| 64 |
-
{
|
| 65 |
-
"cell_type": "markdown",
|
| 66 |
-
"metadata": {},
|
| 67 |
-
"source": [
|
| 68 |
-
"## Lesson 9.3: Analyzing and Labeling Segments\n",
|
| 69 |
-
"\n",
|
| 70 |
-
"- Choose number of clusters (e.g., k=3)\n",
|
| 71 |
-
"- Fit K-Means and assign cluster labels\n",
|
| 72 |
-
"- Analyze cluster centers and interpret user behaviors"
|
| 73 |
-
]
|
| 74 |
-
},
|
| 75 |
-
{
|
| 76 |
-
"cell_type": "code",
|
| 77 |
-
"metadata": {},
|
| 78 |
-
"execution_count": null,
|
| 79 |
-
"outputs": [],
|
| 80 |
-
"source": [
|
| 81 |
-
"k_optimal = 3\n",
|
| 82 |
-
"kmeans = KMeans(n_clusters=k_optimal, random_state=42)\n",
|
| 83 |
-
"data['cluster'] = kmeans.fit_predict(X_scaled)\n",
|
| 84 |
-
"\n",
|
| 85 |
-
"# Display cluster counts\n",
|
| 86 |
-
"print(data['cluster'].value_counts())\n",
|
| 87 |
-
"\n",
|
| 88 |
-
"# Calculate cluster centers (in scaled space)\n",
|
| 89 |
-
"centers = kmeans.cluster_centers_\n",
|
| 90 |
-
"\n",
|
| 91 |
-
"# Convert centers back to original scale for interpretation\n",
|
| 92 |
-
"centers_orig = scaler.inverse_transform(centers)\n",
|
| 93 |
-
"centers_df = pd.DataFrame(centers_orig, columns=X.columns)\n",
|
| 94 |
-
"print(\"Cluster Centers (approximate feature means):\")\n",
|
| 95 |
-
"print(centers_df)\n",
|
| 96 |
-
"\n",
|
| 97 |
-
"# Visualize clusters using first two principal components (optional)\n",
|
| 98 |
-
"from sklearn.decomposition import PCA\n",
|
| 99 |
-
"pca = PCA(n_components=2)\n",
|
| 100 |
-
"X_pca = pca.fit_transform(X_scaled)\n",
|
| 101 |
-
"\n",
|
| 102 |
-
"plt.figure(figsize=(8,6))\n",
|
| 103 |
-
"plt.scatter(X_pca[:,0], X_pca[:,1], c=data['cluster'], cmap='viridis', alpha=0.6)\n",
|
| 104 |
-
"plt.xlabel('PCA Component 1')\n",
|
| 105 |
-
"plt.ylabel('PCA Component 2')\n",
|
| 106 |
-
"plt.title('User Clusters Visualization (PCA)')\n",
|
| 107 |
-
"plt.colorbar(label='Cluster')\n",
|
| 108 |
-
"plt.show()"
|
| 109 |
-
]
|
| 110 |
-
},
|
| 111 |
-
{
|
| 112 |
-
"cell_type": "markdown",
|
| 113 |
-
"metadata": {},
|
| 114 |
-
"source": [
|
| 115 |
-
"## Lesson 9.4: Using Clusters to Enhance Purchase Predictions\n",
|
| 116 |
-
"\n",
|
| 117 |
-
"- Discuss adding cluster assignments as a feature to classifiers\n",
|
| 118 |
-
"- Segment-specific marketing strategies\n"
|
| 119 |
-
]
|
| 120 |
-
},
|
| 121 |
-
{
|
| 122 |
-
"cell_type": "markdown",
|
| 123 |
-
"metadata": {},
|
| 124 |
-
"source": [
|
| 125 |
-
"## Exercises:\n",
|
| 126 |
-
"1. Apply K-Means clustering to your browsing data.\n",
|
| 127 |
-
"2. Use the elbow method to select an optimal number of clusters.\n",
|
| 128 |
-
"3. Analyze and describe characteristics of each cluster.\n",
|
| 129 |
-
"4. Visualize the clusters on 2D PCA components."
|
| 130 |
-
]
|
| 131 |
-
},
|
| 132 |
-
{
|
| 133 |
-
"cell_type": "markdown",
|
| 134 |
-
"metadata": {},
|
| 135 |
-
"source": [
|
| 136 |
-
"## Potential Student Questions:\n",
|
| 137 |
-
"- How does K-Means assign clusters?\n",
|
| 138 |
-
"- What if clusters are not well separated?\n",
|
| 139 |
-
"- Can we use other clustering methods?\n",
|
| 140 |
-
"- How do clusters improve prediction or marketing?"
|
| 141 |
-
]
|
| 142 |
-
}
|
| 143 |
-
],
|
| 144 |
-
"metadata": {
|
| 145 |
-
"kernelspec": {
|
| 146 |
-
"display_name": "Python 3",
|
| 147 |
-
"language": "python",
|
| 148 |
-
"name": "python3"
|
| 149 |
-
},
|
| 150 |
-
"language_info": {
|
| 151 |
-
"name": "python",
|
| 152 |
-
"version": "3.x"
|
| 153 |
-
}
|
| 154 |
-
},
|
| 155 |
-
"nbformat": 4,
|
| 156 |
-
"nbformat_minor": 5
|
| 157 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_09/Overview.jpg
DELETED
Git LFS Details
|
pages/modules/Module_09/Overview.txt
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
Module 9: Clustering and User Segmentation
|
| 2 |
-
|
| 3 |
-
Lesson 9.1: Introduction to Unsupervised Learning and Clustering
|
| 4 |
-
|
| 5 |
-
o Difference between supervised and unsupervised learning
|
| 6 |
-
o Use cases for clustering in e-commerce (user segmentation, personalized marketing)
|
| 7 |
-
|
| 8 |
-
Lesson 9.2: K-Means Clustering
|
| 9 |
-
o How K-Means works conceptually
|
| 10 |
-
o Applying K-Means on browsing behavior features
|
| 11 |
-
o Finding optimal number of clusters (using elbow method)
|
| 12 |
-
|
| 13 |
-
Lesson 9.3: Analyzing and Labeling Segments
|
| 14 |
-
o Profiling clusters based on feature averages
|
| 15 |
-
o Assigning marketing personas or labels (e.g., window shoppers, deal hunters, loyal customers)
|
| 16 |
-
|
| 17 |
-
Lesson 9.4: Using Clusters to Enhance Purchase Predictions
|
| 18 |
-
o Combining clustering results as new features or separate workflows
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/modules/Module_10/Module_10.ipynb
DELETED
|
@@ -1,119 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"metadata": {},
|
| 6 |
-
"source": [
|
| 7 |
-
"# Module 10: Advanced Model Improvement and Ethical Considerations\n",
|
| 8 |
-
"\n",
|
| 9 |
-
"## Lesson 10.1: Hyperparameter Tuning and Handling Class Imbalance\n",
|
| 10 |
-
"\n",
|
| 11 |
-
"- Importance of tuning model hyperparameters to improve performance\n",
|
| 12 |
-
"- Overview of Grid Search and Random Search\n",
|
| 13 |
-
"- Handling class imbalance: resampling, class weights\n"
|
| 14 |
-
]
|
| 15 |
-
},
|
| 16 |
-
{
|
| 17 |
-
"cell_type": "code",
|
| 18 |
-
"metadata": {},
|
| 19 |
-
"execution_count": null,
|
| 20 |
-
"outputs": [],
|
| 21 |
-
"source": [
|
| 22 |
-
"import pandas as pd\n",
|
| 23 |
-
"from sklearn.model_selection import train_test_split, GridSearchCV\n",
|
| 24 |
-
"from sklearn.preprocessing import LabelEncoder\n",
|
| 25 |
-
"import xgboost as xgb\n",
|
| 26 |
-
"\n",
|
| 27 |
-
"# Load and prepare data\n",
|
| 28 |
-
"data = pd.read_csv('sample_browsing_data.csv')\n",
|
| 29 |
-
"le = LabelEncoder()\n",
|
| 30 |
-
"data['purchase_intent_encoded'] = le.fit_transform(data['purchase_intent'])\n",
|
| 31 |
-
"\n",
|
| 32 |
-
"X = data.drop(columns=['purchase_intent', 'purchase_intent_encoded'])\n",
|
| 33 |
-
"y = data['purchase_intent_encoded']\n",
|
| 34 |
-
"\n",
|
| 35 |
-
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n",
|
| 36 |
-
"\n",
|
| 37 |
-
"# Define model\n",
|
| 38 |
-
"model = xgb.XGBClassifier(objective='multi:softmax', num_class=3, use_label_encoder=False, eval_metric='mlogloss', seed=42)\n",
|
| 39 |
-
"\n",
|
| 40 |
-
"# Hyperparameter grid\n",
|
| 41 |
-
"param_grid = {\n",
|
| 42 |
-
" 'max_depth': [3, 5],\n",
|
| 43 |
-
" 'learning_rate': [0.1, 0.01],\n",
|
| 44 |
-
" 'n_estimators': [50, 100]\n",
|
| 45 |
-
"}\n",
|
| 46 |
-
"\n",
|
| 47 |
-
"# Setup GridSearchCV\n",
|
| 48 |
-
"grid_search = GridSearchCV(model, param_grid, cv=3, scoring='accuracy', verbose=1)\n",
|
| 49 |
-
"\n",
|
| 50 |
-
"# Fit grid search\n",
|
| 51 |
-
"grid_search.fit(X_train, y_train)\n",
|
| 52 |
-
"\n",
|
| 53 |
-
"print(f\"Best parameters: {grid_search.best_params_}\")\n",
|
| 54 |
-
"print(f\"Best cross-validation accuracy: {grid_search.best_score_:.2f}\")"
|
| 55 |
-
]
|
| 56 |
-
},
|
| 57 |
-
{
|
| 58 |
-
"cell_type": "markdown",
|
| 59 |
-
"metadata": {},
|
| 60 |
-
"source": [
|
| 61 |
-
"## Handling Class Imbalance (Conceptual)\n",
|
| 62 |
-
"\n",
|
| 63 |
-
"- Techniques:\n",
|
| 64 |
-
" - Oversampling minority class\n",
|
| 65 |
-
" - Undersampling majority class\n",
|
| 66 |
-
" - Using class weights in model training\n",
|
| 67 |
-
"- XGBoost supports scale_pos_weight parameter for binary imbalance (multi-class requires other approaches)"
|
| 68 |
-
]
|
| 69 |
-
},
|
| 70 |
-
{
|
| 71 |
-
"cell_type": "markdown",
|
| 72 |
-
"metadata": {},
|
| 73 |
-
"source": [
|
| 74 |
-
"## Lesson 10.2: Ethical Considerations in ML for E-Commerce\n",
|
| 75 |
-
"\n",
|
| 76 |
-
"- **Privacy:** Ethical collection and use of browsing data\n",
|
| 77 |
-
"- **Bias and fairness:** Avoid reinforcing stereotypes or discrimination\n",
|
| 78 |
-
"- **Transparency:** Explainability of ML predictions\n",
|
| 79 |
-
"- **User consent:** Informing users how data is used\n",
|
| 80 |
-
"\n",
|
| 81 |
-
"Discuss examples and best practices."
|
| 82 |
-
]
|
| 83 |
-
},
|
| 84 |
-
{
|
| 85 |
-
"cell_type": "markdown",
|
| 86 |
-
"metadata": {},
|
| 87 |
-
"source": [
|
| 88 |
-
"## Exercises:\n",
|
| 89 |
-
"1. Perform hyperparameter tuning on your XGBoost model using GridSearchCV.\n",
|
| 90 |
-
"2. Research techniques to handle class imbalance and describe which might fit e-commerce data.\n",
|
| 91 |
-
"3. Write a paragraph on ethical issues you foresee in using ML to predict purchase intent."
|
| 92 |
-
]
|
| 93 |
-
},
|
| 94 |
-
{
|
| 95 |
-
"cell_type": "markdown",
|
| 96 |
-
"metadata": {},
|
| 97 |
-
"source": [
|
| 98 |
-
"## Potential Student Questions:\n",
|
| 99 |
-
"- How do hyperparameters affect model performance?\n",
|
| 100 |
-
"- What happens if classes are imbalanced?\n",
|
| 101 |
-
"- How can models be made fair and unbiased?\n",
|
| 102 |
-
"- What are real risks of privacy violations?"
|
| 103 |
-
]
|
| 104 |
-
}
|
| 105 |
-
],
|
| 106 |
-
"metadata": {
|
| 107 |
-
"kernelspec": {
|
| 108 |
-
"display_name": "Python 3",
|
| 109 |
-
"language": "python",
|
| 110 |
-
"name": "python3"
|
| 111 |
-
},
|
| 112 |
-
"language_info": {
|
| 113 |
-
"name": "python",
|
| 114 |
-
"version": "3.x"
|
| 115 |
-
}
|
| 116 |
-
},
|
| 117 |
-
"nbformat": 4,
|
| 118 |
-
"nbformat_minor": 5
|
| 119 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|