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