CoolFace
Apppublic

Soly663/Genetic_Algorithm-choosingFeature

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
app.py41 linesDownload Raw Back to root
1import streamlit as st2from main_ga import run_genetic_algorithm3 4# --- Page config ---5st.set_page_config(6    page_title="Genetic Algorithm Feature Selection",7    page_icon="๐Ÿงฌ",8    layout="centered"9)10 11st.title("๐Ÿงฌ Genetic Algorithm (GA) Feature Selection")12st.write(13    "Run the Genetic Algorithm to select features from your dataset and see results directly."14)15 16# --- Sidebar settings ---17st.sidebar.header("โš™๏ธ GA Settings")18population_size = st.sidebar.slider("Population Size", 10, 200, 50, 10)19generations = st.sidebar.slider("Generations", 10, 500, 100, 10)20mutation_rate = st.sidebar.slider("Mutation Rate", 0.0, 1.0, 0.05, 0.01)21 22st.sidebar.info("๐Ÿ’ก Adjust values to try different GA settings.")23 24# --- Run button ---25if st.button("๐Ÿš€ Run GA"):26    with st.spinner("Running GA... Please wait ๐Ÿ”„"):27        best_chromosome = run_genetic_algorithm(28            population_size=population_size,29            generations=generations,30            mutation_rate=mutation_rate31        )32        num_selected = sum(best_chromosome)33        st.success("โœ… GA completed successfully!")34        st.write(f"**Selected Features:** {num_selected}")35        st.write("**Resulting Chromosome:**")36        st.code(best_chromosome)37 38# --- Footer ---39st.markdown("---")40st.caption("BIA601 Project | Streamlit Frontend ๐Ÿ’ป")41