{"id":31579192,"url":"https://github.com/josepablodmg/python--linear-regression-advertising","last_synced_at":"2026-05-06T17:31:12.128Z","repository":{"id":316564115,"uuid":"1063909778","full_name":"josepablodmg/Python--Linear-Regression-Advertising","owner":"josepablodmg","description":"A linear regression analysis to predict sales based on advertising spending across TV, radio, and newspaper channels. The project includes exploratory data analysis, model training, coefficient visualization, and residual analysis.","archived":false,"fork":false,"pushed_at":"2025-09-25T09:29:29.000Z","size":376,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-25T11:32:24.712Z","etag":null,"topics":["advertising","data-analysis","exploratory-data-analysis","linear-regression","machine-learning","python","regression","scikit-learn","visualization"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/josepablodmg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-25T09:27:36.000Z","updated_at":"2025-09-25T09:30:31.000Z","dependencies_parsed_at":"2025-09-25T11:32:27.397Z","dependency_job_id":"fb9f7a68-d4ca-4d95-bbab-205bdb7fad3b","html_url":"https://github.com/josepablodmg/Python--Linear-Regression-Advertising","commit_stats":null,"previous_names":["josepablodmg/python--linear-regression-advertising"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/josepablodmg/Python--Linear-Regression-Advertising","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josepablodmg%2FPython--Linear-Regression-Advertising","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josepablodmg%2FPython--Linear-Regression-Advertising/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josepablodmg%2FPython--Linear-Regression-Advertising/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josepablodmg%2FPython--Linear-Regression-Advertising/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josepablodmg","download_url":"https://codeload.github.com/josepablodmg/Python--Linear-Regression-Advertising/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josepablodmg%2FPython--Linear-Regression-Advertising/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278518160,"owners_count":26000176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["advertising","data-analysis","exploratory-data-analysis","linear-regression","machine-learning","python","regression","scikit-learn","visualization"],"created_at":"2025-10-05T20:47:51.671Z","updated_at":"2025-10-05T20:47:56.624Z","avatar_url":"https://github.com/josepablodmg.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linear Regression - Advertising\n\n## Description\nThis project explores the relationship between advertising budgets and sales. Using a linear regression model, the goal is to predict sales based on spending in TV, radio, and newspaper advertising channels. The project also analyzes residuals and visualizes regression coefficients to understand the model's behavior.\n\n## Dataset\n**Number of Instances:** 200  \n**Number of Attributes:** 4  \n\n**Features:**\n- `TV` – Advertising budget for TV\n- `radio` – Advertising budget for radio\n- `newspaper` – Advertising budget for newspaper  \n\n**Target Variable:**\n- `sales` – Sales in units (or currency)\n\nDataset source: [Advertising dataset](https://www.statlearning.com/)\n\n## Libraries\n- `pandas`, `numpy`\n- `matplotlib`, `seaborn`\n- `scikit-learn`\n\n## Key Steps\n1. **Data Exploration:** Checking shape, descriptive statistics, and correlations.\n2. **Data Visualization:** Boxplots, pairplots, and heatmaps to visualize feature relationships.\n3. **Linear Regression:**  \n   - Simple regression: Sales vs TV advertising  \n   - Ordinary Least Squares (OLS) regression  \n4. **Model Evaluation:**  \n   - Mean Squared Error (MSE)  \n   - R² score  \n   - Visualization of predicted vs actual values  \n5. **Residual Analysis:**  \n   - Distribution of residuals to assess model fit  \n6. **Coefficient Visualization:**  \n   - Grid search and 3D plots to visualize RSS against regression coefficients\n\n## Results\n- TV advertising is strongly correlated with sales (`r ≈ 0.78`)  \n- Model slope (TV vs Sales): `0.0443`  \n- Model intercept: `7.4983`  \n- Test MSE: `3.51`  \n- Test R²: `0.682`  \n- Minimized RSS: `2.10`  \n- Residuals analysis shows a roughly normal distribution, indicating a reasonable model fit.\n\n## Insights\nTV advertising has the strongest influence on sales compared to radio and newspaper. The simple linear regression model captures most of the trend but leaves some variance unexplained.\n\n## License\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosepablodmg%2Fpython--linear-regression-advertising","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosepablodmg%2Fpython--linear-regression-advertising","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosepablodmg%2Fpython--linear-regression-advertising/lists"}