Logo Lanfrica

isdor/Linear_regression_Code_challenge_Maji_Ndogo_Yield_Prediction

Domaine:

agriculture

Type de record:

dataset
Créateur:
isd
Hôte:
This repository contains a Colab notebook that explores the relationship between various environmental and management factors (like temperature, pollution, soil type) and standardized crop yield in Maji Ndogo. It demonstrates simple linear regression, data splitting, and residual analysis for model evaluation # Linear regression Code challenge (Maji Ndogo Crop Yield Prediction) ## Project Overview This project delves into the factors influencing standardized crop yields in Maji Ndogo, utilizing a dataset derived from extensive agricultural surveys. The primary goal is to understand the relationships between environmental and farm management features and crop yield, specifically focusing on linear regression techniques. ## Dataset Description The dataset includes various features such as geographic characteristics (Elevation, Latitude, Longitude, Location, Slope), weather features (Rainfall, Min/Max/Ave_temperatures_C), soil and crop features (Soil_fertility, Soil_type, pH), and farm management features (Pollution_level, Plot_size, Chosen_crop). The target variable is `Standard_yield`, which is the standardized yield normalized per crop. ## Analysis Objectives 1. **Visualise Relationships**: Explore the linear relationships between `Standard_yield` and potential predictor variables like `Ave_temps` and `Pollution_level` using scatter plots. 2. **Quantify Correlation**: Calculate Pearson correlation coefficients to measure the strength and direction of linear relationships. 3. **Simple Linear Regression**: Build and evaluate simple linear regression models to predict `Standard_yield` based on single predictors. 4. **Model Evaluation**: Assess model performance using metrics such as R-squared, Mean Absolute Error (MAE), Mean Squared Error (MSE), and Root Mean Squared Error (RMSE). 5. **Train-Test Split**: Implement train-test splitting to evaluate model generalization on unseen data. 6. **Residual Analysis**: Perform residual analysis (histograms and scatter plots of residuals) to diagnose model fit and verify linear regression assumptions. ## Key Findings - **Average Temperature vs. Standard Yield**: Initial scatter plot and Pearson correlation coefficient (approximately 0.007) suggest a negligible linear relationship between average temperature and standard yield. - * …

Languages