ankithpatel commited on
Commit
908e05b
·
verified ·
1 Parent(s): b15e56e

Update pages/Lifecycle of Machine Learning.py

Browse files
Files changed (1) hide show
  1. pages/Lifecycle of Machine Learning.py +25 -142
pages/Lifecycle of Machine Learning.py CHANGED
@@ -1,147 +1,30 @@
1
-
2
- import streamlit as st
3
- import pandas as pd
4
- import numpy as np
5
-
6
- st.markdown(f"""
7
- <style>
8
- /* Set the background image for the entire app */
9
- .stApp {{
10
- background-color:rgba(0,0,0, 0.5);
11
- background-size: 1300px;
12
- background-repeat: no-repeat;
13
- background-attachment: fixed;
14
- background-position: center;
15
- }}
16
-
17
- </style>
18
- """, unsafe_allow_html=True)
19
-
20
  import streamlit as st
 
 
21
 
22
- # Navigation
23
- st.title("Life Cycle of ML")
24
- if 'page' not in st.session_state:
25
- st.session_state['page'] = 'home'
 
 
 
 
 
 
 
 
 
 
26
 
27
- # Main Navigation
28
- if st.session_state['page'] == 'home':
29
- st.subheader("Explore the Life Cycle Stages")
30
- if st.button("Data Collection"):
31
- st.session_state['page'] = 'data_collection'
32
 
33
- elif st.session_state['page'] == 'data_collection':
34
- # Data Collection Page
35
- st.title("Data Collection")
36
- st.header("1. What is Data?")
37
- st.write(
38
- "Data refers to raw facts and figures that are collected, stored, and analyzed to derive insights. "
39
- "It serves as the foundation for any machine learning model."
40
- )
41
-
42
- st.header("2. Types of Data")
43
- data_type = st.radio(
44
- "Select a type of data to learn more:",
45
- ("Structured", "Unstructured", "Semi-Structured")
46
- )
47
-
48
- if data_type == "Structured":
49
- st.subheader("Structured Data")
50
- st.write(
51
- "Structured data is highly organized and easily searchable within databases. "
52
- "It includes rows and columns, such as in relational databases."
53
- )
54
-
55
- st.write("Data Formats:")
56
- format_selected = st.radio(
57
- "Select a format to explore further:",
58
- ("Excel", "CSV")
59
- )
60
-
61
- if format_selected == "Excel":
62
- # Excel Data Format Section
63
- st.subheader("Excel Data Format")
64
- st.write("*What is it?*")
65
- st.write(
66
- "Excel files are spreadsheets used to organize and analyze data in rows and columns. "
67
- "They are widely used due to their user-friendly nature and support for various data types."
68
- )
69
-
70
- st.write("*How to Read Excel Files?*")
71
- st.code(
72
- """
73
- import pandas as pd
74
- # Reading an Excel file
75
- df = pd.read_excel('file.xlsx')
76
- print(df.head())
77
- """,
78
- language="python"
79
- )
80
-
81
- st.write("*Common Issues When Handling Excel Files*")
82
- st.write(
83
- """
84
- - Missing or corrupted files
85
- - Version incompatibilities
86
- - Incorrect file paths
87
- - Handling large Excel files
88
- """
89
- )
90
-
91
- st.write("*How to Overcome These Errors/Issues?*")
92
- st.write(
93
- """
94
- - Use proper error handling with try-except.
95
- - Convert Excel files to CSV for better compatibility.
96
- - Use libraries like openpyxl or xlrd for specific Excel versions.
97
- - Break large files into smaller chunks for processing.
98
- """
99
- )
100
-
101
- # Button to open Jupyter Notebook or PDF
102
- if st.button("Open Excel Documentation"):
103
- st.write("Download the [documentation notebook](path/to/excel_notebook.ipynb) or [PDF](path/to/excel_documentation.pdf).")
104
 
105
- elif format_selected == "CSV":
106
- # CSV Data Format Section
107
- st.subheader("CSV Data Format")
108
- st.write("*What is it?*")
109
- st.write(
110
- "CSV (Comma-Separated Values) files store tabular data in plain text, where each line represents a record, "
111
- "and fields are separated by commas."
112
- )
113
-
114
- st.write("*How to Read CSV Files?*")
115
- st.code(
116
- """
117
- import pandas as pd
118
- # Reading a CSV file
119
- df = pd.read_csv('file.csv')
120
- print(df.head())
121
- """,
122
- language="python"
123
- )
124
-
125
- st.write("*Common Issues When Handling CSV Files*")
126
- st.write(
127
- """
128
- - Encoding issues (e.g., UTF-8, ISO-8859-1)
129
- - Inconsistent delimiters
130
- - Missing or corrupted files
131
- - Large file sizes causing memory errors
132
- """
133
- )
134
-
135
- st.write("*How to Overcome These Errors/Issues?*")
136
- st.write(
137
- """
138
- - Specify the correct encoding when reading files using encoding='utf-8' or similar.
139
- - Use libraries like csv or pandas to handle different delimiters.
140
- - Employ error handling to catch and manage missing/corrupted files.
141
- - Use chunking to read large files in smaller parts: pd.read_csv('file.csv', chunksize=1000).
142
- """
143
- )
144
-
145
- # Button to open Jupyter Notebook or PDF
146
- if st.button("Open CSV Documentation"):
147
- st.write("Download the [documentation notebook](path/to/csv_notebook.ipynb) or [PDF](path/to/csv_documentation.pdf).")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from page1 import page1
3
+ from page2 import page2
4
 
5
+ def background():
6
+ st.markdown(f"""
7
+ <style>
8
+ /* Set the background image for the entire app */
9
+ .stApp {{
10
+ background-color:rgba(96, 155, 124, 0.5);
11
+ background-size: 1300px;
12
+ background-repeat: no-repeat;
13
+ background-attachment: fixed;
14
+ background-position: center;
15
+ }}
16
+
17
+ </style>
18
+ """, unsafe_allow_html=True)
19
 
20
+ def main():
21
+ if 'page' not in st.session_state:
22
+ st.session_state.page = 'Page1'
 
 
23
 
24
+ if st.session_state.page == 'Page1':
25
+ page1()
26
+ elif st.session_state.page == 'Page2':
27
+ page2()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
+ if __name__ == "__main__":
30
+ main()