from vogue2 import fashionTrendClusterer
from TheTrendForecaster import TrendForecaster 
from DesignerInfluence import DesignerInfluenceAnalyzer  

# -------------------------------
# VOGUE2.PY - CLUSTERING MODULE
# -------------------------------

# Initialize the fashion trend clusterer
clusterer = fashionTrendClusterer()

# Load the Vogue dataset (with precomputed image embeddings)
clusterer.load_dataset()

# Apply BIRCH clustering on the embeddings
clusterer.cluster_embeddings()

# Visualize the clusters in an interactive Plotly graph
clusterer.visualize_clusters(interactive=True)

# Generate a DataFrame representing trends over time
print("Generating trend DataFrame...")
top_clusters_df = clusterer.get_trend_dataframe()
print(top_clusters_df.head())  # Show a preview of the trend DataFrame

# Print the representative image indices per cluster (for visual inspection or dashboard use)
print(clusterer.rep_indices)

# -----------------------------------
# THETRENDFORECASTER.PY - FORECASTER
# -----------------------------------

# Initialize the hybrid LSTM+Transformer forecaster with a rolling window size of 3
forecaster = TrendForecaster(window=6)

# Train and predict trend frequencies for each top cluster
models, predictions = forecaster.process_top_clusters(top_clusters_df)

# Plot actual vs predicted log-difference trends for model evaluation
forecaster.plot_log_difference_forecast(top_clusters_df)


