diff --git a/requirements.txt b/requirements.txt index 1fdf8db..4683f85 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,12 +14,16 @@ idna==2.10 ipykernel==6.25.1 ipython==8.14.0 Jinja2==3.1.2 +kafka==1.3.5 +kafka_python==2.1.3 keras==3.9.2 MarkupSafe==2.1.3 +matplotlib==3.8.3 ml-dtypes==0.4.1 numpy==1.26.4 opt-einsum==3.4.0 -pandas==2.0.2 +pandas>=2.2.3 +Pillow==11.2.1 plotly==5.16.1 protobuf==3.20.3 pylint==3.3.6 @@ -27,6 +31,7 @@ pytest==8.3.5 PyPDF2==3.0.1 python-docx==1.1.2 requests==2.31.0 +river>=0.22.0 scikit-learn==1.3.0 six==1.16.0 statsmodels==0.14.4 diff --git a/src/PrescriptiveAnalysis2/backend/consumer.py b/src/PrescriptiveAnalysis2/backend/consumer.py new file mode 100644 index 0000000..9f09684 --- /dev/null +++ b/src/PrescriptiveAnalysis2/backend/consumer.py @@ -0,0 +1,189 @@ +import json +import logging +import os +import pickle +from kafka import KafkaConsumer +from river import tree, metrics +import io +import base64 +import threading +import time +import pandas as pd +from datetime import datetime + +class Consumer: + """Kafka consumer for processing shopping event data and training a Hoeffding tree model.""" + + def __init__(self, bootstrap_servers: str = 'localhost:9092', topic: str = 'shopping_events'): + # Configure logging + logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') + self.logger = logging.getLogger(__name__) + + # Initialize Kafka consumer + self.consumer = KafkaConsumer( + topic, + bootstrap_servers=bootstrap_servers, + value_deserializer=lambda m: json.loads(m.decode('utf-8')) + ) + + # Define categories + self.product_categories = ['electronics', 'fashion', 'home', 'books', 'toys'] + self.event_types = ['view', 'click', 'add_to_cart'] + + # Initialize Hoeffding Tree model + self.model = tree.HoeffdingTreeClassifier( + grace_period=10, + delta=0.99, + nominal_attributes=[ + f'product_category_{cat}' for cat in self.product_categories + ] + [ + f'event_type_{et}' for et in self.event_types + ], + split_criterion='gini' + ) + + # Initialize metrics + self.accuracy = metrics.Accuracy() + self.f1_score = metrics.F1() + self.sample_count = 0 + + # Set up data directory + self.data_dir = './src/PrescriptiveAnalysis2/streamlit_data/' + self.tree_dir = os.path.join(self.data_dir, 'tree') + self.events_dir = os.path.join(self.data_dir, 'hoeff_events') + + # Create directories + os.makedirs(self.data_dir, exist_ok=True) + os.makedirs(self.tree_dir, exist_ok=True) + os.makedirs(self.events_dir, exist_ok=True) + + # In-memory event store + self.recent_events = [] + self.max_recent_events = 100 + + # Last update timestamps + self.last_tree_update = 0 + self.last_events_update = 0 + + def preprocess(self, data: dict) -> dict: + """Preprocess raw event data into model features.""" + event_mapping = {'view': 0, 'click': 1, 'add_to_cart': 2} + category_mapping = {cat: idx for idx, cat in enumerate(self.product_categories)} + + return { + 'event_type': event_mapping[data['event_type']], + 'session_duration': data['session_duration'], + 'product_category': category_mapping[data['product_category']], + 'user_total_purchases': data['user_total_purchases'] + } + + def process_event(self, data: dict): + """Process a single shopping event.""" + features = self.preprocess(data) + target = data['purchase'] + + try: + # Make prediction + y_pred = self.model.predict_one(features) + + if y_pred is not None: + self.accuracy.update(target, y_pred) + self.f1_score.update(target, y_pred) + + # Learn from the new example + self.model.learn_one(features, target) + self.sample_count += 1 + + # Create readable event record + event_record = { + "timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"), + "user_id": data["user_id"], + "event_type": data["event_type"], + "session_duration": data["session_duration"], + "product_category": data["product_category"], + "user_total_purchases": data["user_total_purchases"], + "purchase": "Yes" if target == 1 else "No", + "prediction": "Yes" if y_pred == 1 else "No" if y_pred == 0 else "N/A" + } + + # Add to recent events + self.recent_events.append(event_record) + self.recent_events = self.recent_events[-self.max_recent_events:] # Keep only most recent + + # Create pandas DataFrame for events + df = pd.DataFrame(self.recent_events) + + # Update event data file every 5 processed events + if self.sample_count % 5 == 0: + # Save as CSV for easy reading + current_time = datetime.now().strftime("%Y%m%d_%H%M%S") + csv_path = os.path.join(self.events_dir, f"events_{current_time}.csv") + df.to_csv(csv_path, index=False) + self.logger.info(f"Saved events to {csv_path}") + + # Update tree visualization and accuracy every 20 events + if self.sample_count % 20 == 0: + self.update_tree_visualization() + self.update_accuracy() + + self.logger.info(f"Processed event: {data['user_id']}, prediction: {y_pred}, actual: {target}") + + except Exception as e: + self.logger.error(f"Error processing message: {e}") + import traceback + self.logger.error(traceback.format_exc()) + + def update_tree_visualization(self): + """Generate and save tree visualization image""" + try: + # Generate tree visualization + graph = self.model.draw(max_depth=5) + + # Save as PNG image with timestamp + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + image_path = os.path.join(self.tree_dir, f"tree_{timestamp}") + graph.render(filename=image_path, format='png', cleanup=True) + + self.logger.info(f"Tree visualization saved to {image_path}.png") + self.last_tree_update = time.time() + + except Exception as e: + self.logger.error(f"Error updating tree visualization: {e}") + import traceback + self.logger.error(traceback.format_exc()) + + def update_accuracy(self): + """Update accuracy metrics file""" + try: + # Save accuracy to a simple text file + accuracy_path = os.path.join(self.data_dir, 'accuracy.txt') + with open(accuracy_path, 'w') as f: + f.write(str(self.accuracy.get())) + + self.logger.info(f"Accuracy updated: {self.accuracy.get():.4f}") + + except Exception as e: + self.logger.error(f"Error updating accuracy: {e}") + + def run(self): + """Start consuming messages and processing events.""" + self.logger.info("Starting shopping event consumer and training model...") + + try: + for message in self.consumer: + data = message.value + self.process_event(data) + + except KeyboardInterrupt: + self.logger.info("Consumer stopped by user.") + except Exception as e: + self.logger.error(f"Unexpected error: {e}") + import traceback + self.logger.error(traceback.format_exc()) + finally: + self.consumer.close() + self.logger.info("Consumer connection closed.") + +if __name__ == "__main__": + consumer = Consumer() + consumer.run() \ No newline at end of file diff --git a/src/PrescriptiveAnalysis2/backend/consumer_clu.py b/src/PrescriptiveAnalysis2/backend/consumer_clu.py new file mode 100644 index 0000000..8f98ca6 --- /dev/null +++ b/src/PrescriptiveAnalysis2/backend/consumer_clu.py @@ -0,0 +1,237 @@ +import json +import logging +import os +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt +from kafka import KafkaConsumer +from datetime import datetime +import time + +# ========== CluStream Micro-Cluster Code ========== + +class MicroCluster: + def __init__(self, point, timestamp): + self.N = 1 + self.LS = np.array(point, dtype=float) + self.SS = np.square(point) + self.timestamp = timestamp + + def add_point(self, point): + self.N += 1 + self.LS += point + self.SS += np.square(point) + + def get_centroid(self): + return self.LS / self.N + + def get_radius(self): + centroid = self.get_centroid() + return np.sqrt(np.sum(self.SS / self.N - centroid ** 2)) + +class CluStream: + def __init__(self, max_micro_clusters=3, distance_threshold=50): + self.micro_clusters = [] + self.max_micro_clusters = max_micro_clusters + self.distance_threshold = distance_threshold + + def _euclidean(self, a, b): + return np.linalg.norm(a - b) + + def update(self, point, timestamp): + point = np.array(point) + if not self.micro_clusters: + self.micro_clusters.append(MicroCluster(point, timestamp)) + return + + min_dist = float('inf') + best_cluster = None + + for cluster in self.micro_clusters: + dist = self._euclidean(point, cluster.get_centroid()) + if dist < min_dist: + min_dist = dist + best_cluster = cluster + + if min_dist <= self.distance_threshold: + best_cluster.add_point(point) + elif len(self.micro_clusters) < self.max_micro_clusters: + self.micro_clusters.append(MicroCluster(point, timestamp)) + else: + # Replace the oldest cluster + oldest_idx = np.argmin([c.timestamp for c in self.micro_clusters]) + self.micro_clusters[oldest_idx] = MicroCluster(point, timestamp) + + def get_clusters(self): + return [cluster.get_centroid() for cluster in self.micro_clusters] + +# ========== Kafka + CluStream Consumer ========== + +class Consumer: + """Kafka consumer for processing parking event data and clustering with CluStream.""" + + def __init__(self, bootstrap_servers: str = 'localhost:9092', topic: str = 'parkingstream'): + # Configure logging + logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') + self.logger = logging.getLogger(__name__) + + # Initialize Kafka consumer + self.consumer = KafkaConsumer( + topic, + bootstrap_servers=bootstrap_servers, + value_deserializer=lambda m: json.loads(m.decode('utf-8')), + auto_offset_reset='latest', + enable_auto_commit=True, + group_id='parking-group' + ) + + # Initialize CluStream model + self.clustream = CluStream(max_micro_clusters=3, distance_threshold=100) + + # Define colors for clusters + self.cluster_colors = ['blue', 'green', 'purple'] + + # Initialize counters and storage + self.sample_count = 0 + self.recent_events = [] + self.max_recent_events = 100 + + # Set up data directory + self.data_dir = './src/PrescriptiveAnalysis2/streamlit_data/' + self.plot_dir = os.path.join(self.data_dir, 'plots') + self.events_dir = os.path.join(self.data_dir, 'events') + + # Create directories + os.makedirs(self.data_dir, exist_ok=True) + os.makedirs(self.plot_dir, exist_ok=True) + os.makedirs(self.events_dir, exist_ok=True) + + # Last update timestamps + self.last_plot_update = 0 + self.last_events_update = 0 + + def preprocess(self, data: dict) -> list: + """Preprocess raw event data into model features.""" + return [data['time_of_day'], data['occupancy']] + + def process_event(self, data: dict): + """Process a single parking event.""" + try: + # Preprocess data + point = self.preprocess(data) + timestamp = data['time_of_day'] + + # Update CluStream model + self.clustream.update(point, timestamp) + self.sample_count += 1 + + # Determine closest cluster + cluster_centers = np.array(self.clustream.get_clusters()) + if len(cluster_centers) > 0: + distances = [np.linalg.norm(np.array(point) - c) for c in cluster_centers] + closest_cluster = np.argmin(distances) + cluster_label = closest_cluster + else: + cluster_label = -1 # No clusters yet + + # Create readable event record + event_record = { + "timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"), + "time_of_day": data["time_of_day"], + "occupancy": data["occupancy"], + "cluster": cluster_label + } + + # Add to recent events + self.recent_events.append(event_record) + self.recent_events = self.recent_events[-self.max_recent_events:] # Keep only most recent + + # Create pandas DataFrame for events + df = pd.DataFrame(self.recent_events) + + # Update event data file every 5 processed events + if self.sample_count % 5 == 0: + current_time = datetime.now().strftime("%Y%m%d_%H%M%S") + csv_path = os.path.join(self.events_dir, f"events_{current_time}.csv") + df.to_csv(csv_path, index=False) + self.logger.info(f"Saved events to {csv_path}") + self.last_events_update = time.time() + + # Update cluster visualization every 20 events + if self.sample_count % 20 == 0: + self.update_cluster_visualization() + + self.logger.info(f"Processed event: time_of_day={data['time_of_day']}, occupancy={data['occupancy']}, cluster={cluster_label}") + + except Exception as e: + self.logger.error(f"Error processing message: {e}") + import traceback + self.logger.error(traceback.format_exc()) + + def update_cluster_visualization(self): + """Generate and save cluster visualization plot.""" + try: + # Prepare data + X = np.array([[e['time_of_day'], e['occupancy']] for e in self.recent_events]) + cluster_centers = np.array(self.clustream.get_clusters()) + + # Assign colors based on closest cluster + point_colors = [] + for p in X: + if len(cluster_centers) > 0: + distances = [np.linalg.norm(p - c) for c in cluster_centers] + closest_cluster = np.argmin(distances) + point_colors.append(self.cluster_colors[closest_cluster]) + else: + point_colors.append('gray') # Default color if no clusters + + # Create plot + plt.clf() + if len(X) > 0: + plt.scatter(X[:, 0], X[:, 1], color=point_colors, alpha=0.5, label='Streamed Points') + if len(cluster_centers) > 0: + plt.scatter(cluster_centers[:, 0], cluster_centers[:, 1], color='red', s=200, marker='X', label='Micro-Clusters') + + plt.xlabel("Time of Day (minutes)") + plt.ylabel("Occupancy (%)") + plt.title("CluStream: Streaming Micro-Clustering") + plt.legend() + + # Save plot + timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") + plot_path = os.path.join(self.plot_dir, f"plot_{timestamp}.png") + plt.savefig(plot_path) + plt.close() + + self.logger.info(f"Cluster visualization saved to {plot_path}") + self.last_plot_update = time.time() + + except Exception as e: + self.logger.error(f"Error updating cluster visualization: {e}") + import traceback + self.logger.error(traceback.format_exc()) + + def run(self): + """Start consuming messages and processing events.""" + self.logger.info("Starting parking event consumer and clustering with CluStream...") + + try: + for message in self.consumer: + data = message.value + self.process_event(data) + + except KeyboardInterrupt: + self.logger.info("Consumer stopped by user.") + except Exception as e: + self.logger.error(f"Unexpected error: {e}") + import traceback + self.logger.error(traceback.format_exc()) + finally: + self.consumer.close() + self.logger.info("Consumer connection closed.") + +if __name__ == "__main__": + consumer = Consumer() + consumer.run() + + diff --git a/src/PrescriptiveAnalysis2/backend/producer.py b/src/PrescriptiveAnalysis2/backend/producer.py new file mode 100644 index 0000000..aa230e6 --- /dev/null +++ b/src/PrescriptiveAnalysis2/backend/producer.py @@ -0,0 +1,91 @@ +import json +import random +import time +import logging +from kafka import KafkaProducer + +class Producer: + """Kafka producer for simulated shopping event data.""" + + def __init__(self, bootstrap_servers: str = 'localhost:9092'): + # Configure logging + logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') + self.logger = logging.getLogger(__name__) + + # Initialize Kafka producer + self.producer = KafkaProducer( + bootstrap_servers=bootstrap_servers, + value_serializer=lambda v: json.dumps(v).encode('utf-8') + ) + + # Parameters + self.user_ids = [f"user_{i:04}" for i in range(1, 201)] + self.product_categories = ['electronics', 'fashion', 'home', 'books', 'toys'] + self.event_types = ['view', 'click', 'add_to_cart'] + + # Track per-user purchase frequency + self.user_purchase_counts = {uid: random.randint(0, 30) for uid in self.user_ids} + + def generate_event(self) -> dict: + """Generate a simulated shopping event.""" + user_id = random.choice(self.user_ids) + product_category = random.choice(self.product_categories) + event_type = random.choice(self.event_types) + session_duration = round(random.uniform(1, 20), 2) + user_purchases = self.user_purchase_counts[user_id] + + # Rule-based purchase logic + purchase = int( + (event_type == 'view' and session_duration > 12 and user_purchases > 10) + or (event_type == 'add_to_cart' and session_duration > 5 and user_purchases > 4) + or (event_type == 'click' and session_duration > 7 and user_purchases > 6) + ) + + # Session duration categorization + if session_duration <= 6: + sd = 'low' + elif 6 < session_duration <= 10: + sd = 'medium' + else: + sd = 'high' + + # User purchases categorization + if user_purchases <= 5: + up = 'very few' + elif 5 < user_purchases <= 10: + up = 'few' + elif 10 < user_purchases <= 20: + up = 'medium' + else: + up = 'high' + + return { + "user_id": user_id, + "event_type": event_type, + "session_duration": sd, + "product_category": product_category, + "user_total_purchases": up, + "purchase": purchase + } + + def run(self): + """Continuously produce shopping events.""" + self.logger.info("Starting shopping data producer...") + try: + while True: + event = self.generate_event() + self.producer.send('shopping_events', event) + self.logger.info(f"Sent: {event}") + time.sleep(2) # Simulate near real-time events + + except KeyboardInterrupt: + self.logger.info("Producer stopped by user.") + except Exception as e: + self.logger.error(f"Unexpected error: {e}") + finally: + self.producer.close() + self.logger.info("Producer connection closed.") + +if __name__ == "__main__": + producer = Producer() + producer.run() diff --git a/src/PrescriptiveAnalysis2/backend/producer_clu.py b/src/PrescriptiveAnalysis2/backend/producer_clu.py new file mode 100644 index 0000000..7ec42fd --- /dev/null +++ b/src/PrescriptiveAnalysis2/backend/producer_clu.py @@ -0,0 +1,35 @@ +from kafka import KafkaProducer +import json +import time +import random +from datetime import datetime + +producer = KafkaProducer( + bootstrap_servers='localhost:9092', + value_serializer=lambda v: json.dumps(v).encode('utf-8') +) + +topic = 'parkingstream' + +def generate_occupancy(time_min): + """Generate occupancy percentage based on time.""" + if 420 <= time_min <= 600: # 7 AM – 10 AM + return random.randint(70, 90) + elif 720 <= time_min <= 900: # 12 PM – 3 PM + return random.randint(85, 100) + elif 1080 <= time_min <= 1320: # 6 PM – 10 PM + return random.randint(40, 60) + else: + return random.randint(5, 30) + +time_of_day = 0 + +while time_of_day < 1440: + data = { + 'time_of_day': time_of_day, + 'occupancy': generate_occupancy(time_of_day) + } + print(f"Produced: {data}") + producer.send(topic, value=data) + time.sleep(2) # Simulate streaming every second (10 minutes in simulation) + time_of_day += 10 \ No newline at end of file diff --git a/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_20.png b/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_20.png new file mode 100644 index 0000000..ed10327 Binary files /dev/null and b/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_20.png differ diff --git a/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_40.png b/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_40.png new file mode 100644 index 0000000..0ec7581 Binary files /dev/null and b/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_40.png differ diff --git a/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_60.png b/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_60.png new file mode 100644 index 0000000..4234cb5 Binary files /dev/null and b/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_60.png differ diff --git a/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_80.png b/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_80.png new file mode 100644 index 0000000..faaa52a Binary files /dev/null and b/src/PrescriptiveAnalysis2/backend/visualisations/hoeffding_tree_80.png differ diff --git a/src/PrescriptiveAnalysis2/frontend/clustream_ui.py b/src/PrescriptiveAnalysis2/frontend/clustream_ui.py new file mode 100644 index 0000000..f24fadc --- /dev/null +++ b/src/PrescriptiveAnalysis2/frontend/clustream_ui.py @@ -0,0 +1,242 @@ +import streamlit as st +import subprocess +import time +import os +import glob +import shutil +from PIL import Image +import pandas as pd + +# Configuration +KAFKA_HOME = "C:/kafka_2.13-3.9.0" # Update this path if needed +TOPIC_NAME = "parkingstream" + +# Paths (keep relative as in consumer code) +DATA_DIR = './src/PrescriptiveAnalysis2/streamlit_data/' +PLOT_DIR = os.path.join(DATA_DIR, 'plots') +EVENTS_DIR = os.path.join(DATA_DIR, 'events') + +# Create directories if they don't exist +os.makedirs(PLOT_DIR, exist_ok=True) +os.makedirs(EVENTS_DIR, exist_ok=True) + +# Kafka commands +ZK_CMD = f'{KAFKA_HOME}/bin/windows/zookeeper-server-start.bat {KAFKA_HOME}/config/zookeeper.properties' +KAFKA_CMD = f'{KAFKA_HOME}/bin/windows/kafka-server-start.bat {KAFKA_HOME}/config/server.properties' +TOPIC_CMD = f'{KAFKA_HOME}/bin/windows/kafka-topics.bat --create --topic {TOPIC_NAME} --bootstrap-server localhost:9092 --replication-factor 1 --partitions 4' + +# Streamlit UI setup +st.set_page_config(page_title="CluStream Clustering", layout="wide") +st.title("CluStream Clustering") + +# Global variables to track processes +processes = { + 'zookeeper': None, + 'kafka_server': None, + 'producer': None, + 'consumer': None +} + +# Initialize session state +if "running" not in st.session_state: + st.session_state.running = False +if "last_plot_refresh" not in st.session_state: + st.session_state.last_plot_refresh = time.time() +if "last_data_refresh" not in st.session_state: + st.session_state.last_data_refresh = time.time() + +def clear_directories(): + """Clear contents of both PLOT_DIR and EVENTS_DIR""" + try: + # Clear plot directory + for filename in os.listdir(PLOT_DIR): + file_path = os.path.join(PLOT_DIR, filename) + try: + if os.path.isfile(file_path) or os.path.islink(file_path): + os.unlink(file_path) + elif os.path.isdir(file_path): + shutil.rmtree(file_path) + except Exception as e: + st.error(f'Failed to delete {file_path}. Reason: {e}') + + # Clear events directory + for filename in os.listdir(EVENTS_DIR): + file_path = os.path.join(EVENTS_DIR, filename) + try: + if os.path.isfile(file_path) or os.path.islink(file_path): + os.unlink(file_path) + elif os.path.isdir(file_path): + shutil.rmtree(file_path) + except Exception as e: + st.error(f'Failed to delete {file_path}. Reason: {e}') + + st.success("Cleared all plot and event data files") + except Exception as e: + st.error(f"Error clearing directories: {e}") + +def launch_background(command, process_key=None): + """Launch a background process and store reference if needed""" + if isinstance(command, list): + process = subprocess.Popen(command) + else: + process = subprocess.Popen(command, shell=True) + if process_key: + processes[process_key] = process + return process + +def start_zookeeper(): + """Start Zookeeper service""" + st.info("Starting Zookeeper...") + processes['zookeeper'] = launch_background(ZK_CMD) + time.sleep(5) + st.success("Zookeeper started successfully") + +def start_kafka_server(): + """Start Kafka server""" + st.info("Starting Kafka Server...") + processes['kafka_server'] = launch_background(KAFKA_CMD) + time.sleep(10) + st.success("Kafka Server started successfully") + +def create_topic(): + """Create Kafka topic""" + st.info("Creating Kafka topic...") + try: + result = subprocess.run(TOPIC_CMD, shell=True, capture_output=True, text=True) + if result.returncode == 0: + st.success(f"Topic '{TOPIC_NAME}' created successfully") + else: + st.warning(f"Topic creation may have failed: {result.stderr}") + except Exception as e: + st.warning(f"Topic creation may have failed: {e}") + time.sleep(2) + +def start_producer(): + """Start the producer script""" + st.info("Starting Kafka Producer...") + processes['producer'] = launch_background(['python', 'src/PrescriptiveAnalysis2/backend/producer_clu.py']) + st.success("Producer started successfully") + +def start_consumer(): + """Start the consumer script""" + st.info("Starting Kafka Consumer...") + processes['consumer'] = launch_background(['python', 'src/PrescriptiveAnalysis2/backend/consumer_clu.py']) + st.success("Consumer started successfully") + +def stop_services(): + """Stop all running services and clear data directories""" + st.session_state.running = False + + # First stop all services + for name, process in processes.items(): + if process: + try: + process.terminate() + process.wait(timeout=5) + except: + pass + processes[name] = None + # Then clear the data directories + clear_directories() + + st.success("All services stopped and data cleared successfully") + +def start_all_services(): + """Start the complete pipeline""" + if not st.session_state.running: + st.session_state.running = True + start_zookeeper() + start_kafka_server() + create_topic() + start_producer() + start_consumer() + +# UI Controls +st.subheader("") +col1, col2 = st.columns(2) +with col1: + if st.button("Start Full Pipeline", disabled=st.session_state.running): + start_all_services() +with col2: + if st.button("Stop Pipeline", disabled=not st.session_state.running): + stop_services() + +# Layout containers +col1, col2 = st.columns([2, 3]) + +# Event data display container +with col1: + st.subheader("📈 Recent Events") + events_placeholder = st.empty() + +# Cluster visualization container +with col2: + st.subheader("📊 CluStream Cluster Visualization") + plot_placeholder = st.empty() + +def get_recent_event_data(): + """Get the most recent event data from CSV files""" + try: + csv_files = glob.glob(os.path.join(EVENTS_DIR, "*.csv")) + if not csv_files: + st.warning("No event CSV files found in ./streamlit_data/events/") + return None + csv_files.sort(key=os.path.getmtime, reverse=True) + df = pd.read_csv(csv_files[0]) + return df + except Exception as e: + st.error(f"Error loading event data: {e}") + return None + +def get_latest_plot_image(): + """Get the most recent cluster visualization image""" + try: + png_files = glob.glob(os.path.join(PLOT_DIR, "*.png")) + if not png_files: + st.warning("No plot PNG files found in ./streamlit_data/plots/") + return None + png_files.sort(key=os.path.getmtime, reverse=True) + return Image.open(png_files[0]) + except Exception as e: + st.error(f"Error loading plot image: {e}") + return None + +def update_status(): + """Update pipeline status in sidebar""" + status_text = f""" + - Zookeeper: {'✅ Running' if processes['zookeeper'] and processes['zookeeper'].poll() is None else '❌ Stopped'} + - Kafka Server: {'✅ Running' if processes['kafka_server'] and processes['kafka_server'].poll() is None else '❌ Stopped'} + - Producer: {'✅ Running' if processes['producer'] and processes['producer'].poll() is None else '❌ Stopped'} + - Consumer: {'✅ Running' if processes['consumer'] and processes['consumer'].poll() is None else '❌ Stopped'} + """ + st.sidebar.markdown(status_text) + +# Sidebar for status +st.sidebar.subheader("Pipeline Status") + +# Main UI logic +if st.session_state.running: + # Update UI when pipeline is running + update_status() + + # Update event data + df = get_recent_event_data() + if df is not None: + events_placeholder.dataframe(df, use_container_width=True) + else: + events_placeholder.warning("Waiting for event data...") + + # Update cluster visualization + img = get_latest_plot_image() + if img: + plot_placeholder.image(img, use_column_width=True) + else: + plot_placeholder.warning("Waiting for cluster visualization...") + + time.sleep(2) # Update every 2 seconds + st.rerun() # Refresh UI +else: + # Display placeholders when pipeline is not running + update_status() + events_placeholder.info("Start the pipeline to see recent events.") + plot_placeholder.info("Start the pipeline to see the cluster visualization.") \ No newline at end of file diff --git a/src/PrescriptiveAnalysis2/frontend/hoeffding_ui.py b/src/PrescriptiveAnalysis2/frontend/hoeffding_ui.py new file mode 100644 index 0000000..90b60f2 --- /dev/null +++ b/src/PrescriptiveAnalysis2/frontend/hoeffding_ui.py @@ -0,0 +1,267 @@ +import streamlit as st +import subprocess +import time +import os +import glob +import shutil +from PIL import Image +import pandas as pd + +# Configuration +KAFKA_HOME = "C:/kafka_2.13-3.9.0" # Update this path if needed +TOPIC_NAME = "shopping_events" + +# Paths (keep relative as in original) +DATA_DIR = './src/PrescriptiveAnalysis2/streamlit_data/' +TREE_DIR = os.path.join(DATA_DIR, 'tree') +EVENTS_DIR = os.path.join(DATA_DIR, 'hoeff_events') + +# Create directories if they don't exist +os.makedirs(TREE_DIR, exist_ok=True) +os.makedirs(EVENTS_DIR, exist_ok=True) + +# Kafka commands +ZK_CMD = f'{KAFKA_HOME}/bin/windows/zookeeper-server-start.bat {KAFKA_HOME}/config/zookeeper.properties' +KAFKA_CMD = f'{KAFKA_HOME}/bin/windows/kafka-server-start.bat {KAFKA_HOME}/config/server.properties' +TOPIC_CMD = f'{KAFKA_HOME}/bin/windows/kafka-topics.bat --create --topic {TOPIC_NAME} --bootstrap-server localhost:9092 --replication-factor 1 --partitions 4' + +# Streamlit UI setup +st.set_page_config(page_title="Hoeffding Tree Stream", layout="wide") +st.title("Hoeffding Tree") + +# Global variables to track processes +processes = { + 'zookeeper': None, + 'kafka_server': None, + 'producer': None, + 'consumer': None +} + +# Initialize session state +if "running" not in st.session_state: + st.session_state.running = False +if "last_tree_refresh" not in st.session_state: + st.session_state.last_tree_refresh = time.time() +if "last_data_refresh" not in st.session_state: + st.session_state.last_data_refresh = time.time() + +def clear_directories(): + """Clear contents of TREE_DIR and EVENTS_DIR""" + try: + # Clear tree directory + for filename in os.listdir(TREE_DIR): + file_path = os.path.join(TREE_DIR, filename) + try: + if os.path.isfile(file_path) or os.path.islink(file_path): + os.unlink(file_path) + elif os.path.isdir(file_path): + shutil.rmtree(file_path) + except Exception as e: + st.error(f'Failed to delete {file_path}. Reason: {e}') + + # Clear events directory + for filename in os.listdir(EVENTS_DIR): + file_path = os.path.join(EVENTS_DIR, filename) + try: + if os.path.isfile(file_path) or os.path.islink(file_path): + os.unlink(file_path) + elif os.path.isdir(file_path): + shutil.rmtree(file_path) + except Exception as e: + st.error(f'Failed to delete {file_path}. Reason: {e}') + + st.success("Cleared all data files") + except Exception as e: + st.error(f"Error clearing directories: {e}") + +def launch_background(command, process_key=None): + """Launch a background process and store reference if needed""" + if isinstance(command, list): + process = subprocess.Popen(command) + else: + process = subprocess.Popen(command, shell=True) + if process_key: + processes[process_key] = process + return process + +def start_zookeeper(): + """Start Zookeeper service""" + st.info("Starting Zookeeper...") + processes['zookeeper'] = launch_background(ZK_CMD) + time.sleep(5) + st.success("Zookeeper started successfully") + +def start_kafka_server(): + """Start Kafka server""" + st.info("Starting Kafka Server...") + processes['kafka_server'] = launch_background(KAFKA_CMD) + time.sleep(10) + st.success("Kafka Server started successfully") + +def create_topic(): + """Create Kafka topic""" + st.info("Creating Kafka topic...") + try: + result = subprocess.run(TOPIC_CMD, shell=True, capture_output=True, text=True) + if result.returncode == 0: + st.success(f"Topic '{TOPIC_NAME}' created successfully") + else: + st.warning(f"Topic creation may have failed: {result.stderr}") + except Exception as e: + st.warning(f"Topic creation may have failed: {e}") + time.sleep(2) + +def start_producer(): + """Start the producer script""" + st.info("Starting Kafka Producer...") + processes['producer'] = launch_background(['python', 'src/PrescriptiveAnalysis2/backend/producer.py']) + st.success("Producer started successfully") + +def start_consumer(): + """Start the consumer script""" + st.info("Starting Kafka Consumer...") + processes['consumer'] = launch_background(['python', 'src/PrescriptiveAnalysis2/backend/consumer.py']) + st.success("Consumer started successfully") + +def stop_services(): + """Stop all running services and clear data""" + st.session_state.running = False + for name, process in processes.items(): + if process: + try: + process.terminate() + process.wait(timeout=5) + except: + pass + processes[name] = None + + # Clear the data directories + clear_directories() + st.success("All services stopped and data cleared successfully") + +def start_all_services(): + """Start the complete pipeline""" + if not st.session_state.running: + st.session_state.running = True + start_zookeeper() + start_kafka_server() + create_topic() + start_producer() + start_consumer() + +# UI Controls +st.subheader("") +col1, col2 = st.columns(2) +with col1: + if st.button("Start Full Pipeline", disabled=st.session_state.running): + start_all_services() +with col2: + if st.button("Stop Pipeline", disabled=not st.session_state.running): + stop_services() + +# Layout containers +col1, col2 = st.columns([2, 3]) + +# Event data display container +with col1: + st.subheader("📈 Recent Events") + events_placeholder = st.empty() + +# Tree visualization and stats containers +with col2: + st.subheader("🌳 Hoeffding Tree Visualization") + tree_placeholder = st.empty() + st.subheader("📉 Model Accuracy") + accuracy_placeholder = st.empty() + +def get_recent_event_data(): + """Get the most recent event data from CSV files""" + try: + csv_files = glob.glob(os.path.join(EVENTS_DIR, "*.csv")) + if not csv_files: + st.warning("No event CSV files found in ./streamlit_data/hoeff_events/") + return None + csv_files.sort(key=os.path.getmtime, reverse=True) + df = pd.read_csv(csv_files[0]) + return df + except Exception as e: + st.error(f"Error loading event data: {e}") + return None + +def get_latest_tree_image(): + """Get the most recent tree visualization image""" + try: + png_files = glob.glob(os.path.join(TREE_DIR, "*.png")) + if not png_files: + st.warning("No tree PNG files found in ./streamlit_data/tree/") + return None + png_files.sort(key=os.path.getmtime, reverse=True) + return Image.open(png_files[0]) + except Exception as e: + st.error(f"Error loading tree image: {e}") + return None + +def get_latest_accuracy(): + """Get the latest accuracy from the accuracy.txt file""" + try: + acc_file = os.path.join(DATA_DIR, 'accuracy.txt') + if not os.path.exists(acc_file): + st.warning("Accuracy file not found at ./streamlit_data/accuracy.txt") + return None + with open(acc_file, 'r') as f: + acc_text = f.read().strip() + if acc_text: + return float(acc_text) + return None + except Exception as e: + st.error(f"Error reading accuracy: {e}") + return None + +def update_status(): + """Update pipeline status in sidebar""" + status_text = f""" + - Zookeeper: {'✅ Running' if processes['zookeeper'] and processes['zookeeper'].poll() is None else '❌ Stopped'} + - Kafka Server: {'✅ Running' if processes['kafka_server'] and processes['kafka_server'].poll() is None else '❌ Stopped'} + - Producer: {'✅ Running' if processes['producer'] and processes['producer'].poll() is None else '❌ Stopped'} + - Consumer: {'✅ Running' if processes['consumer'] and processes['consumer'].poll() is None else '❌ Stopped'} + """ + st.sidebar.markdown(status_text) + +# Sidebar for status +st.sidebar.subheader("Pipeline Status") +#update_status() + +# Main UI logic +if st.session_state.running: + # Update UI when pipeline is running + update_status() + + # Update event data + df = get_recent_event_data() + if df is not None: + events_placeholder.dataframe(df, use_container_width=True) + else: + events_placeholder.warning("Waiting for event data...") + + # Update tree visualization + img = get_latest_tree_image() + if img: + tree_placeholder.image(img, use_column_width=True) + else: + tree_placeholder.warning("Waiting for tree visualization...") + + # Update accuracy + acc = get_latest_accuracy() + if acc is not None: + accuracy_placeholder.metric("Model Accuracy", f"{acc:.4f}") + else: + accuracy_placeholder.warning("Waiting for accuracy data...") + + time.sleep(2) # Update every 2 seconds + st.rerun() # Refresh UI +else: + # Display placeholders when pipeline is not running + update_status() + events_placeholder.info("Start the pipeline to see recent events.") + tree_placeholder.info("Start the pipeline to see the tree visualization.") + accuracy_placeholder.info("Start the pipeline to see model accuracy.") \ No newline at end of file diff --git a/src/PrescriptiveAnalysis2/frontend/main_ui.py b/src/PrescriptiveAnalysis2/frontend/main_ui.py new file mode 100644 index 0000000..a63c598 --- /dev/null +++ b/src/PrescriptiveAnalysis2/frontend/main_ui.py @@ -0,0 +1,19 @@ +import streamlit as st +import subprocess + +st.set_page_config(page_title="PRESCRIPTIVE ANALYSIS-2 : STREAMING DATA ANALYSIS") + +st.title("PRESCRIPTIVE ANALYSIS-2 : STREAMING DATA ANALYSIS") +st.markdown("### Select a module to launch:") + +option = st.selectbox("Choose Module", ["-- Select --", "Hoeffding Tree", "CluStream"]) + +if st.button("Run Selected Module"): + if option == "Hoeffding Tree": + st.success("Launching Hoeffding Tree UI...") + subprocess.Popen(["streamlit", "run", "./src/PrescriptiveAnalysis2/frontend/hoeffding_ui.py"]) + elif option == "CluStream": + st.success("Launching Clustream UI...") + subprocess.Popen(["streamlit", "run", "./src/PrescriptiveAnalysis2/frontend/clustream_ui.py"]) + else: + st.warning("Please select a valid module.") diff --git a/src/PrescriptiveAnalysis2/streamlit_data/accuracy.txt b/src/PrescriptiveAnalysis2/streamlit_data/accuracy.txt new file mode 100644 index 0000000..9c1f7d3 --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/accuracy.txt @@ -0,0 +1 @@ +0.7988826815642458 \ No newline at end of file diff --git a/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005756.csv b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005756.csv new file mode 100644 index 0000000..7c7acf4 --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005756.csv @@ -0,0 +1,101 @@ +timestamp,time_of_day,occupancy,cluster +2025-04-17 00:54:37,50,26,0 +2025-04-17 00:54:39,60,24,0 +2025-04-17 00:54:41,70,22,0 +2025-04-17 00:54:43,80,19,0 +2025-04-17 00:54:45,90,18,0 +2025-04-17 00:54:47,100,12,0 +2025-04-17 00:54:49,110,24,0 +2025-04-17 00:54:51,120,14,0 +2025-04-17 00:54:53,130,9,0 +2025-04-17 00:54:55,140,7,0 +2025-04-17 00:54:57,150,26,0 +2025-04-17 00:54:59,160,6,0 +2025-04-17 00:55:01,170,8,0 +2025-04-17 00:55:03,180,25,0 +2025-04-17 00:55:05,190,15,1 +2025-04-17 00:55:07,200,27,1 +2025-04-17 00:55:09,210,6,1 +2025-04-17 00:55:11,220,29,1 +2025-04-17 00:55:13,230,25,1 +2025-04-17 00:55:15,240,8,1 +2025-04-17 00:55:17,250,20,1 +2025-04-17 00:55:19,260,23,1 +2025-04-17 00:55:21,270,21,1 +2025-04-17 00:55:23,280,9,1 +2025-04-17 00:55:25,290,24,1 +2025-04-17 00:55:27,300,5,1 +2025-04-17 00:55:29,310,7,1 +2025-04-17 00:55:31,320,30,1 +2025-04-17 00:55:33,330,19,1 +2025-04-17 00:55:35,340,14,1 +2025-04-17 00:55:37,350,24,1 +2025-04-17 00:55:39,360,25,1 +2025-04-17 00:55:42,370,11,1 +2025-04-17 00:55:43,380,10,2 +2025-04-17 00:55:45,390,25,2 +2025-04-17 00:55:47,400,22,2 +2025-04-17 00:55:49,410,14,2 +2025-04-17 00:55:51,420,80,2 +2025-04-17 00:55:53,430,84,2 +2025-04-17 00:55:55,440,87,2 +2025-04-17 00:55:57,450,72,2 +2025-04-17 00:55:59,460,74,2 +2025-04-17 00:56:02,470,77,2 +2025-04-17 00:56:04,480,84,2 +2025-04-17 00:56:06,490,88,2 +2025-04-17 00:56:08,500,77,2 +2025-04-17 00:56:10,510,87,2 +2025-04-17 00:56:12,520,90,2 +2025-04-17 00:56:14,530,79,2 +2025-04-17 00:56:16,540,79,2 +2025-04-17 00:56:18,550,85,2 +2025-04-17 00:56:20,560,86,2 +2025-04-17 00:56:22,570,77,0 +2025-04-17 00:56:24,580,76,0 +2025-04-17 00:56:26,590,72,0 +2025-04-17 00:56:28,600,81,0 +2025-04-17 00:56:30,610,19,0 +2025-04-17 00:56:32,620,10,0 +2025-04-17 00:56:34,630,6,0 +2025-04-17 00:56:36,640,16,0 +2025-04-17 00:56:38,650,19,0 +2025-04-17 00:56:40,660,24,0 +2025-04-17 00:56:42,670,25,0 +2025-04-17 00:56:44,680,10,0 +2025-04-17 00:56:46,690,13,0 +2025-04-17 00:56:48,700,29,0 +2025-04-17 00:56:50,710,10,0 +2025-04-17 00:56:52,720,91,0 +2025-04-17 00:56:54,730,97,1 +2025-04-17 00:56:56,740,89,1 +2025-04-17 00:56:58,750,93,1 +2025-04-17 00:57:00,760,93,1 +2025-04-17 00:57:02,770,88,1 +2025-04-17 00:57:04,780,91,1 +2025-04-17 00:57:06,790,86,1 +2025-04-17 00:57:08,800,88,1 +2025-04-17 00:57:10,810,86,1 +2025-04-17 00:57:12,820,92,1 +2025-04-17 00:57:14,830,99,1 +2025-04-17 00:57:16,840,96,1 +2025-04-17 00:57:18,850,85,1 +2025-04-17 00:57:20,860,98,1 +2025-04-17 00:57:22,870,88,1 +2025-04-17 00:57:24,880,93,1 +2025-04-17 00:57:26,890,90,1 +2025-04-17 00:57:28,900,90,1 +2025-04-17 00:57:30,910,21,2 +2025-04-17 00:57:32,920,23,2 +2025-04-17 00:57:34,930,14,2 +2025-04-17 00:57:36,940,9,2 +2025-04-17 00:57:38,950,22,2 +2025-04-17 00:57:40,960,22,2 +2025-04-17 00:57:42,970,11,2 +2025-04-17 00:57:44,980,26,2 +2025-04-17 00:57:46,990,24,2 +2025-04-17 00:57:48,1000,11,2 +2025-04-17 00:57:50,1010,18,2 +2025-04-17 00:57:52,1020,18,2 +2025-04-17 00:57:54,1030,15,2 +2025-04-17 00:57:56,1040,25,2 diff --git a/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005806.csv b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005806.csv new file mode 100644 index 0000000..38101b0 --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005806.csv @@ -0,0 +1,101 @@ +timestamp,time_of_day,occupancy,cluster +2025-04-17 00:54:47,100,12,0 +2025-04-17 00:54:49,110,24,0 +2025-04-17 00:54:51,120,14,0 +2025-04-17 00:54:53,130,9,0 +2025-04-17 00:54:55,140,7,0 +2025-04-17 00:54:57,150,26,0 +2025-04-17 00:54:59,160,6,0 +2025-04-17 00:55:01,170,8,0 +2025-04-17 00:55:03,180,25,0 +2025-04-17 00:55:05,190,15,1 +2025-04-17 00:55:07,200,27,1 +2025-04-17 00:55:09,210,6,1 +2025-04-17 00:55:11,220,29,1 +2025-04-17 00:55:13,230,25,1 +2025-04-17 00:55:15,240,8,1 +2025-04-17 00:55:17,250,20,1 +2025-04-17 00:55:19,260,23,1 +2025-04-17 00:55:21,270,21,1 +2025-04-17 00:55:23,280,9,1 +2025-04-17 00:55:25,290,24,1 +2025-04-17 00:55:27,300,5,1 +2025-04-17 00:55:29,310,7,1 +2025-04-17 00:55:31,320,30,1 +2025-04-17 00:55:33,330,19,1 +2025-04-17 00:55:35,340,14,1 +2025-04-17 00:55:37,350,24,1 +2025-04-17 00:55:39,360,25,1 +2025-04-17 00:55:42,370,11,1 +2025-04-17 00:55:43,380,10,2 +2025-04-17 00:55:45,390,25,2 +2025-04-17 00:55:47,400,22,2 +2025-04-17 00:55:49,410,14,2 +2025-04-17 00:55:51,420,80,2 +2025-04-17 00:55:53,430,84,2 +2025-04-17 00:55:55,440,87,2 +2025-04-17 00:55:57,450,72,2 +2025-04-17 00:55:59,460,74,2 +2025-04-17 00:56:02,470,77,2 +2025-04-17 00:56:04,480,84,2 +2025-04-17 00:56:06,490,88,2 +2025-04-17 00:56:08,500,77,2 +2025-04-17 00:56:10,510,87,2 +2025-04-17 00:56:12,520,90,2 +2025-04-17 00:56:14,530,79,2 +2025-04-17 00:56:16,540,79,2 +2025-04-17 00:56:18,550,85,2 +2025-04-17 00:56:20,560,86,2 +2025-04-17 00:56:22,570,77,0 +2025-04-17 00:56:24,580,76,0 +2025-04-17 00:56:26,590,72,0 +2025-04-17 00:56:28,600,81,0 +2025-04-17 00:56:30,610,19,0 +2025-04-17 00:56:32,620,10,0 +2025-04-17 00:56:34,630,6,0 +2025-04-17 00:56:36,640,16,0 +2025-04-17 00:56:38,650,19,0 +2025-04-17 00:56:40,660,24,0 +2025-04-17 00:56:42,670,25,0 +2025-04-17 00:56:44,680,10,0 +2025-04-17 00:56:46,690,13,0 +2025-04-17 00:56:48,700,29,0 +2025-04-17 00:56:50,710,10,0 +2025-04-17 00:56:52,720,91,0 +2025-04-17 00:56:54,730,97,1 +2025-04-17 00:56:56,740,89,1 +2025-04-17 00:56:58,750,93,1 +2025-04-17 00:57:00,760,93,1 +2025-04-17 00:57:02,770,88,1 +2025-04-17 00:57:04,780,91,1 +2025-04-17 00:57:06,790,86,1 +2025-04-17 00:57:08,800,88,1 +2025-04-17 00:57:10,810,86,1 +2025-04-17 00:57:12,820,92,1 +2025-04-17 00:57:14,830,99,1 +2025-04-17 00:57:16,840,96,1 +2025-04-17 00:57:18,850,85,1 +2025-04-17 00:57:20,860,98,1 +2025-04-17 00:57:22,870,88,1 +2025-04-17 00:57:24,880,93,1 +2025-04-17 00:57:26,890,90,1 +2025-04-17 00:57:28,900,90,1 +2025-04-17 00:57:30,910,21,2 +2025-04-17 00:57:32,920,23,2 +2025-04-17 00:57:34,930,14,2 +2025-04-17 00:57:36,940,9,2 +2025-04-17 00:57:38,950,22,2 +2025-04-17 00:57:40,960,22,2 +2025-04-17 00:57:42,970,11,2 +2025-04-17 00:57:44,980,26,2 +2025-04-17 00:57:46,990,24,2 +2025-04-17 00:57:48,1000,11,2 +2025-04-17 00:57:50,1010,18,2 +2025-04-17 00:57:52,1020,18,2 +2025-04-17 00:57:54,1030,15,2 +2025-04-17 00:57:56,1040,25,2 +2025-04-17 00:57:58,1050,25,2 +2025-04-17 00:58:00,1060,8,2 +2025-04-17 00:58:02,1070,26,2 +2025-04-17 00:58:04,1080,49,2 +2025-04-17 00:58:06,1090,49,2 diff --git a/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005816.csv b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005816.csv new file mode 100644 index 0000000..e380aa7 --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005816.csv @@ -0,0 +1,101 @@ +timestamp,time_of_day,occupancy,cluster +2025-04-17 00:54:57,150,26,0 +2025-04-17 00:54:59,160,6,0 +2025-04-17 00:55:01,170,8,0 +2025-04-17 00:55:03,180,25,0 +2025-04-17 00:55:05,190,15,1 +2025-04-17 00:55:07,200,27,1 +2025-04-17 00:55:09,210,6,1 +2025-04-17 00:55:11,220,29,1 +2025-04-17 00:55:13,230,25,1 +2025-04-17 00:55:15,240,8,1 +2025-04-17 00:55:17,250,20,1 +2025-04-17 00:55:19,260,23,1 +2025-04-17 00:55:21,270,21,1 +2025-04-17 00:55:23,280,9,1 +2025-04-17 00:55:25,290,24,1 +2025-04-17 00:55:27,300,5,1 +2025-04-17 00:55:29,310,7,1 +2025-04-17 00:55:31,320,30,1 +2025-04-17 00:55:33,330,19,1 +2025-04-17 00:55:35,340,14,1 +2025-04-17 00:55:37,350,24,1 +2025-04-17 00:55:39,360,25,1 +2025-04-17 00:55:42,370,11,1 +2025-04-17 00:55:43,380,10,2 +2025-04-17 00:55:45,390,25,2 +2025-04-17 00:55:47,400,22,2 +2025-04-17 00:55:49,410,14,2 +2025-04-17 00:55:51,420,80,2 +2025-04-17 00:55:53,430,84,2 +2025-04-17 00:55:55,440,87,2 +2025-04-17 00:55:57,450,72,2 +2025-04-17 00:55:59,460,74,2 +2025-04-17 00:56:02,470,77,2 +2025-04-17 00:56:04,480,84,2 +2025-04-17 00:56:06,490,88,2 +2025-04-17 00:56:08,500,77,2 +2025-04-17 00:56:10,510,87,2 +2025-04-17 00:56:12,520,90,2 +2025-04-17 00:56:14,530,79,2 +2025-04-17 00:56:16,540,79,2 +2025-04-17 00:56:18,550,85,2 +2025-04-17 00:56:20,560,86,2 +2025-04-17 00:56:22,570,77,0 +2025-04-17 00:56:24,580,76,0 +2025-04-17 00:56:26,590,72,0 +2025-04-17 00:56:28,600,81,0 +2025-04-17 00:56:30,610,19,0 +2025-04-17 00:56:32,620,10,0 +2025-04-17 00:56:34,630,6,0 +2025-04-17 00:56:36,640,16,0 +2025-04-17 00:56:38,650,19,0 +2025-04-17 00:56:40,660,24,0 +2025-04-17 00:56:42,670,25,0 +2025-04-17 00:56:44,680,10,0 +2025-04-17 00:56:46,690,13,0 +2025-04-17 00:56:48,700,29,0 +2025-04-17 00:56:50,710,10,0 +2025-04-17 00:56:52,720,91,0 +2025-04-17 00:56:54,730,97,1 +2025-04-17 00:56:56,740,89,1 +2025-04-17 00:56:58,750,93,1 +2025-04-17 00:57:00,760,93,1 +2025-04-17 00:57:02,770,88,1 +2025-04-17 00:57:04,780,91,1 +2025-04-17 00:57:06,790,86,1 +2025-04-17 00:57:08,800,88,1 +2025-04-17 00:57:10,810,86,1 +2025-04-17 00:57:12,820,92,1 +2025-04-17 00:57:14,830,99,1 +2025-04-17 00:57:16,840,96,1 +2025-04-17 00:57:18,850,85,1 +2025-04-17 00:57:20,860,98,1 +2025-04-17 00:57:22,870,88,1 +2025-04-17 00:57:24,880,93,1 +2025-04-17 00:57:26,890,90,1 +2025-04-17 00:57:28,900,90,1 +2025-04-17 00:57:30,910,21,2 +2025-04-17 00:57:32,920,23,2 +2025-04-17 00:57:34,930,14,2 +2025-04-17 00:57:36,940,9,2 +2025-04-17 00:57:38,950,22,2 +2025-04-17 00:57:40,960,22,2 +2025-04-17 00:57:42,970,11,2 +2025-04-17 00:57:44,980,26,2 +2025-04-17 00:57:46,990,24,2 +2025-04-17 00:57:48,1000,11,2 +2025-04-17 00:57:50,1010,18,2 +2025-04-17 00:57:52,1020,18,2 +2025-04-17 00:57:54,1030,15,2 +2025-04-17 00:57:56,1040,25,2 +2025-04-17 00:57:58,1050,25,2 +2025-04-17 00:58:00,1060,8,2 +2025-04-17 00:58:02,1070,26,2 +2025-04-17 00:58:04,1080,49,2 +2025-04-17 00:58:06,1090,49,2 +2025-04-17 00:58:08,1100,60,0 +2025-04-17 00:58:10,1110,55,0 +2025-04-17 00:58:12,1120,60,0 +2025-04-17 00:58:14,1130,43,0 +2025-04-17 00:58:16,1140,42,0 diff --git a/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005826.csv b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005826.csv new file mode 100644 index 0000000..e4373fd --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005826.csv @@ -0,0 +1,101 @@ +timestamp,time_of_day,occupancy,cluster +2025-04-17 00:55:07,200,27,1 +2025-04-17 00:55:09,210,6,1 +2025-04-17 00:55:11,220,29,1 +2025-04-17 00:55:13,230,25,1 +2025-04-17 00:55:15,240,8,1 +2025-04-17 00:55:17,250,20,1 +2025-04-17 00:55:19,260,23,1 +2025-04-17 00:55:21,270,21,1 +2025-04-17 00:55:23,280,9,1 +2025-04-17 00:55:25,290,24,1 +2025-04-17 00:55:27,300,5,1 +2025-04-17 00:55:29,310,7,1 +2025-04-17 00:55:31,320,30,1 +2025-04-17 00:55:33,330,19,1 +2025-04-17 00:55:35,340,14,1 +2025-04-17 00:55:37,350,24,1 +2025-04-17 00:55:39,360,25,1 +2025-04-17 00:55:42,370,11,1 +2025-04-17 00:55:43,380,10,2 +2025-04-17 00:55:45,390,25,2 +2025-04-17 00:55:47,400,22,2 +2025-04-17 00:55:49,410,14,2 +2025-04-17 00:55:51,420,80,2 +2025-04-17 00:55:53,430,84,2 +2025-04-17 00:55:55,440,87,2 +2025-04-17 00:55:57,450,72,2 +2025-04-17 00:55:59,460,74,2 +2025-04-17 00:56:02,470,77,2 +2025-04-17 00:56:04,480,84,2 +2025-04-17 00:56:06,490,88,2 +2025-04-17 00:56:08,500,77,2 +2025-04-17 00:56:10,510,87,2 +2025-04-17 00:56:12,520,90,2 +2025-04-17 00:56:14,530,79,2 +2025-04-17 00:56:16,540,79,2 +2025-04-17 00:56:18,550,85,2 +2025-04-17 00:56:20,560,86,2 +2025-04-17 00:56:22,570,77,0 +2025-04-17 00:56:24,580,76,0 +2025-04-17 00:56:26,590,72,0 +2025-04-17 00:56:28,600,81,0 +2025-04-17 00:56:30,610,19,0 +2025-04-17 00:56:32,620,10,0 +2025-04-17 00:56:34,630,6,0 +2025-04-17 00:56:36,640,16,0 +2025-04-17 00:56:38,650,19,0 +2025-04-17 00:56:40,660,24,0 +2025-04-17 00:56:42,670,25,0 +2025-04-17 00:56:44,680,10,0 +2025-04-17 00:56:46,690,13,0 +2025-04-17 00:56:48,700,29,0 +2025-04-17 00:56:50,710,10,0 +2025-04-17 00:56:52,720,91,0 +2025-04-17 00:56:54,730,97,1 +2025-04-17 00:56:56,740,89,1 +2025-04-17 00:56:58,750,93,1 +2025-04-17 00:57:00,760,93,1 +2025-04-17 00:57:02,770,88,1 +2025-04-17 00:57:04,780,91,1 +2025-04-17 00:57:06,790,86,1 +2025-04-17 00:57:08,800,88,1 +2025-04-17 00:57:10,810,86,1 +2025-04-17 00:57:12,820,92,1 +2025-04-17 00:57:14,830,99,1 +2025-04-17 00:57:16,840,96,1 +2025-04-17 00:57:18,850,85,1 +2025-04-17 00:57:20,860,98,1 +2025-04-17 00:57:22,870,88,1 +2025-04-17 00:57:24,880,93,1 +2025-04-17 00:57:26,890,90,1 +2025-04-17 00:57:28,900,90,1 +2025-04-17 00:57:30,910,21,2 +2025-04-17 00:57:32,920,23,2 +2025-04-17 00:57:34,930,14,2 +2025-04-17 00:57:36,940,9,2 +2025-04-17 00:57:38,950,22,2 +2025-04-17 00:57:40,960,22,2 +2025-04-17 00:57:42,970,11,2 +2025-04-17 00:57:44,980,26,2 +2025-04-17 00:57:46,990,24,2 +2025-04-17 00:57:48,1000,11,2 +2025-04-17 00:57:50,1010,18,2 +2025-04-17 00:57:52,1020,18,2 +2025-04-17 00:57:54,1030,15,2 +2025-04-17 00:57:56,1040,25,2 +2025-04-17 00:57:58,1050,25,2 +2025-04-17 00:58:00,1060,8,2 +2025-04-17 00:58:02,1070,26,2 +2025-04-17 00:58:04,1080,49,2 +2025-04-17 00:58:06,1090,49,2 +2025-04-17 00:58:08,1100,60,0 +2025-04-17 00:58:10,1110,55,0 +2025-04-17 00:58:12,1120,60,0 +2025-04-17 00:58:14,1130,43,0 +2025-04-17 00:58:16,1140,42,0 +2025-04-17 00:58:18,1150,40,0 +2025-04-17 00:58:20,1160,41,0 +2025-04-17 00:58:22,1170,51,0 +2025-04-17 00:58:24,1180,49,0 +2025-04-17 00:58:26,1190,56,0 diff --git a/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005836.csv b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005836.csv new file mode 100644 index 0000000..e380d30 --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005836.csv @@ -0,0 +1,101 @@ +timestamp,time_of_day,occupancy,cluster +2025-04-17 00:55:17,250,20,1 +2025-04-17 00:55:19,260,23,1 +2025-04-17 00:55:21,270,21,1 +2025-04-17 00:55:23,280,9,1 +2025-04-17 00:55:25,290,24,1 +2025-04-17 00:55:27,300,5,1 +2025-04-17 00:55:29,310,7,1 +2025-04-17 00:55:31,320,30,1 +2025-04-17 00:55:33,330,19,1 +2025-04-17 00:55:35,340,14,1 +2025-04-17 00:55:37,350,24,1 +2025-04-17 00:55:39,360,25,1 +2025-04-17 00:55:42,370,11,1 +2025-04-17 00:55:43,380,10,2 +2025-04-17 00:55:45,390,25,2 +2025-04-17 00:55:47,400,22,2 +2025-04-17 00:55:49,410,14,2 +2025-04-17 00:55:51,420,80,2 +2025-04-17 00:55:53,430,84,2 +2025-04-17 00:55:55,440,87,2 +2025-04-17 00:55:57,450,72,2 +2025-04-17 00:55:59,460,74,2 +2025-04-17 00:56:02,470,77,2 +2025-04-17 00:56:04,480,84,2 +2025-04-17 00:56:06,490,88,2 +2025-04-17 00:56:08,500,77,2 +2025-04-17 00:56:10,510,87,2 +2025-04-17 00:56:12,520,90,2 +2025-04-17 00:56:14,530,79,2 +2025-04-17 00:56:16,540,79,2 +2025-04-17 00:56:18,550,85,2 +2025-04-17 00:56:20,560,86,2 +2025-04-17 00:56:22,570,77,0 +2025-04-17 00:56:24,580,76,0 +2025-04-17 00:56:26,590,72,0 +2025-04-17 00:56:28,600,81,0 +2025-04-17 00:56:30,610,19,0 +2025-04-17 00:56:32,620,10,0 +2025-04-17 00:56:34,630,6,0 +2025-04-17 00:56:36,640,16,0 +2025-04-17 00:56:38,650,19,0 +2025-04-17 00:56:40,660,24,0 +2025-04-17 00:56:42,670,25,0 +2025-04-17 00:56:44,680,10,0 +2025-04-17 00:56:46,690,13,0 +2025-04-17 00:56:48,700,29,0 +2025-04-17 00:56:50,710,10,0 +2025-04-17 00:56:52,720,91,0 +2025-04-17 00:56:54,730,97,1 +2025-04-17 00:56:56,740,89,1 +2025-04-17 00:56:58,750,93,1 +2025-04-17 00:57:00,760,93,1 +2025-04-17 00:57:02,770,88,1 +2025-04-17 00:57:04,780,91,1 +2025-04-17 00:57:06,790,86,1 +2025-04-17 00:57:08,800,88,1 +2025-04-17 00:57:10,810,86,1 +2025-04-17 00:57:12,820,92,1 +2025-04-17 00:57:14,830,99,1 +2025-04-17 00:57:16,840,96,1 +2025-04-17 00:57:18,850,85,1 +2025-04-17 00:57:20,860,98,1 +2025-04-17 00:57:22,870,88,1 +2025-04-17 00:57:24,880,93,1 +2025-04-17 00:57:26,890,90,1 +2025-04-17 00:57:28,900,90,1 +2025-04-17 00:57:30,910,21,2 +2025-04-17 00:57:32,920,23,2 +2025-04-17 00:57:34,930,14,2 +2025-04-17 00:57:36,940,9,2 +2025-04-17 00:57:38,950,22,2 +2025-04-17 00:57:40,960,22,2 +2025-04-17 00:57:42,970,11,2 +2025-04-17 00:57:44,980,26,2 +2025-04-17 00:57:46,990,24,2 +2025-04-17 00:57:48,1000,11,2 +2025-04-17 00:57:50,1010,18,2 +2025-04-17 00:57:52,1020,18,2 +2025-04-17 00:57:54,1030,15,2 +2025-04-17 00:57:56,1040,25,2 +2025-04-17 00:57:58,1050,25,2 +2025-04-17 00:58:00,1060,8,2 +2025-04-17 00:58:02,1070,26,2 +2025-04-17 00:58:04,1080,49,2 +2025-04-17 00:58:06,1090,49,2 +2025-04-17 00:58:08,1100,60,0 +2025-04-17 00:58:10,1110,55,0 +2025-04-17 00:58:12,1120,60,0 +2025-04-17 00:58:14,1130,43,0 +2025-04-17 00:58:16,1140,42,0 +2025-04-17 00:58:18,1150,40,0 +2025-04-17 00:58:20,1160,41,0 +2025-04-17 00:58:22,1170,51,0 +2025-04-17 00:58:24,1180,49,0 +2025-04-17 00:58:26,1190,56,0 +2025-04-17 00:58:28,1200,49,0 +2025-04-17 00:58:30,1210,49,0 +2025-04-17 00:58:32,1220,46,0 +2025-04-17 00:58:34,1230,43,0 +2025-04-17 00:58:36,1240,52,0 diff --git a/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005846.csv b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005846.csv new file mode 100644 index 0000000..3b5ae16 --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005846.csv @@ -0,0 +1,101 @@ +timestamp,time_of_day,occupancy,cluster +2025-04-17 00:55:27,300,5,1 +2025-04-17 00:55:29,310,7,1 +2025-04-17 00:55:31,320,30,1 +2025-04-17 00:55:33,330,19,1 +2025-04-17 00:55:35,340,14,1 +2025-04-17 00:55:37,350,24,1 +2025-04-17 00:55:39,360,25,1 +2025-04-17 00:55:42,370,11,1 +2025-04-17 00:55:43,380,10,2 +2025-04-17 00:55:45,390,25,2 +2025-04-17 00:55:47,400,22,2 +2025-04-17 00:55:49,410,14,2 +2025-04-17 00:55:51,420,80,2 +2025-04-17 00:55:53,430,84,2 +2025-04-17 00:55:55,440,87,2 +2025-04-17 00:55:57,450,72,2 +2025-04-17 00:55:59,460,74,2 +2025-04-17 00:56:02,470,77,2 +2025-04-17 00:56:04,480,84,2 +2025-04-17 00:56:06,490,88,2 +2025-04-17 00:56:08,500,77,2 +2025-04-17 00:56:10,510,87,2 +2025-04-17 00:56:12,520,90,2 +2025-04-17 00:56:14,530,79,2 +2025-04-17 00:56:16,540,79,2 +2025-04-17 00:56:18,550,85,2 +2025-04-17 00:56:20,560,86,2 +2025-04-17 00:56:22,570,77,0 +2025-04-17 00:56:24,580,76,0 +2025-04-17 00:56:26,590,72,0 +2025-04-17 00:56:28,600,81,0 +2025-04-17 00:56:30,610,19,0 +2025-04-17 00:56:32,620,10,0 +2025-04-17 00:56:34,630,6,0 +2025-04-17 00:56:36,640,16,0 +2025-04-17 00:56:38,650,19,0 +2025-04-17 00:56:40,660,24,0 +2025-04-17 00:56:42,670,25,0 +2025-04-17 00:56:44,680,10,0 +2025-04-17 00:56:46,690,13,0 +2025-04-17 00:56:48,700,29,0 +2025-04-17 00:56:50,710,10,0 +2025-04-17 00:56:52,720,91,0 +2025-04-17 00:56:54,730,97,1 +2025-04-17 00:56:56,740,89,1 +2025-04-17 00:56:58,750,93,1 +2025-04-17 00:57:00,760,93,1 +2025-04-17 00:57:02,770,88,1 +2025-04-17 00:57:04,780,91,1 +2025-04-17 00:57:06,790,86,1 +2025-04-17 00:57:08,800,88,1 +2025-04-17 00:57:10,810,86,1 +2025-04-17 00:57:12,820,92,1 +2025-04-17 00:57:14,830,99,1 +2025-04-17 00:57:16,840,96,1 +2025-04-17 00:57:18,850,85,1 +2025-04-17 00:57:20,860,98,1 +2025-04-17 00:57:22,870,88,1 +2025-04-17 00:57:24,880,93,1 +2025-04-17 00:57:26,890,90,1 +2025-04-17 00:57:28,900,90,1 +2025-04-17 00:57:30,910,21,2 +2025-04-17 00:57:32,920,23,2 +2025-04-17 00:57:34,930,14,2 +2025-04-17 00:57:36,940,9,2 +2025-04-17 00:57:38,950,22,2 +2025-04-17 00:57:40,960,22,2 +2025-04-17 00:57:42,970,11,2 +2025-04-17 00:57:44,980,26,2 +2025-04-17 00:57:46,990,24,2 +2025-04-17 00:57:48,1000,11,2 +2025-04-17 00:57:50,1010,18,2 +2025-04-17 00:57:52,1020,18,2 +2025-04-17 00:57:54,1030,15,2 +2025-04-17 00:57:56,1040,25,2 +2025-04-17 00:57:58,1050,25,2 +2025-04-17 00:58:00,1060,8,2 +2025-04-17 00:58:02,1070,26,2 +2025-04-17 00:58:04,1080,49,2 +2025-04-17 00:58:06,1090,49,2 +2025-04-17 00:58:08,1100,60,0 +2025-04-17 00:58:10,1110,55,0 +2025-04-17 00:58:12,1120,60,0 +2025-04-17 00:58:14,1130,43,0 +2025-04-17 00:58:16,1140,42,0 +2025-04-17 00:58:18,1150,40,0 +2025-04-17 00:58:20,1160,41,0 +2025-04-17 00:58:22,1170,51,0 +2025-04-17 00:58:24,1180,49,0 +2025-04-17 00:58:26,1190,56,0 +2025-04-17 00:58:28,1200,49,0 +2025-04-17 00:58:30,1210,49,0 +2025-04-17 00:58:32,1220,46,0 +2025-04-17 00:58:34,1230,43,0 +2025-04-17 00:58:36,1240,52,0 +2025-04-17 00:58:38,1250,58,0 +2025-04-17 00:58:40,1260,44,0 +2025-04-17 00:58:42,1270,46,0 +2025-04-17 00:58:44,1280,46,0 +2025-04-17 00:58:46,1290,53,1 diff --git a/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005856.csv b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005856.csv new file mode 100644 index 0000000..97adafe --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005856.csv @@ -0,0 +1,101 @@ +timestamp,time_of_day,occupancy,cluster +2025-04-17 00:55:37,350,24,1 +2025-04-17 00:55:39,360,25,1 +2025-04-17 00:55:42,370,11,1 +2025-04-17 00:55:43,380,10,2 +2025-04-17 00:55:45,390,25,2 +2025-04-17 00:55:47,400,22,2 +2025-04-17 00:55:49,410,14,2 +2025-04-17 00:55:51,420,80,2 +2025-04-17 00:55:53,430,84,2 +2025-04-17 00:55:55,440,87,2 +2025-04-17 00:55:57,450,72,2 +2025-04-17 00:55:59,460,74,2 +2025-04-17 00:56:02,470,77,2 +2025-04-17 00:56:04,480,84,2 +2025-04-17 00:56:06,490,88,2 +2025-04-17 00:56:08,500,77,2 +2025-04-17 00:56:10,510,87,2 +2025-04-17 00:56:12,520,90,2 +2025-04-17 00:56:14,530,79,2 +2025-04-17 00:56:16,540,79,2 +2025-04-17 00:56:18,550,85,2 +2025-04-17 00:56:20,560,86,2 +2025-04-17 00:56:22,570,77,0 +2025-04-17 00:56:24,580,76,0 +2025-04-17 00:56:26,590,72,0 +2025-04-17 00:56:28,600,81,0 +2025-04-17 00:56:30,610,19,0 +2025-04-17 00:56:32,620,10,0 +2025-04-17 00:56:34,630,6,0 +2025-04-17 00:56:36,640,16,0 +2025-04-17 00:56:38,650,19,0 +2025-04-17 00:56:40,660,24,0 +2025-04-17 00:56:42,670,25,0 +2025-04-17 00:56:44,680,10,0 +2025-04-17 00:56:46,690,13,0 +2025-04-17 00:56:48,700,29,0 +2025-04-17 00:56:50,710,10,0 +2025-04-17 00:56:52,720,91,0 +2025-04-17 00:56:54,730,97,1 +2025-04-17 00:56:56,740,89,1 +2025-04-17 00:56:58,750,93,1 +2025-04-17 00:57:00,760,93,1 +2025-04-17 00:57:02,770,88,1 +2025-04-17 00:57:04,780,91,1 +2025-04-17 00:57:06,790,86,1 +2025-04-17 00:57:08,800,88,1 +2025-04-17 00:57:10,810,86,1 +2025-04-17 00:57:12,820,92,1 +2025-04-17 00:57:14,830,99,1 +2025-04-17 00:57:16,840,96,1 +2025-04-17 00:57:18,850,85,1 +2025-04-17 00:57:20,860,98,1 +2025-04-17 00:57:22,870,88,1 +2025-04-17 00:57:24,880,93,1 +2025-04-17 00:57:26,890,90,1 +2025-04-17 00:57:28,900,90,1 +2025-04-17 00:57:30,910,21,2 +2025-04-17 00:57:32,920,23,2 +2025-04-17 00:57:34,930,14,2 +2025-04-17 00:57:36,940,9,2 +2025-04-17 00:57:38,950,22,2 +2025-04-17 00:57:40,960,22,2 +2025-04-17 00:57:42,970,11,2 +2025-04-17 00:57:44,980,26,2 +2025-04-17 00:57:46,990,24,2 +2025-04-17 00:57:48,1000,11,2 +2025-04-17 00:57:50,1010,18,2 +2025-04-17 00:57:52,1020,18,2 +2025-04-17 00:57:54,1030,15,2 +2025-04-17 00:57:56,1040,25,2 +2025-04-17 00:57:58,1050,25,2 +2025-04-17 00:58:00,1060,8,2 +2025-04-17 00:58:02,1070,26,2 +2025-04-17 00:58:04,1080,49,2 +2025-04-17 00:58:06,1090,49,2 +2025-04-17 00:58:08,1100,60,0 +2025-04-17 00:58:10,1110,55,0 +2025-04-17 00:58:12,1120,60,0 +2025-04-17 00:58:14,1130,43,0 +2025-04-17 00:58:16,1140,42,0 +2025-04-17 00:58:18,1150,40,0 +2025-04-17 00:58:20,1160,41,0 +2025-04-17 00:58:22,1170,51,0 +2025-04-17 00:58:24,1180,49,0 +2025-04-17 00:58:26,1190,56,0 +2025-04-17 00:58:28,1200,49,0 +2025-04-17 00:58:30,1210,49,0 +2025-04-17 00:58:32,1220,46,0 +2025-04-17 00:58:34,1230,43,0 +2025-04-17 00:58:36,1240,52,0 +2025-04-17 00:58:38,1250,58,0 +2025-04-17 00:58:40,1260,44,0 +2025-04-17 00:58:42,1270,46,0 +2025-04-17 00:58:44,1280,46,0 +2025-04-17 00:58:46,1290,53,1 +2025-04-17 00:58:48,1300,60,1 +2025-04-17 00:58:50,1310,59,1 +2025-04-17 00:58:52,1320,49,1 +2025-04-17 00:58:54,1330,30,1 +2025-04-17 00:58:56,1340,13,1 diff --git a/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005906.csv b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005906.csv new file mode 100644 index 0000000..2ca7e4d --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/events/events_20250417_005906.csv @@ -0,0 +1,101 @@ +timestamp,time_of_day,occupancy,cluster +2025-04-17 00:55:47,400,22,2 +2025-04-17 00:55:49,410,14,2 +2025-04-17 00:55:51,420,80,2 +2025-04-17 00:55:53,430,84,2 +2025-04-17 00:55:55,440,87,2 +2025-04-17 00:55:57,450,72,2 +2025-04-17 00:55:59,460,74,2 +2025-04-17 00:56:02,470,77,2 +2025-04-17 00:56:04,480,84,2 +2025-04-17 00:56:06,490,88,2 +2025-04-17 00:56:08,500,77,2 +2025-04-17 00:56:10,510,87,2 +2025-04-17 00:56:12,520,90,2 +2025-04-17 00:56:14,530,79,2 +2025-04-17 00:56:16,540,79,2 +2025-04-17 00:56:18,550,85,2 +2025-04-17 00:56:20,560,86,2 +2025-04-17 00:56:22,570,77,0 +2025-04-17 00:56:24,580,76,0 +2025-04-17 00:56:26,590,72,0 +2025-04-17 00:56:28,600,81,0 +2025-04-17 00:56:30,610,19,0 +2025-04-17 00:56:32,620,10,0 +2025-04-17 00:56:34,630,6,0 +2025-04-17 00:56:36,640,16,0 +2025-04-17 00:56:38,650,19,0 +2025-04-17 00:56:40,660,24,0 +2025-04-17 00:56:42,670,25,0 +2025-04-17 00:56:44,680,10,0 +2025-04-17 00:56:46,690,13,0 +2025-04-17 00:56:48,700,29,0 +2025-04-17 00:56:50,710,10,0 +2025-04-17 00:56:52,720,91,0 +2025-04-17 00:56:54,730,97,1 +2025-04-17 00:56:56,740,89,1 +2025-04-17 00:56:58,750,93,1 +2025-04-17 00:57:00,760,93,1 +2025-04-17 00:57:02,770,88,1 +2025-04-17 00:57:04,780,91,1 +2025-04-17 00:57:06,790,86,1 +2025-04-17 00:57:08,800,88,1 +2025-04-17 00:57:10,810,86,1 +2025-04-17 00:57:12,820,92,1 +2025-04-17 00:57:14,830,99,1 +2025-04-17 00:57:16,840,96,1 +2025-04-17 00:57:18,850,85,1 +2025-04-17 00:57:20,860,98,1 +2025-04-17 00:57:22,870,88,1 +2025-04-17 00:57:24,880,93,1 +2025-04-17 00:57:26,890,90,1 +2025-04-17 00:57:28,900,90,1 +2025-04-17 00:57:30,910,21,2 +2025-04-17 00:57:32,920,23,2 +2025-04-17 00:57:34,930,14,2 +2025-04-17 00:57:36,940,9,2 +2025-04-17 00:57:38,950,22,2 +2025-04-17 00:57:40,960,22,2 +2025-04-17 00:57:42,970,11,2 +2025-04-17 00:57:44,980,26,2 +2025-04-17 00:57:46,990,24,2 +2025-04-17 00:57:48,1000,11,2 +2025-04-17 00:57:50,1010,18,2 +2025-04-17 00:57:52,1020,18,2 +2025-04-17 00:57:54,1030,15,2 +2025-04-17 00:57:56,1040,25,2 +2025-04-17 00:57:58,1050,25,2 +2025-04-17 00:58:00,1060,8,2 +2025-04-17 00:58:02,1070,26,2 +2025-04-17 00:58:04,1080,49,2 +2025-04-17 00:58:06,1090,49,2 +2025-04-17 00:58:08,1100,60,0 +2025-04-17 00:58:10,1110,55,0 +2025-04-17 00:58:12,1120,60,0 +2025-04-17 00:58:14,1130,43,0 +2025-04-17 00:58:16,1140,42,0 +2025-04-17 00:58:18,1150,40,0 +2025-04-17 00:58:20,1160,41,0 +2025-04-17 00:58:22,1170,51,0 +2025-04-17 00:58:24,1180,49,0 +2025-04-17 00:58:26,1190,56,0 +2025-04-17 00:58:28,1200,49,0 +2025-04-17 00:58:30,1210,49,0 +2025-04-17 00:58:32,1220,46,0 +2025-04-17 00:58:34,1230,43,0 +2025-04-17 00:58:36,1240,52,0 +2025-04-17 00:58:38,1250,58,0 +2025-04-17 00:58:40,1260,44,0 +2025-04-17 00:58:42,1270,46,0 +2025-04-17 00:58:44,1280,46,0 +2025-04-17 00:58:46,1290,53,1 +2025-04-17 00:58:48,1300,60,1 +2025-04-17 00:58:50,1310,59,1 +2025-04-17 00:58:52,1320,49,1 +2025-04-17 00:58:54,1330,30,1 +2025-04-17 00:58:56,1340,13,1 +2025-04-17 00:58:58,1350,8,1 +2025-04-17 00:59:00,1360,21,1 +2025-04-17 00:59:02,1370,29,1 +2025-04-17 00:59:04,1380,14,1 +2025-04-17 00:59:06,1390,18,1 diff --git a/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005743.csv b/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005743.csv new file mode 100644 index 0000000..b69519f --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005743.csv @@ -0,0 +1,91 @@ +timestamp,user_id,event_type,session_duration,product_category,user_total_purchases,purchase,prediction +2025-04-17 00:54:45,user_0179,add_to_cart,high,fashion,medium,Yes,N/A +2025-04-17 00:54:47,user_0099,click,high,fashion,medium,Yes,Yes +2025-04-17 00:54:49,user_0020,add_to_cart,low,books,medium,No,Yes +2025-04-17 00:54:51,user_0086,view,low,books,high,No,Yes +2025-04-17 00:54:53,user_0170,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:54:55,user_0109,add_to_cart,low,electronics,medium,Yes,No +2025-04-17 00:54:57,user_0140,click,high,home,high,Yes,Yes +2025-04-17 00:54:59,user_0137,add_to_cart,low,home,medium,Yes,Yes +2025-04-17 00:55:01,user_0072,add_to_cart,low,books,few,No,Yes +2025-04-17 00:55:03,user_0171,click,low,electronics,few,No,Yes +2025-04-17 00:55:05,user_0050,add_to_cart,low,fashion,high,No,No +2025-04-17 00:55:07,user_0177,add_to_cart,low,toys,very few,No,Yes +2025-04-17 00:55:09,user_0120,click,low,fashion,very few,No,No +2025-04-17 00:55:11,user_0026,add_to_cart,high,electronics,very few,No,No +2025-04-17 00:55:13,user_0049,add_to_cart,high,electronics,medium,Yes,Yes +2025-04-17 00:55:15,user_0099,view,high,books,medium,Yes,Yes +2025-04-17 00:55:17,user_0154,click,medium,books,high,No,No +2025-04-17 00:55:19,user_0143,add_to_cart,high,home,medium,Yes,No +2025-04-17 00:55:21,user_0023,view,high,electronics,very few,No,No +2025-04-17 00:55:23,user_0082,view,high,books,medium,Yes,Yes +2025-04-17 00:55:25,user_0009,add_to_cart,medium,home,medium,Yes,Yes +2025-04-17 00:55:27,user_0196,add_to_cart,low,toys,high,No,Yes +2025-04-17 00:55:29,user_0008,view,medium,home,very few,No,No +2025-04-17 00:55:31,user_0111,click,high,electronics,few,Yes,No +2025-04-17 00:55:33,user_0121,click,low,electronics,high,No,No +2025-04-17 00:55:35,user_0192,click,high,fashion,few,Yes,No +2025-04-17 00:55:37,user_0041,click,high,electronics,high,Yes,No +2025-04-17 00:55:39,user_0106,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:55:41,user_0184,view,medium,books,high,No,No +2025-04-17 00:55:43,user_0132,click,medium,fashion,high,Yes,No +2025-04-17 00:55:45,user_0043,view,low,toys,medium,No,Yes +2025-04-17 00:55:47,user_0006,view,high,fashion,medium,Yes,Yes +2025-04-17 00:55:49,user_0164,view,high,electronics,medium,Yes,Yes +2025-04-17 00:55:51,user_0113,view,medium,fashion,medium,No,Yes +2025-04-17 00:55:53,user_0197,add_to_cart,medium,toys,high,Yes,No +2025-04-17 00:55:55,user_0104,add_to_cart,high,toys,medium,Yes,Yes +2025-04-17 00:55:57,user_0008,view,high,books,very few,No,No +2025-04-17 00:55:59,user_0118,add_to_cart,medium,books,very few,No,No +2025-04-17 00:56:01,user_0163,view,high,books,medium,Yes,Yes +2025-04-17 00:56:03,user_0113,view,medium,toys,medium,No,No +2025-04-17 00:56:05,user_0044,click,medium,toys,high,Yes,No +2025-04-17 00:56:07,user_0087,click,high,home,medium,Yes,Yes +2025-04-17 00:56:09,user_0179,view,medium,home,medium,No,No +2025-04-17 00:56:11,user_0032,view,high,electronics,few,No,No +2025-04-17 00:56:13,user_0108,add_to_cart,high,fashion,high,Yes,No +2025-04-17 00:56:15,user_0053,add_to_cart,high,electronics,high,Yes,Yes +2025-04-17 00:56:17,user_0012,click,low,toys,high,No,No +2025-04-17 00:56:19,user_0019,click,low,electronics,high,No,No +2025-04-17 00:56:21,user_0131,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:23,user_0103,add_to_cart,low,toys,medium,No,No +2025-04-17 00:56:25,user_0022,view,medium,home,medium,No,Yes +2025-04-17 00:56:27,user_0187,add_to_cart,high,home,medium,Yes,Yes +2025-04-17 00:56:29,user_0106,add_to_cart,high,home,medium,Yes,Yes +2025-04-17 00:56:31,user_0019,click,high,books,high,Yes,Yes +2025-04-17 00:56:33,user_0044,view,high,home,high,Yes,Yes +2025-04-17 00:56:35,user_0172,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:37,user_0096,add_to_cart,medium,electronics,medium,Yes,No +2025-04-17 00:56:39,user_0179,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:56:41,user_0068,click,high,electronics,medium,Yes,Yes +2025-04-17 00:56:43,user_0173,view,low,electronics,high,No,No +2025-04-17 00:56:45,user_0149,click,high,books,high,Yes,Yes +2025-04-17 00:56:47,user_0076,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:49,user_0045,add_to_cart,high,toys,medium,Yes,Yes +2025-04-17 00:56:51,user_0086,click,high,home,high,Yes,Yes +2025-04-17 00:56:53,user_0061,view,low,electronics,high,No,No +2025-04-17 00:56:55,user_0118,view,low,toys,very few,No,No +2025-04-17 00:56:57,user_0038,view,high,books,high,Yes,Yes +2025-04-17 00:56:59,user_0098,click,low,fashion,medium,No,No +2025-04-17 00:57:01,user_0165,click,high,electronics,high,Yes,Yes +2025-04-17 00:57:03,user_0057,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:57:05,user_0029,view,medium,fashion,high,No,Yes +2025-04-17 00:57:07,user_0057,view,high,toys,high,Yes,Yes +2025-04-17 00:57:09,user_0133,click,high,home,high,Yes,Yes +2025-04-17 00:57:11,user_0037,click,high,home,high,Yes,Yes +2025-04-17 00:57:13,user_0143,view,medium,electronics,medium,No,Yes +2025-04-17 00:57:15,user_0041,click,low,books,high,No,No +2025-04-17 00:57:17,user_0007,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:19,user_0054,view,low,electronics,very few,No,No +2025-04-17 00:57:21,user_0150,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:57:23,user_0193,click,medium,toys,high,Yes,No +2025-04-17 00:57:25,user_0183,click,high,electronics,few,No,No +2025-04-17 00:57:27,user_0134,add_to_cart,low,toys,very few,No,No +2025-04-17 00:57:29,user_0170,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:31,user_0113,add_to_cart,low,home,medium,No,No +2025-04-17 00:57:33,user_0044,click,medium,home,high,Yes,Yes +2025-04-17 00:57:35,user_0067,add_to_cart,high,electronics,very few,No,No +2025-04-17 00:57:37,user_0146,click,high,books,few,Yes,No +2025-04-17 00:57:39,user_0156,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:41,user_0157,view,low,books,very few,No,No +2025-04-17 00:57:43,user_0066,add_to_cart,low,toys,very few,No,No diff --git a/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005753.csv b/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005753.csv new file mode 100644 index 0000000..e96922d --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005753.csv @@ -0,0 +1,96 @@ +timestamp,user_id,event_type,session_duration,product_category,user_total_purchases,purchase,prediction +2025-04-17 00:54:45,user_0179,add_to_cart,high,fashion,medium,Yes,N/A +2025-04-17 00:54:47,user_0099,click,high,fashion,medium,Yes,Yes +2025-04-17 00:54:49,user_0020,add_to_cart,low,books,medium,No,Yes +2025-04-17 00:54:51,user_0086,view,low,books,high,No,Yes +2025-04-17 00:54:53,user_0170,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:54:55,user_0109,add_to_cart,low,electronics,medium,Yes,No +2025-04-17 00:54:57,user_0140,click,high,home,high,Yes,Yes +2025-04-17 00:54:59,user_0137,add_to_cart,low,home,medium,Yes,Yes +2025-04-17 00:55:01,user_0072,add_to_cart,low,books,few,No,Yes +2025-04-17 00:55:03,user_0171,click,low,electronics,few,No,Yes +2025-04-17 00:55:05,user_0050,add_to_cart,low,fashion,high,No,No +2025-04-17 00:55:07,user_0177,add_to_cart,low,toys,very few,No,Yes +2025-04-17 00:55:09,user_0120,click,low,fashion,very few,No,No +2025-04-17 00:55:11,user_0026,add_to_cart,high,electronics,very few,No,No +2025-04-17 00:55:13,user_0049,add_to_cart,high,electronics,medium,Yes,Yes +2025-04-17 00:55:15,user_0099,view,high,books,medium,Yes,Yes +2025-04-17 00:55:17,user_0154,click,medium,books,high,No,No +2025-04-17 00:55:19,user_0143,add_to_cart,high,home,medium,Yes,No +2025-04-17 00:55:21,user_0023,view,high,electronics,very few,No,No +2025-04-17 00:55:23,user_0082,view,high,books,medium,Yes,Yes +2025-04-17 00:55:25,user_0009,add_to_cart,medium,home,medium,Yes,Yes +2025-04-17 00:55:27,user_0196,add_to_cart,low,toys,high,No,Yes +2025-04-17 00:55:29,user_0008,view,medium,home,very few,No,No +2025-04-17 00:55:31,user_0111,click,high,electronics,few,Yes,No +2025-04-17 00:55:33,user_0121,click,low,electronics,high,No,No +2025-04-17 00:55:35,user_0192,click,high,fashion,few,Yes,No +2025-04-17 00:55:37,user_0041,click,high,electronics,high,Yes,No +2025-04-17 00:55:39,user_0106,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:55:41,user_0184,view,medium,books,high,No,No +2025-04-17 00:55:43,user_0132,click,medium,fashion,high,Yes,No +2025-04-17 00:55:45,user_0043,view,low,toys,medium,No,Yes +2025-04-17 00:55:47,user_0006,view,high,fashion,medium,Yes,Yes +2025-04-17 00:55:49,user_0164,view,high,electronics,medium,Yes,Yes +2025-04-17 00:55:51,user_0113,view,medium,fashion,medium,No,Yes +2025-04-17 00:55:53,user_0197,add_to_cart,medium,toys,high,Yes,No +2025-04-17 00:55:55,user_0104,add_to_cart,high,toys,medium,Yes,Yes +2025-04-17 00:55:57,user_0008,view,high,books,very few,No,No +2025-04-17 00:55:59,user_0118,add_to_cart,medium,books,very few,No,No +2025-04-17 00:56:01,user_0163,view,high,books,medium,Yes,Yes +2025-04-17 00:56:03,user_0113,view,medium,toys,medium,No,No +2025-04-17 00:56:05,user_0044,click,medium,toys,high,Yes,No +2025-04-17 00:56:07,user_0087,click,high,home,medium,Yes,Yes +2025-04-17 00:56:09,user_0179,view,medium,home,medium,No,No +2025-04-17 00:56:11,user_0032,view,high,electronics,few,No,No +2025-04-17 00:56:13,user_0108,add_to_cart,high,fashion,high,Yes,No +2025-04-17 00:56:15,user_0053,add_to_cart,high,electronics,high,Yes,Yes +2025-04-17 00:56:17,user_0012,click,low,toys,high,No,No +2025-04-17 00:56:19,user_0019,click,low,electronics,high,No,No +2025-04-17 00:56:21,user_0131,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:23,user_0103,add_to_cart,low,toys,medium,No,No +2025-04-17 00:56:25,user_0022,view,medium,home,medium,No,Yes +2025-04-17 00:56:27,user_0187,add_to_cart,high,home,medium,Yes,Yes +2025-04-17 00:56:29,user_0106,add_to_cart,high,home,medium,Yes,Yes +2025-04-17 00:56:31,user_0019,click,high,books,high,Yes,Yes +2025-04-17 00:56:33,user_0044,view,high,home,high,Yes,Yes +2025-04-17 00:56:35,user_0172,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:37,user_0096,add_to_cart,medium,electronics,medium,Yes,No +2025-04-17 00:56:39,user_0179,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:56:41,user_0068,click,high,electronics,medium,Yes,Yes +2025-04-17 00:56:43,user_0173,view,low,electronics,high,No,No +2025-04-17 00:56:45,user_0149,click,high,books,high,Yes,Yes +2025-04-17 00:56:47,user_0076,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:49,user_0045,add_to_cart,high,toys,medium,Yes,Yes +2025-04-17 00:56:51,user_0086,click,high,home,high,Yes,Yes +2025-04-17 00:56:53,user_0061,view,low,electronics,high,No,No +2025-04-17 00:56:55,user_0118,view,low,toys,very few,No,No +2025-04-17 00:56:57,user_0038,view,high,books,high,Yes,Yes +2025-04-17 00:56:59,user_0098,click,low,fashion,medium,No,No +2025-04-17 00:57:01,user_0165,click,high,electronics,high,Yes,Yes +2025-04-17 00:57:03,user_0057,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:57:05,user_0029,view,medium,fashion,high,No,Yes +2025-04-17 00:57:07,user_0057,view,high,toys,high,Yes,Yes +2025-04-17 00:57:09,user_0133,click,high,home,high,Yes,Yes +2025-04-17 00:57:11,user_0037,click,high,home,high,Yes,Yes +2025-04-17 00:57:13,user_0143,view,medium,electronics,medium,No,Yes +2025-04-17 00:57:15,user_0041,click,low,books,high,No,No +2025-04-17 00:57:17,user_0007,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:19,user_0054,view,low,electronics,very few,No,No +2025-04-17 00:57:21,user_0150,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:57:23,user_0193,click,medium,toys,high,Yes,No +2025-04-17 00:57:25,user_0183,click,high,electronics,few,No,No +2025-04-17 00:57:27,user_0134,add_to_cart,low,toys,very few,No,No +2025-04-17 00:57:29,user_0170,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:31,user_0113,add_to_cart,low,home,medium,No,No +2025-04-17 00:57:33,user_0044,click,medium,home,high,Yes,Yes +2025-04-17 00:57:35,user_0067,add_to_cart,high,electronics,very few,No,No +2025-04-17 00:57:37,user_0146,click,high,books,few,Yes,No +2025-04-17 00:57:39,user_0156,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:41,user_0157,view,low,books,very few,No,No +2025-04-17 00:57:43,user_0066,add_to_cart,low,toys,very few,No,No +2025-04-17 00:57:45,user_0148,add_to_cart,medium,toys,very few,No,No +2025-04-17 00:57:47,user_0184,view,low,books,high,No,No +2025-04-17 00:57:49,user_0032,view,medium,home,few,No,No +2025-04-17 00:57:51,user_0087,view,low,fashion,medium,No,No +2025-04-17 00:57:53,user_0187,view,low,home,medium,No,No diff --git a/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005813.csv b/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005813.csv new file mode 100644 index 0000000..20c2635 --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005813.csv @@ -0,0 +1,101 @@ +timestamp,user_id,event_type,session_duration,product_category,user_total_purchases,purchase,prediction +2025-04-17 00:54:55,user_0109,add_to_cart,low,electronics,medium,Yes,No +2025-04-17 00:54:57,user_0140,click,high,home,high,Yes,Yes +2025-04-17 00:54:59,user_0137,add_to_cart,low,home,medium,Yes,Yes +2025-04-17 00:55:01,user_0072,add_to_cart,low,books,few,No,Yes +2025-04-17 00:55:03,user_0171,click,low,electronics,few,No,Yes +2025-04-17 00:55:05,user_0050,add_to_cart,low,fashion,high,No,No +2025-04-17 00:55:07,user_0177,add_to_cart,low,toys,very few,No,Yes +2025-04-17 00:55:09,user_0120,click,low,fashion,very few,No,No +2025-04-17 00:55:11,user_0026,add_to_cart,high,electronics,very few,No,No +2025-04-17 00:55:13,user_0049,add_to_cart,high,electronics,medium,Yes,Yes +2025-04-17 00:55:15,user_0099,view,high,books,medium,Yes,Yes +2025-04-17 00:55:17,user_0154,click,medium,books,high,No,No +2025-04-17 00:55:19,user_0143,add_to_cart,high,home,medium,Yes,No +2025-04-17 00:55:21,user_0023,view,high,electronics,very few,No,No +2025-04-17 00:55:23,user_0082,view,high,books,medium,Yes,Yes +2025-04-17 00:55:25,user_0009,add_to_cart,medium,home,medium,Yes,Yes +2025-04-17 00:55:27,user_0196,add_to_cart,low,toys,high,No,Yes +2025-04-17 00:55:29,user_0008,view,medium,home,very few,No,No +2025-04-17 00:55:31,user_0111,click,high,electronics,few,Yes,No +2025-04-17 00:55:33,user_0121,click,low,electronics,high,No,No +2025-04-17 00:55:35,user_0192,click,high,fashion,few,Yes,No +2025-04-17 00:55:37,user_0041,click,high,electronics,high,Yes,No +2025-04-17 00:55:39,user_0106,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:55:41,user_0184,view,medium,books,high,No,No +2025-04-17 00:55:43,user_0132,click,medium,fashion,high,Yes,No +2025-04-17 00:55:45,user_0043,view,low,toys,medium,No,Yes +2025-04-17 00:55:47,user_0006,view,high,fashion,medium,Yes,Yes +2025-04-17 00:55:49,user_0164,view,high,electronics,medium,Yes,Yes +2025-04-17 00:55:51,user_0113,view,medium,fashion,medium,No,Yes +2025-04-17 00:55:53,user_0197,add_to_cart,medium,toys,high,Yes,No +2025-04-17 00:55:55,user_0104,add_to_cart,high,toys,medium,Yes,Yes +2025-04-17 00:55:57,user_0008,view,high,books,very few,No,No +2025-04-17 00:55:59,user_0118,add_to_cart,medium,books,very few,No,No +2025-04-17 00:56:01,user_0163,view,high,books,medium,Yes,Yes +2025-04-17 00:56:03,user_0113,view,medium,toys,medium,No,No +2025-04-17 00:56:05,user_0044,click,medium,toys,high,Yes,No +2025-04-17 00:56:07,user_0087,click,high,home,medium,Yes,Yes +2025-04-17 00:56:09,user_0179,view,medium,home,medium,No,No +2025-04-17 00:56:11,user_0032,view,high,electronics,few,No,No +2025-04-17 00:56:13,user_0108,add_to_cart,high,fashion,high,Yes,No +2025-04-17 00:56:15,user_0053,add_to_cart,high,electronics,high,Yes,Yes +2025-04-17 00:56:17,user_0012,click,low,toys,high,No,No +2025-04-17 00:56:19,user_0019,click,low,electronics,high,No,No +2025-04-17 00:56:21,user_0131,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:23,user_0103,add_to_cart,low,toys,medium,No,No +2025-04-17 00:56:25,user_0022,view,medium,home,medium,No,Yes +2025-04-17 00:56:27,user_0187,add_to_cart,high,home,medium,Yes,Yes +2025-04-17 00:56:29,user_0106,add_to_cart,high,home,medium,Yes,Yes +2025-04-17 00:56:31,user_0019,click,high,books,high,Yes,Yes +2025-04-17 00:56:33,user_0044,view,high,home,high,Yes,Yes +2025-04-17 00:56:35,user_0172,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:37,user_0096,add_to_cart,medium,electronics,medium,Yes,No +2025-04-17 00:56:39,user_0179,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:56:41,user_0068,click,high,electronics,medium,Yes,Yes +2025-04-17 00:56:43,user_0173,view,low,electronics,high,No,No +2025-04-17 00:56:45,user_0149,click,high,books,high,Yes,Yes +2025-04-17 00:56:47,user_0076,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:49,user_0045,add_to_cart,high,toys,medium,Yes,Yes +2025-04-17 00:56:51,user_0086,click,high,home,high,Yes,Yes +2025-04-17 00:56:53,user_0061,view,low,electronics,high,No,No +2025-04-17 00:56:55,user_0118,view,low,toys,very few,No,No +2025-04-17 00:56:57,user_0038,view,high,books,high,Yes,Yes +2025-04-17 00:56:59,user_0098,click,low,fashion,medium,No,No +2025-04-17 00:57:01,user_0165,click,high,electronics,high,Yes,Yes +2025-04-17 00:57:03,user_0057,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:57:05,user_0029,view,medium,fashion,high,No,Yes +2025-04-17 00:57:07,user_0057,view,high,toys,high,Yes,Yes +2025-04-17 00:57:09,user_0133,click,high,home,high,Yes,Yes +2025-04-17 00:57:11,user_0037,click,high,home,high,Yes,Yes +2025-04-17 00:57:13,user_0143,view,medium,electronics,medium,No,Yes +2025-04-17 00:57:15,user_0041,click,low,books,high,No,No +2025-04-17 00:57:17,user_0007,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:19,user_0054,view,low,electronics,very few,No,No +2025-04-17 00:57:21,user_0150,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:57:23,user_0193,click,medium,toys,high,Yes,No +2025-04-17 00:57:25,user_0183,click,high,electronics,few,No,No +2025-04-17 00:57:27,user_0134,add_to_cart,low,toys,very few,No,No +2025-04-17 00:57:29,user_0170,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:31,user_0113,add_to_cart,low,home,medium,No,No +2025-04-17 00:57:33,user_0044,click,medium,home,high,Yes,Yes +2025-04-17 00:57:35,user_0067,add_to_cart,high,electronics,very few,No,No +2025-04-17 00:57:37,user_0146,click,high,books,few,Yes,No +2025-04-17 00:57:39,user_0156,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:41,user_0157,view,low,books,very few,No,No +2025-04-17 00:57:43,user_0066,add_to_cart,low,toys,very few,No,No +2025-04-17 00:57:45,user_0148,add_to_cart,medium,toys,very few,No,No +2025-04-17 00:57:47,user_0184,view,low,books,high,No,No +2025-04-17 00:57:49,user_0032,view,medium,home,few,No,No +2025-04-17 00:57:51,user_0087,view,low,fashion,medium,No,No +2025-04-17 00:57:53,user_0187,view,low,home,medium,No,No +2025-04-17 00:57:55,user_0005,view,low,home,high,No,No +2025-04-17 00:57:57,user_0149,click,high,fashion,high,Yes,Yes +2025-04-17 00:57:59,user_0179,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:58:01,user_0159,add_to_cart,high,toys,high,Yes,Yes +2025-04-17 00:58:03,user_0025,view,high,home,few,No,Yes +2025-04-17 00:58:05,user_0136,click,low,fashion,medium,No,No +2025-04-17 00:58:07,user_0027,view,medium,toys,very few,No,No +2025-04-17 00:58:09,user_0002,view,high,toys,very few,No,No +2025-04-17 00:58:11,user_0149,click,high,home,high,Yes,Yes +2025-04-17 00:58:13,user_0084,click,high,books,very few,No,No diff --git a/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005823.csv b/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005823.csv new file mode 100644 index 0000000..c3c8f9b --- /dev/null +++ b/src/PrescriptiveAnalysis2/streamlit_data/hoeff_events/events_20250417_005823.csv @@ -0,0 +1,101 @@ +timestamp,user_id,event_type,session_duration,product_category,user_total_purchases,purchase,prediction +2025-04-17 00:55:05,user_0050,add_to_cart,low,fashion,high,No,No +2025-04-17 00:55:07,user_0177,add_to_cart,low,toys,very few,No,Yes +2025-04-17 00:55:09,user_0120,click,low,fashion,very few,No,No +2025-04-17 00:55:11,user_0026,add_to_cart,high,electronics,very few,No,No +2025-04-17 00:55:13,user_0049,add_to_cart,high,electronics,medium,Yes,Yes +2025-04-17 00:55:15,user_0099,view,high,books,medium,Yes,Yes +2025-04-17 00:55:17,user_0154,click,medium,books,high,No,No +2025-04-17 00:55:19,user_0143,add_to_cart,high,home,medium,Yes,No +2025-04-17 00:55:21,user_0023,view,high,electronics,very few,No,No +2025-04-17 00:55:23,user_0082,view,high,books,medium,Yes,Yes +2025-04-17 00:55:25,user_0009,add_to_cart,medium,home,medium,Yes,Yes +2025-04-17 00:55:27,user_0196,add_to_cart,low,toys,high,No,Yes +2025-04-17 00:55:29,user_0008,view,medium,home,very few,No,No +2025-04-17 00:55:31,user_0111,click,high,electronics,few,Yes,No +2025-04-17 00:55:33,user_0121,click,low,electronics,high,No,No +2025-04-17 00:55:35,user_0192,click,high,fashion,few,Yes,No +2025-04-17 00:55:37,user_0041,click,high,electronics,high,Yes,No +2025-04-17 00:55:39,user_0106,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:55:41,user_0184,view,medium,books,high,No,No +2025-04-17 00:55:43,user_0132,click,medium,fashion,high,Yes,No +2025-04-17 00:55:45,user_0043,view,low,toys,medium,No,Yes +2025-04-17 00:55:47,user_0006,view,high,fashion,medium,Yes,Yes +2025-04-17 00:55:49,user_0164,view,high,electronics,medium,Yes,Yes +2025-04-17 00:55:51,user_0113,view,medium,fashion,medium,No,Yes +2025-04-17 00:55:53,user_0197,add_to_cart,medium,toys,high,Yes,No +2025-04-17 00:55:55,user_0104,add_to_cart,high,toys,medium,Yes,Yes +2025-04-17 00:55:57,user_0008,view,high,books,very few,No,No +2025-04-17 00:55:59,user_0118,add_to_cart,medium,books,very few,No,No +2025-04-17 00:56:01,user_0163,view,high,books,medium,Yes,Yes +2025-04-17 00:56:03,user_0113,view,medium,toys,medium,No,No +2025-04-17 00:56:05,user_0044,click,medium,toys,high,Yes,No +2025-04-17 00:56:07,user_0087,click,high,home,medium,Yes,Yes +2025-04-17 00:56:09,user_0179,view,medium,home,medium,No,No +2025-04-17 00:56:11,user_0032,view,high,electronics,few,No,No +2025-04-17 00:56:13,user_0108,add_to_cart,high,fashion,high,Yes,No +2025-04-17 00:56:15,user_0053,add_to_cart,high,electronics,high,Yes,Yes +2025-04-17 00:56:17,user_0012,click,low,toys,high,No,No +2025-04-17 00:56:19,user_0019,click,low,electronics,high,No,No +2025-04-17 00:56:21,user_0131,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:23,user_0103,add_to_cart,low,toys,medium,No,No +2025-04-17 00:56:25,user_0022,view,medium,home,medium,No,Yes +2025-04-17 00:56:27,user_0187,add_to_cart,high,home,medium,Yes,Yes +2025-04-17 00:56:29,user_0106,add_to_cart,high,home,medium,Yes,Yes +2025-04-17 00:56:31,user_0019,click,high,books,high,Yes,Yes +2025-04-17 00:56:33,user_0044,view,high,home,high,Yes,Yes +2025-04-17 00:56:35,user_0172,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:37,user_0096,add_to_cart,medium,electronics,medium,Yes,No +2025-04-17 00:56:39,user_0179,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:56:41,user_0068,click,high,electronics,medium,Yes,Yes +2025-04-17 00:56:43,user_0173,view,low,electronics,high,No,No +2025-04-17 00:56:45,user_0149,click,high,books,high,Yes,Yes +2025-04-17 00:56:47,user_0076,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:56:49,user_0045,add_to_cart,high,toys,medium,Yes,Yes +2025-04-17 00:56:51,user_0086,click,high,home,high,Yes,Yes +2025-04-17 00:56:53,user_0061,view,low,electronics,high,No,No +2025-04-17 00:56:55,user_0118,view,low,toys,very few,No,No +2025-04-17 00:56:57,user_0038,view,high,books,high,Yes,Yes +2025-04-17 00:56:59,user_0098,click,low,fashion,medium,No,No +2025-04-17 00:57:01,user_0165,click,high,electronics,high,Yes,Yes +2025-04-17 00:57:03,user_0057,add_to_cart,high,fashion,high,Yes,Yes +2025-04-17 00:57:05,user_0029,view,medium,fashion,high,No,Yes +2025-04-17 00:57:07,user_0057,view,high,toys,high,Yes,Yes +2025-04-17 00:57:09,user_0133,click,high,home,high,Yes,Yes +2025-04-17 00:57:11,user_0037,click,high,home,high,Yes,Yes +2025-04-17 00:57:13,user_0143,view,medium,electronics,medium,No,Yes +2025-04-17 00:57:15,user_0041,click,low,books,high,No,No +2025-04-17 00:57:17,user_0007,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:19,user_0054,view,low,electronics,very few,No,No +2025-04-17 00:57:21,user_0150,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:57:23,user_0193,click,medium,toys,high,Yes,No +2025-04-17 00:57:25,user_0183,click,high,electronics,few,No,No +2025-04-17 00:57:27,user_0134,add_to_cart,low,toys,very few,No,No +2025-04-17 00:57:29,user_0170,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:31,user_0113,add_to_cart,low,home,medium,No,No +2025-04-17 00:57:33,user_0044,click,medium,home,high,Yes,Yes +2025-04-17 00:57:35,user_0067,add_to_cart,high,electronics,very few,No,No +2025-04-17 00:57:37,user_0146,click,high,books,few,Yes,No +2025-04-17 00:57:39,user_0156,click,high,electronics,medium,Yes,Yes +2025-04-17 00:57:41,user_0157,view,low,books,very few,No,No +2025-04-17 00:57:43,user_0066,add_to_cart,low,toys,very few,No,No +2025-04-17 00:57:45,user_0148,add_to_cart,medium,toys,very few,No,No +2025-04-17 00:57:47,user_0184,view,low,books,high,No,No +2025-04-17 00:57:49,user_0032,view,medium,home,few,No,No +2025-04-17 00:57:51,user_0087,view,low,fashion,medium,No,No +2025-04-17 00:57:53,user_0187,view,low,home,medium,No,No +2025-04-17 00:57:55,user_0005,view,low,home,high,No,No +2025-04-17 00:57:57,user_0149,click,high,fashion,high,Yes,Yes +2025-04-17 00:57:59,user_0179,add_to_cart,high,books,medium,Yes,Yes +2025-04-17 00:58:01,user_0159,add_to_cart,high,toys,high,Yes,Yes +2025-04-17 00:58:03,user_0025,view,high,home,few,No,Yes +2025-04-17 00:58:05,user_0136,click,low,fashion,medium,No,No +2025-04-17 00:58:07,user_0027,view,medium,toys,very few,No,No +2025-04-17 00:58:09,user_0002,view,high,toys,very few,No,No +2025-04-17 00:58:11,user_0149,click,high,home,high,Yes,Yes +2025-04-17 00:58:13,user_0084,click,high,books,very few,No,No +2025-04-17 00:58:15,user_0046,view,high,electronics,medium,Yes,Yes +2025-04-17 00:58:17,user_0164,click,low,fashion,medium,No,No +2025-04-17 00:58:19,user_0030,click,high,fashion,medium,Yes,Yes +2025-04-17 00:58:21,user_0064,click,low,fashion,high,No,No +2025-04-17 00:58:23,user_0026,click,high,books,very few,No,No diff --git a/tests/test_pytest.py b/tests/test_pytest.py deleted file mode 100644 index 95c5ab7..0000000 --- a/tests/test_pytest.py +++ /dev/null @@ -1,2 +0,0 @@ -def test_example(): - assert 1 + 1 == 2