raymondEDS commited on
Commit
d1da800
·
verified ·
1 Parent(s): d70f00d

Upload 13 files

Browse files
README.md CHANGED
@@ -1,12 +1,80 @@
1
- ---
2
- title: DS Webclass
3
- emoji: 🏆
4
- colorFrom: gray
5
- colorTo: red
6
- sdk: streamlit
7
- sdk_version: 1.44.1
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Data Science Course App
2
+
3
+ An interactive Streamlit-based platform for guiding students through a 10-week machine learning research paper project.
4
+
5
+ ## Project Structure
6
+
7
+ ```
8
+ DS_course_app/
9
+ ├── app/
10
+ │ ├── pages/ # Individual week pages
11
+ │ ├── components/ # Reusable Streamlit components
12
+ │ └── utils/ # Utility functions
13
+ ├── data/ # Sample datasets and resources
14
+ ├── assets/ # Images, CSS, and other static files
15
+ ├── environment.yml # Conda environment file
16
+ └── requirements.txt # Project dependencies (alternative)
17
+ ```
18
+
19
+ ## Setup Instructions
20
+
21
+ 1. Create and activate the Conda environment:
22
+ ```bash
23
+ # Create the environment from environment.yml
24
+ conda env create -f environment.yml
25
+
26
+ # Activate the environment
27
+ conda activate ds_course_app
28
+ ```
29
+
30
+ 2. Run the application:
31
+ ```bash
32
+ streamlit run app/main.py
33
+ ```
34
+
35
+ ## Course Structure
36
+
37
+ The course is designed to guide students through the process of creating a machine learning research paper over 10 weeks:
38
+
39
+ 1. Week 1: Research Topic Selection and Literature Review
40
+ 2. Week 2: Data Collection and Preprocessing
41
+ 3. Week 3: Exploratory Data Analysis
42
+ 4. Week 4: Feature Engineering
43
+ 5. Week 5: Model Selection and Baseline
44
+ 6. Week 6: Model Training and Optimization
45
+ 7. Week 7: Model Evaluation
46
+ 8. Week 8: Results Analysis
47
+ 9. Week 9: Paper Writing
48
+ 10. Week 10: Final Review and Submission
49
+
50
+ ## Features
51
+
52
+ - Interactive learning modules for each week
53
+ - Progress tracking
54
+ - Sample datasets and resources
55
+ - Code templates and examples
56
+ - Peer review system
57
+ - Submission and feedback system
58
+
59
+ ## Environment Management
60
+
61
+ ### Using Conda (Recommended)
62
+ ```bash
63
+ # Create environment
64
+ conda env create -f environment.yml
65
+
66
+ # Activate environment
67
+ conda activate ds_course_app
68
+
69
+ # Update environment
70
+ conda env update -f environment.yml
71
+
72
+ # Deactivate environment
73
+ conda deactivate
74
+ ```
75
+
76
+ ### Alternative: Using pip
77
+ If you prefer using pip, you can still use the requirements.txt file:
78
+ ```bash
79
+ pip install -r requirements.txt
80
+ ```
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import os
3
+ import sys
4
+
5
+ # Add the current directory to the Python path
6
+ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
7
+
8
+ # Import the main app
9
+ from app.main import main, sidebar_navigation, load_css
10
+
11
+ if __name__ == "__main__":
12
+ load_css()
13
+ sidebar_navigation()
14
+ main()
app/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # This file makes the app directory a Python package
app/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (173 Bytes). View file
 
app/components/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # This file makes the components directory a Python package
app/components/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (184 Bytes). View file
 
app/components/__pycache__/login.cpython-311.pyc ADDED
Binary file (1.59 kB). View file
 
app/components/login.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ def login():
4
+ """
5
+ Display a login form and return True if login is successful, False otherwise.
6
+ """
7
+ st.title("Login to Data Science Course App")
8
+
9
+ # Create a form for login
10
+ with st.form("login_form"):
11
+ username = st.text_input("Username")
12
+ password = st.text_input("Password", type="password")
13
+ submit_button = st.form_submit_button("Login")
14
+
15
+ if submit_button:
16
+ # Check credentials (test account)
17
+ if username == "student" and password == "123":
18
+ # Store login state in session
19
+ st.session_state.logged_in = True
20
+ st.session_state.username = username
21
+ st.success("Login successful!")
22
+ st.rerun()
23
+ else:
24
+ st.error("Invalid username or password. Please try again.")
25
+
26
+ return st.session_state.get("logged_in", False)
app/main.py ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import os
3
+ import glob
4
+ import sys
5
+
6
+ # Add the parent directory to the Python path
7
+ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
8
+
9
+ # Import the login component
10
+ from app.components.login import login
11
+
12
+ # Page configuration
13
+ st.set_page_config(
14
+ page_title="Data Science Course App",
15
+ page_icon="📚",
16
+ layout="wide",
17
+ initial_sidebar_state="expanded"
18
+ )
19
+
20
+ # Custom CSS
21
+ def load_css():
22
+ try:
23
+ with open('assets/style.css') as f:
24
+ st.markdown(f'<style>{f.read()}</style>', unsafe_allow_html=True)
25
+ except FileNotFoundError:
26
+ # Fallback for Streamlit Cloud deployment
27
+ st.markdown("""
28
+ <style>
29
+ /* Main title styling */
30
+ .main .block-container h1 {
31
+ color: #2c3e50;
32
+ font-size: 2.5rem;
33
+ margin-bottom: 1rem;
34
+ }
35
+
36
+ /* Subtitle styling */
37
+ .main .block-container h2 {
38
+ color: #34495e;
39
+ font-size: 1.8rem;
40
+ margin-top: 2rem;
41
+ margin-bottom: 1rem;
42
+ }
43
+
44
+ /* Sidebar styling */
45
+ .sidebar .sidebar-content {
46
+ background-color: #f8f9fa;
47
+ }
48
+
49
+ /* Button styling */
50
+ .stButton>button {
51
+ width: 100%;
52
+ border-radius: 5px;
53
+ height: 3em;
54
+ margin: 0.5em 0;
55
+ background-color: #3498db;
56
+ color: white;
57
+ border: none;
58
+ }
59
+
60
+ .stButton>button:hover {
61
+ background-color: #2980b9;
62
+ }
63
+
64
+ /* Progress bar styling */
65
+ .stProgress > div > div {
66
+ background-color: #2ecc71;
67
+ }
68
+
69
+ /* Info box styling */
70
+ .stAlert {
71
+ border-radius: 5px;
72
+ padding: 1rem;
73
+ margin: 1rem 0;
74
+ }
75
+
76
+ /* Code block styling */
77
+ .stCodeBlock {
78
+ background-color: #f8f9fa;
79
+ border-radius: 5px;
80
+ padding: 1rem;
81
+ margin: 1rem 0;
82
+ }
83
+ </style>
84
+ """, unsafe_allow_html=True)
85
+
86
+ # Initialize session state
87
+ if 'current_week' not in st.session_state:
88
+ st.session_state.current_week = 1
89
+ if 'logged_in' not in st.session_state:
90
+ st.session_state.logged_in = False
91
+
92
+ # Get class content
93
+ def get_class_content(week_number):
94
+ # Try different possible paths for class files
95
+ possible_paths = [
96
+ f"data_science_class_files/class_{week_number}", # Local development
97
+ f"app/data_science_class_files/class_{week_number}", # Alternative local path
98
+ f"class_{week_number}", # Streamlit Cloud deployment
99
+ ]
100
+
101
+ for class_dir in possible_paths:
102
+ if os.path.exists(class_dir):
103
+ # Get all files in the class directory
104
+ files = glob.glob(f"{class_dir}/*")
105
+ return {
106
+ 'directory': class_dir,
107
+ 'files': [os.path.basename(f) for f in files]
108
+ }
109
+
110
+ return None
111
+
112
+ # Sidebar navigation
113
+ def sidebar_navigation():
114
+ with st.sidebar:
115
+ st.title("Course Navigation")
116
+
117
+ # Show username if logged in
118
+ if st.session_state.logged_in:
119
+ st.write(f"Welcome, {st.session_state.username}!")
120
+
121
+ # Logout button
122
+ if st.button("Logout"):
123
+ st.session_state.logged_in = False
124
+ st.session_state.username = None
125
+ st.rerun()
126
+
127
+ st.markdown("---")
128
+ st.subheader("Course Progress")
129
+ progress = st.progress(st.session_state.current_week / 10)
130
+ st.write(f"Week {st.session_state.current_week} of 10")
131
+
132
+ st.markdown("---")
133
+ st.subheader("Quick Links")
134
+ for week in range(1, 11):
135
+ if st.button(f"Week {week}", key=f"week_{week}"):
136
+ st.session_state.current_week = week
137
+ st.rerun()
138
+
139
+ # Main content
140
+ def main():
141
+ # Check if user is logged in
142
+ if not st.session_state.logged_in:
143
+ # Show login page
144
+ login()
145
+ return
146
+
147
+ # User is logged in, show course content
148
+ st.title("Data Science Research Paper Course")
149
+
150
+ # Welcome message for first-time visitors
151
+ if st.session_state.current_week == 1:
152
+ st.markdown("""
153
+ ## Welcome to the Data Science Research Paper Course! 📚
154
+
155
+ This 10-week course will guide you through the process of creating a machine learning research paper.
156
+ Each week, you'll learn new concepts and complete tasks that build upon each other.
157
+
158
+ ### Getting Started
159
+ 1. Use the sidebar to navigate between weeks
160
+ 2. Complete the weekly tasks and assignments
161
+ 3. Track your progress using the progress bar
162
+ 4. Submit your work for feedback
163
+
164
+ ### Course Overview
165
+ - Week 1: Research Topic Selection and Literature Review
166
+ - Week 2: Data Collection and Preprocessing
167
+ - Week 3: Exploratory Data Analysis
168
+ - Week 4: Feature Engineering
169
+ - Week 5: Model Selection and Baseline
170
+ - Week 6: Model Training and Optimization
171
+ - Week 7: Model Evaluation
172
+ - Week 8: Results Analysis
173
+ - Week 9: Paper Writing
174
+ - Week 10: Final Review and Submission
175
+ """)
176
+
177
+ # Display current week's content
178
+ st.markdown(f"## Week {st.session_state.current_week}")
179
+
180
+ # Get class content
181
+ class_content = get_class_content(st.session_state.current_week)
182
+
183
+ if class_content:
184
+ st.subheader("Class Materials")
185
+
186
+ # Display files in the class directory
187
+ for file in class_content['files']:
188
+ file_path = os.path.join(class_content['directory'], file)
189
+
190
+ # Handle different file types
191
+ if file.endswith('.py'):
192
+ try:
193
+ with open(file_path, 'r') as f:
194
+ st.code(f.read(), language='python')
195
+ except Exception as e:
196
+ st.error(f"Error reading file {file}: {str(e)}")
197
+ elif file.endswith('.md'):
198
+ try:
199
+ with open(file_path, 'r') as f:
200
+ st.markdown(f.read())
201
+ except Exception as e:
202
+ st.error(f"Error reading file {file}: {str(e)}")
203
+ elif file.endswith(('.pptx', '.pdf', '.doc', '.docx')):
204
+ try:
205
+ with open(file_path, 'rb') as f:
206
+ st.download_button(
207
+ label=f"Download {file}",
208
+ data=f.read(),
209
+ file_name=file,
210
+ mime='application/octet-stream'
211
+ )
212
+ except Exception as e:
213
+ st.error(f"Error reading file {file}: {str(e)}")
214
+ else:
215
+ st.write(f"- {file}")
216
+ else:
217
+ st.info("Content for this week is being prepared. Check back soon!")
218
+
219
+ if __name__ == "__main__":
220
+ load_css()
221
+ sidebar_navigation()
222
+ main()
app/pages/week_1.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ def show_week_content():
4
+ st.markdown("""
5
+ ## Week 1: Research Topic Selection and Literature Review
6
+
7
+ This week, you'll learn how to:
8
+ - Select a suitable research topic
9
+ - Conduct a literature review
10
+ - Define your research objectives
11
+ - Create a research proposal
12
+ """)
13
+
14
+ # Topic Selection Section
15
+ st.header("1. Topic Selection")
16
+ st.markdown("""
17
+ ### Guidelines for Selecting Your Research Topic:
18
+ - Choose a topic that interests you
19
+ - Ensure sufficient data availability
20
+ - Consider the scope and complexity
21
+ - Check for existing research gaps
22
+ """)
23
+
24
+ # Interactive Topic Selection
25
+ st.subheader("Topic Selection Form")
26
+ with st.form("topic_form"):
27
+ research_area = st.selectbox(
28
+ "Select your research area",
29
+ ["Computer Vision", "NLP", "Time Series", "Recommendation Systems", "Other"]
30
+ )
31
+
32
+ topic = st.text_input("Proposed Research Topic")
33
+ problem_statement = st.text_area("Brief Problem Statement")
34
+ motivation = st.text_area("Why is this research important?")
35
+
36
+ submitted = st.form_submit_button("Submit Topic")
37
+
38
+ if submitted:
39
+ st.success("Topic submitted successfully! We'll review and provide feedback.")
40
+
41
+ # Literature Review Section
42
+ st.header("2. Literature Review")
43
+ st.markdown("""
44
+ ### Steps for Conducting Literature Review:
45
+ 1. Search for relevant papers
46
+ 2. Read and analyze key papers
47
+ 3. Identify research gaps
48
+ 4. Document your findings
49
+ """)
50
+
51
+ # Literature Review Template
52
+ st.subheader("Literature Review Template")
53
+ with st.expander("Download Template"):
54
+ st.download_button(
55
+ label="Download Literature Review Template",
56
+ data="Literature Review Template\n\n1. Introduction\n2. Related Work\n3. Methodology\n4. Results\n5. Discussion\n6. Conclusion",
57
+ file_name="literature_review_template.txt",
58
+ mime="text/plain"
59
+ )
60
+
61
+ # Weekly Assignment
62
+ st.header("Weekly Assignment")
63
+ st.markdown("""
64
+ ### Assignment 1: Research Proposal
65
+ 1. Select your research topic
66
+ 2. Write a brief problem statement
67
+ 3. Conduct initial literature review
68
+ 4. Submit your research proposal
69
+
70
+ **Due Date:** End of Week 1
71
+ """)
72
+
73
+ # Assignment Submission
74
+ st.subheader("Submit Your Assignment")
75
+ with st.form("assignment_form"):
76
+ proposal_file = st.file_uploader("Upload your research proposal (PDF or DOC)")
77
+ comments = st.text_area("Additional comments or questions")
78
+
79
+ if st.form_submit_button("Submit Assignment"):
80
+ if proposal_file is not None:
81
+ st.success("Assignment submitted successfully!")
82
+ else:
83
+ st.error("Please upload your research proposal.")
84
+
85
+ if __name__ == "__main__":
86
+ show_week_content()
assets/style.css ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Main title styling */
2
+ .main .block-container h1 {
3
+ color: #2c3e50;
4
+ font-size: 2.5rem;
5
+ margin-bottom: 1rem;
6
+ }
7
+
8
+ /* Subtitle styling */
9
+ .main .block-container h2 {
10
+ color: #34495e;
11
+ font-size: 1.8rem;
12
+ margin-top: 2rem;
13
+ margin-bottom: 1rem;
14
+ }
15
+
16
+ /* Sidebar styling */
17
+ .sidebar .sidebar-content {
18
+ background-color: #f8f9fa;
19
+ }
20
+
21
+ /* Button styling */
22
+ .stButton>button {
23
+ width: 100%;
24
+ border-radius: 5px;
25
+ height: 3em;
26
+ margin: 0.5em 0;
27
+ background-color: #3498db;
28
+ color: white;
29
+ border: none;
30
+ }
31
+
32
+ .stButton>button:hover {
33
+ background-color: #2980b9;
34
+ }
35
+
36
+ /* Progress bar styling */
37
+ .stProgress > div > div {
38
+ background-color: #2ecc71;
39
+ }
40
+
41
+ /* Info box styling */
42
+ .stAlert {
43
+ border-radius: 5px;
44
+ padding: 1rem;
45
+ margin: 1rem 0;
46
+ }
47
+
48
+ /* Code block styling */
49
+ .stCodeBlock {
50
+ background-color: #f8f9fa;
51
+ border-radius: 5px;
52
+ padding: 1rem;
53
+ margin: 1rem 0;
54
+ }
environment.yml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: ds_course_app
2
+ channels:
3
+ - conda-forge
4
+ - defaults
5
+ dependencies:
6
+ - python=3.11
7
+ - streamlit=1.32.0
8
+ - pandas=2.2.0
9
+ - numpy=1.26.4
10
+ - scikit-learn=1.4.0
11
+ - matplotlib=3.8.3
12
+ - seaborn=0.13.2
13
+ - plotly=5.18.0
14
+ - pip
15
+ - pip:
16
+ - streamlit==1.32.0 # Some packages might need to be installed via pip
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ streamlit==1.32.0
2
+ pandas==2.2.0
3
+ numpy==1.26.4
4
+ scikit-learn==1.4.0
5
+ matplotlib==3.8.3
6
+ seaborn==0.13.2
7
+ plotly==5.18.0