CoolFace
Apppublic

giodesi/Logistic_Regression

sourceHugging Facemitupdated 11mo agoView on Hugging Face
0likes
App README

๐Ÿ“Š Logistic Regression Analysis Tool

Overview

This interactive application enables you to perform comprehensive logistic regression analysis on any CSV dataset without writing code. Logistic regression is a statistical model used to predict a binary categorical outcome (e.g., Yes/No, 1/0, Churn/Stay) based on a set of independent variables. Upload your data and follow the intuitive workflow to build, evaluate, and deploy powerful classification models.

How to Use

The application guides you through a complete machine learning workflow via a simple interface.

  1. 1.Select Mode: In the sidebar, choose 'Training Data' to build a new model or 'New Data for Prediction' if you have already trained one.
  2. 2.Upload Data: Upload your CSV file. The app provides a data preview and information.
  3. 3.Train Model (Training Mode):
  4. 4.Select your Features (X) (independent variables) and your Target (y) (the binary variable you want to predict).
  5. 5.Configure the Test Set Size, Random State, and whether to Standardize features.
  6. 6.Click 'Train Model'.
  7. 7.Evaluate Results: Explore the model's performance through multiple tabs, including Accuracy, Log Loss, a Confusion Matrix, Feature Coefficients, and a full Classification Report.
  8. 8.Make Predictions (Prediction Mode):
  9. 9.Upload your new dataset (which must contain the same feature columns).
  10. 10.Click 'Make Predictions' to get classifications for your new data.

Key Features

The application implements a professional-grade logistic regression workflow with features designed for clear and reliable classification.

  • โ€”Binary Classification: Specifically designed for models that predict one of two outcomes.
  • โ€”Comprehensive Metrics: Evaluate your model using Accuracy, Log Loss, Precision, Recall, and F1-Score.
  • โ€”Intuitive Visualizations:
  • โ€”Feature Coefficients Plot: Understand which features most strongly influence the prediction.
  • โ€”Confusion Matrix: Clearly see how many predictions were correct (True Positives/Negatives) and incorrect (False Positives/Negatives).
  • โ€”Data Standardization: Includes the option to scale features using StandardScaler, which is highly recommended for logistic regression to improve model performance.
  • โ€”Train/Predict Modes: A persistent session state (st.session_state) keeps your trained model in memory, allowing you to immediately use it for predictions on new data.

Data Requirements

Your CSV file should contain numeric columns.

  • โ€”Features (X): All feature columns must be numeric. The app does not currently support automatic encoding of text-based categorical data.
  • โ€”Target (y): The target variable must be binary and encoded as two numbers (e.g., 0 and 1).
  • โ€”Missing Values: The application will warn you of missing values and drop the affected rows before training or prediction.

Example Use Cases

This tool is ideal for any binary classification problem where you need to predict a categorical outcome.

  • โ€”Business: Predict customer churn (like the included ChurnData.csv example).
  • โ€”Finance: Determine if a customer will default on a loan (Yes/No) or if a transaction is fraudulent (Yes/No).
  • โ€”Healthcare: Predict the presence of a disease (Positive/Negative) based on clinical measurements.
  • โ€”Marketing: Predict if a user will click an ad (Click/No Click) or subscribe to a service (Yes/No).

Technical Implementation

Built with Streamlit and scikit-learn, the application leverages industry-standard machine learning libraries while maintaining an accessible interface. The implementation emphasizes robust error handling and input validation to ensure reliable results. State management (st.session_state) preserves your trained model and scaler, allowing you to seamlessly switch between training and prediction modes.

Source Code and Documentation

The complete source code and comprehensive documentation are available on GitHub at **Logistic_Regression**. The repository includes the full application source code (app.py), a detailed Jupyter notebook (Logistic_Regression.ipynb) demonstrating the underlying concepts, and all necessary project files.

Support and Feedback

For questions, bug reports, or feature requests, please visit the **GitHub repository issues page**. Your feedback is valuable and helps guide future development.

License

This project is released under the MIT License, enabling free use, modification, and distribution. See the **LICENSE** file for complete terms.