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()