Spaces:
Sleeping
Sleeping
Update Home.py
Browse files
Home.py
CHANGED
|
@@ -1,134 +1,30 @@
|
|
| 1 |
-
# import streamlit as st
|
| 2 |
-
# import pandas as pd
|
| 3 |
-
# import numpy as np
|
| 4 |
-
|
| 5 |
-
# st.markdown("""
|
| 6 |
-
# <h1 style="text-align:center; color:orange;">Hotel Data Analysis & Machine Learning</h1>
|
| 7 |
-
# """, unsafe_allow_html=True)
|
| 8 |
-
|
| 9 |
-
# st.markdown("""
|
| 10 |
-
# ## Predicting Customer Preferences and Optimizing Pricing:
|
| 11 |
-
# #### π Data Exploration and Preprocessing:
|
| 12 |
-
# - <span style="font-size:20px;">Cleaning and preparing data by handling missing values, encoding categorical features like *"category"* and *"location,"* and normalizing numerical data such as *"price"* and *"rating."*</span>
|
| 13 |
-
# - <span style="font-size:20px;">Analyzing trends in **customer reviews**, **cashback offers**, **discounts**, and **free services** to identify influential factors.
|
| 14 |
-
|
| 15 |
-
# #### π€ Predictive Modeling:
|
| 16 |
-
# - <span style="font-size:20px;">**Target Variable**: Predicting key metrics like *price category*, *likelihood of cancellation*, or *hotel ratings.*</span>
|
| 17 |
-
# - <span style="font-size:20px;">**Model Selection**: Building ML models such as **Decision Trees**, **Random Forests**, or **Gradient Boosting** for classification or regression tasks.</span>
|
| 18 |
-
# - <span style="font-size:20px;">**Feature Engineering**: Extracting insights from **review text** (via text sentiment analysis) or **free services** (binary encoding).</span>
|
| 19 |
-
|
| 20 |
-
# #### π Model Evaluation:
|
| 21 |
-
# - <span style="font-size:20px;">Comparing model performance using metrics like **accuracy**, **F1 score**, or **RMSE**, depending on the task.</span>
|
| 22 |
-
# - <span style="font-size:20px;">Employing techniques like **hyperparameter tuning** and **cross-validation** for optimization.</span>
|
| 23 |
-
|
| 24 |
-
# #### πΌ Insights and Deployment:
|
| 25 |
-
# - <span style="font-size:20px;">Unveiling actionable insights from **feature importance** to guide hotel marketing and pricing strategies.</span>
|
| 26 |
-
# - <span style="font-size:20px;">Deploying the model in a user-friendly interface to support stakeholders in making real-time decisions.</span>
|
| 27 |
-
|
| 28 |
-
# #### By integrating **machine learning** with **data analysis**, this project empowers hotel businesses to enhance customer satisfaction, optimize pricing strategies, and maximize profitability.
|
| 29 |
-
# """, unsafe_allow_html=True)
|
| 30 |
-
|
| 31 |
-
import os
|
| 32 |
-
import pandas as pd
|
| 33 |
import streamlit as st
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
# Define a persistent file path for the dataset
|
| 36 |
-
DATA_FILE_PATH = "dataset.csv"
|
| 37 |
-
|
| 38 |
-
# Page Title
|
| 39 |
st.markdown("""
|
| 40 |
-
<h1 style="text-align:center; color:
|
| 41 |
""", unsafe_allow_html=True)
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
if "dataset" not in st.session_state:
|
| 49 |
-
if os.path.exists(DATA_FILE_PATH):
|
| 50 |
-
st.session_state["dataset"] = pd.read_csv(DATA_FILE_PATH)
|
| 51 |
-
else:
|
| 52 |
-
st.session_state["dataset"] = None
|
| 53 |
-
|
| 54 |
-
# Home Page
|
| 55 |
-
if page == "Home":
|
| 56 |
-
st.title("Welcome to the Hotel Data App!")
|
| 57 |
-
|
| 58 |
-
# Add your new section for "Hotel Data Analysis & Machine Learning"
|
| 59 |
-
st.markdown("""
|
| 60 |
-
<h1 style="text-align:center; color:orange;">Hotel Data Analysis & Machine Learning</h1>
|
| 61 |
-
""", unsafe_allow_html=True)
|
| 62 |
-
|
| 63 |
-
st.markdown("""
|
| 64 |
-
## Predicting Customer Preferences and Optimizing Pricing:
|
| 65 |
-
#### π Data Exploration and Preprocessing:
|
| 66 |
-
- <span style="font-size:20px;">Cleaning and preparing data by handling missing values, encoding categorical features like *"category"* and *"location,"* and normalizing numerical data such as *"price"* and *"rating."*</span>
|
| 67 |
-
- <span style="font-size:20px;">Analyzing trends in **customer reviews**, **cashback offers**, **discounts**, and **free services** to identify influential factors.</span>
|
| 68 |
-
#### π€ Predictive Modeling:
|
| 69 |
-
- <span style="font-size:20px;">**Target Variable**: Predicting key metrics like *price category*, *likelihood of cancellation*, or *hotel ratings.*</span>
|
| 70 |
-
- <span style="font-size:20px;">**Model Selection**: Building ML models such as **Decision Trees**, **Random Forests**, or **Gradient Boosting** for classification or regression tasks.</span>
|
| 71 |
-
- <span style="font-size:20px;">**Feature Engineering**: Extracting insights from **review text** (via text sentiment analysis) or **free services** (binary encoding).</span>
|
| 72 |
-
#### π Model Evaluation:
|
| 73 |
-
- <span style="font-size:20px;">Comparing model performance using metrics like **accuracy**, **F1 score**, or **RMSE**, depending on the task.</span>
|
| 74 |
-
- <span style="font-size:20px;">Employing techniques like **hyperparameter tuning** and **cross-validation** for optimization.</span>
|
| 75 |
-
#### πΌ Insights and Deployment:
|
| 76 |
-
- <span style="font-size:20px;">Unveiling actionable insights from **feature importance** to guide hotel marketing and pricing strategies.</span>
|
| 77 |
-
- <span style="font-size:20px;">Deploying the model in a user-friendly interface to support stakeholders in making real-time decisions.</span>
|
| 78 |
-
#### By integrating **machine learning** with **data analysis**, this project empowers hotel businesses to enhance customer satisfaction, optimize pricing strategies, and maximize profitability.
|
| 79 |
-
""", unsafe_allow_html=True)
|
| 80 |
-
|
| 81 |
-
# st.info("Please upload a dataset to get started.")
|
| 82 |
-
elif page == "Hotel Data":
|
| 83 |
-
import pages.Hotel_Data
|
| 84 |
-
elif page == "Simple-EDA":
|
| 85 |
-
import pages.Simple_EDA
|
| 86 |
-
|
| 87 |
-
# # File uploader to upload a new dataset
|
| 88 |
-
# uploaded_file = st.file_uploader("Choose a CSV file", type=["csv"])
|
| 89 |
-
# if uploaded_file is not None:
|
| 90 |
-
# # Read and save the uploaded dataset
|
| 91 |
-
# df = pd.read_csv(uploaded_file)
|
| 92 |
-
# df.to_csv(DATA_FILE_PATH, index=False)
|
| 93 |
-
# st.session_state["dataset"] = df
|
| 94 |
-
|
| 95 |
-
# st.success("Dataset uploaded and saved permanently!")
|
| 96 |
-
# st.subheader("Uploaded Dataset Preview:")
|
| 97 |
-
# st.write(df.head())
|
| 98 |
-
|
| 99 |
-
# # Page 1: Dataset Overview
|
| 100 |
-
# elif page == "Page 1":
|
| 101 |
-
# st.title("Page 1: Dataset Overview")
|
| 102 |
-
|
| 103 |
-
# # Access dataset from session state
|
| 104 |
-
# df = st.session_state.get("dataset")
|
| 105 |
-
|
| 106 |
-
# if df is not None:
|
| 107 |
-
# st.subheader("Dataset Preview:")
|
| 108 |
-
# st.write(df.head())
|
| 109 |
-
|
| 110 |
-
# st.subheader("Dataset Description:")
|
| 111 |
-
# st.write(df.describe())
|
| 112 |
-
|
| 113 |
-
# st.subheader("Dataset Shape (Rows, Columns):")
|
| 114 |
-
# st.write(df.shape)
|
| 115 |
-
# else:
|
| 116 |
-
# st.warning("No dataset found. Please upload a dataset on the Home page.")
|
| 117 |
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
|
|
|
| 121 |
|
| 122 |
-
|
| 123 |
-
|
|
|
|
| 124 |
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
# st.write(f"Number of Columns: {df.shape[1]}")
|
| 129 |
-
# st.write("Column Names:", list(df.columns))
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
# st.warning("No dataset found. Please upload a dataset on the Home page.")
|
| 134 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
st.markdown("""
|
| 6 |
+
<h1 style="text-align:center; color:orange;">Hotel Data Analysis & Machine Learning</h1>
|
| 7 |
""", unsafe_allow_html=True)
|
| 8 |
|
| 9 |
+
st.markdown("""
|
| 10 |
+
## Predicting Customer Preferences and Optimizing Pricing:
|
| 11 |
+
#### π Data Exploration and Preprocessing:
|
| 12 |
+
- <span style="font-size:20px;">Cleaning and preparing data by handling missing values, encoding categorical features like *"category"* and *"location,"* and normalizing numerical data such as *"price"* and *"rating."*</span>
|
| 13 |
+
- <span style="font-size:20px;">Analyzing trends in **customer reviews**, **cashback offers**, **discounts**, and **free services** to identify influential factors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
#### π€ Predictive Modeling:
|
| 16 |
+
- <span style="font-size:20px;">**Target Variable**: Predicting key metrics like *price category*, *likelihood of cancellation*, or *hotel ratings.*</span>
|
| 17 |
+
- <span style="font-size:20px;">**Model Selection**: Building ML models such as **Decision Trees**, **Random Forests**, or **Gradient Boosting** for classification or regression tasks.</span>
|
| 18 |
+
- <span style="font-size:20px;">**Feature Engineering**: Extracting insights from **review text** (via text sentiment analysis) or **free services** (binary encoding).</span>
|
| 19 |
|
| 20 |
+
#### π Model Evaluation:
|
| 21 |
+
- <span style="font-size:20px;">Comparing model performance using metrics like **accuracy**, **F1 score**, or **RMSE**, depending on the task.</span>
|
| 22 |
+
- <span style="font-size:20px;">Employing techniques like **hyperparameter tuning** and **cross-validation** for optimization.</span>
|
| 23 |
|
| 24 |
+
#### πΌ Insights and Deployment:
|
| 25 |
+
- <span style="font-size:20px;">Unveiling actionable insights from **feature importance** to guide hotel marketing and pricing strategies.</span>
|
| 26 |
+
- <span style="font-size:20px;">Deploying the model in a user-friendly interface to support stakeholders in making real-time decisions.</span>
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
#### By integrating **machine learning** with **data analysis**, this project empowers hotel businesses to enhance customer satisfaction, optimize pricing strategies, and maximize profitability.
|
| 29 |
+
""", unsafe_allow_html=True)
|
|
|
|
| 30 |
|