--- title: Soil Resistivity Prediction emoji: 🚗 colorFrom: blue colorTo: green sdk: streamlit sdk_version: "1.29.0" app_file: app.py pinned: false --- # Soil Resistivity Prediction Tool This application predicts soil resistivity based on various soil properties using a deep learning model with a transformer-based architecture. ## Features - Interactive web interface for inputting soil properties - Real-time prediction of soil resistivity - SHAP-based explanation of feature importance - Visualization of prediction results ## Installation 1. Make sure you have Python 3.8+ installed 2. Install the required packages: ```bash pip install -r requirements.txt ``` ## Usage 1. Run the Streamlit application: ```bash streamlit run app.py ``` 2. Open your web browser and navigate to the URL shown in the terminal (typically http://localhost:8501) 3. Enter the soil properties in the input fields 4. Click the "Predict Resistivity" button to get a prediction 5. View the prediction result and feature importance explanation ## Files - `app.py`: The main Streamlit application - `data.xlsx`: Sample data used for scaling and background for SHAP explanations - `best_val_r2_model.pth`: The trained PyTorch model - `scaler_X.pkl`: Scaler for input features - `scaler_y.pkl`: Scaler for target variable - `feature_names.json`: Names of the input features - `temp/`: Directory for temporary files (created automatically) ## Model Architecture The model uses a transformer-based architecture with: - Feature embeddings for each input feature - Multi-head self-attention mechanisms - Both feature-wise and sample-wise attention - Residual connections and layer normalization ## Troubleshooting If you encounter any issues: 1. Make sure all required files are in the same directory 2. Check that all dependencies are installed correctly 3. Ensure you have sufficient permissions to create the temp directory 4. If you see warnings about feature names, these can be safely ignored ## License This project is licensed under the MIT License - see the LICENSE file for details.