Update app.py
Browse files
app.py
CHANGED
|
@@ -110,31 +110,34 @@ elif st.session_state.selected_page == "NLP Lifecycle":
|
|
| 110 |
elif lifecycle_option == "Problem Definition":
|
| 111 |
st.write("""
|
| 112 |
#### 1. Problem Definition
|
| 113 |
-
|
| 114 |
-
-
|
| 115 |
-
|
| 116 |
-
- What
|
| 117 |
-
- What
|
| 118 |
-
|
|
|
|
|
|
|
| 119 |
""")
|
| 120 |
|
| 121 |
-
|
| 122 |
elif lifecycle_option == "Data Collection":
|
| 123 |
st.write("""
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
-
|
| 128 |
-
-
|
| 129 |
-
-
|
| 130 |
-
-
|
|
|
|
|
|
|
| 131 |
|
| 132 |
**Example**: Scraping customer reviews from Amazon to analyze sentiment and feedback about a product.
|
| 133 |
""")
|
| 134 |
|
| 135 |
elif lifecycle_option == "Text Preprocessing":
|
| 136 |
st.write("""
|
| 137 |
-
####
|
| 138 |
Text preprocessing prepares raw text for further analysis. This stage involves cleaning and transforming the data into a structured format that machine learning models can understand.
|
| 139 |
- **Tokenization**: Splitting text into smaller units (e.g., words, phrases).
|
| 140 |
- **Stop Words Removal**: Removing common words that don’t contribute much information.
|
|
@@ -150,7 +153,7 @@ elif st.session_state.selected_page == "NLP Lifecycle":
|
|
| 150 |
|
| 151 |
elif lifecycle_option == "Text Representation":
|
| 152 |
st.write("""
|
| 153 |
-
####
|
| 154 |
After preprocessing, the text data needs to be converted into a numerical format for use in machine learning models. There are several methods for text representation:
|
| 155 |
- **Bag of Words (BoW)**: Converts text into a matrix of word frequencies.
|
| 156 |
- **TF-IDF**: Weighs words based on their frequency in a specific document relative to their frequency across the entire dataset.
|
|
@@ -163,7 +166,7 @@ elif st.session_state.selected_page == "NLP Lifecycle":
|
|
| 163 |
|
| 164 |
elif lifecycle_option == "Model Training":
|
| 165 |
st.write("""
|
| 166 |
-
####
|
| 167 |
In the model training stage, machine learning algorithms are trained on the preprocessed and represented text data. The choice of model depends on the task:
|
| 168 |
- **Text Classification**: Naive Bayes, Support Vector Machines (SVM), or neural networks.
|
| 169 |
- **Named Entity Recognition (NER)**: Conditional Random Fields (CRF), LSTMs, or transformers.
|
|
@@ -174,7 +177,7 @@ elif st.session_state.selected_page == "NLP Lifecycle":
|
|
| 174 |
|
| 175 |
elif lifecycle_option == "Evaluation":
|
| 176 |
st.write("""
|
| 177 |
-
####
|
| 178 |
After training the model, it's important to evaluate its performance. Common evaluation metrics include:
|
| 179 |
- **Accuracy**: The percentage of correctly classified samples.
|
| 180 |
- **Precision**: The proportion of true positive predictions among all positive predictions.
|
|
@@ -187,7 +190,7 @@ elif st.session_state.selected_page == "NLP Lifecycle":
|
|
| 187 |
|
| 188 |
elif lifecycle_option == "Deployment":
|
| 189 |
st.write("""
|
| 190 |
-
####
|
| 191 |
Once the model is trained and evaluated, it is deployed to production for real-world use. This might include integration with applications like chatbots, recommendation systems, or text summarization tools.
|
| 192 |
- **Monitoring**: Continuous monitoring to ensure that the model performs well over time.
|
| 193 |
- **Retraining**: The model might need to be retrained periodically as new data becomes available.
|
|
|
|
| 110 |
elif lifecycle_option == "Problem Definition":
|
| 111 |
st.write("""
|
| 112 |
#### 1. Problem Definition
|
| 113 |
+
- The first step in the NLP lifecycle is defining the problem. This means understanding the goal and figuring out how NLP can help solve the problem.
|
| 114 |
+
- Based on the problem, you will need to gather the data.
|
| 115 |
+
- **To better understand the problem, consider asking questions such as**:
|
| 116 |
+
- What is the main goal of this analysis?
|
| 117 |
+
- What kind of text data are we working with (e.g., reviews, social media posts, documents)?
|
| 118 |
+
- What do we want the output to be (e.g., sentiment score, summary, or classification)?
|
| 119 |
+
|
| 120 |
+
**Example of a problem statement**: The goal could be to classify customer reviews as either positive or negative, or to find the main topics in product reviews.
|
| 121 |
""")
|
| 122 |
|
|
|
|
| 123 |
elif lifecycle_option == "Data Collection":
|
| 124 |
st.write("""
|
| 125 |
+
#### 2. Data Collection
|
| 126 |
+
Data collection is the second step in the NLP lifecycle. It involves gathering data from various sources based on the problem statement, so it can be analyzed and processed.
|
| 127 |
+
- **Sources for data collection**:
|
| 128 |
+
- The data should be collected based on a clear understanding of the problem statement.
|
| 129 |
+
- From datasets available on websites like Kaggle.
|
| 130 |
+
- Through APIs.
|
| 131 |
+
- Manually, when needed.
|
| 132 |
+
- In most cases, data is collected through websites or APIs, but manual collection may be required in rare situations.
|
| 133 |
+
|
| 134 |
|
| 135 |
**Example**: Scraping customer reviews from Amazon to analyze sentiment and feedback about a product.
|
| 136 |
""")
|
| 137 |
|
| 138 |
elif lifecycle_option == "Text Preprocessing":
|
| 139 |
st.write("""
|
| 140 |
+
#### 3. Text Preprocessing
|
| 141 |
Text preprocessing prepares raw text for further analysis. This stage involves cleaning and transforming the data into a structured format that machine learning models can understand.
|
| 142 |
- **Tokenization**: Splitting text into smaller units (e.g., words, phrases).
|
| 143 |
- **Stop Words Removal**: Removing common words that don’t contribute much information.
|
|
|
|
| 153 |
|
| 154 |
elif lifecycle_option == "Text Representation":
|
| 155 |
st.write("""
|
| 156 |
+
#### 4. Text Representation
|
| 157 |
After preprocessing, the text data needs to be converted into a numerical format for use in machine learning models. There are several methods for text representation:
|
| 158 |
- **Bag of Words (BoW)**: Converts text into a matrix of word frequencies.
|
| 159 |
- **TF-IDF**: Weighs words based on their frequency in a specific document relative to their frequency across the entire dataset.
|
|
|
|
| 166 |
|
| 167 |
elif lifecycle_option == "Model Training":
|
| 168 |
st.write("""
|
| 169 |
+
#### 5. Model Training
|
| 170 |
In the model training stage, machine learning algorithms are trained on the preprocessed and represented text data. The choice of model depends on the task:
|
| 171 |
- **Text Classification**: Naive Bayes, Support Vector Machines (SVM), or neural networks.
|
| 172 |
- **Named Entity Recognition (NER)**: Conditional Random Fields (CRF), LSTMs, or transformers.
|
|
|
|
| 177 |
|
| 178 |
elif lifecycle_option == "Evaluation":
|
| 179 |
st.write("""
|
| 180 |
+
#### 6. Evaluation
|
| 181 |
After training the model, it's important to evaluate its performance. Common evaluation metrics include:
|
| 182 |
- **Accuracy**: The percentage of correctly classified samples.
|
| 183 |
- **Precision**: The proportion of true positive predictions among all positive predictions.
|
|
|
|
| 190 |
|
| 191 |
elif lifecycle_option == "Deployment":
|
| 192 |
st.write("""
|
| 193 |
+
#### 7. Deployment
|
| 194 |
Once the model is trained and evaluated, it is deployed to production for real-world use. This might include integration with applications like chatbots, recommendation systems, or text summarization tools.
|
| 195 |
- **Monitoring**: Continuous monitoring to ensure that the model performs well over time.
|
| 196 |
- **Retraining**: The model might need to be retrained periodically as new data becomes available.
|