Spaces:
Sleeping
Sleeping
Update stages/problem_statement.py
Browse files- stages/problem_statement.py +119 -1
stages/problem_statement.py
CHANGED
|
@@ -1,3 +1,121 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
+
def main():
|
| 4 |
+
st.title("Step 1: Problem Statement Definition :mag:")
|
| 5 |
+
|
| 6 |
+
st.markdown(
|
| 7 |
+
"""
|
| 8 |
+
Every successful NLP project begins with a **clear and well-defined problem statement**. This step lays the groundwork by identifying what you aim to solve, why it matters, and how you plan to approach it.
|
| 9 |
+
|
| 10 |
+
A well-defined problem statement keeps your project focused and aligned with its goals.
|
| 11 |
+
"""
|
| 12 |
+
)
|
| 13 |
+
st.divider()
|
| 14 |
+
|
| 15 |
+
# Section 1: Understand the Business or Use Case
|
| 16 |
+
st.subheader("1. Understand the Business or Use Case :globe_with_meridians:")
|
| 17 |
+
st.write(
|
| 18 |
+
"""
|
| 19 |
+
Before jumping into solutions, take time to **understand the context** of the problem. Whether you're building a chatbot, performing sentiment analysis, or classifying text, you must align your project with the **real-world needs** of the business or end-users.
|
| 20 |
+
"""
|
| 21 |
+
)
|
| 22 |
+
st.markdown(
|
| 23 |
+
"""
|
| 24 |
+
**Steps to Understand the Use Case:**
|
| 25 |
+
- Ask **what problem** you are solving.
|
| 26 |
+
- Determine **who benefits** from the solution (users, stakeholders).
|
| 27 |
+
- Identify **why it matters**: What value does solving this problem provide?
|
| 28 |
+
|
| 29 |
+
**Example:**
|
| 30 |
+
- Business Problem: "Customers struggle to get quick answers on our website."
|
| 31 |
+
- NLP Solution: Build a **customer support chatbot** to automate responses to common queries.
|
| 32 |
+
"""
|
| 33 |
+
)
|
| 34 |
+
st.divider()
|
| 35 |
+
|
| 36 |
+
# Section 2: Define the Scope
|
| 37 |
+
st.subheader("2. Define the Scope :sunrise_over_mountains:")
|
| 38 |
+
st.write(
|
| 39 |
+
"""
|
| 40 |
+
Clearly defining the **scope** of your problem is critical to avoid unnecessary complexity and keep the project manageable.
|
| 41 |
+
|
| 42 |
+
Scope helps you identify **what's included** in the problem and what isn't.
|
| 43 |
+
"""
|
| 44 |
+
)
|
| 45 |
+
st.markdown(
|
| 46 |
+
"""
|
| 47 |
+
**Questions to Define Scope:**
|
| 48 |
+
- What **specific goals** are we targeting? (e.g., classify sentiment as positive or negative)
|
| 49 |
+
- Are there any **limitations**? (e.g., only working with English text)
|
| 50 |
+
- What **data sources** are needed? (e.g., customer reviews, social media posts)
|
| 51 |
+
|
| 52 |
+
**Example:**
|
| 53 |
+
- Problem Scope: "Analyze customer reviews to detect positive, negative, or neutral sentiments for English-language text only."
|
| 54 |
+
"""
|
| 55 |
+
)
|
| 56 |
+
st.divider()
|
| 57 |
+
|
| 58 |
+
# Section 3: Identify Key Metrics
|
| 59 |
+
st.subheader("3. Identify Key Metrics :1234:")
|
| 60 |
+
st.write(
|
| 61 |
+
"""
|
| 62 |
+
To evaluate the success of your NLP project, define **key metrics** that measure performance and ensure your model meets expectations.
|
| 63 |
+
|
| 64 |
+
Metrics provide a way to **quantify progress** and compare different approaches.
|
| 65 |
+
"""
|
| 66 |
+
)
|
| 67 |
+
st.markdown(
|
| 68 |
+
"""
|
| 69 |
+
**Common NLP Metrics:**
|
| 70 |
+
- **Accuracy**: Proportion of correct predictions.
|
| 71 |
+
- **F1-Score**: Balance between precision and recall.
|
| 72 |
+
- **BLEU Score**: For evaluating text generation models.
|
| 73 |
+
- **Perplexity**: To assess language models.
|
| 74 |
+
|
| 75 |
+
**Example:**
|
| 76 |
+
- "For a sentiment analysis model, aim for an F1-score of **85% or higher** on the test dataset."
|
| 77 |
+
"""
|
| 78 |
+
)
|
| 79 |
+
st.divider()
|
| 80 |
+
|
| 81 |
+
# Section 4: Formulate the Problem as an NLP Task
|
| 82 |
+
st.subheader("4. Formulate the Problem as an NLP Task :robot_face:")
|
| 83 |
+
st.write(
|
| 84 |
+
"""
|
| 85 |
+
Once the problem is defined and scoped, formulate it as a specific **NLP task**. This step bridges the gap between the problem statement and the technical solution.
|
| 86 |
+
"""
|
| 87 |
+
)
|
| 88 |
+
st.markdown(
|
| 89 |
+
"""
|
| 90 |
+
**Common NLP Tasks:**
|
| 91 |
+
- **Text Classification**: Categorize text into predefined classes (e.g., spam detection).
|
| 92 |
+
- **Named Entity Recognition (NER)**: Identify entities like names, dates, or locations.
|
| 93 |
+
- **Sentiment Analysis**: Detect emotions like positive, negative, or neutral sentiment.
|
| 94 |
+
- **Text Summarization**: Summarize long documents into concise versions.
|
| 95 |
+
|
| 96 |
+
**Example:**
|
| 97 |
+
- Problem: "Categorize customer complaints into relevant topics."
|
| 98 |
+
- NLP Task: **Text Classification**.
|
| 99 |
+
"""
|
| 100 |
+
)
|
| 101 |
+
st.divider()
|
| 102 |
+
|
| 103 |
+
# Summary Section
|
| 104 |
+
st.subheader("Summary::star2:")
|
| 105 |
+
st.markdown(
|
| 106 |
+
"""
|
| 107 |
+
Defining the problem statement involves:
|
| 108 |
+
|
| 109 |
+
1. **Understanding the Use Case**: Align with real-world needs.
|
| 110 |
+
2. **Defining the Scope**: Set clear boundaries for the project.
|
| 111 |
+
3. **Identifying Key Metrics**: Quantify success with appropriate measures.
|
| 112 |
+
4. **Formulating the Problem**: Map it to a specific NLP task.
|
| 113 |
+
|
| 114 |
+
**Friendly Tip :bulb::**
|
| 115 |
+
A clear problem statement ensures your project stays focused, measurable, and achievable. Spend time here to avoid confusion later in the NLP pipeline!
|
| 116 |
+
"""
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
st.divider()
|
| 120 |
+
|
| 121 |
+
main()
|