File size: 6,264 Bytes
a4a298f
f7c5f07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b3b48bc
f7c5f07
b3b48bc
 
 
d4a7a6d
 
 
b3b48bc
 
 
 
f7c5f07
d4a7a6d
b3b48bc
 
 
d4a7a6d
b3b48bc
d4a7a6d
 
 
b3b48bc
 
 
 
 
f7c5f07
d4a7a6d
b3b48bc
 
 
d4a7a6d
 
b3b48bc
 
 
 
f7c5f07
25fab03
5554831
 
 
 
 
25fab03
5554831
 
 
 
 
 
 
 
 
 
25fab03
 
 
 
 
e92ee8b
25fab03
b8bcf0b
e92ee8b
9408831
 
 
 
 
 
 
 
dfceb96
 
 
 
 
 
 
 
9408831
 
 
dfceb96
 
 
9408831
e92ee8b
e4f9e2d
 
 
 
 
 
 
 
 
 
 
9408831
 
 
e4f9e2d
dfceb96
e4f9e2d
 
 
dfceb96
 
 
 
e4f9e2d
39864a0
e92ee8b
b8bcf0b
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
import streamlit as st

st.markdown("""
    <style>
    /* Set a soft background color */
    body {
        background-color: #eef2f7;
    }
    /* Style for main title */
    h1 {
        color: black;
        font-family: 'Roboto', sans-serif;
        font-weight: 700;
        text-align: center;
        margin-bottom: 25px;
    }
    /* Style for headers */
    h2 {
        color: black;
        font-family: 'Roboto', sans-serif;
        font-weight: 600;
        margin-top: 30px;
    }
    
    /* Style for subheaders */
     h3 {
        color: red;
        font-family: 'Roboto', sans-serif;
        font-weight: 500;
        margin-top: 20px;
    }
    .custom-subheader {
        color: black;
        font-family: 'Roboto', sans-serif;
        font-weight: 600;
        margin-bottom: 15px;
    }
    /* Paragraph styling */
    p {
        font-family: 'Georgia', serif;
        line-height: 1.8;
        color: black;
        margin-bottom: 20px;
    }
    /* List styling with checkmark bullets */
    .icon-bullet {
        list-style-type: none;
        padding-left: 20px;
    }
    .icon-bullet li {
        font-family: 'Georgia', serif;
        font-size: 1.1em;
        margin-bottom: 10px;
        color: black;
    }
    .icon-bullet li::before {
        content: "◆";
        padding-right: 10px;
        color: black;
    }
    /* Sidebar styling */
    .sidebar .sidebar-content {
        background-color: #ffffff;
        border-radius: 10px;
        padding: 15px;
    }
    .sidebar h2 {
        color: #495057;
    }
    /* Custom button style */
    .streamlit-button {
        background-color: #00FFFF;
        color: #000000;
        font-weight: bold;
    }
    </style>
    """, unsafe_allow_html=True)

st.markdown("<h1 class='header-title'>🛠️ Feature Engineering 📌</h1>", unsafe_allow_html=True)

st.markdown(
    """
    <div class='info-box'>
        <p>🔹 When we take existing features from collected data and create new useful features, where this is automatically engineered made from existing features and the technique of creating the features is known as <span class='highlight'>Feature Engineering</span>.</p>
        <p> These engineered features enhance machine learning models.</p>
        <p> A subpart of feature engineering is Feature Extraction.</p>
    </div>
    """,
    unsafe_allow_html=True
)

st.subheader(":violet[Feature Extraxtion]")
st.markdown(
    """
    <div class='info-box'>
        <p>📝 Feature Extraction is the process where text data which is natural language is given to machine to understand the natural language.</p>
        <ul>
            <li>Text is converted into vectors using specific algorithms.</li>
            <li>Preserving meaningful information is key.</li>
            <li>Helps in better text analysis & machine learning</li>
        </ul>
    </div>
    """,
    unsafe_allow_html=True
)

st.header("Vectorization🧭")
st.markdown(
    """
    <div class='info-box'>
        <p>Vectorization is the process of converting text into vector.</p>
        <p>This allows ML models to process text data effectively.</p>
    </div>
    """,
    unsafe_allow_html=True
)

st.subheader(":violet[Vectorization techniques]")
st.markdown("""
    There a different techniques to convert text into vector format.They are :
    <ul class="icon-bullet">
        <li>One-Hot Vectorization </li>
        <li>Bag of Words(BOW) </li>
        <li>Term Frequency - Inverse Document Frequency(TF-IDF)</li>
    </ul>
""", unsafe_allow_html=True)

st.markdown("""
    There are advance vectorization techniques.They are :
    <ul class="icon-bullet">
        <li>Word Embedding </li>
            <li>Word2Vec </li>
            <li>Fasttext</li>
    </ul>
""", unsafe_allow_html=True) 

st.sidebar.title("Navigation 🧭")
file_type = st.sidebar.radio(
    "Choose a Vectorization technique :",
    ("One-Hot Vectorization", "Bag of Words(BOW)", "Term Frequency - Inverse Document Frequency(TF-IDF)"))

if file_type == "One-Hot Vectorization":
    st.title(":red[One-Hot Vectorization]")
    st.markdown("""
        ### 📌 What is One-Hot Vectorization?
        -  It is a type of vectorization technique where text is converted into a numerical vector.
        -  This technique helps in representing words as unique vectors for machine learning models.
    """)

    st.markdown("""
        ### 🛠️ Steps in One-Hot Vectorization:
         - Create a Vocabulary ➡️ (A set of all unique words in the collected corpus).  
         - Find the Length of Vocabulary ➡️ (Total number of unique words = d-dimensions).  
         - Convert Each Word into a Vector:
           -  Every unique word is transformed into a vector.
           -  Each vector has d-dimensions, where each dimension corresponds to a unique word.
           -  Words are converted individually, and then combined to form a vector.

         This technique ensures that each word is treated uniquely and efficiently in NLP tasks.
        """)

    st.markdown("""
        -  Each word gets a unique vector representation.
        -  The number of dimensions = total vocabulary size.
        -  Words are vectorized separately, then combined into document vectors.
    """)

    st.markdown("""
        | **Word** | **Vector Representation** |
        |----------|--------------------------|
        |  **toy**  | [1,0,0,0,0] |
        |  **is**   | [0,1,0,0,0] |
        |  **good** | [0,0,1,0,0] |
        |  **not**  | [0,0,0,1,0] |
        |  **bad**  | [0,0,0,0,1] |
    """, unsafe_allow_html=True)

    st.markdown("""
        - d₁ → v₁ → `[[1,0,0,0,0] , [0,1,0,0,0] , [0,0,1,0,0]]`  
        - d₂ → v₂ → `[[1,0,0,0,0] , [0,1,0,0,0] , [0,0,0,1,0] , [0,0,1,0,0]]`  
        - d₃ → v₃ → `[[0,0,0,0,1], [1,0,0,0,0]]`  

     This One-Hot Vectorization technique converts words into numerical vectors while preserving their uniqueness.  
    """)

    st.markdown("""
        ###  Key Takeaways:
        -  Each word is represented as a 5-dimensional vector.  
        -  Every dimension corresponds to a unique word in the vocabulary.  
        -  This method is useful for transforming text into a numerical format for Machine Learning tasks.
    """)