Spaces:
Sleeping
Sleeping
Update pages/6_Model Creation.py
Browse files- pages/6_Model Creation.py +50 -0
pages/6_Model Creation.py
CHANGED
|
@@ -3,3 +3,53 @@ import numpy as np
|
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
st.markdown("<h1 style='text-align:center; color:purple;'>Modeal Creation</h1>",unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
|
| 5 |
st.markdown("<h1 style='text-align:center; color:purple;'>Modeal Creation</h1>",unsafe_allow_html=True)
|
| 6 |
+
|
| 7 |
+
import streamlit as st
|
| 8 |
+
|
| 9 |
+
# Title
|
| 10 |
+
st.title("Model Training and Selection with Optuna")
|
| 11 |
+
|
| 12 |
+
# Introduction to the section
|
| 13 |
+
st.write("""
|
| 14 |
+
Model training and selection is a crucial phase in machine learning. After completing the exploratory data analysis (EDA), the next step is to build and optimize predictive models. This section focuses on the following key aspects:
|
| 15 |
+
""")
|
| 16 |
+
|
| 17 |
+
# Data Splitting
|
| 18 |
+
st.subheader("Data Splitting")
|
| 19 |
+
st.write("""
|
| 20 |
+
The dataset is divided into training and testing sets. The training set is used to train the model, while the testing set is used to evaluate its performance on unseen data.
|
| 21 |
+
""")
|
| 22 |
+
|
| 23 |
+
# Model Selection
|
| 24 |
+
st.subheader("Model Selection")
|
| 25 |
+
st.write("""
|
| 26 |
+
Various machine learning algorithms can be used for solving the problem. In this section, we will consider:
|
| 27 |
+
- **Logistic Regression**: A statistical model commonly used for binary classification tasks.
|
| 28 |
+
- **K-Nearest Neighbors (KNN)**: A non-parametric algorithm used for classification based on distance metrics.
|
| 29 |
+
""")
|
| 30 |
+
|
| 31 |
+
# Data Preprocessing
|
| 32 |
+
st.subheader("Data Preprocessing")
|
| 33 |
+
st.write("""
|
| 34 |
+
Before training the model, the data may need to be preprocessed. This includes scaling features using techniques like:
|
| 35 |
+
- **StandardScaler**: Standardizes features by removing the mean and scaling to unit variance.
|
| 36 |
+
- **MinMaxScaler**: Scales features to a specific range, typically between 0 and 1.
|
| 37 |
+
""")
|
| 38 |
+
|
| 39 |
+
# Hyperparameter Tuning with Optuna
|
| 40 |
+
st.subheader("Hyperparameter Tuning with Optuna")
|
| 41 |
+
st.write("""
|
| 42 |
+
Optuna is an automatic hyperparameter optimization framework that allows us to efficiently search for the best hyperparameters for our models. It uses a technique called Bayesian Optimization to find the optimal set of hyperparameters that maximize the model's performance.
|
| 43 |
+
""")
|
| 44 |
+
|
| 45 |
+
# Model Evaluation
|
| 46 |
+
st.subheader("Model Evaluation")
|
| 47 |
+
st.write("""
|
| 48 |
+
After the model is trained and optimized, its performance is evaluated using appropriate metrics, such as accuracy, precision, recall, F1-score, etc.
|
| 49 |
+
""")
|
| 50 |
+
|
| 51 |
+
# Conclusion
|
| 52 |
+
st.write("""
|
| 53 |
+
This section focuses on using **Optuna** for hyperparameter tuning, ensuring the model performs optimally before deployment.
|
| 54 |
+
""")
|
| 55 |
+
|