├── .gitignore ├── Chapter 03 └── solutions │ ├── 01.png │ ├── 02.png │ ├── 03.png │ ├── 04.png │ ├── 05.png │ ├── 06.png │ ├── 07.png │ ├── 08.png │ ├── 09.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 19.png │ ├── 20.png │ ├── 21.png │ ├── 22.png │ ├── 23.png │ ├── 24.png │ └── 25.png ├── Chapter 04 └── solutions │ ├── 01.png │ ├── 02.png │ ├── 03.png │ ├── 04.png │ ├── 05.png │ ├── 06.png │ ├── 07.png │ ├── 08.png │ ├── 09.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ └── 18.png ├── Chapter 06 ├── Output-Screenshot │ ├── Lasso611.png │ ├── PLS621.png │ ├── PermeabilityEls621.png │ ├── accuEls.png │ ├── elasticNet.png │ ├── meatPCR.png │ ├── meatPLS.png │ ├── permeabilityPLS621.png │ ├── permeabilityRg621.png │ ├── predLasso611.png │ ├── predPCA611.png │ ├── predPLS61.png │ ├── predPermeabilityEls621.png │ ├── predPermeabilityPLS621.png │ ├── predPermeabilityRg621.png │ ├── predReg11.png │ ├── predReg611.png │ ├── predRegression611.png │ ├── ridge6.1.png │ └── screeplot.png ├── Question6.1 │ └── 6-1.r ├── Question6.2 │ └── 6-2.r └── solutions │ ├── 01.png │ ├── 02.png │ ├── 03.png │ ├── 04.png │ ├── 05.png │ ├── 06.png │ ├── 07.png │ ├── 08.png │ ├── 09.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 19.png │ ├── 20.png │ ├── 21.png │ ├── 22.png │ ├── 23.png │ ├── 24.png │ ├── 25.png │ ├── 26.png │ ├── 27.png │ ├── 28.png │ ├── 29.png │ ├── 30.png │ ├── 31.png │ └── 32.png ├── Chapter 07 ├── Question 7.1 │ └── 7-1.r ├── Question 7.3 │ └── 7-3.r ├── Question 7.4 │ └── 7-4.r └── solutions │ ├── 01.png │ ├── 02.png │ ├── 03.png │ ├── 04.png │ ├── 05.png │ ├── 06.png │ ├── 07.png │ ├── 08.png │ ├── 09.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 19.png │ ├── 20.png │ ├── 21.png │ ├── 22.png │ ├── 23.png │ ├── 24.png │ ├── 25.png │ ├── 26.png │ ├── 27.png │ ├── 28.png │ ├── 29.png │ ├── 30.png │ ├── 31.png │ ├── 32.png │ ├── 33.png │ ├── 34.png │ ├── 35.png │ ├── 36.png │ ├── 37.png │ ├── 38.png │ ├── 39.png │ ├── 40.png │ ├── 41.png │ ├── 42.png │ ├── 43.png │ ├── 44.png │ ├── 45.png │ ├── 46.png │ ├── 47.png │ ├── 48.png │ └── 49.png ├── Chapter 12 ├── Output-Screenshot │ ├── 12-1-nsc-top-predictors-chem.png │ ├── 12-1-penalized-LR-top-predictors-bio.png │ ├── 12-1-top-predictor-nsc-merged.png │ ├── 12-1-top-predictor-penalized-lR-merged.png │ ├── 12-2-class-imbalance-result.png │ ├── 12.1-bio │ │ ├── 12-1-confusion-matrix-LDA-bio.png │ │ ├── 12-1-confusion-matrix-LR-bio.png │ │ ├── 12-1-confusion-matrix-NSC-bio.png │ │ ├── 12-1-confusion-matrix-PLS-DAbio.png │ │ ├── 12-1-confusion-matrix-penalized-LDA-bio.png │ │ └── 12-1-confusion-matrix-penalized-LR-bio.png │ ├── 12.1-chem │ │ ├── 12-1-confusion-matrix-LDA-chem.png │ │ ├── 12-1-confusion-matrix-LR-chem.png │ │ ├── 12-1-confusion-matrix-NSC-chem.png │ │ ├── 12-1-confusion-matrix-PLS-DA-chem.png │ │ ├── 12-1-confusion-matrix-penalized-LDA-chem.png │ │ └── 12-1-confusion-matrix-penalized-LR-chem.png │ ├── 12.1-merged │ │ ├── 12-1-confusion-matrix-LDA-merged.png │ │ ├── 12-1-confusion-matrix-LR-merged.png │ │ ├── 12-1-confusion-matrix-nsc-merged.png │ │ ├── 12-1-confusion-matrix-penalized-LDA-merged.png │ │ ├── 12-1-confusion-matrix-penalized-LR-merged.png │ │ └── 12-1-confusion-matrix-pls-da-merged.png │ ├── 12.2 │ │ ├── 12-2-confusion-matrix-LR-fattyAcid.png │ │ ├── 12-2-confusion-matrix-lda-fattyacids.png │ │ ├── 12-2-confusion-matrix-nsc-fattyacids.png │ │ ├── 12-2-confusion-matrix-penalized-LDA-fattyacids.png │ │ ├── 12-2-confusion-matrix-penalized-LR-fattyacids.png │ │ ├── 12-2-confusion-matrix-penalized-lda-fattyacids.png │ │ └── 12-2-confusion-matrix-pls-fattyacids.png │ └── class-imbalance-response.png ├── Question 12.1 │ ├── 12-1-bio.R │ ├── 12-1-chem.R │ └── 12-1-comb.R ├── Question 12.2 │ └── 12-2.r └── solutions │ ├── 01.png │ ├── 02.png │ ├── 03.png │ ├── 04.png │ ├── 05.png │ ├── 06.png │ ├── 07.png │ ├── 08.png │ ├── 09.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 19.png │ ├── 20.png │ ├── 21.png │ ├── 22.png │ ├── 23.png │ ├── 24.png │ ├── 25.png │ ├── 26.png │ ├── 27.png │ ├── 28.png │ ├── 29.png │ ├── 30.png │ ├── 31.png │ ├── 32.png │ ├── 33.png │ ├── 34.png │ ├── 35.png │ ├── 36.png │ ├── 37.png │ ├── 38.png │ ├── 39.png │ ├── 40.png │ ├── 41.png │ ├── 42.png │ ├── 43.png │ ├── 44.png │ └── 45.png ├── Chapter 13 ├── .Rhistory ├── 13-2.r └── solutions │ ├── 01.png │ ├── 02.png │ ├── 03.png │ ├── 04.png │ ├── 05.png │ ├── 06.png │ ├── 07.png │ ├── 08.png │ ├── 09.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 16.png │ ├── 17.png │ ├── 18.png │ ├── 19.png │ ├── 20.png │ └── 21.png ├── README.md └── Wine-Data-quality-anlaysis └── presentation ├── 01.png ├── 02.png ├── 03.png ├── 04.png ├── 05.png ├── 06.png ├── 07.png ├── 08.png ├── 09.png ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 14.png ├── 15.png ├── 16.png ├── 17.png ├── 18.png ├── 19.png ├── 20.png ├── 21.png ├── 22.png ├── 23.png ├── 24.png ├── 25.png ├── 26.png ├── 27.png ├── 28.png ├── 29.png ├── 30.png ├── 31.png ├── 32.png ├── 33.png ├── 34.png ├── 35.png ├── 36.png ├── 37.png ├── 38.png ├── 39.png ├── 40.png ├── 41.png ├── 42.png ├── 43.png └── 44.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.pdf 2 | /*.pdf 3 | *.pdf* 4 | -------------------------------------------------------------------------------- /Chapter 03/solutions/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/01.png -------------------------------------------------------------------------------- /Chapter 03/solutions/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/02.png -------------------------------------------------------------------------------- /Chapter 03/solutions/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/03.png -------------------------------------------------------------------------------- /Chapter 03/solutions/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/04.png -------------------------------------------------------------------------------- /Chapter 03/solutions/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/05.png -------------------------------------------------------------------------------- /Chapter 03/solutions/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/06.png -------------------------------------------------------------------------------- /Chapter 03/solutions/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/07.png -------------------------------------------------------------------------------- /Chapter 03/solutions/08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/08.png -------------------------------------------------------------------------------- /Chapter 03/solutions/09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/09.png -------------------------------------------------------------------------------- /Chapter 03/solutions/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/10.png -------------------------------------------------------------------------------- /Chapter 03/solutions/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/11.png -------------------------------------------------------------------------------- /Chapter 03/solutions/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/12.png -------------------------------------------------------------------------------- /Chapter 03/solutions/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/13.png -------------------------------------------------------------------------------- /Chapter 03/solutions/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/14.png -------------------------------------------------------------------------------- /Chapter 03/solutions/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/15.png -------------------------------------------------------------------------------- /Chapter 03/solutions/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/16.png -------------------------------------------------------------------------------- /Chapter 03/solutions/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/17.png -------------------------------------------------------------------------------- /Chapter 03/solutions/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/18.png -------------------------------------------------------------------------------- /Chapter 03/solutions/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/19.png -------------------------------------------------------------------------------- /Chapter 03/solutions/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/20.png -------------------------------------------------------------------------------- /Chapter 03/solutions/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/21.png -------------------------------------------------------------------------------- /Chapter 03/solutions/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/22.png -------------------------------------------------------------------------------- /Chapter 03/solutions/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/23.png -------------------------------------------------------------------------------- /Chapter 03/solutions/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/24.png -------------------------------------------------------------------------------- /Chapter 03/solutions/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 03/solutions/25.png -------------------------------------------------------------------------------- /Chapter 04/solutions/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/01.png -------------------------------------------------------------------------------- /Chapter 04/solutions/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/02.png -------------------------------------------------------------------------------- /Chapter 04/solutions/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/03.png -------------------------------------------------------------------------------- /Chapter 04/solutions/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/04.png -------------------------------------------------------------------------------- /Chapter 04/solutions/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/05.png -------------------------------------------------------------------------------- /Chapter 04/solutions/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/06.png -------------------------------------------------------------------------------- /Chapter 04/solutions/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/07.png -------------------------------------------------------------------------------- /Chapter 04/solutions/08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/08.png -------------------------------------------------------------------------------- /Chapter 04/solutions/09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/09.png -------------------------------------------------------------------------------- /Chapter 04/solutions/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/10.png -------------------------------------------------------------------------------- /Chapter 04/solutions/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/11.png -------------------------------------------------------------------------------- /Chapter 04/solutions/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/12.png -------------------------------------------------------------------------------- /Chapter 04/solutions/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/13.png -------------------------------------------------------------------------------- /Chapter 04/solutions/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/14.png -------------------------------------------------------------------------------- /Chapter 04/solutions/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/15.png -------------------------------------------------------------------------------- /Chapter 04/solutions/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/16.png -------------------------------------------------------------------------------- /Chapter 04/solutions/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/17.png -------------------------------------------------------------------------------- /Chapter 04/solutions/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 04/solutions/18.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/Lasso611.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/Lasso611.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/PLS621.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/PLS621.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/PermeabilityEls621.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/PermeabilityEls621.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/accuEls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/accuEls.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/elasticNet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/elasticNet.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/meatPCR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/meatPCR.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/meatPLS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/meatPLS.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/permeabilityPLS621.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/permeabilityPLS621.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/permeabilityRg621.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/permeabilityRg621.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/predLasso611.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/predLasso611.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/predPCA611.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/predPCA611.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/predPLS61.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/predPLS61.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/predPermeabilityEls621.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/predPermeabilityEls621.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/predPermeabilityPLS621.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/predPermeabilityPLS621.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/predPermeabilityRg621.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/predPermeabilityRg621.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/predReg11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/predReg11.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/predReg611.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/predReg611.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/predRegression611.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/predRegression611.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/ridge6.1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/ridge6.1.png -------------------------------------------------------------------------------- /Chapter 06/Output-Screenshot/screeplot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/Output-Screenshot/screeplot.png -------------------------------------------------------------------------------- /Chapter 06/Question6.1/6-1.r: -------------------------------------------------------------------------------- 1 | library(AppliedPredictiveModeling) 2 | library(MASS) 3 | library(caret) 4 | library(elasticnet) 5 | library(lars) 6 | library(pls) 7 | 8 | data(tecator) 9 | 10 | ######################### 11 | # question 6.1(b) 12 | ######################### 13 | 14 | colName = {} 15 | for (i in 1:100){ 16 | colName[i]<- paste("X",i) 17 | } 18 | colnames(absorp)<-colName 19 | 20 | ## The base R function prcomp can be used for PCA. In the code below, 21 | ## the data are centered and scaled prior to PCA. 22 | pcaObject <- prcomp(absorp, center = TRUE, scale. = TRUE) 23 | 24 | # The standard deviations for the columns in the data are stored in pcaObject as a sub-object called ad: 25 | # Calculate the cumulative percentage of variance which each component 26 | # accounts for. 27 | percentVariance <- pcaObject$sd^2/sum(pcaObject$sd^2)*100 28 | print(percentVariance[1:5]) 29 | 30 | # taking only 5 variances set npcs = 5 31 | screeplot(pcaObject, npcs = 5, type = "lines", main = "Scree Plot for PCA Analysis") 32 | 33 | 34 | ######################### 35 | ######################### 36 | 37 | ######################### 38 | # question 6.1(c,d,e) 39 | ######################### 40 | 41 | # Response variable = Fat 42 | 43 | # BarPlot of response variable 44 | 45 | counts <- table( endpoints[,2]) 46 | barplot(counts, main="Fat Distribution", 47 | xlab="Percentage Of Fat ") 48 | 49 | 50 | # splitting data into 80% and 20% based on Fat Response 51 | set.seed(12345) 52 | 53 | trainingRows = createDataPartition(endpoints[,2], p = .75, list= FALSE) 54 | 55 | trainAbsorption <- absorp[ trainingRows, ] 56 | testAbsorption <- absorp[-trainingRows, ] 57 | trainFat <- endpoints[trainingRows, 2] 58 | testFat <- endpoints[-trainingRows, 2] 59 | 60 | ctrl <- trainControl(method = "repeatedcv", repeats=4) 61 | 62 | cat("\n") 63 | 64 | set.seed(12345) 65 | 66 | # simple linear regression 67 | meatln <- train(x = trainAbsorption , y = trainFat, method = "lm", trControl = ctrl) 68 | print(meatln) 69 | 70 | 71 | prediction<-predict(meatln,testAbsorption) 72 | accuracy3<-data.frame(obs=testFat,pred=prediction) 73 | defaultSummary(accuracy3) 74 | plot(accuracy3) 75 | 76 | 77 | 78 | cat("\n") 79 | 80 | # PCR method 81 | meatPCR <- train(x = trainAbsorption , y = trainFat, method = "pcr", trControl = ctrl, tuneLength = 24) 82 | print(meatPCR) 83 | plot(meatPCR) 84 | 85 | cat("\n") 86 | cat("\n") 87 | 88 | # PLS method 89 | meatPLS <- train(x = trainAbsorption , y = trainFat, method = "pls", trControl = ctrl, tuneLength = 24) 90 | print(meatPLS) 91 | plot(meatPLS) 92 | cat("\n") 93 | 94 | 95 | 96 | # Ridge Regression Method 97 | meatRg <- train(x = trainAbsorption , y = trainFat, method = "ridge", 98 | trControl = ctrl, 99 | preProcess = c("center","scale"), 100 | tuneGrid = expand.grid(lambda = seq(0,1,length=15))) 101 | 102 | print(meatRg) 103 | plot(meatRg) 104 | cat("\n") 105 | 106 | prediction<-predict(meatRg,testAbsorption) 107 | accuracy2<-data.frame(obs=testFat,pred=prediction) 108 | defaultSummary(accuracy2) 109 | plot(accuracy2) 110 | 111 | 112 | # Lasso Regression Method 113 | meatLasso <- train(x = trainAbsorption , y = trainFat, method = "lasso", 114 | trControl = ctrl, 115 | preProcess = c("center","scale"), 116 | tuneGrid = expand.grid(fraction = seq(0.1,1,length=20))) 117 | 118 | print(meatLasso) 119 | plot(meatLasso) 120 | cat("\n") 121 | 122 | 123 | prediction<-predict(meatLasso,testAbsorption) 124 | accuracy3<-data.frame(obs=testFat,pred=prediction) 125 | defaultSummary(accuracy3) 126 | plot(accuracy3) 127 | 128 | 129 | 130 | # Elastic Net Method 131 | meatEls <- train(x = trainAbsorption , y = trainFat, method = "enet", 132 | trControl = ctrl, 133 | preProcess = c("center","scale"), 134 | tuneGrid = expand.grid(lambda = c(0,.001,.01,.1,1), 135 | fraction = seq(0.05,1,length=20))) 136 | 137 | print(meatEls) 138 | plot(meatEls) 139 | cat("\n") 140 | 141 | prediction<-predict(meatEls,testAbsorption) 142 | accuracy1<-data.frame(obs=testFat,pred=prediction) 143 | defaultSummary(accuracy1) 144 | plot(accuracy1) 145 | -------------------------------------------------------------------------------- /Chapter 06/Question6.2/6-2.r: -------------------------------------------------------------------------------- 1 | library(AppliedPredictiveModeling) 2 | library(MASS) 3 | library(caret) 4 | library(elasticnet) 5 | library(lars) 6 | library(pls) 7 | 8 | data(permeability) 9 | 10 | ######################### 11 | # question 6.2(b) 12 | ######################### 13 | cat("Before Non-Zero Variance, number of predictors in fingerprints is 1107: \n") 14 | print(str(fingerprints)) 15 | cat("\n\n") 16 | 17 | cat("After Non-Zero Variance, number of predictors in fingerprints is 388: \n") 18 | NZVfingerprints <- nearZeroVar(fingerprints) 19 | noNZVfingerprints <- fingerprints[,-NZVfingerprints] 20 | print(str(noNZVfingerprints)) 21 | cat("\n\n") 22 | 23 | ######################### 24 | ######################### 25 | 26 | ######################### 27 | # question 6.2(c) 28 | ######################### 29 | 30 | # stratified random sample splitting with 75% training and 25% testing 31 | 32 | set.seed(12345) 33 | trainingRows = createDataPartition(permeability, p = .75, list= FALSE) 34 | 35 | trainFingerprints <- noNZVfingerprints[trainingRows,] 36 | trainPermeability <- permeability[trainingRows,] 37 | 38 | testFingerprints <- noNZVfingerprints[-trainingRows,] 39 | testPermeability <- permeability[-trainingRows,] 40 | 41 | set.seed(12345) 42 | 43 | ctrl <- trainControl(method = "repeatedcv", repeats=5, number = 4) 44 | 45 | 46 | # PLS Model 47 | permeabiltyPLS <- train(x = trainFingerprints , y = trainPermeability,preProcess = c("center","scale"), method = "pls", tuneGrid = expand.grid(ncomp = 1:15), trControl = ctrl) 48 | print(permeabiltyPLS) 49 | plot(permeabiltyPLS, metric ="Rsquared", main = "PLS Tuning Parameter for Permeability Data") 50 | 51 | cat("\n") 52 | 53 | # # Ridge Regression Method 54 | # permeabiltyRg <- train(x = trainFingerprints , y = trainPermeability, method = "ridge", 55 | # trControl = ctrl, 56 | # preProcess = c("center","scale"), 57 | # tuneGrid = expand.grid(lambda = seq(0,1,length=15))) 58 | # 59 | # print(permeabiltyRg) 60 | # plot(permeabiltyRg, metric ="Rsquared", main = "Ridge Regression Tuning Parameter for Permeability Data") 61 | # 62 | # 63 | # # Lasso Regression Method 64 | # meatLasso <- train(x = trainFingerprints , y = trainPermeability, method = "lasso", 65 | # trControl = ctrl, 66 | # preProcess = c("center","scale"), 67 | # tuneGrid = expand.grid(fraction = seq(0.1,1,length=20))) 68 | # 69 | # print(meatLasso) 70 | # plot(meatLasso) 71 | # cat("\n") 72 | # 73 | # 74 | # # Elastic Net Method 75 | # meatEls <- train(x = trainAbsorption , y = trainFat, method = "enet", 76 | # trControl = ctrl, 77 | # preProcess = c("center","scale"), 78 | # tuneGrid = expand.grid(lambda = c(0,.001,.01,.1,1), 79 | # fraction = seq(0.05,1,length=20))) 80 | # 81 | # print(meatEls) 82 | # plot(meatEls) 83 | # cat("\n") 84 | # 85 | # prediction<-predict(meatEls,testAbsorption) 86 | # accuracy1<-data.frame(obs=testFat,pred=prediction) 87 | # defaultSummary(accuracy1) 88 | # plot(accuracy1) 89 | # 90 | # ######################### 91 | # ######################### 92 | # 93 | -------------------------------------------------------------------------------- /Chapter 06/solutions/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/01.png -------------------------------------------------------------------------------- /Chapter 06/solutions/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/02.png -------------------------------------------------------------------------------- /Chapter 06/solutions/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/03.png -------------------------------------------------------------------------------- /Chapter 06/solutions/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/04.png -------------------------------------------------------------------------------- /Chapter 06/solutions/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/05.png -------------------------------------------------------------------------------- /Chapter 06/solutions/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/06.png -------------------------------------------------------------------------------- /Chapter 06/solutions/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/07.png -------------------------------------------------------------------------------- /Chapter 06/solutions/08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/08.png -------------------------------------------------------------------------------- /Chapter 06/solutions/09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/09.png -------------------------------------------------------------------------------- /Chapter 06/solutions/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/10.png -------------------------------------------------------------------------------- /Chapter 06/solutions/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/11.png -------------------------------------------------------------------------------- /Chapter 06/solutions/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/12.png -------------------------------------------------------------------------------- /Chapter 06/solutions/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/13.png -------------------------------------------------------------------------------- /Chapter 06/solutions/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/14.png -------------------------------------------------------------------------------- /Chapter 06/solutions/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/15.png -------------------------------------------------------------------------------- /Chapter 06/solutions/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/16.png -------------------------------------------------------------------------------- /Chapter 06/solutions/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/17.png -------------------------------------------------------------------------------- /Chapter 06/solutions/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/18.png -------------------------------------------------------------------------------- /Chapter 06/solutions/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/19.png -------------------------------------------------------------------------------- /Chapter 06/solutions/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/20.png -------------------------------------------------------------------------------- /Chapter 06/solutions/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/21.png -------------------------------------------------------------------------------- /Chapter 06/solutions/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/22.png -------------------------------------------------------------------------------- /Chapter 06/solutions/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/23.png -------------------------------------------------------------------------------- /Chapter 06/solutions/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/24.png -------------------------------------------------------------------------------- /Chapter 06/solutions/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/25.png -------------------------------------------------------------------------------- /Chapter 06/solutions/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/26.png -------------------------------------------------------------------------------- /Chapter 06/solutions/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/27.png -------------------------------------------------------------------------------- /Chapter 06/solutions/28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/28.png -------------------------------------------------------------------------------- /Chapter 06/solutions/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/29.png -------------------------------------------------------------------------------- /Chapter 06/solutions/30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/30.png -------------------------------------------------------------------------------- /Chapter 06/solutions/31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/31.png -------------------------------------------------------------------------------- /Chapter 06/solutions/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 06/solutions/32.png -------------------------------------------------------------------------------- /Chapter 07/Question 7.1/7-1.r: -------------------------------------------------------------------------------- 1 | library(caret) 2 | library(kernlab) 3 | library(lattice) 4 | library(ggplot2) 5 | 6 | x<-runif(100,min=2,max=10) 7 | y<-sin(x)+rnorm(length(x))*0.25 8 | sinData<-data.frame(x=x,y=y) 9 | 10 | # create a data Grid 11 | dataGrid<-data.frame(x=seq(2,10,length=100)) 12 | 13 | # this is done to divide the graph in 4 columns 14 | par(mfrow = c(2,2)) 15 | 16 | svmParam1 <- expand.grid(eps = c(0.01,0.05,0.1,0.5), costs = 2^c(-2,0,2,8)) 17 | for ( i in 1: nrow(svmParam1)){ 18 | set.seed(121) 19 | rbfSVM <- ksvm(x=x,y=y, data=sinData, 20 | kernel="rbfdot",kpar="automatic", 21 | C= svmParam1$costs[i],epsilon = svmParam1$eps[i]) 22 | 23 | tmp<-data.frame(x=dataGrid$x,y =predict(rbfSVM,newdata= dataGrid), 24 | eps=paste("epsilon",format(svmParam1$eps)[i]), 25 | costs=paste("costs",format(svmParam1$costs)[i])) 26 | 27 | svmPred1 <- if(i==1) tmp else rbind(tmp,svmPred1) 28 | 29 | modelPrediction <- predict(rbfSVM, newdata = dataGrid) 30 | plot(x,y) 31 | points(x = dataGrid$x, y = modelPrediction[,1], type = "l", col = "blue") 32 | 33 | } 34 | svmPred1$costs <- factor(svmPred1$costs, levels=rev(levels(svmPred1$costs))) 35 | 36 | 37 | svmParam2 <- expand.grid(eps = c(0.01,0.05,0.1,0.5), 38 | costs = 2^c(-2,0,2,8), 39 | sigma=as.vector(sigest(y~x,data=sinData,frac=.75))) 40 | 41 | for ( i in 1: nrow(svmParam2)){ 42 | set.seed(121) 43 | rbfSVM <- ksvm(x=x,y=y, data=sinData, 44 | kernel="rbfdot", 45 | kpar=list(sigma=svmParam2$sigma[i]), 46 | C= svmParam2$costs[i], 47 | epsilon = svmParam2$eps[i] 48 | ) 49 | 50 | tmp<-data.frame(x=dataGrid$x, 51 | y =predict(rbfSVM,newdata= dataGrid), 52 | eps=paste("epsilon",format(svmParam2$eps)[i]), 53 | costs=paste("costs",format(svmParam2$costs)[i]), 54 | sigma=paste("sigma",format(svmParam2$sigma,digits=2)[i]) 55 | ) 56 | svmPred2 <- if(i==1) tmp else rbind(tmp,svmPred2) 57 | 58 | modelPrediction <- predict(rbfSVM, newdata = dataGrid) 59 | plot(x,y) 60 | points(x = dataGrid$x, y = modelPrediction[,1], type = "l", col = "blue") 61 | 62 | } 63 | 64 | svmPred2$costs <- factor(svmPred2$costs, levels=rev(levels(svmPred2$costs))) 65 | svmPred2$sigma <- factor(svmPred2$sigma, levels=rev(levels(svmPred2$sigma))) 66 | 67 | -------------------------------------------------------------------------------- /Chapter 07/Question 7.3/7-3.r: -------------------------------------------------------------------------------- 1 | library(mlbench) 2 | library(caret) 3 | library(earth) 4 | library(doParallel) 5 | library(nnet) 6 | 7 | data(tecator) 8 | 9 | colName = {} 10 | for (i in 1:100){ 11 | colName[i]<- paste("X",i) 12 | } 13 | colnames(absorp)<-colName 14 | 15 | 16 | # splitting data into 80% and 20% based on Fat Response 17 | set.seed(12345) 18 | 19 | trainingRows = createDataPartition(endpoints[,2], p = .80, list= FALSE) 20 | 21 | trainAbsorption <- absorp[ trainingRows, ] 22 | testAbsorption <- absorp[-trainingRows, ] 23 | trainFat <- endpoints[trainingRows, 2] 24 | testFat <- endpoints[-trainingRows, 2] 25 | 26 | ctrl <- trainControl(method = "repeatedcv", repeats=4) 27 | 28 | # # For neuralnetwork, find the correlation and delete the correlated data 29 | tooHigh <- findCorrelation(cor(trainAbsorption), cutoff = .80) 30 | 31 | # the tooHigh gives 99 correlated datas 32 | trainXnnet1 = trainAbsorption[,-tooHigh] 33 | testXnnet1 = testAbsorption[,-tooHigh] 34 | 35 | set.seed(12344) 36 | 37 | library(nnet) 38 | library(caret) 39 | 40 | # without using PCA 41 | # to train in parallel to 5 processor 42 | cl <- makePSOCKcluster(5) 43 | registerDoParallel(cl) 44 | 45 | nnetGrid1 <- expand.grid(.decay = c(0, 0.01, .1), 46 | .size = c(1:10), 47 | ## The next option is to use bagging (see the 48 | ## next chapter) instead of different random 49 | ## seeds. 50 | .bag = FALSE) 51 | 52 | nnetTune1 <- train(trainAbsorption, trainFat, 53 | method = "avNNet", 54 | trControl = ctrl, 55 | preProc = c("center", "scale"), 56 | linout = TRUE, 57 | trace = FALSE, 58 | MaxNWts = 10 * (ncol(trainAbsorption) + 1) + 10 + 1, 59 | maxit = 500, 60 | tuneGrid = nnetGrid1) 61 | 62 | prediction<-predict(nnetTune1,testAbsorption) 63 | accuracy<-data.frame(obs=testFat,pred=prediction) 64 | defaultSummary(accuracy) 65 | plot(accuracy) 66 | ## When you are done: 67 | stopCluster(cl) 68 | 69 | # using PCA 70 | # to train in parallel to 5 processor 71 | cl <- makePSOCKcluster(5) 72 | registerDoParallel(cl) 73 | 74 | nnetGrid1 <- expand.grid(.decay = c(0, 0.01, .1), 75 | .size = c(1:10), 76 | ## The next option is to use bagging (see the 77 | ## next chapter) instead of different random 78 | ## seeds. 79 | .bag = FALSE) 80 | 81 | nnetTune2 <- train(trainAbsorption, trainFat, 82 | method = "avNNet", 83 | trControl = ctrl, 84 | preProc = c("center", "scale","pca"), 85 | linout = TRUE, 86 | trace = FALSE, 87 | MaxNWts = 10 * (ncol(trainAbsorption) + 1) + 10 + 1, 88 | maxit = 500, 89 | tuneGrid = nnetGrid1) 90 | 91 | prediction<-predict(nnetTune2,testAbsorption) 92 | accuracy<-data.frame(obs=testFat,pred=prediction[-41]) 93 | defaultSummary(accuracy) 94 | plot(accuracy) 95 | ## When you are done: 96 | stopCluster(cl) 97 | 98 | 99 | 100 | # # For MARS, using resampling method to tune the model Selection Using GCV 101 | set.seed(12345) 102 | marsFit <- earth(trainAbsorption,trainFat) 103 | summary(marsFit) 104 | # 105 | set.seed(12345) 106 | marsGrid <- expand.grid(.degree = 1:2, .nprune = 2:18) 107 | marsTuned <- train(trainAbsorption, trainFat, method="earth", 108 | tuneGrid = marsGrid, 109 | trControl = ctrl) 110 | 111 | prediction<-predict(marsTuned,testAbsorption) 112 | accuracy<-data.frame(obs=testFat,pred=prediction[,1]) 113 | defaultSummary(accuracy) 114 | plot(accuracy) 115 | # 116 | 117 | # # For SVM, using radial function is automatic and if the data are linear in regression should use 118 | # linear svm, otherwise radial SVM is good 119 | set.seed(12345) 120 | svmRTuned <- train(trainAbsorption, trainFat, method="svmRadial", 121 | tuneLength = 14, 122 | preProc = c("center", "scale"), 123 | trControl = ctrl) 124 | # 125 | prediction<-predict(svmRTuned,testAbsorption) 126 | accuracy<-data.frame(obs=testFat,pred=prediction) 127 | defaultSummary(accuracy) 128 | plot(accuracy) 129 | 130 | 131 | # # For KNN, remove the near-zero-variance predictors 132 | # # And, do the centering and scaling 133 | knnDescr <- trainAbsorption[ ,-nearZeroVar(trainAbsorption)] 134 | set.seed(12345) 135 | knnTune <- train(trainAbsorption,trainFat, 136 | method="knn", 137 | preProc = c("center","scale"), 138 | tuneGrid = data.frame(k=1:20), 139 | trControl = ctrl) 140 | # 141 | prediction<-predict(knnTune,testAbsorption) 142 | accuracy<-data.frame(obs=testFat,pred=prediction) 143 | defaultSummary(accuracy) 144 | plot(accuracy) 145 | 146 | -------------------------------------------------------------------------------- /Chapter 07/Question 7.4/7-4.r: -------------------------------------------------------------------------------- 1 | library(AppliedPredictiveModeling) 2 | library(mlbench) 3 | library(caret) 4 | library(earth) 5 | library(MASS) 6 | library(elasticnet) 7 | library(lars) 8 | library(pls) 9 | library(doParallel) 10 | library(nnet) 11 | 12 | data(permeability) 13 | 14 | 15 | cat("After Non-Zero Variance, number of predictors in fingerprints is 388: \n") 16 | NZVfingerprints <- nearZeroVar(fingerprints) 17 | noNZVfingerprints <- fingerprints[,-NZVfingerprints] 18 | print(str(noNZVfingerprints)) 19 | cat("\n\n") 20 | 21 | # stratified random sample splitting with 75% training and 25% testing 22 | 23 | set.seed(12345) 24 | trainingRows = createDataPartition(permeability, p = .75, list= FALSE) 25 | trainFingerprints <- noNZVfingerprints[trainingRows,] 26 | trainPermeability <- permeability[trainingRows,] 27 | 28 | testFingerprints <- noNZVfingerprints[-trainingRows,] 29 | testPermeability <- permeability[-trainingRows,] 30 | 31 | set.seed(12345) 32 | 33 | ctrl <- trainControl(method = "repeatedcv", repeats=5, number = 4) 34 | 35 | 36 | # # For neuralnetwork, find the correlation and delete the correlated data 37 | tooHigh <- findCorrelation(cor(trainFingerprints), cutoff = .75) 38 | # 39 | # # the tooHigh gives 99 correlated datas 40 | trainXnnet = trainFingerprints[,-tooHigh] 41 | testXnnet = testFingerprints[,-tooHigh] 42 | # 43 | # set.seed(12344) 44 | 45 | nnetGrid <- expand.grid(.decay = c(0, 0.01, .1), 46 | .size = c(1:10), 47 | ## The next option is to use bagging (see the 48 | ## next chapter) instead of different random 49 | ## seeds. 50 | .bag = FALSE) 51 | 52 | 53 | nnetTune <- train(trainXnnet, trainFat, 54 | method = "avNNet", 55 | tuneGrid = nnetGrid, 56 | trControl = ctrl, 57 | ## Automatically standardize data prior to modeling 58 | ## and prediction 59 | preProc = c("center", "scale"), 60 | linout = TRUE, 61 | trace = FALSE, 62 | MaxNWts = 10 * (ncol(trainXnnet) + 1) + 10 + 1, 63 | maxit = 500) 64 | 65 | prediction<-predict(nnetTune,testXnnet) 66 | accuracy<-data.frame(obs=testPermeability,pred=prediction) 67 | defaultSummary(accuracy) 68 | plot(accuracy) 69 | 70 | 71 | # # For MARS, using resampling method to tune the model Selection Using GCV 72 | set.seed(12345) 73 | marsFit <- earth(trainFingerprints,trainPermeability) 74 | summary(marsFit) 75 | 76 | set.seed(12345) 77 | permeabilitymarsGrid <- expand.grid(degree = 1:2,nprune = 2:13) 78 | permeabilitymarsTuned <- train(trainFingerprints, trainPermeability, 79 | method="earth", 80 | tuneGrid = permeabilitymarsGrid, 81 | trControl = ctrl) 82 | # 83 | 84 | prediction<-predict(permeabilitymarsTuned,testFingerprints) 85 | accuracy<-data.frame(obs=testPermeability,pred=prediction[,1]) 86 | defaultSummary(accuracy) 87 | plot(accuracy) 88 | 89 | # 90 | 91 | # # For SVM, using radial function is automatic and if the data are linear in regression should use 92 | # linear svm, otherwise radial SVM is good 93 | set.seed(12345) 94 | permeabilitysvmRTuned <- train(trainFingerprints, trainPermeability, 95 | method="svmRadial", 96 | tuneLength = 14, 97 | preProc = c("center", "scale"), 98 | trControl = ctrl) 99 | # 100 | prediction<-predict(permeabilitysvmRTuned,testFingerprints) 101 | accuracy<-data.frame(obs=testPermeability,pred=prediction) 102 | defaultSummary(accuracy) 103 | plot(accuracy) 104 | 105 | 106 | # # For KNN, remove the near-zero-variance predictors 107 | # # And, do the centering and scaling 108 | permeabilityknnDescr <- trainFingerprints[ ,-nearZeroVar(trainFingerprints)] 109 | set.seed(12345) 110 | permeabilityknnTuned <- train(permeabilityknnDescr,trainPermeability, 111 | method="knn", 112 | preProc = c("center","scale"), 113 | tuneGrid = data.frame(k=1:20), 114 | trControl = ctrl) 115 | 116 | prediction<-predict(permeabilityknnTuned,testFingerprints) 117 | accuracy<-data.frame(obs=testPermeability,pred=prediction) 118 | defaultSummary(accuracy) 119 | plot(accuracy) 120 | -------------------------------------------------------------------------------- /Chapter 07/solutions/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/01.png -------------------------------------------------------------------------------- /Chapter 07/solutions/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/02.png -------------------------------------------------------------------------------- /Chapter 07/solutions/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/03.png -------------------------------------------------------------------------------- /Chapter 07/solutions/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/04.png -------------------------------------------------------------------------------- /Chapter 07/solutions/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/05.png -------------------------------------------------------------------------------- /Chapter 07/solutions/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/06.png -------------------------------------------------------------------------------- /Chapter 07/solutions/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/07.png -------------------------------------------------------------------------------- /Chapter 07/solutions/08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/08.png -------------------------------------------------------------------------------- /Chapter 07/solutions/09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/09.png -------------------------------------------------------------------------------- /Chapter 07/solutions/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/10.png -------------------------------------------------------------------------------- /Chapter 07/solutions/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/11.png -------------------------------------------------------------------------------- /Chapter 07/solutions/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/12.png -------------------------------------------------------------------------------- /Chapter 07/solutions/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/13.png -------------------------------------------------------------------------------- /Chapter 07/solutions/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/14.png -------------------------------------------------------------------------------- /Chapter 07/solutions/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/15.png -------------------------------------------------------------------------------- /Chapter 07/solutions/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/16.png -------------------------------------------------------------------------------- /Chapter 07/solutions/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/17.png -------------------------------------------------------------------------------- /Chapter 07/solutions/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/18.png -------------------------------------------------------------------------------- /Chapter 07/solutions/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/19.png -------------------------------------------------------------------------------- /Chapter 07/solutions/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/20.png -------------------------------------------------------------------------------- /Chapter 07/solutions/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/21.png -------------------------------------------------------------------------------- /Chapter 07/solutions/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/22.png -------------------------------------------------------------------------------- /Chapter 07/solutions/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/23.png -------------------------------------------------------------------------------- /Chapter 07/solutions/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/24.png -------------------------------------------------------------------------------- /Chapter 07/solutions/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/25.png -------------------------------------------------------------------------------- /Chapter 07/solutions/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/26.png -------------------------------------------------------------------------------- /Chapter 07/solutions/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/27.png -------------------------------------------------------------------------------- /Chapter 07/solutions/28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/28.png -------------------------------------------------------------------------------- /Chapter 07/solutions/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/29.png -------------------------------------------------------------------------------- /Chapter 07/solutions/30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/30.png -------------------------------------------------------------------------------- /Chapter 07/solutions/31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/31.png -------------------------------------------------------------------------------- /Chapter 07/solutions/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/32.png -------------------------------------------------------------------------------- /Chapter 07/solutions/33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/33.png -------------------------------------------------------------------------------- /Chapter 07/solutions/34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/34.png -------------------------------------------------------------------------------- /Chapter 07/solutions/35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/35.png -------------------------------------------------------------------------------- /Chapter 07/solutions/36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/36.png -------------------------------------------------------------------------------- /Chapter 07/solutions/37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/37.png -------------------------------------------------------------------------------- /Chapter 07/solutions/38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/38.png -------------------------------------------------------------------------------- /Chapter 07/solutions/39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/39.png -------------------------------------------------------------------------------- /Chapter 07/solutions/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/40.png -------------------------------------------------------------------------------- /Chapter 07/solutions/41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/41.png -------------------------------------------------------------------------------- /Chapter 07/solutions/42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/42.png -------------------------------------------------------------------------------- /Chapter 07/solutions/43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/43.png -------------------------------------------------------------------------------- /Chapter 07/solutions/44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/44.png -------------------------------------------------------------------------------- /Chapter 07/solutions/45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/45.png -------------------------------------------------------------------------------- /Chapter 07/solutions/46.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/46.png -------------------------------------------------------------------------------- /Chapter 07/solutions/47.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/47.png -------------------------------------------------------------------------------- /Chapter 07/solutions/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/48.png -------------------------------------------------------------------------------- /Chapter 07/solutions/49.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 07/solutions/49.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12-1-nsc-top-predictors-chem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12-1-nsc-top-predictors-chem.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12-1-penalized-LR-top-predictors-bio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12-1-penalized-LR-top-predictors-bio.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12-1-top-predictor-nsc-merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12-1-top-predictor-nsc-merged.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12-1-top-predictor-penalized-lR-merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12-1-top-predictor-penalized-lR-merged.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12-2-class-imbalance-result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12-2-class-imbalance-result.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-LDA-bio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-LDA-bio.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-LR-bio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-LR-bio.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-NSC-bio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-NSC-bio.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-PLS-DAbio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-PLS-DAbio.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-penalized-LDA-bio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-penalized-LDA-bio.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-penalized-LR-bio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-bio/12-1-confusion-matrix-penalized-LR-bio.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-LDA-chem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-LDA-chem.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-LR-chem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-LR-chem.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-NSC-chem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-NSC-chem.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-PLS-DA-chem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-PLS-DA-chem.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-penalized-LDA-chem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-penalized-LDA-chem.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-penalized-LR-chem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-chem/12-1-confusion-matrix-penalized-LR-chem.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-LDA-merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-LDA-merged.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-LR-merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-LR-merged.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-nsc-merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-nsc-merged.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-penalized-LDA-merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-penalized-LDA-merged.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-penalized-LR-merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-penalized-LR-merged.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-pls-da-merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.1-merged/12-1-confusion-matrix-pls-da-merged.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-LR-fattyAcid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-LR-fattyAcid.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-lda-fattyacids.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-lda-fattyacids.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-nsc-fattyacids.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-nsc-fattyacids.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-penalized-LDA-fattyacids.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-penalized-LDA-fattyacids.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-penalized-LR-fattyacids.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-penalized-LR-fattyacids.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-penalized-lda-fattyacids.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-penalized-lda-fattyacids.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-pls-fattyacids.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/12.2/12-2-confusion-matrix-pls-fattyacids.png -------------------------------------------------------------------------------- /Chapter 12/Output-Screenshot/class-imbalance-response.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/Output-Screenshot/class-imbalance-response.png -------------------------------------------------------------------------------- /Chapter 12/Question 12.1/12-1-bio.R: -------------------------------------------------------------------------------- 1 | library(caret) 2 | library(AppliedPredictiveModeling) 3 | 4 | data(hepatic) 5 | # use ?hepatic to see more details 6 | 7 | 8 | library(MASS) 9 | set.seed(975) 10 | 11 | barplot(table(injury),col=c("yellow","red","green"), main="Class Distribution") 12 | 13 | #------------------------------------------------------------------------ 14 | # Use the biological predictors: 15 | #------------------------------------------------------------------------ 16 | 17 | 18 | #this gives Z114 predictor has zero-variance 19 | nearZeroVar(bio) 20 | 21 | #remove the Z114 predictor and then find the correlation between the predictors 22 | noZVbio <- bio[,-114] 23 | 24 | #remove the correlation between the predictors 25 | highCorBio<-findCorrelation(cor(noZVbio),cutoff = .75) 26 | filteredCorBio <- noZVbio[,-highCorBio] 27 | 28 | 29 | 30 | # splitting data into 75% and 25% based on injury response 31 | set.seed(975) 32 | trainingRows = createDataPartition(injury, p = .75, list= FALSE) 33 | 34 | trainBio <- filteredCorBio[ trainingRows, ] 35 | testBio <- filteredCorBio[-trainingRows, ] 36 | 37 | 38 | trainInjury <- injury[trainingRows] 39 | testInjury <- injury[-trainingRows] 40 | 41 | 42 | ctrl <- trainControl(summaryFunction = defaultSummary) 43 | 44 | ############ Logistic Regression Analysis ############# 45 | # logistic regression 46 | 47 | library(caret) 48 | set.seed(975) 49 | lrBio <- train(x=trainBio, 50 | y = trainInjury, 51 | method = "multinom", 52 | metric = "Accuracy", 53 | trControl = ctrl) 54 | 55 | 56 | predictionLRBio<-predict(lrBio,testBio) 57 | 58 | confusionMatrix(data =predictionLRBio, 59 | reference = testInjury) 60 | 61 | ####################################################### 62 | ############ Linear Discriminant Analysis ############# 63 | 64 | # LDA Analysis 65 | library(MASS) 66 | set.seed(975) 67 | 68 | 69 | ldaBio <- train(x = trainBio, 70 | y = trainInjury, 71 | method = "lda", 72 | metric = "Accuracy", 73 | trControl = ctrl) 74 | 75 | predictionLDABio <- predict(ldaBio,testBio) 76 | confusionMatrix(data =predictionLDABio, 77 | reference = testInjury) 78 | ########################################################################## 79 | 80 | ############## Partial Least Squares Discriminant Analysis ############### 81 | library(MASS) 82 | set.seed(975) 83 | plsBio <- train(x = trainBio, 84 | y = trainInjury, 85 | method = "pls", 86 | tuneGrid = expand.grid(.ncomp = 1:1), 87 | # preProc = c("center","scale"), 88 | metric = "Accuracy", 89 | trControl = ctrl) 90 | 91 | predictionPLSBio <-predict(plsBio,testBio) 92 | confusionMatrix(data =predictionPLSBio, 93 | reference = testInjury) 94 | 95 | ####################################################### 96 | ########### Penalized Models ########### 97 | 98 | ########### Penalized Models for Logistic Regression ########### 99 | glmnGrid <- expand.grid(.alpha = c(0, .1, .2, .4), 100 | .lambda = seq(.01, .2, length = 10)) 101 | set.seed(975) 102 | 103 | glmnTunedLRBio <- train(x=trainBio, 104 | y =trainInjury, 105 | method = "glmnet", 106 | tuneGrid = glmnGrid, 107 | # preProc = c("center", "scale"), 108 | metric = "Accuracy", 109 | trControl = ctrl) 110 | 111 | predictionGlmnetBio <- predict(glmnTunedLRBio,testBio) 112 | confusionMatrix(data =predictionGlmnetBio, 113 | reference = testInjury) 114 | 115 | 116 | ########### Penalized Models for LDA ########### 117 | library(sparseLDA) 118 | set.seed(975) 119 | sparseLdaModelBio <- sda(x=trainBio, 120 | y =trainInjury, 121 | lambda = 0.01, 122 | stop = -146) 123 | ## the ridge parameter called lambda. 124 | 125 | predictionSparseLDABio <- predict(sparseLdaModelBio,testBio) 126 | confusionMatrix(data =predictionSparseLDABio$class, 127 | reference = testInjury) 128 | 129 | 130 | 131 | ####################################################### 132 | ########### Nearest Shrunken Centroids ########### 133 | 134 | library(pamr) 135 | nscGridBio <- data.frame(.threshold = seq(0,4, by=0.1)) 136 | set.seed(476) 137 | nscTunedBio <- train(x = trainBio, 138 | y = trainInjury, 139 | method = "pam", 140 | # preProc = c("center", "scale"), 141 | tuneGrid = nscGridBio, 142 | metric = "Accuracy", 143 | trControl = ctrl) 144 | 145 | predictionNSCBio <-predict(nscTunedBio,testBio) 146 | confusionMatrix(data =predictionNSCBio, 147 | reference = testInjury) 148 | 149 | -------------------------------------------------------------------------------- /Chapter 12/Question 12.1/12-1-chem.R: -------------------------------------------------------------------------------- 1 | library(caret) 2 | library(AppliedPredictiveModeling) 3 | 4 | data(hepatic) 5 | # use ?hepatic to see more details 6 | 7 | 8 | library(MASS) 9 | set.seed(975) 10 | 11 | barplot(table(injury),col=c("yellow","red","green"), main="Class Distribution") 12 | 13 | 14 | set.seed(975) 15 | 16 | #------------------------------------------------------------------------ 17 | # Use the Chemical predictors: 18 | #------------------------------------------------------------------------ 19 | 20 | 21 | # this gives removes near-zero variance 22 | # this is a categorical predictor and should remove near zero variance for this data 23 | zv_cols = nearZeroVar(chem) 24 | noZVChem = chem[,-zv_cols] 25 | 26 | 27 | #remove the correlation between the predictors 28 | highCorChem<-findCorrelation(cor(noZVChem),cutoff = .75) 29 | filteredCorChem <- noZVChem[,-highCorChem] 30 | 31 | 32 | 33 | # splitting data into 75% and 25% based on injury response 34 | set.seed(975) 35 | trainingRows = createDataPartition(injury, p = .75, list= FALSE) 36 | 37 | trainChem <- filteredCorChem[trainingRows,] 38 | testChem <- filteredCorChem[-trainingRows, ] 39 | 40 | trainInjury <- injury[trainingRows] 41 | testInjury <- injury[-trainingRows] 42 | 43 | 44 | ctrl <- trainControl(summaryFunction = defaultSummary) 45 | 46 | ############ Logistic Regression Analysis ############# 47 | # logistic regression 48 | 49 | library(caret) 50 | set.seed(975) 51 | lrChem <- train(x=trainChem, 52 | y = trainInjury, 53 | method = "multinom", 54 | metric = "Accuracy", 55 | trControl = ctrl) 56 | 57 | 58 | predictionLRChem<-predict(lrChem,testChem) 59 | 60 | confusionMatrix(data =predictionLRChem, 61 | reference = testInjury) 62 | 63 | ####################################################### 64 | ############ Linear Discriminant Analysis ############# 65 | 66 | # LDA Analysis 67 | library(MASS) 68 | set.seed(975) 69 | 70 | ldaChem <- train(x = trainChem, 71 | y = trainInjury, 72 | method = "lda", 73 | preProc = c("center","scale"), 74 | metric = "Accuracy", 75 | trControl = ctrl) 76 | 77 | predictionLDAChem <-predict(ldaChem,testChem) 78 | confusionMatrix(data =predictionLDAChem, 79 | reference = testInjury) 80 | ########################################################################## 81 | 82 | ############## Partial Least Squares Discriminant Analysis ############### 83 | library(MASS) 84 | set.seed(975) 85 | plsChem <- train(x = trainChem, 86 | y = trainInjury, 87 | method = "pls", 88 | tuneGrid = expand.grid(.ncomp = 1:1), 89 | preProc = c("center","scale"), 90 | metric = "Accuracy", 91 | trControl = ctrl) 92 | 93 | predictionPLSChem <-predict(plsChem,testChem) 94 | confusionMatrix(data =predictionPLSChem, 95 | reference = testInjury) 96 | 97 | ####################################################### 98 | ########### Penalized Models ########### 99 | 100 | ########### Penalized Models for Logistic Regression ########### 101 | 102 | glmnGrid <- expand.grid(.alpha = c(0, .1, .2, .4), 103 | .lambda = seq(.01, .2, length = 10)) 104 | set.seed(975) 105 | glmnTunedChem <- train(x=trainChem, 106 | y =trainInjury, 107 | method = "glmnet", 108 | tuneGrid = glmnGrid, 109 | preProc = c("center", "scale"), 110 | metric = "Accuracy", 111 | trControl = ctrl) 112 | 113 | predictionGlmnetChem <- predict(glmnTunedChem,testChem) 114 | confusionMatrix(data =predictionGlmnetChem, 115 | reference = testInjury) 116 | 117 | 118 | ########### Penalized Models for LDA ########### 119 | library(sparseLDA) 120 | set.seed(975) 121 | sparseLdaModelChem <- sda(x=trainChem, 122 | y =trainInjury, 123 | lambda = 0.01, 124 | stop = -73) 125 | ## the ridge parameter called lambda. 126 | 127 | predictionSparseLDAChem <- predict(sparseLdaModelChem,testChem) 128 | confusionMatrix(data = predictionSparseLDAChem$class, 129 | reference = testInjury) 130 | 131 | ####################################################### 132 | ########### Nearest Shrunken Centroids ########### 133 | 134 | library(pamr) 135 | 136 | nscGridChem <- data.frame(.threshold = seq(0,4, by=0.1)) 137 | set.seed(975) 138 | nscTunedChem <- train(x = trainChem, 139 | y = trainInjury, 140 | method = "pam", 141 | preProc = c("center", "scale"), 142 | tuneGrid = nscGridBio, 143 | metric = "Accuracy", 144 | trControl = ctrl) 145 | 146 | predictionNSCChem <-predict(nscTunedChem,testChem) 147 | confusionMatrix(data =predictionNSCChem, 148 | reference = testInjury) 149 | 150 | -------------------------------------------------------------------------------- /Chapter 12/Question 12.1/12-1-comb.R: -------------------------------------------------------------------------------- 1 | library(caret) 2 | library(AppliedPredictiveModeling) 3 | 4 | data(hepatic) 5 | # use ?hepatic to see more details 6 | 7 | 8 | library(MASS) 9 | set.seed(975) 10 | 11 | #this gives Z114 predictor has zero-variance 12 | nearZeroVar(bio) 13 | 14 | #remove the Z114 predictor and then find the correlation between the predictors 15 | noZVbio <- bio[,-114] 16 | 17 | #remove the correlation between the predictors 18 | highCorBio<-findCorrelation(cor(noZVbio),cutoff = .75) 19 | filteredCorBio <- noZVbio[,-highCorBio] 20 | 21 | 22 | # this gives removes near-zero variance 23 | # this is a categorical predictor and should remove near zero variance for this data 24 | zv_cols = nearZeroVar(chem) 25 | noZVChem = chem[,-zv_cols] 26 | 27 | 28 | #remove the correlation between the predictors 29 | highCorChem<-findCorrelation(cor(noZVChem),cutoff = .75) 30 | filteredCorChem <- noZVChem[,-highCorChem] 31 | 32 | mergedPredictor <-data.frame(filteredCorBio,filteredCorChem) 33 | 34 | # splitting data into 75% and 25% based on injury response 35 | set.seed(975) 36 | trainingRows = createDataPartition(injury, p = .75, list= FALSE) 37 | 38 | trainmergedPredictor <- mergedPredictor[trainingRows,] 39 | testmergedPredictor <- mergedPredictor[-trainingRows, ] 40 | 41 | trainInjury <- injury[trainingRows] 42 | testInjury <- injury[-trainingRows] 43 | 44 | 45 | ctrl <- trainControl(summaryFunction = defaultSummary) 46 | 47 | ############ Logistic Regression Analysis ############# 48 | # logistic regression 49 | 50 | library(caret) 51 | set.seed(975) 52 | lrmergedPredictor <- train(x=trainmergedPredictor, 53 | y = trainInjury, 54 | method = "multinom", 55 | metric = "Accuracy", 56 | trControl = ctrl) 57 | 58 | 59 | predictionLRmergedPredictor<-predict(lrmergedPredictor,testmergedPredictor) 60 | 61 | confusionMatrix(data =predictionLRmergedPredictor, 62 | reference = testInjury) 63 | 64 | ####################################################### 65 | ############ Linear Discriminant Analysis ############# 66 | 67 | # LDA Analysis 68 | library(MASS) 69 | set.seed(975) 70 | 71 | ldamergedPredictor <- train(x = trainmergedPredictor, 72 | y = trainInjury, 73 | method = "lda", 74 | # preProc = c("center","scale"), 75 | metric = "Accuracy", 76 | trControl = ctrl) 77 | 78 | predictionLDAmergedPredictor <-predict(ldamergedPredictor,testmergedPredictor) 79 | confusionMatrix(data =predictionLDAmergedPredictor, 80 | reference = testInjury) 81 | ########################################################################## 82 | 83 | ############## Partial Least Squares Discriminant Analysis ############### 84 | library(MASS) 85 | set.seed(975) 86 | plsmergedPredictor <- train(x = trainmergedPredictor, 87 | y = trainInjury, 88 | method = "pls", 89 | tuneGrid = expand.grid(.ncomp = 1:4), 90 | # preProc = c("center","scale"), 91 | metric = "Accuracy", 92 | trControl = ctrl) 93 | 94 | predictionPLSmergedPredictor <-predict(plsmergedPredictor,testmergedPredictor) 95 | confusionMatrix(data =predictionPLSmergedPredictor, 96 | reference = testInjury) 97 | 98 | ####################################################### 99 | ########### Penalized Models ########### 100 | 101 | ########### Penalized Models for Logistic Regression ########### 102 | 103 | glmnGrid <- expand.grid(.alpha = c(0, .1, .2, .4), 104 | .lambda = seq(.01, .2, length = 10)) 105 | set.seed(975) 106 | glmnTunedmergedPredictor <- train(x=trainmergedPredictor, 107 | y =trainInjury, 108 | method = "glmnet", 109 | tuneGrid = glmnGrid, 110 | # preProc = c("center", "scale"), 111 | metric = "Accuracy", 112 | trControl = ctrl) 113 | 114 | predictionGlmnetmergedPredictor <- predict(glmnTunedmergedPredictor,testmergedPredictor) 115 | confusionMatrix(data =predictionGlmnetmergedPredictor, 116 | reference = testInjury) 117 | 118 | 119 | ########### Penalized Models for LDA ########### 120 | library(sparseLDA) 121 | set.seed(975) 122 | sparseLdaModelmergedPredictor <- sda(x=trainmergedPredictor, 123 | y =trainInjury, 124 | lambda = 0.01, 125 | stop = -73) 126 | ## the ridge parameter called lambda. 127 | 128 | predictionSparseLDAmergedPredictor <- predict(sparseLdaModelmergedPredictor,testmergedPredictor) 129 | confusionMatrix(data = predictionSparseLDAmergedPredictor$class, 130 | reference = testInjury) 131 | 132 | ####################################################### 133 | ########### Nearest Shrunken Centroids ########### 134 | 135 | library(pamr) 136 | 137 | nscGridmergedPredictor <- data.frame(.threshold = seq(0,4, by=0.1)) 138 | set.seed(975) 139 | nscTunedmergedPredictor <- train(x = trainmergedPredictor, 140 | y = trainInjury, 141 | method = "pam", 142 | # preProc = c("center", "scale"), 143 | tuneGrid = nscGridmergedPredictor, 144 | metric = "Accuracy", 145 | trControl = ctrl) 146 | 147 | predictionNSCmergedPredictor <-predict(nscTunedmergedPredictor,testmergedPredictor) 148 | confusionMatrix(data =predictionNSCmergedPredictor, 149 | reference = testInjury) 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /Chapter 12/Question 12.2/12-2.r: -------------------------------------------------------------------------------- 1 | library(caret) 2 | library(AppliedPredictiveModeling) 3 | 4 | data(oil) 5 | # use ?hepatic to see more details 6 | 7 | 8 | library(MASS) 9 | set.seed(975) 10 | 11 | barplot(table(oilType),col=c("yellow"), main="Class Distribution") 12 | 13 | 14 | 15 | #this gives 0 predictor with zero-variance 16 | nearZeroVar(fattyAcids,saveMetrics =TRUE) 17 | 18 | #remove the correlation between the predictors 19 | highCorM<-findCorrelation(cor(fattyAcids),cutoff = .75) 20 | filteredCorFatty <- fattyAcids[,-highCorM] 21 | 22 | # after removing the highly correlated predictor, we split the data using 23 | # stratified random sampling 24 | 25 | # splitting data into 80% and 20% based on oilType response 26 | 27 | set.seed(975) 28 | trainingRows = createDataPartition(oilType, p = .80, list= FALSE) 29 | 30 | trainFattyAcids <- filteredCorFatty[ trainingRows, ] 31 | testFattyAcids <- filteredCorFatty[-trainingRows, ] 32 | 33 | trainOilType <- oilType[trainingRows] 34 | testOilType <- oilType[-trainingRows] 35 | 36 | ctrl <- trainControl(summaryFunction = defaultSummary) 37 | 38 | ############ Logistic Regression Analysis ############# 39 | # logistic regression 40 | 41 | library(caret) 42 | set.seed(975) 43 | lrFattyAcids <- train(x=trainFattyAcids, 44 | y = trainOilType, 45 | method = "multinom", 46 | metric = "Accuracy", 47 | trControl = ctrl) 48 | 49 | 50 | predictionLRFattyAcids<-predict(lrFattyAcids,testFattyAcids) 51 | 52 | confusionMatrix(data =predictionLRFattyAcids, 53 | reference = testOilType) 54 | 55 | ####################################################### 56 | ############ Linear Discriminant Analysis ############# 57 | 58 | # LDA Analysis 59 | library(MASS) 60 | set.seed(975) 61 | 62 | 63 | ldaFattyAcids <- train(x = trainFattyAcids, 64 | y = trainOilType, 65 | method = "lda", 66 | metric = "Accuracy", 67 | trControl = ctrl) 68 | 69 | predictionLDAFattyAcids <-predict(ldaFattyAcids,testFattyAcids) 70 | confusionMatrix(data =predictionLDAFattyAcids, 71 | reference = testOilType) 72 | ########################################################################## 73 | 74 | ############## Partial Least Squares Discriminant Analysis ############### 75 | library(MASS) 76 | set.seed(975) 77 | plsFattyAcids <- train(x = trainFattyAcids, 78 | y = trainOilType, 79 | method = "pls", 80 | tuneGrid = expand.grid(.ncomp = 1:4), 81 | # preProc = c("center","scale"), 82 | metric = "Accuracy", 83 | trControl = ctrl) 84 | 85 | predictionPLSFattyAcids <-predict(plsFattyAcids,testFattyAcids) 86 | confusionMatrix(data =predictionPLSFattyAcids, 87 | reference = testOilType) 88 | 89 | ####################################################### 90 | ########### Penalized Models ########### 91 | 92 | ########### Penalized Models for Logistic Regression ########### 93 | # glmnGrid <- expand.grid(.alpha = c(0, .1, .2, .4), 94 | # .lambda = seq(.01, .2, length = 10)) 95 | glmnGrid <- expand.grid(.alpha = c(0, .1, .2, .4, .6, .8, 1), 96 | .lambda = seq(.01, .2, length = 10)) 97 | set.seed(476) 98 | 99 | glmnTunedLRFattyAcids<- train(x=trainFattyAcids, 100 | y =trainOilType, 101 | method = "glmnet", 102 | tuneGrid = glmnGrid, 103 | # preProc = c("center", "scale"), 104 | metric = "Accuracy", 105 | trControl = ctrl) 106 | 107 | predictionGlmnetFattyAcids <- predict(glmnTunedLRFattyAcids,testFattyAcids) 108 | confusionMatrix(data =predictionGlmnetFattyAcids, 109 | reference = testOilType) 110 | 111 | 112 | ########### Penalized Models for LDA ########### 113 | library(sparseLDA) 114 | set.seed(975) 115 | sparseLdaModelFattyAcids <- sda(x=trainFattyAcids, 116 | y =trainOilType, 117 | lambda = 0.01, 118 | stop = -7) 119 | ## the ridge parameter called lambda. 120 | 121 | predictionSparseLDAFattyAcids <- predict(sparseLdaModelFattyAcids,testFattyAcids) 122 | confusionMatrix(data =predictionSparseLDAFattyAcids$class, 123 | reference = testOilType) 124 | 125 | 126 | 127 | ####################################################### 128 | ########### Nearest Shrunken Centroids ########### 129 | 130 | library(pamr) 131 | nscGridFattyAcids <- data.frame(.threshold = seq(0,4, by=0.1)) 132 | set.seed(975) 133 | nscTunedFattyAcids <- train(x = trainFattyAcids, 134 | y = trainOilType, 135 | method = "pam", 136 | # preProc = c("center", "scale"), 137 | tuneGrid = nscGridFattyAcids, 138 | metric = "Accuracy", 139 | trControl = ctrl) 140 | 141 | predictionNSCFattyAcids <-predict(nscTunedFattyAcids,testFattyAcids) 142 | confusionMatrix(data =predictionNSCFattyAcids, 143 | reference = testOilType) 144 | 145 | -------------------------------------------------------------------------------- /Chapter 12/solutions/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/01.png -------------------------------------------------------------------------------- /Chapter 12/solutions/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/02.png -------------------------------------------------------------------------------- /Chapter 12/solutions/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/03.png -------------------------------------------------------------------------------- /Chapter 12/solutions/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/04.png -------------------------------------------------------------------------------- /Chapter 12/solutions/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/05.png -------------------------------------------------------------------------------- /Chapter 12/solutions/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/06.png -------------------------------------------------------------------------------- /Chapter 12/solutions/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/07.png -------------------------------------------------------------------------------- /Chapter 12/solutions/08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/08.png -------------------------------------------------------------------------------- /Chapter 12/solutions/09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/09.png -------------------------------------------------------------------------------- /Chapter 12/solutions/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/10.png -------------------------------------------------------------------------------- /Chapter 12/solutions/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/11.png -------------------------------------------------------------------------------- /Chapter 12/solutions/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/12.png -------------------------------------------------------------------------------- /Chapter 12/solutions/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/13.png -------------------------------------------------------------------------------- /Chapter 12/solutions/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/14.png -------------------------------------------------------------------------------- /Chapter 12/solutions/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/15.png -------------------------------------------------------------------------------- /Chapter 12/solutions/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/16.png -------------------------------------------------------------------------------- /Chapter 12/solutions/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/17.png -------------------------------------------------------------------------------- /Chapter 12/solutions/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/18.png -------------------------------------------------------------------------------- /Chapter 12/solutions/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/19.png -------------------------------------------------------------------------------- /Chapter 12/solutions/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/20.png -------------------------------------------------------------------------------- /Chapter 12/solutions/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/21.png -------------------------------------------------------------------------------- /Chapter 12/solutions/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/22.png -------------------------------------------------------------------------------- /Chapter 12/solutions/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/23.png -------------------------------------------------------------------------------- /Chapter 12/solutions/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/24.png -------------------------------------------------------------------------------- /Chapter 12/solutions/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/25.png -------------------------------------------------------------------------------- /Chapter 12/solutions/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/26.png -------------------------------------------------------------------------------- /Chapter 12/solutions/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/27.png -------------------------------------------------------------------------------- /Chapter 12/solutions/28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/28.png -------------------------------------------------------------------------------- /Chapter 12/solutions/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/29.png -------------------------------------------------------------------------------- /Chapter 12/solutions/30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/30.png -------------------------------------------------------------------------------- /Chapter 12/solutions/31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/31.png -------------------------------------------------------------------------------- /Chapter 12/solutions/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/32.png -------------------------------------------------------------------------------- /Chapter 12/solutions/33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/33.png -------------------------------------------------------------------------------- /Chapter 12/solutions/34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/34.png -------------------------------------------------------------------------------- /Chapter 12/solutions/35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/35.png -------------------------------------------------------------------------------- /Chapter 12/solutions/36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/36.png -------------------------------------------------------------------------------- /Chapter 12/solutions/37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/37.png -------------------------------------------------------------------------------- /Chapter 12/solutions/38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/38.png -------------------------------------------------------------------------------- /Chapter 12/solutions/39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/39.png -------------------------------------------------------------------------------- /Chapter 12/solutions/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/40.png -------------------------------------------------------------------------------- /Chapter 12/solutions/41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/41.png -------------------------------------------------------------------------------- /Chapter 12/solutions/42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/42.png -------------------------------------------------------------------------------- /Chapter 12/solutions/43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/43.png -------------------------------------------------------------------------------- /Chapter 12/solutions/44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/44.png -------------------------------------------------------------------------------- /Chapter 12/solutions/45.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 12/solutions/45.png -------------------------------------------------------------------------------- /Chapter 13/.Rhistory: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/.Rhistory -------------------------------------------------------------------------------- /Chapter 13/13-2.r: -------------------------------------------------------------------------------- 1 | library(caret) 2 | library(AppliedPredictiveModeling) 3 | 4 | data(oil) 5 | # use ?hepatic to see more details 6 | 7 | 8 | library(MASS) 9 | set.seed(975) 10 | 11 | barplot(table(oilType),col=c("yellow"), main="Class Distribution") 12 | 13 | #this gives 0 predictor with zero-variance 14 | nearZeroVar(fattyAcids,saveMetrics =TRUE) 15 | 16 | #remove the correlation between the predictors 17 | highCorM<-findCorrelation(cor(fattyAcids),cutoff = .75) 18 | filteredCorFatty <- fattyAcids[,-highCorM] 19 | 20 | ####### Nonlinear Discriminant Analysis ########## 21 | 22 | ctrl <- trainControl(summaryFunction = defaultSummary) 23 | set.seed(476) 24 | mdaFit <- train(x = filteredCorFatty, 25 | y = oilType, 26 | method = "mda", 27 | metric = "Accuracy", 28 | tuneGrid = expand.grid(.subclasses = 1:3), 29 | trControl = ctrl) 30 | mdaPrediction<-predict(mdaFit,filteredCorFatty) 31 | confusionMatrix(mdaPrediction,oilType) 32 | 33 | ############### Neural Networks ############# 34 | 35 | library(nnet) 36 | set.seed(476) 37 | nnetGrid <- expand.grid(.size = 1:10, .decay = c(0, .1, 1, 2)) 38 | 39 | maxSize <- max(nnetGrid$.size) 40 | 41 | numWts <- 1*(maxSize * (6 + 1) + maxSize + 1) ## 6 is the number of predictors 42 | 43 | nnetFit <- train(x = filteredCorFatty, 44 | y = oilType, 45 | method = "nnet", 46 | metric = "Accuracy", 47 | preProc = c("center", "scale", "spatialSign"), 48 | tuneGrid = nnetGrid, 49 | trace = FALSE, 50 | maxit = 2000, 51 | MaxNWts = numWts, 52 | trControl = ctrl) 53 | nnetFit 54 | 55 | ########## Flexible Discriminant Analysis ############ 56 | 57 | library(MASS) 58 | set.seed(476) 59 | marsGrid <- expand.grid(.degree = 1:2, .nprune = 2:38) 60 | fdaTuned <- train(x = filteredCorFatty, 61 | y = oilType, 62 | method = "fda", 63 | metric = "Accuracy", 64 | # Explicitly declare the candidate models to test 65 | tuneGrid = marsGrid, 66 | trControl = ctrl) 67 | 68 | fdaTuned 69 | 70 | 71 | ############## Support Vector Machines ########## 72 | 73 | library(MASS) 74 | set.seed(476) 75 | library(kernlab) 76 | library(caret) 77 | 78 | sigmaRangeReduced <- sigest(as.matrix(filteredCorFatty)) 79 | 80 | ## Given a range of values for the "sigma" inverse width parameter 81 | ## in the Gaussian Radial Basis kernel for use with SVM. 82 | ## The estimation is based on the data to be used. 83 | 84 | svmRGridReduced <- expand.grid(.sigma = sigmaRangeReduced[1], 85 | .C = 2^(seq(-4, 6))) 86 | set.seed(476) 87 | svmRModel <- train(x = filteredCorFatty, 88 | y = oilType, 89 | method = "svmRadial", 90 | metric = "Accuracy", 91 | preProc = c("center", "scale"), 92 | tuneGrid = svmRGridReduced, 93 | fit = FALSE, 94 | trControl = ctrl) 95 | svmRModel 96 | 97 | 98 | ############ K-Nearest Neighbors ############# 99 | library(caret) 100 | set.seed(476) 101 | knnFit <- train(x = filteredCorFatty, 102 | y = oilType, 103 | method = "knn", 104 | metric = "Accuracy", 105 | preProc = c("center", "scale"), 106 | ##tuneGrid = data.frame(.k = c(4*(0:5)+1, 20*(1:5)+1, 50*(2:9)+1)), ## 21 is the best 107 | tuneGrid = data.frame(.k = 1:50), 108 | trControl = ctrl) 109 | 110 | knnFit 111 | 112 | 113 | ########## Naive Bayes ########## 114 | library(klaR) 115 | set.seed(476) 116 | nbFit <- train( x = filteredCorFatty, 117 | y = oilType, 118 | method = "nb", 119 | metric = "Accuracy", 120 | ## preProc = c("center", "scale"), 121 | # tuneGrid = data.frame(.k = c(4*(0:5)+1, 20*(1:5)+1, 50*(2:9)+1)), ## 21 is the best 122 | tuneGrid = data.frame(.fL = 2,.usekernel = TRUE,.adjust = TRUE), 123 | trControl = ctrl) 124 | 125 | nbFit 126 | -------------------------------------------------------------------------------- /Chapter 13/solutions/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/01.png -------------------------------------------------------------------------------- /Chapter 13/solutions/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/02.png -------------------------------------------------------------------------------- /Chapter 13/solutions/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/03.png -------------------------------------------------------------------------------- /Chapter 13/solutions/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/04.png -------------------------------------------------------------------------------- /Chapter 13/solutions/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/05.png -------------------------------------------------------------------------------- /Chapter 13/solutions/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/06.png -------------------------------------------------------------------------------- /Chapter 13/solutions/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/07.png -------------------------------------------------------------------------------- /Chapter 13/solutions/08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/08.png -------------------------------------------------------------------------------- /Chapter 13/solutions/09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/09.png -------------------------------------------------------------------------------- /Chapter 13/solutions/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/10.png -------------------------------------------------------------------------------- /Chapter 13/solutions/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/11.png -------------------------------------------------------------------------------- /Chapter 13/solutions/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/12.png -------------------------------------------------------------------------------- /Chapter 13/solutions/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/13.png -------------------------------------------------------------------------------- /Chapter 13/solutions/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/14.png -------------------------------------------------------------------------------- /Chapter 13/solutions/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/15.png -------------------------------------------------------------------------------- /Chapter 13/solutions/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/16.png -------------------------------------------------------------------------------- /Chapter 13/solutions/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/17.png -------------------------------------------------------------------------------- /Chapter 13/solutions/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/18.png -------------------------------------------------------------------------------- /Chapter 13/solutions/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/19.png -------------------------------------------------------------------------------- /Chapter 13/solutions/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/20.png -------------------------------------------------------------------------------- /Chapter 13/solutions/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Chapter 13/solutions/21.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Applied Predictive Modeling 2 | This project is done to achieve good knowledge on predictive modeling. 3 | Once you go through the book and solve the questions, you will be able to tackle 4 | many complicated problems and can sharpen yourself towards data analysis. 5 | 6 | ## For various nature of data, some of open source data files are listed below: 7 | 1) https://archive.ics.uci.edu/ml/datasets.html 8 | 2) https://www.kaggle.com/ 9 | 10 | ## Question & Answers 11 | 1) Inside each `chapter` folder, there is `solutions` folder 12 | 2) Inside each solutions folder, there are both `solutions` and `R codes` 13 | 14 | Reference Book: 15 | 1) Kuhn, M., Johnson, K. (2013) Applied Predictive Modeling. NY: Springer 16 | -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/01.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/02.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/03.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/04.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/05.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/06.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/07.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/08.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/09.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/10.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/11.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/12.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/13.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/14.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/15.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/16.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/17.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/18.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/19.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/20.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/21.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/22.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/23.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/24.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/25.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/26.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/27.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/28.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/29.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/30.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/31.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/32.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/33.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/34.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/35.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/36.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/36.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/37.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/37.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/38.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/39.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/39.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/40.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/41.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/42.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/42.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/43.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/43.png -------------------------------------------------------------------------------- /Wine-Data-quality-anlaysis/presentation/44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/anilsilwal98/AppliedPredictiveModeling/a49d90f9a9533c84a5b1c99c321a037ffb2673a0/Wine-Data-quality-anlaysis/presentation/44.png --------------------------------------------------------------------------------