Spaces:
Running
Running
Upload 1_Week_1.py
Browse files- app/pages/1_Week_1.py +168 -0
app/pages/1_Week_1.py
ADDED
@@ -0,0 +1,168 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
import plotly.graph_objects as go
|
4 |
+
from sklearn.linear_model import LinearRegression
|
5 |
+
|
6 |
+
# Page configuration
|
7 |
+
st.set_page_config(
|
8 |
+
page_title="Week 1 - Research Topic Selection",
|
9 |
+
page_icon="📚",
|
10 |
+
layout="wide"
|
11 |
+
)
|
12 |
+
|
13 |
+
# Check if user is logged in
|
14 |
+
if not st.session_state.get("logged_in", False):
|
15 |
+
st.warning("Please log in to access this page.")
|
16 |
+
st.stop()
|
17 |
+
|
18 |
+
# Main content
|
19 |
+
st.markdown("""
|
20 |
+
## Week 1: Research Topic Selection and Literature Review
|
21 |
+
|
22 |
+
This week, you'll learn how to:
|
23 |
+
- Select a suitable research topic
|
24 |
+
- Conduct a literature review
|
25 |
+
- Define your research objectives
|
26 |
+
- Create a research proposal
|
27 |
+
""")
|
28 |
+
|
29 |
+
# Topic Selection Section
|
30 |
+
st.header("1. Topic Selection")
|
31 |
+
st.markdown("""
|
32 |
+
### Guidelines for Selecting Your Research Topic:
|
33 |
+
- Choose a topic that interests you
|
34 |
+
- Ensure sufficient data availability
|
35 |
+
- Consider the scope and complexity
|
36 |
+
- Check for existing research gaps
|
37 |
+
""")
|
38 |
+
|
39 |
+
# Interactive Topic Selection
|
40 |
+
st.subheader("Topic Selection Form")
|
41 |
+
with st.form("topic_form"):
|
42 |
+
research_area = st.selectbox(
|
43 |
+
"Select your research area",
|
44 |
+
["Computer Vision", "NLP", "Time Series", "Recommendation Systems", "Other"]
|
45 |
+
)
|
46 |
+
|
47 |
+
topic = st.text_input("Proposed Research Topic")
|
48 |
+
problem_statement = st.text_area("Brief Problem Statement")
|
49 |
+
motivation = st.text_area("Why is this research important?")
|
50 |
+
|
51 |
+
submitted = st.form_submit_button("Submit Topic")
|
52 |
+
|
53 |
+
if submitted:
|
54 |
+
st.success("Topic submitted successfully! We'll review and provide feedback.")
|
55 |
+
|
56 |
+
# Linear Regression Visualization
|
57 |
+
st.header("2. Linear Regression Demo")
|
58 |
+
st.markdown("""
|
59 |
+
### Understanding Linear Regression
|
60 |
+
|
61 |
+
Linear regression is a fundamental machine learning algorithm that models the relationship between a dependent variable and one or more independent variables.
|
62 |
+
Below is an interactive demonstration of simple linear regression.
|
63 |
+
""")
|
64 |
+
|
65 |
+
# Create interactive controls
|
66 |
+
col1, col2 = st.columns(2)
|
67 |
+
with col1:
|
68 |
+
n_points = st.slider("Number of data points", 10, 100, 50)
|
69 |
+
noise = st.slider("Noise level", 0.1, 2.0, 0.5)
|
70 |
+
with col2:
|
71 |
+
slope = st.slider("True slope", -2.0, 2.0, 1.0)
|
72 |
+
intercept = st.slider("True intercept", -5.0, 5.0, 0.0)
|
73 |
+
|
74 |
+
# Generate synthetic data
|
75 |
+
np.random.seed(42)
|
76 |
+
X = np.random.rand(n_points) * 10
|
77 |
+
y = slope * X + intercept + np.random.normal(0, noise, n_points)
|
78 |
+
|
79 |
+
# Fit linear regression
|
80 |
+
X_reshaped = X.reshape(-1, 1)
|
81 |
+
model = LinearRegression()
|
82 |
+
model.fit(X_reshaped, y)
|
83 |
+
y_pred = model.predict(X_reshaped)
|
84 |
+
|
85 |
+
# Create the plot
|
86 |
+
fig = go.Figure()
|
87 |
+
|
88 |
+
# Add scatter plot of actual data
|
89 |
+
fig.add_trace(go.Scatter(
|
90 |
+
x=X,
|
91 |
+
y=y,
|
92 |
+
mode='markers',
|
93 |
+
name='Actual Data',
|
94 |
+
marker=dict(color='blue')
|
95 |
+
))
|
96 |
+
|
97 |
+
# Add regression line
|
98 |
+
fig.add_trace(go.Scatter(
|
99 |
+
x=X,
|
100 |
+
y=y_pred,
|
101 |
+
mode='lines',
|
102 |
+
name='Regression Line',
|
103 |
+
line=dict(color='red')
|
104 |
+
))
|
105 |
+
|
106 |
+
# Update layout
|
107 |
+
fig.update_layout(
|
108 |
+
title='Linear Regression Visualization',
|
109 |
+
xaxis_title='X',
|
110 |
+
yaxis_title='Y',
|
111 |
+
showlegend=True,
|
112 |
+
height=500
|
113 |
+
)
|
114 |
+
|
115 |
+
# Display the plot
|
116 |
+
st.plotly_chart(fig, use_container_width=True)
|
117 |
+
|
118 |
+
# Display regression coefficients
|
119 |
+
st.markdown(f"""
|
120 |
+
### Regression Results
|
121 |
+
- Estimated slope: {model.coef_[0]:.2f}
|
122 |
+
- Estimated intercept: {model.intercept_:.2f}
|
123 |
+
- R² score: {model.score(X_reshaped, y):.2f}
|
124 |
+
""")
|
125 |
+
|
126 |
+
# Literature Review Section
|
127 |
+
st.header("3. Literature Review")
|
128 |
+
st.markdown("""
|
129 |
+
### Steps for Conducting Literature Review:
|
130 |
+
1. Search for relevant papers
|
131 |
+
2. Read and analyze key papers
|
132 |
+
3. Identify research gaps
|
133 |
+
4. Document your findings
|
134 |
+
""")
|
135 |
+
|
136 |
+
# Literature Review Template
|
137 |
+
st.subheader("Literature Review Template")
|
138 |
+
with st.expander("Download Template"):
|
139 |
+
st.download_button(
|
140 |
+
label="Download Literature Review Template",
|
141 |
+
data="Literature Review Template\n\n1. Introduction\n2. Related Work\n3. Methodology\n4. Results\n5. Discussion\n6. Conclusion",
|
142 |
+
file_name="literature_review_template.txt",
|
143 |
+
mime="text/plain"
|
144 |
+
)
|
145 |
+
|
146 |
+
# Weekly Assignment
|
147 |
+
st.header("Weekly Assignment")
|
148 |
+
st.markdown("""
|
149 |
+
### Assignment 1: Research Proposal
|
150 |
+
1. Select your research topic
|
151 |
+
2. Write a brief problem statement
|
152 |
+
3. Conduct initial literature review
|
153 |
+
4. Submit your research proposal
|
154 |
+
|
155 |
+
**Due Date:** End of Week 1
|
156 |
+
""")
|
157 |
+
|
158 |
+
# Assignment Submission
|
159 |
+
st.subheader("Submit Your Assignment")
|
160 |
+
with st.form("assignment_form"):
|
161 |
+
proposal_file = st.file_uploader("Upload your research proposal (PDF or DOC)")
|
162 |
+
comments = st.text_area("Additional comments or questions")
|
163 |
+
|
164 |
+
if st.form_submit_button("Submit Assignment"):
|
165 |
+
if proposal_file is not None:
|
166 |
+
st.success("Assignment submitted successfully!")
|
167 |
+
else:
|
168 |
+
st.error("Please upload your research proposal.")
|