├── 1.LinearRegressionTillCloud ├── Admission_Prediction.csv ├── Advertising.csv ├── GradientDescent.gif ├── L1.PNG ├── Linear Regression.ipynb ├── LinearGraph.png ├── MLApplicationFlow.jpg ├── MLApplicationFlow_bold.png ├── MLApplicationFlow_col.png ├── PolynomialGraph.png ├── Position_Salaries.csv ├── Procfile ├── RSS.PNG ├── RSS_reg.PNG ├── RSquared.png ├── TSS.PNG ├── TSS2.PNG ├── TrainingPipeline.jpg ├── adjr.PNG ├── adjr2.PNG ├── app.yaml ├── cor.PNG ├── cre_pro.PNG ├── dashboard.PNG ├── elasticNet.PNG ├── fileForDoc.py ├── final_snap.PNG ├── finalized_model.pickle ├── flask_flow.PNG ├── folder_structure.PNG ├── generalEquation.PNG ├── iam.PNG ├── main.py ├── matrix1.PNG ├── minima.PNG ├── minima2.png ├── multicollinearity_flow.PNG ├── multicollinearity_pic.PNG ├── new_m.PNG ├── partialDerivatives.PNG ├── region_select.PNG ├── requirements.txt ├── residual.png ├── ridge.PNG ├── ridge_vs_lasso.PNG ├── select_project.PNG ├── setup.PNG ├── static │ └── css │ │ ├── main.css │ │ └── style.css ├── sumOfResiduals.PNG ├── templates │ ├── base.html │ ├── index.html │ └── results.html ├── testingPipeline.jpg ├── testing_pipeline.PNG └── tutorial.PNG ├── 12.SVM ├── Admission_Prediction.csv ├── FlaskApp.PNG ├── Kernels.png ├── ProjectStruct.PNG ├── SVM.docx ├── SVM_3D_Hyperplane.png ├── SVM_hyperplane.png ├── SVM_intution.png ├── SVR.png ├── SupportVectorMachines.ipynb ├── TEST.pickle ├── Untitled.ipynb ├── __pycache__ │ ├── clientApp.cpython-36.pyc │ └── clientApp.cpython-37.pyc ├── application.py ├── clientApp.py ├── createAPP.PNG ├── finalResult.PNG ├── finalized_model.pickle ├── hyperplane.png ├── red-wine-quality-cortez-et-al-2009.zip ├── requirements.txt ├── static │ └── css │ │ ├── main.css │ │ └── style.css ├── templates │ ├── base.html │ ├── index.html │ └── results.html ├── test1.joblib ├── test1.pickle ├── webApp.PNG ├── winequality-red.csv └── zipCreation.PNG ├── 2.Logistic-regression_final ├── AUC.PNG ├── Logistic Regression.ipynb ├── MLApplicationFlow_bold.png ├── Procfile ├── ROC.PNG ├── Social_Network_Ads.csv ├── app.py ├── cf1.PNG ├── cf2.PNG ├── confusionMatrix.PNG ├── derivative.PNG ├── diabetes.csv ├── gitignore ├── logisticRegression.PNG ├── logistic_deploy.py ├── logistic_function.PNG ├── logistic_regression.py ├── logit.PNG ├── manip1.PNG ├── modelForPrediction.sav ├── multi.PNG ├── old │ └── Logistic_Regression_Mohit.ipynb ├── prediction.PNG ├── projectStructure.PNG ├── requirements.txt ├── sandardScalar.sav ├── sigmoid.PNG ├── tandardScalar.sav ├── testing_pipeline.PNG └── tradeoff.PNG ├── 3.Decision tree ├── DecisionTree_DEPLOYMENT │ ├── Procfile │ ├── app.py │ ├── modelForPrediction.sav │ ├── pca_model.sav │ ├── requirements.txt │ └── standardScalar.sav ├── Decision_tree-deploy.png ├── Decision_tree.ipynb ├── Decision_tree1.png ├── MLApplicationFlow.png ├── Source.gv ├── app.py ├── class_distribution.csv ├── cv1.png ├── cv2.png ├── cv3.png ├── cv4.png ├── data_class.PNG ├── entropy.png ├── entropy1.png ├── entropy_tree.png ├── example │ ├── 1.png │ ├── 10.1.PNG │ ├── 10.2.PNG │ ├── 11.PNG │ ├── 12.PNG │ ├── 13.PNG │ ├── 14.PNG │ ├── 15.PNG │ ├── 16.PNG │ ├── 2.png │ ├── 3.1.PNG │ ├── 3.PNG │ ├── 4.PNG │ ├── 5.PNG │ ├── 6.PNG │ ├── 7.PNG │ ├── 8.PNG │ ├── 9.PNG │ ├── entropyVsgini.PNG │ ├── formula_entropy.PNG │ ├── gini.PNG │ └── inform_gain.PNG ├── formula1.png ├── formula2.png ├── formula3.png ├── ginni.png ├── hypr_params.PNG ├── info_gain.png ├── modelForPrediction.sav ├── mytree.dot ├── mytree.png ├── pca_model.sav ├── standardScalar.sav ├── testing_pipeline.png ├── tree_example.png ├── tree_explain.PNG └── winequality_red.csv ├── 4.EnsembleLearning_And_RandomForest ├── 1.png ├── 2.png ├── 3.PNG ├── 6.PNG ├── 7.PNG ├── 8.png ├── Ensemble.png ├── EnsembleLearningAndRandomForest.ipynb ├── MLApplicationFlow.png ├── cv1.png ├── cv2.png ├── cv3.png ├── cv4.png ├── dep1.png ├── dep2.png ├── dep3.png ├── dep4.png ├── dep5.png ├── dep6.png ├── diabetes.csv └── modelForPrediction.sav ├── 5.KNN ├── 1.png ├── 10.png ├── 11.png ├── 12.png ├── 13.png ├── 14.png ├── 15.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png ├── 9.png ├── KNN_CrossValidation.ipynb ├── MLApplicationFlow.png ├── app.py ├── cv1.png ├── cv2.png ├── cv3.png ├── cv4.png ├── deploy │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ └── 6.png ├── diabetes.csv ├── kNN_deployment │ ├── app.py │ ├── diabetes.csv │ ├── knn.py │ ├── modelForPrediction.sav │ └── standardScalar.sav ├── modelForPrediction.sav ├── standardScalar.sav └── testing_pipeline.png ├── 6.1.Link For Boosting Class.txt ├── 6.Ensemble_boosting ├── 6.1.Link For Boosting Class.txt ├── Boosting.ipynb ├── MLApplicationFlow_bold.png ├── app.yaml ├── app_yaml.PNG ├── available_projects.PNG ├── average_residual_tree.PNG ├── ba1.PNG ├── boosting_basic.PNG ├── bw1.PNG ├── cp1.PNG ├── dashboard.PNG ├── disable.PNG ├── final.PNG ├── get_started.PNG ├── heart_disease.PNG ├── heart_disease.csv ├── hessian.PNG ├── main.py ├── manage_resources.PNG ├── normalized_wt.PNG ├── nsw1.PNG ├── pima-indians-diabetes.csv ├── project_structure.PNG ├── pseudo_residuals.PNG ├── pseudo_residuals1.png ├── region_selection.png ├── requirements.txt ├── residual_tree.PNG ├── residual_tree1.png ├── scaler_model.pickle ├── sw1.PNG ├── testing_pipeline.PNG ├── weights.csv ├── xgboost_model.pickle └── yes.PNG ├── 7.Clustering ├── Assignment │ └── clusteringAssignment.ipynb ├── Clustering.ipynb ├── Mall_Customers.csv ├── Untitled.ipynb ├── after_deployment.png ├── app.py ├── bad cluster.PNG ├── conf1.PNG ├── cred.PNG ├── elbow.PNG ├── final.PNG ├── final_ck.PNG ├── finalized_model.pickle ├── folder_structure.png ├── good_cluster.PNG ├── kudo.PNG ├── local_git.PNG ├── minimize_ck.PNG ├── non_overlapping.PNG ├── point_def.PNG ├── prec_recall1.PNG ├── prec_recall2.PNG ├── prob_conf.png ├── requirements.txt ├── sil.PNG ├── sil2.PNG ├── testing_pipeline.PNG ├── unsupervised_ApplicationFlow.png ├── wck_formula.PNG ├── web_app.PNG └── web_app2.PNG ├── 8.PCA ├── 8.1 PCA.txt ├── PCA.ipynb ├── PCA_intro.png ├── PCA_intro1.png ├── axis_rotate.PNG ├── best_fit.PNG ├── covariance.PNG ├── fig_code │ ├── ML_flow_chart.py │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-37.pyc │ │ ├── data.cpython-37.pyc │ │ ├── figures.cpython-37.pyc │ │ ├── helpers.cpython-37.pyc │ │ ├── linear_regression.cpython-37.pyc │ │ └── sgd_separator.cpython-37.pyc │ ├── data.py │ ├── figures.py │ ├── helpers.py │ ├── linear_regression.py │ ├── sgd_separator.py │ └── svm_gui.py ├── glass.data ├── glass.names ├── intro.png ├── move_average.PNG ├── points.PNG ├── projected_points.PNG ├── scree.PNG └── table.PNG ├── 9.Naive_Bayes ├── Assignment │ └── Naive_Bayes.ipynb ├── MLApplicationFlow.png ├── Naive Bayes.ipynb ├── __pycache__ │ └── nb_deploy.cpython-37.pyc ├── app_creation.PNG ├── application.py ├── aws_buildapp.PNG ├── diabetes.csv ├── fig1.PNG ├── fig2.PNG ├── fig3.PNG ├── fig4.PNG ├── final_result.PNG ├── for_deployment.zip ├── formula.PNG ├── modelForPrediction.sav ├── nb_deploy.py ├── project_structure.png ├── requirements.txt ├── standardScalar.sav ├── testing_pipeline.PNG └── zip.PNG ├── Hyperparameter Tunning.docx └── README.md /1.LinearRegressionTillCloud/Advertising.csv: -------------------------------------------------------------------------------- 1 | ,TV,radio,newspaper,sales 2 | 1,230.1,37.8,69.2,22.1 3 | 2,44.5,39.3,45.1,10.4 4 | 3,17.2,45.9,69.3,9.3 5 | 4,151.5,41.3,58.5,18.5 6 | 5,180.8,10.8,58.4,12.9 7 | 6,8.7,48.9,75,7.2 8 | 7,57.5,32.8,23.5,11.8 9 | 8,120.2,19.6,11.6,13.2 10 | 9,8.6,2.1,1,4.8 11 | 10,199.8,2.6,21.2,10.6 12 | 11,66.1,5.8,24.2,8.6 13 | 12,214.7,24,4,17.4 14 | 13,23.8,35.1,65.9,9.2 15 | 14,97.5,7.6,7.2,9.7 16 | 15,204.1,32.9,46,19 17 | 16,195.4,47.7,52.9,22.4 18 | 17,67.8,36.6,114,12.5 19 | 18,281.4,39.6,55.8,24.4 20 | 19,69.2,20.5,18.3,11.3 21 | 20,147.3,23.9,19.1,14.6 22 | 21,218.4,27.7,53.4,18 23 | 22,237.4,5.1,23.5,12.5 24 | 23,13.2,15.9,49.6,5.6 25 | 24,228.3,16.9,26.2,15.5 26 | 25,62.3,12.6,18.3,9.7 27 | 26,262.9,3.5,19.5,12 28 | 27,142.9,29.3,12.6,15 29 | 28,240.1,16.7,22.9,15.9 30 | 29,248.8,27.1,22.9,18.9 31 | 30,70.6,16,40.8,10.5 32 | 31,292.9,28.3,43.2,21.4 33 | 32,112.9,17.4,38.6,11.9 34 | 33,97.2,1.5,30,9.6 35 | 34,265.6,20,0.3,17.4 36 | 35,95.7,1.4,7.4,9.5 37 | 36,290.7,4.1,8.5,12.8 38 | 37,266.9,43.8,5,25.4 39 | 38,74.7,49.4,45.7,14.7 40 | 39,43.1,26.7,35.1,10.1 41 | 40,228,37.7,32,21.5 42 | 41,202.5,22.3,31.6,16.6 43 | 42,177,33.4,38.7,17.1 44 | 43,293.6,27.7,1.8,20.7 45 | 44,206.9,8.4,26.4,12.9 46 | 45,25.1,25.7,43.3,8.5 47 | 46,175.1,22.5,31.5,14.9 48 | 47,89.7,9.9,35.7,10.6 49 | 48,239.9,41.5,18.5,23.2 50 | 49,227.2,15.8,49.9,14.8 51 | 50,66.9,11.7,36.8,9.7 52 | 51,199.8,3.1,34.6,11.4 53 | 52,100.4,9.6,3.6,10.7 54 | 53,216.4,41.7,39.6,22.6 55 | 54,182.6,46.2,58.7,21.2 56 | 55,262.7,28.8,15.9,20.2 57 | 56,198.9,49.4,60,23.7 58 | 57,7.3,28.1,41.4,5.5 59 | 58,136.2,19.2,16.6,13.2 60 | 59,210.8,49.6,37.7,23.8 61 | 60,210.7,29.5,9.3,18.4 62 | 61,53.5,2,21.4,8.1 63 | 62,261.3,42.7,54.7,24.2 64 | 63,239.3,15.5,27.3,15.7 65 | 64,102.7,29.6,8.4,14 66 | 65,131.1,42.8,28.9,18 67 | 66,69,9.3,0.9,9.3 68 | 67,31.5,24.6,2.2,9.5 69 | 68,139.3,14.5,10.2,13.4 70 | 69,237.4,27.5,11,18.9 71 | 70,216.8,43.9,27.2,22.3 72 | 71,199.1,30.6,38.7,18.3 73 | 72,109.8,14.3,31.7,12.4 74 | 73,26.8,33,19.3,8.8 75 | 74,129.4,5.7,31.3,11 76 | 75,213.4,24.6,13.1,17 77 | 76,16.9,43.7,89.4,8.7 78 | 77,27.5,1.6,20.7,6.9 79 | 78,120.5,28.5,14.2,14.2 80 | 79,5.4,29.9,9.4,5.3 81 | 80,116,7.7,23.1,11 82 | 81,76.4,26.7,22.3,11.8 83 | 82,239.8,4.1,36.9,12.3 84 | 83,75.3,20.3,32.5,11.3 85 | 84,68.4,44.5,35.6,13.6 86 | 85,213.5,43,33.8,21.7 87 | 86,193.2,18.4,65.7,15.2 88 | 87,76.3,27.5,16,12 89 | 88,110.7,40.6,63.2,16 90 | 89,88.3,25.5,73.4,12.9 91 | 90,109.8,47.8,51.4,16.7 92 | 91,134.3,4.9,9.3,11.2 93 | 92,28.6,1.5,33,7.3 94 | 93,217.7,33.5,59,19.4 95 | 94,250.9,36.5,72.3,22.2 96 | 95,107.4,14,10.9,11.5 97 | 96,163.3,31.6,52.9,16.9 98 | 97,197.6,3.5,5.9,11.7 99 | 98,184.9,21,22,15.5 100 | 99,289.7,42.3,51.2,25.4 101 | 100,135.2,41.7,45.9,17.2 102 | 101,222.4,4.3,49.8,11.7 103 | 102,296.4,36.3,100.9,23.8 104 | 103,280.2,10.1,21.4,14.8 105 | 104,187.9,17.2,17.9,14.7 106 | 105,238.2,34.3,5.3,20.7 107 | 106,137.9,46.4,59,19.2 108 | 107,25,11,29.7,7.2 109 | 108,90.4,0.3,23.2,8.7 110 | 109,13.1,0.4,25.6,5.3 111 | 110,255.4,26.9,5.5,19.8 112 | 111,225.8,8.2,56.5,13.4 113 | 112,241.7,38,23.2,21.8 114 | 113,175.7,15.4,2.4,14.1 115 | 114,209.6,20.6,10.7,15.9 116 | 115,78.2,46.8,34.5,14.6 117 | 116,75.1,35,52.7,12.6 118 | 117,139.2,14.3,25.6,12.2 119 | 118,76.4,0.8,14.8,9.4 120 | 119,125.7,36.9,79.2,15.9 121 | 120,19.4,16,22.3,6.6 122 | 121,141.3,26.8,46.2,15.5 123 | 122,18.8,21.7,50.4,7 124 | 123,224,2.4,15.6,11.6 125 | 124,123.1,34.6,12.4,15.2 126 | 125,229.5,32.3,74.2,19.7 127 | 126,87.2,11.8,25.9,10.6 128 | 127,7.8,38.9,50.6,6.6 129 | 128,80.2,0,9.2,8.8 130 | 129,220.3,49,3.2,24.7 131 | 130,59.6,12,43.1,9.7 132 | 131,0.7,39.6,8.7,1.6 133 | 132,265.2,2.9,43,12.7 134 | 133,8.4,27.2,2.1,5.7 135 | 134,219.8,33.5,45.1,19.6 136 | 135,36.9,38.6,65.6,10.8 137 | 136,48.3,47,8.5,11.6 138 | 137,25.6,39,9.3,9.5 139 | 138,273.7,28.9,59.7,20.8 140 | 139,43,25.9,20.5,9.6 141 | 140,184.9,43.9,1.7,20.7 142 | 141,73.4,17,12.9,10.9 143 | 142,193.7,35.4,75.6,19.2 144 | 143,220.5,33.2,37.9,20.1 145 | 144,104.6,5.7,34.4,10.4 146 | 145,96.2,14.8,38.9,11.4 147 | 146,140.3,1.9,9,10.3 148 | 147,240.1,7.3,8.7,13.2 149 | 148,243.2,49,44.3,25.4 150 | 149,38,40.3,11.9,10.9 151 | 150,44.7,25.8,20.6,10.1 152 | 151,280.7,13.9,37,16.1 153 | 152,121,8.4,48.7,11.6 154 | 153,197.6,23.3,14.2,16.6 155 | 154,171.3,39.7,37.7,19 156 | 155,187.8,21.1,9.5,15.6 157 | 156,4.1,11.6,5.7,3.2 158 | 157,93.9,43.5,50.5,15.3 159 | 158,149.8,1.3,24.3,10.1 160 | 159,11.7,36.9,45.2,7.3 161 | 160,131.7,18.4,34.6,12.9 162 | 161,172.5,18.1,30.7,14.4 163 | 162,85.7,35.8,49.3,13.3 164 | 163,188.4,18.1,25.6,14.9 165 | 164,163.5,36.8,7.4,18 166 | 165,117.2,14.7,5.4,11.9 167 | 166,234.5,3.4,84.8,11.9 168 | 167,17.9,37.6,21.6,8 169 | 168,206.8,5.2,19.4,12.2 170 | 169,215.4,23.6,57.6,17.1 171 | 170,284.3,10.6,6.4,15 172 | 171,50,11.6,18.4,8.4 173 | 172,164.5,20.9,47.4,14.5 174 | 173,19.6,20.1,17,7.6 175 | 174,168.4,7.1,12.8,11.7 176 | 175,222.4,3.4,13.1,11.5 177 | 176,276.9,48.9,41.8,27 178 | 177,248.4,30.2,20.3,20.2 179 | 178,170.2,7.8,35.2,11.7 180 | 179,276.7,2.3,23.7,11.8 181 | 180,165.6,10,17.6,12.6 182 | 181,156.6,2.6,8.3,10.5 183 | 182,218.5,5.4,27.4,12.2 184 | 183,56.2,5.7,29.7,8.7 185 | 184,287.6,43,71.8,26.2 186 | 185,253.8,21.3,30,17.6 187 | 186,205,45.1,19.6,22.6 188 | 187,139.5,2.1,26.6,10.3 189 | 188,191.1,28.7,18.2,17.3 190 | 189,286,13.9,3.7,15.9 191 | 190,18.7,12.1,23.4,6.7 192 | 191,39.5,41.1,5.8,10.8 193 | 192,75.5,10.8,6,9.9 194 | 193,17.2,4.1,31.6,5.9 195 | 194,166.8,42,3.6,19.6 196 | 195,149.7,35.6,6,17.3 197 | 196,38.2,3.7,13.8,7.6 198 | 197,94.2,4.9,8.1,9.7 199 | 198,177,9.3,6.4,12.8 200 | 199,283.6,42,66.2,25.5 201 | 200,232.1,8.6,8.7,13.4 202 | -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/GradientDescent.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/GradientDescent.gif -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/L1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/L1.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/LinearGraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/LinearGraph.png -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/MLApplicationFlow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/MLApplicationFlow.jpg -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/MLApplicationFlow_bold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/MLApplicationFlow_bold.png -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/MLApplicationFlow_col.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/MLApplicationFlow_col.png -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/PolynomialGraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/PolynomialGraph.png -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/Position_Salaries.csv: -------------------------------------------------------------------------------- 1 | Position,Level,Salary 2 | Business Analyst,1,45000 3 | Junior Consultant,2,50000 4 | Senior Consultant,3,60000 5 | Manager,4,80000 6 | Country Manager,5,110000 7 | Region Manager,6,150000 8 | Partner,7,200000 9 | Senior Partner,8,300000 10 | C-level,9,500000 11 | CEO,10,1000000 -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn app:app -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/RSS.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/RSS.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/RSS_reg.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/RSS_reg.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/RSquared.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/RSquared.png -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/TSS.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/TSS.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/TSS2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/TSS2.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/TrainingPipeline.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/TrainingPipeline.jpg -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/adjr.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/adjr.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/adjr2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/adjr2.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/app.yaml: -------------------------------------------------------------------------------- 1 | runtime: python37 -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/cor.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/cor.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/cre_pro.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/cre_pro.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/dashboard.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/dashboard.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/elasticNet.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/elasticNet.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/fileForDoc.py: -------------------------------------------------------------------------------- 1 | # necessary Imports 2 | import pandas as pd 3 | import matplotlib.pyplot as plt 4 | import pickle 5 | % matpllotlib inline 6 | 7 | df= pd.read_csv('Admission_Prediction.csv') # reading the CSV file 8 | 9 | df.head() # cheking the first five rows from the dataset 10 | df.info() # printing the summary of the dataframe 11 | 12 | df['GRE Score'].fillna(df['GRE Score'].mode()[0],inplace=True) 13 | #to replace the missing values in the 'GRE Score' column with the mode of the column 14 | # Mode has been used here to replace the scores with the most occuring scores so that data follows the general trend 15 | 16 | df['TOEFL Score'].fillna(df['TOEFL Score'].mode()[0],inplace=True) 17 | #to replace the missing values in the 'GRE Score' column with the mode of the column 18 | # Mode has been used here to replace the scores with the most occuring scores so that data follows the general trend 19 | 20 | df['University Rating'].fillna(df['University Rating'].mean(),inplace=True) 21 | #to replace the missing values in the 'University Rating' column with the mode of the column 22 | # Mean has been used here to replace the scores with the average score 23 | 24 | # dropping the 'Chance of Admit' and 'serial number' as they are not going to be used as features for prediction 25 | x=df.drop(['Chance of Admit','Serial No.'],axis=1) 26 | # 'Chance of Admit' is the target column which shows the probability of admission for a candidate 27 | y=df['Chance of Admit'] 28 | 29 | 30 | plt.scatter(df['GRE Score'],y) # Relationship between GRE Score and Chance of Admission 31 | plt.scatter(df['TOEFL Score'],y) # Relationship between TOEFL Score and Chance of Admission 32 | plt.scatter(df['CGPA'],y) # Relationship between CGPA and Chance of Admission 33 | 34 | 35 | # splitting the data into training and testing sets 36 | from sklearn.model_selection import train_test_split 37 | train_x,test_x,train_y,test_y=train_test_split(x,y,test_size=0.33, random_state=100) 38 | 39 | # fitting the date to the Linear regression model 40 | from sklearn import linear_model 41 | reg = linear_model.LinearRegression() 42 | reg.fit(train_x, train_y) 43 | 44 | # calucltaing the accuracy of the model 45 | from sklearn.metrics import r2_score 46 | score= r2_score(reg.predict(test_x),test_y) 47 | 48 | # saving the model to the local file system 49 | filename = 'finalized_model.pickle' 50 | pickle.dump(reg, open(filename, 'wb')) 51 | 52 | # prediction using the saved model. 53 | loaded_model = pickle.load(open(filename, 'rb')) 54 | prediction=loaded_model.predict(([[320,120,5,5,5,10,1]])) 55 | print(prediction[0]) -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/final_snap.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/final_snap.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/finalized_model.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/finalized_model.pickle -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/flask_flow.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/flask_flow.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/folder_structure.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/folder_structure.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/generalEquation.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/generalEquation.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/iam.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/iam.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/main.py: -------------------------------------------------------------------------------- 1 | 2 | # importing the necessary dependencies 3 | from flask import Flask, render_template, request,jsonify 4 | from flask_cors import CORS,cross_origin 5 | import pickle 6 | 7 | app = Flask(__name__) # initializing a flask app 8 | 9 | @app.route('/',methods=['GET']) # route to display the home page 10 | @cross_origin() 11 | def homePage(): 12 | return render_template("index.html") 13 | 14 | @app.route('/predict',methods=['POST','GET']) # route to show the predictions in a web UI 15 | @cross_origin() 16 | def index(): 17 | if request.method == 'POST': 18 | try: 19 | # reading the inputs given by the user 20 | gre_score=float(request.form['gre_score']) 21 | toefl_score = float(request.form['toefl_score']) 22 | university_rating = float(request.form['university_rating']) 23 | sop = float(request.form['sop']) 24 | lor = float(request.form['lor']) 25 | cgpa = float(request.form['cgpa']) 26 | is_research = request.form['research'] 27 | if(is_research=='yes'): 28 | research=1 29 | else: 30 | research=0 31 | filename = 'finalized_model.pickle' 32 | loaded_model = pickle.load(open(filename, 'rb')) # loading the model file from the storage 33 | # predictions using the loaded model file 34 | prediction=loaded_model.predict([[gre_score,toefl_score,university_rating,sop,lor,cgpa,research]]) 35 | print('prediction is', prediction) 36 | # showing the prediction results in a UI 37 | return render_template('results.html',prediction=round(100*prediction[0])) 38 | except Exception as e: 39 | print('The Exception message is: ',e) 40 | return 'something is wrong' 41 | # return render_template('results.html') 42 | else: 43 | return render_template('index.html') 44 | 45 | 46 | 47 | if __name__ == "__main__": 48 | #app.run(host='127.0.0.1', port=8001, debug=True) 49 | app.run(debug=True) # running the app -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/matrix1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/matrix1.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/minima.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/minima.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/minima2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/minima2.png -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/multicollinearity_flow.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/multicollinearity_flow.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/multicollinearity_pic.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/multicollinearity_pic.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/new_m.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/new_m.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/partialDerivatives.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/partialDerivatives.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/region_select.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/region_select.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2019.11.28 2 | Click==7.0 3 | Flask==1.1.1 4 | Flask-Cors==3.0.8 5 | gunicorn==20.0.4 6 | itsdangerous==1.1.0 7 | Jinja2==2.10.3 8 | joblib==0.14.0 9 | MarkupSafe==1.1.1 10 | mkl-fft==1.0.15 11 | mkl-random==1.1.0 12 | mkl-service==2.3.0 13 | numpy==1.17.4 14 | scikit-learn==0.21.3 15 | scipy==1.3.2 16 | six==1.13.0 17 | Werkzeug==0.16.0 18 | wincertstore==0.2 19 | -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/residual.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/residual.png -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/ridge.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/ridge.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/ridge_vs_lasso.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/ridge_vs_lasso.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/select_project.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/select_project.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/setup.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/setup.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/static/css/main.css: -------------------------------------------------------------------------------- 1 | body, html { 2 | margin: 0; 3 | font-family: sans-serif; 4 | } 5 | 6 | .content { 7 | margin: 0 auto; 8 | width: 400px; 9 | } 10 | 11 | table, td, th { 12 | border: 1px solid #aaa; 13 | } 14 | 15 | table { 16 | border-collapse: collapse; 17 | width: 100%; 18 | } 19 | 20 | th { 21 | height: 30px; 22 | } 23 | 24 | td { 25 | text-align: center; 26 | padding: 5px; 27 | } 28 | 29 | .form { 30 | margin-top: 20px; 31 | } 32 | 33 | #content { 34 | width: 70%; 35 | } -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/static/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #91ced4; 3 | } 4 | body * { 5 | box-sizing: border-box; 6 | } 7 | 8 | .header { 9 | background-color: #327a81; 10 | color: white; 11 | font-size: 1.5em; 12 | padding: 1rem; 13 | text-align: center; 14 | text-transform: uppercase; 15 | } 16 | 17 | img { 18 | border-radius: 50%; 19 | height: 60px; 20 | width: 60px; 21 | } 22 | 23 | .table-users { 24 | border: 1px solid #327a81; 25 | border-radius: 10px; 26 | box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.1); 27 | max-width: calc(100% - 2em); 28 | margin: 1em auto; 29 | overflow: hidden; 30 | width: 800px; 31 | } 32 | 33 | table { 34 | width: 100%; 35 | } 36 | table td, table th { 37 | color: #2b686e; 38 | padding: 10px; 39 | } 40 | table td { 41 | text-align: center; 42 | vertical-align: middle; 43 | } 44 | table td:last-child { 45 | font-size: 0.95em; 46 | line-height: 1.4; 47 | text-align: left; 48 | } 49 | table th { 50 | background-color: #daeff1; 51 | font-weight: 300; 52 | } 53 | table tr:nth-child(2n) { 54 | background-color: white; 55 | } 56 | table tr:nth-child(2n+1) { 57 | background-color: #edf7f8; 58 | } 59 | 60 | @media screen and (max-width: 700px) { 61 | table, tr, td { 62 | display: block; 63 | } 64 | 65 | td:first-child { 66 | position: absolute; 67 | top: 50%; 68 | -webkit-transform: translateY(-50%); 69 | transform: translateY(-50%); 70 | width: 100px; 71 | } 72 | td:not(:first-child) { 73 | clear: both; 74 | margin-left: 100px; 75 | padding: 4px 20px 4px 90px; 76 | position: relative; 77 | text-align: left; 78 | } 79 | td:not(:first-child):before { 80 | color: #91ced4; 81 | content: ''; 82 | display: block; 83 | left: 0; 84 | position: absolute; 85 | } 86 | td:nth-child(2):before { 87 | content: 'Name:'; 88 | } 89 | td:nth-child(3):before { 90 | content: 'Email:'; 91 | } 92 | td:nth-child(4):before { 93 | content: 'Phone:'; 94 | } 95 | td:nth-child(5):before { 96 | content: 'Comments:'; 97 | } 98 | 99 | tr { 100 | padding: 10px 0; 101 | position: relative; 102 | } 103 | tr:first-child { 104 | display: none; 105 | } 106 | } 107 | @media screen and (max-width: 500px) { 108 | .header { 109 | background-color: transparent; 110 | color: white; 111 | font-size: 2em; 112 | font-weight: 700; 113 | padding: 0; 114 | text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1); 115 | } 116 | 117 | img { 118 | border: 3px solid; 119 | border-color: #daeff1; 120 | height: 100px; 121 | margin: 0.5rem 0; 122 | width: 100px; 123 | } 124 | 125 | td:first-child { 126 | background-color: #c8e7ea; 127 | border-bottom: 1px solid #91ced4; 128 | border-radius: 10px 10px 0 0; 129 | position: relative; 130 | top: 0; 131 | -webkit-transform: translateY(0); 132 | transform: translateY(0); 133 | width: 100%; 134 | } 135 | td:not(:first-child) { 136 | margin: 0; 137 | padding: 5px 1em; 138 | width: 100%; 139 | } 140 | td:not(:first-child):before { 141 | font-size: .8em; 142 | padding-top: 0.3em; 143 | position: relative; 144 | } 145 | td:last-child { 146 | padding-bottom: 1rem !important; 147 | } 148 | 149 | tr { 150 | background-color: white !important; 151 | border: 1px solid #6cbec6; 152 | border-radius: 10px; 153 | box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1); 154 | margin: 0.5rem 0; 155 | padding: 0; 156 | } 157 | 158 | .table-users { 159 | border: none; 160 | box-shadow: none; 161 | overflow: visible; 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/sumOfResiduals.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/sumOfResiduals.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {% block head %}{% endblock %} 9 | 10 | 11 | {% block body %}{% endblock %} 12 | 13 | -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block head %} 4 | 5 | Search Page 6 | 7 | {% endblock %} 8 | 9 | {% block body %} 10 |
11 |

Predict Your chances for Admission

12 | 13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 |
27 |
28 |
29 | {% endblock %} -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/templates/results.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Review Page 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
Prediction
21 | 22 |

Your chance for admission is {{prediction}} percent

23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/testingPipeline.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/testingPipeline.jpg -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/testing_pipeline.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/testing_pipeline.PNG -------------------------------------------------------------------------------- /1.LinearRegressionTillCloud/tutorial.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/1.LinearRegressionTillCloud/tutorial.PNG -------------------------------------------------------------------------------- /12.SVM/FlaskApp.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/FlaskApp.PNG -------------------------------------------------------------------------------- /12.SVM/Kernels.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/Kernels.png -------------------------------------------------------------------------------- /12.SVM/ProjectStruct.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/ProjectStruct.PNG -------------------------------------------------------------------------------- /12.SVM/SVM.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/SVM.docx -------------------------------------------------------------------------------- /12.SVM/SVM_3D_Hyperplane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/SVM_3D_Hyperplane.png -------------------------------------------------------------------------------- /12.SVM/SVM_hyperplane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/SVM_hyperplane.png -------------------------------------------------------------------------------- /12.SVM/SVM_intution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/SVM_intution.png -------------------------------------------------------------------------------- /12.SVM/SVR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/SVR.png -------------------------------------------------------------------------------- /12.SVM/TEST.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/TEST.pickle -------------------------------------------------------------------------------- /12.SVM/Untitled.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 2, 6 | "metadata": {}, 7 | "outputs": [ 8 | { 9 | "name": "stderr", 10 | "output_type": "stream", 11 | "text": [ 12 | "C:\\Users\\virat\\AppData\\Roaming\\Python\\Python37\\site-packages\\sklearn\\linear_model\\_logistic.py:939: ConvergenceWarning: lbfgs failed to converge (status=1):\n", 13 | "STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n", 14 | "\n", 15 | "Increase the number of iterations (max_iter) or scale the data as shown in:\n", 16 | " https://scikit-learn.org/stable/modules/preprocessing.html.\n", 17 | "Please also refer to the documentation for alternative solver options:\n", 18 | " https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n", 19 | " extra_warning_msg=_LOGISTIC_SOLVER_CONVERGENCE_MSG)\n" 20 | ] 21 | } 22 | ], 23 | "source": [ 24 | "from sklearn.datasets import load_iris\n", 25 | "from sklearn.linear_model import LogisticRegression\n", 26 | "X, y = load_iris(return_X_y=True)\n", 27 | "clf = LogisticRegression(random_state=0).fit(X, y)\n", 28 | "clf.predict(X[:2, :])\n", 29 | "proba=clf.predict_proba(X[:2, :])" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": 3, 35 | "metadata": {}, 36 | "outputs": [ 37 | { 38 | "data": { 39 | "text/plain": [ 40 | "array([[9.81797141e-01, 1.82028445e-02, 1.44269293e-08],\n", 41 | " [9.71725476e-01, 2.82744937e-02, 3.01659208e-08]])" 42 | ] 43 | }, 44 | "execution_count": 3, 45 | "metadata": {}, 46 | "output_type": "execute_result" 47 | } 48 | ], 49 | "source": [ 50 | "proba" 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": 4, 56 | "metadata": {}, 57 | "outputs": [ 58 | { 59 | "name": "stdout", 60 | "output_type": "stream", 61 | "text": [ 62 | "[[9.81797141e-01 1.82028445e-02 1.44269293e-08]\n", 63 | " [9.71725476e-01 2.82744937e-02 3.01659208e-08]]\n" 64 | ] 65 | } 66 | ], 67 | "source": [ 68 | "print(proba)" 69 | ] 70 | }, 71 | { 72 | "cell_type": "code", 73 | "execution_count": 5, 74 | "metadata": {}, 75 | "outputs": [ 76 | { 77 | "data": { 78 | "text/plain": [ 79 | "array([9.81797141e-01, 1.82028445e-02, 1.44269293e-08])" 80 | ] 81 | }, 82 | "execution_count": 5, 83 | "metadata": {}, 84 | "output_type": "execute_result" 85 | } 86 | ], 87 | "source": [ 88 | "proba[0]" 89 | ] 90 | }, 91 | { 92 | "cell_type": "code", 93 | "execution_count": 7, 94 | "metadata": {}, 95 | "outputs": [ 96 | { 97 | "data": { 98 | "text/plain": [ 99 | "(2, 3)" 100 | ] 101 | }, 102 | "execution_count": 7, 103 | "metadata": {}, 104 | "output_type": "execute_result" 105 | } 106 | ], 107 | "source": [ 108 | "proba.shape" 109 | ] 110 | }, 111 | { 112 | "cell_type": "code", 113 | "execution_count": 8, 114 | "metadata": {}, 115 | "outputs": [ 116 | { 117 | "name": "stdout", 118 | "output_type": "stream", 119 | "text": [ 120 | "Confidence score for class 0 is 0.9817971410639899\n" 121 | ] 122 | } 123 | ], 124 | "source": [ 125 | "count=0\n", 126 | "print('Confidence score for class ',count,'is ',proba[0][0])" 127 | ] 128 | }, 129 | { 130 | "cell_type": "code", 131 | "execution_count": null, 132 | "metadata": {}, 133 | "outputs": [], 134 | "source": [] 135 | } 136 | ], 137 | "metadata": { 138 | "kernelspec": { 139 | "display_name": "Python 3", 140 | "language": "python", 141 | "name": "python3" 142 | }, 143 | "language_info": { 144 | "codemirror_mode": { 145 | "name": "ipython", 146 | "version": 3 147 | }, 148 | "file_extension": ".py", 149 | "mimetype": "text/x-python", 150 | "name": "python", 151 | "nbconvert_exporter": "python", 152 | "pygments_lexer": "ipython3", 153 | "version": "3.7.3" 154 | } 155 | }, 156 | "nbformat": 4, 157 | "nbformat_minor": 2 158 | } 159 | -------------------------------------------------------------------------------- /12.SVM/__pycache__/clientApp.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/__pycache__/clientApp.cpython-36.pyc -------------------------------------------------------------------------------- /12.SVM/__pycache__/clientApp.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/__pycache__/clientApp.cpython-37.pyc -------------------------------------------------------------------------------- /12.SVM/application.py: -------------------------------------------------------------------------------- 1 | 2 | # importing the necessary dependencies 3 | from flask import Flask, render_template, request,jsonify 4 | from flask_cors import CORS,cross_origin 5 | import pickle 6 | 7 | application = Flask(__name__) # initializing a flask app 8 | app=application 9 | @app.route('/',methods=['GET']) # route to display the home page 10 | @cross_origin() 11 | def homePage(): 12 | return render_template("index.html") 13 | 14 | @app.route('/predict',methods=['POST','GET']) # route to show the predictions in a web UI 15 | @cross_origin() 16 | def index(): 17 | if request.method == 'POST': 18 | try: 19 | # reading the inputs given by the user 20 | gre_score=float(request.form['gre_score']) 21 | toefl_score = float(request.form['toefl_score']) 22 | university_rating = float(request.form['university_rating']) 23 | sop = float(request.form['sop']) 24 | lor = float(request.form['lor']) 25 | cgpa = float(request.form['cgpa']) 26 | is_research = request.form['research'] 27 | if(is_research=='yes'): 28 | research=1 29 | else: 30 | research=0 31 | filename = 'TEST.pickle' 32 | loaded_model = pickle.load(open(filename, 'rb')) # loading the model file from the storage 33 | # predictions using the loaded model file 34 | prediction=loaded_model.predict([[gre_score,toefl_score,university_rating,sop,lor,cgpa,research]]) 35 | print('prediction is', prediction) 36 | # showing the prediction results in a UI 37 | return render_template('results.html',prediction=round(100*prediction[0])) 38 | except Exception as e: 39 | print('The Exception message is: ',e) 40 | return 'something is wrong' 41 | # return render_template('results.html') 42 | else: 43 | return render_template('index.html') 44 | 45 | 46 | 47 | if __name__ == "__main__": 48 | #app.run(host='127.0.0.1', port=8001, debug=True) 49 | app.run(debug=True) # running the app -------------------------------------------------------------------------------- /12.SVM/clientApp.py: -------------------------------------------------------------------------------- 1 | 2 | # importing the necessary dependencies 3 | # import pickle 4 | 5 | import joblib 6 | from flask import Flask, render_template, request,jsonify 7 | from flask_cors import CORS,cross_origin 8 | # import pickle 9 | 10 | application = Flask(__name__) # initializing a flask app 11 | app=application 12 | @app.route('/',methods=['GET']) # route to display the home page 13 | @cross_origin() 14 | def homePage(): 15 | return render_template("index.html") 16 | 17 | @app.route('/predict',methods=['POST','GET']) # route to show the predictions in a web UI 18 | @cross_origin() 19 | def index(): 20 | if request.method == 'POST': 21 | try: 22 | # reading the inputs given by the user 23 | gre_score=float(request.form['gre_score']) 24 | toefl_score = float(request.form['toefl_score']) 25 | university_rating = float(request.form['university_rating']) 26 | sop = float(request.form['sop']) 27 | lor = float(request.form['lor']) 28 | cgpa = float(request.form['cgpa']) 29 | is_research = request.form['research'] 30 | if(is_research=='yes'): 31 | research=1 32 | else: 33 | research=0 34 | filename = 'test1.pickle' 35 | loaded_model = joblib.load(open(filename, 'rb')) # loading the model file from the storage 36 | # predictions using the loaded model file 37 | prediction=loaded_model.predict([[gre_score,toefl_score,university_rating,sop,lor,cgpa,research]]) 38 | print('prediction is', prediction) 39 | # showing the prediction results in a UI 40 | return render_template('results.html',prediction=round(100*prediction[0])) 41 | except Exception as e: 42 | print('The Exception message is: ',e) 43 | return 'something is wrong' 44 | # return render_template('results.html') 45 | else: 46 | return render_template('index.html') 47 | 48 | 49 | 50 | if __name__ == "__main__": 51 | #app.run(host='127.0.0.1', port=8001, debug=True) 52 | app.run(debug=True) # running the app -------------------------------------------------------------------------------- /12.SVM/createAPP.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/createAPP.PNG -------------------------------------------------------------------------------- /12.SVM/finalResult.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/finalResult.PNG -------------------------------------------------------------------------------- /12.SVM/finalized_model.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/finalized_model.pickle -------------------------------------------------------------------------------- /12.SVM/hyperplane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/hyperplane.png -------------------------------------------------------------------------------- /12.SVM/red-wine-quality-cortez-et-al-2009.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/red-wine-quality-cortez-et-al-2009.zip -------------------------------------------------------------------------------- /12.SVM/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2019.11.28 2 | Click==7.0 3 | Flask==1.1.1 4 | Flask-Cors==3.0.8 5 | gunicorn==20.0.4 6 | itsdangerous==1.1.0 7 | Jinja2==2.10.3 8 | joblib==0.14.0 9 | MarkupSafe==1.1.1 10 | numpy==1.17.4 11 | scikit-learn==0.21.3 12 | scipy==1.3.2 13 | six==1.13.0 14 | Werkzeug==0.16.0 15 | wincertstore==0.2 16 | -------------------------------------------------------------------------------- /12.SVM/static/css/main.css: -------------------------------------------------------------------------------- 1 | body, html { 2 | margin: 0; 3 | font-family: sans-serif; 4 | } 5 | 6 | .content { 7 | margin: 0 auto; 8 | width: 400px; 9 | } 10 | 11 | table, td, th { 12 | border: 1px solid #aaa; 13 | } 14 | 15 | table { 16 | border-collapse: collapse; 17 | width: 100%; 18 | } 19 | 20 | th { 21 | height: 30px; 22 | } 23 | 24 | td { 25 | text-align: center; 26 | padding: 5px; 27 | } 28 | 29 | .form { 30 | margin-top: 20px; 31 | } 32 | 33 | #content { 34 | width: 70%; 35 | } -------------------------------------------------------------------------------- /12.SVM/static/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #91ced4; 3 | } 4 | body * { 5 | box-sizing: border-box; 6 | } 7 | 8 | .header { 9 | background-color: #327a81; 10 | color: white; 11 | font-size: 1.5em; 12 | padding: 1rem; 13 | text-align: center; 14 | text-transform: uppercase; 15 | } 16 | 17 | img { 18 | border-radius: 50%; 19 | height: 60px; 20 | width: 60px; 21 | } 22 | 23 | .table-users { 24 | border: 1px solid #327a81; 25 | border-radius: 10px; 26 | box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.1); 27 | max-width: calc(100% - 2em); 28 | margin: 1em auto; 29 | overflow: hidden; 30 | width: 800px; 31 | } 32 | 33 | table { 34 | width: 100%; 35 | } 36 | table td, table th { 37 | color: #2b686e; 38 | padding: 10px; 39 | } 40 | table td { 41 | text-align: center; 42 | vertical-align: middle; 43 | } 44 | table td:last-child { 45 | font-size: 0.95em; 46 | line-height: 1.4; 47 | text-align: left; 48 | } 49 | table th { 50 | background-color: #daeff1; 51 | font-weight: 300; 52 | } 53 | table tr:nth-child(2n) { 54 | background-color: white; 55 | } 56 | table tr:nth-child(2n+1) { 57 | background-color: #edf7f8; 58 | } 59 | 60 | @media screen and (max-width: 700px) { 61 | table, tr, td { 62 | display: block; 63 | } 64 | 65 | td:first-child { 66 | position: absolute; 67 | top: 50%; 68 | -webkit-transform: translateY(-50%); 69 | transform: translateY(-50%); 70 | width: 100px; 71 | } 72 | td:not(:first-child) { 73 | clear: both; 74 | margin-left: 100px; 75 | padding: 4px 20px 4px 90px; 76 | position: relative; 77 | text-align: left; 78 | } 79 | td:not(:first-child):before { 80 | color: #91ced4; 81 | content: ''; 82 | display: block; 83 | left: 0; 84 | position: absolute; 85 | } 86 | td:nth-child(2):before { 87 | content: 'Name:'; 88 | } 89 | td:nth-child(3):before { 90 | content: 'Email:'; 91 | } 92 | td:nth-child(4):before { 93 | content: 'Phone:'; 94 | } 95 | td:nth-child(5):before { 96 | content: 'Comments:'; 97 | } 98 | 99 | tr { 100 | padding: 10px 0; 101 | position: relative; 102 | } 103 | tr:first-child { 104 | display: none; 105 | } 106 | } 107 | @media screen and (max-width: 500px) { 108 | .header { 109 | background-color: transparent; 110 | color: white; 111 | font-size: 2em; 112 | font-weight: 700; 113 | padding: 0; 114 | text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1); 115 | } 116 | 117 | img { 118 | border: 3px solid; 119 | border-color: #daeff1; 120 | height: 100px; 121 | margin: 0.5rem 0; 122 | width: 100px; 123 | } 124 | 125 | td:first-child { 126 | background-color: #c8e7ea; 127 | border-bottom: 1px solid #91ced4; 128 | border-radius: 10px 10px 0 0; 129 | position: relative; 130 | top: 0; 131 | -webkit-transform: translateY(0); 132 | transform: translateY(0); 133 | width: 100%; 134 | } 135 | td:not(:first-child) { 136 | margin: 0; 137 | padding: 5px 1em; 138 | width: 100%; 139 | } 140 | td:not(:first-child):before { 141 | font-size: .8em; 142 | padding-top: 0.3em; 143 | position: relative; 144 | } 145 | td:last-child { 146 | padding-bottom: 1rem !important; 147 | } 148 | 149 | tr { 150 | background-color: white !important; 151 | border: 1px solid #6cbec6; 152 | border-radius: 10px; 153 | box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1); 154 | margin: 0.5rem 0; 155 | padding: 0; 156 | } 157 | 158 | .table-users { 159 | border: none; 160 | box-shadow: none; 161 | overflow: visible; 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /12.SVM/templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | {% block head %}{% endblock %} 9 | 10 | 11 | {% block body %}{% endblock %} 12 | 13 | -------------------------------------------------------------------------------- /12.SVM/templates/index.html: -------------------------------------------------------------------------------- 1 | {% extends 'base.html' %} 2 | 3 | {% block head %} 4 | 5 | Search Page 6 | 7 | {% endblock %} 8 | 9 | {% block body %} 10 |
11 |

Predict Your chances for Admission

12 | 13 |
14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 |
27 |
28 |
29 | {% endblock %} -------------------------------------------------------------------------------- /12.SVM/templates/results.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Review Page 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
Prediction
21 | 22 |

Your chance for admission is {{prediction}} percent

23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /12.SVM/test1.joblib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/test1.joblib -------------------------------------------------------------------------------- /12.SVM/test1.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/test1.pickle -------------------------------------------------------------------------------- /12.SVM/webApp.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/webApp.PNG -------------------------------------------------------------------------------- /12.SVM/zipCreation.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/12.SVM/zipCreation.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/AUC.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/AUC.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/MLApplicationFlow_bold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/MLApplicationFlow_bold.png -------------------------------------------------------------------------------- /2.Logistic-regression_final/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn app:app -------------------------------------------------------------------------------- /2.Logistic-regression_final/ROC.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/ROC.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/Social_Network_Ads.csv: -------------------------------------------------------------------------------- 1 | User ID,Gender,Age,EstimatedSalary,Purchased 2 | 15624510,Male,19,19000,0 3 | 15810944,Male,35,20000,0 4 | 15668575,Female,26,43000,0 5 | 15603246,Female,27,57000,0 6 | 15804002,Male,19,76000,0 7 | 15728773,Male,27,58000,0 8 | 15598044,Female,27,84000,0 9 | 15694829,Female,32,150000,1 10 | 15600575,Male,25,33000,0 11 | 15727311,Female,35,65000,0 12 | 15570769,Female,26,80000,0 13 | 15606274,Female,26,52000,0 14 | 15746139,Male,20,86000,0 15 | 15704987,Male,32,18000,0 16 | 15628972,Male,18,82000,0 17 | 15697686,Male,29,80000,0 18 | 15733883,Male,47,25000,1 19 | 15617482,Male,45,26000,1 20 | 15704583,Male,46,28000,1 21 | 15621083,Female,48,29000,1 22 | 15649487,Male,45,22000,1 23 | 15736760,Female,47,49000,1 24 | 15714658,Male,48,41000,1 25 | 15599081,Female,45,22000,1 26 | 15705113,Male,46,23000,1 27 | 15631159,Male,47,20000,1 28 | 15792818,Male,49,28000,1 29 | 15633531,Female,47,30000,1 30 | 15744529,Male,29,43000,0 31 | 15669656,Male,31,18000,0 32 | 15581198,Male,31,74000,0 33 | 15729054,Female,27,137000,1 34 | 15573452,Female,21,16000,0 35 | 15776733,Female,28,44000,0 36 | 15724858,Male,27,90000,0 37 | 15713144,Male,35,27000,0 38 | 15690188,Female,33,28000,0 39 | 15689425,Male,30,49000,0 40 | 15671766,Female,26,72000,0 41 | 15782806,Female,27,31000,0 42 | 15764419,Female,27,17000,0 43 | 15591915,Female,33,51000,0 44 | 15772798,Male,35,108000,0 45 | 15792008,Male,30,15000,0 46 | 15715541,Female,28,84000,0 47 | 15639277,Male,23,20000,0 48 | 15798850,Male,25,79000,0 49 | 15776348,Female,27,54000,0 50 | 15727696,Male,30,135000,1 51 | 15793813,Female,31,89000,0 52 | 15694395,Female,24,32000,0 53 | 15764195,Female,18,44000,0 54 | 15744919,Female,29,83000,0 55 | 15671655,Female,35,23000,0 56 | 15654901,Female,27,58000,0 57 | 15649136,Female,24,55000,0 58 | 15775562,Female,23,48000,0 59 | 15807481,Male,28,79000,0 60 | 15642885,Male,22,18000,0 61 | 15789109,Female,32,117000,0 62 | 15814004,Male,27,20000,0 63 | 15673619,Male,25,87000,0 64 | 15595135,Female,23,66000,0 65 | 15583681,Male,32,120000,1 66 | 15605000,Female,59,83000,0 67 | 15718071,Male,24,58000,0 68 | 15679760,Male,24,19000,0 69 | 15654574,Female,23,82000,0 70 | 15577178,Female,22,63000,0 71 | 15595324,Female,31,68000,0 72 | 15756932,Male,25,80000,0 73 | 15726358,Female,24,27000,0 74 | 15595228,Female,20,23000,0 75 | 15782530,Female,33,113000,0 76 | 15592877,Male,32,18000,0 77 | 15651983,Male,34,112000,1 78 | 15746737,Male,18,52000,0 79 | 15774179,Female,22,27000,0 80 | 15667265,Female,28,87000,0 81 | 15655123,Female,26,17000,0 82 | 15595917,Male,30,80000,0 83 | 15668385,Male,39,42000,0 84 | 15709476,Male,20,49000,0 85 | 15711218,Male,35,88000,0 86 | 15798659,Female,30,62000,0 87 | 15663939,Female,31,118000,1 88 | 15694946,Male,24,55000,0 89 | 15631912,Female,28,85000,0 90 | 15768816,Male,26,81000,0 91 | 15682268,Male,35,50000,0 92 | 15684801,Male,22,81000,0 93 | 15636428,Female,30,116000,0 94 | 15809823,Male,26,15000,0 95 | 15699284,Female,29,28000,0 96 | 15786993,Female,29,83000,0 97 | 15709441,Female,35,44000,0 98 | 15710257,Female,35,25000,0 99 | 15582492,Male,28,123000,1 100 | 15575694,Male,35,73000,0 101 | 15756820,Female,28,37000,0 102 | 15766289,Male,27,88000,0 103 | 15593014,Male,28,59000,0 104 | 15584545,Female,32,86000,0 105 | 15675949,Female,33,149000,1 106 | 15672091,Female,19,21000,0 107 | 15801658,Male,21,72000,0 108 | 15706185,Female,26,35000,0 109 | 15789863,Male,27,89000,0 110 | 15720943,Male,26,86000,0 111 | 15697997,Female,38,80000,0 112 | 15665416,Female,39,71000,0 113 | 15660200,Female,37,71000,0 114 | 15619653,Male,38,61000,0 115 | 15773447,Male,37,55000,0 116 | 15739160,Male,42,80000,0 117 | 15689237,Male,40,57000,0 118 | 15679297,Male,35,75000,0 119 | 15591433,Male,36,52000,0 120 | 15642725,Male,40,59000,0 121 | 15701962,Male,41,59000,0 122 | 15811613,Female,36,75000,0 123 | 15741049,Male,37,72000,0 124 | 15724423,Female,40,75000,0 125 | 15574305,Male,35,53000,0 126 | 15678168,Female,41,51000,0 127 | 15697020,Female,39,61000,0 128 | 15610801,Male,42,65000,0 129 | 15745232,Male,26,32000,0 130 | 15722758,Male,30,17000,0 131 | 15792102,Female,26,84000,0 132 | 15675185,Male,31,58000,0 133 | 15801247,Male,33,31000,0 134 | 15725660,Male,30,87000,0 135 | 15638963,Female,21,68000,0 136 | 15800061,Female,28,55000,0 137 | 15578006,Male,23,63000,0 138 | 15668504,Female,20,82000,0 139 | 15687491,Male,30,107000,1 140 | 15610403,Female,28,59000,0 141 | 15741094,Male,19,25000,0 142 | 15807909,Male,19,85000,0 143 | 15666141,Female,18,68000,0 144 | 15617134,Male,35,59000,0 145 | 15783029,Male,30,89000,0 146 | 15622833,Female,34,25000,0 147 | 15746422,Female,24,89000,0 148 | 15750839,Female,27,96000,1 149 | 15749130,Female,41,30000,0 150 | 15779862,Male,29,61000,0 151 | 15767871,Male,20,74000,0 152 | 15679651,Female,26,15000,0 153 | 15576219,Male,41,45000,0 154 | 15699247,Male,31,76000,0 155 | 15619087,Female,36,50000,0 156 | 15605327,Male,40,47000,0 157 | 15610140,Female,31,15000,0 158 | 15791174,Male,46,59000,0 159 | 15602373,Male,29,75000,0 160 | 15762605,Male,26,30000,0 161 | 15598840,Female,32,135000,1 162 | 15744279,Male,32,100000,1 163 | 15670619,Male,25,90000,0 164 | 15599533,Female,37,33000,0 165 | 15757837,Male,35,38000,0 166 | 15697574,Female,33,69000,0 167 | 15578738,Female,18,86000,0 168 | 15762228,Female,22,55000,0 169 | 15614827,Female,35,71000,0 170 | 15789815,Male,29,148000,1 171 | 15579781,Female,29,47000,0 172 | 15587013,Male,21,88000,0 173 | 15570932,Male,34,115000,0 174 | 15794661,Female,26,118000,0 175 | 15581654,Female,34,43000,0 176 | 15644296,Female,34,72000,0 177 | 15614420,Female,23,28000,0 178 | 15609653,Female,35,47000,0 179 | 15594577,Male,25,22000,0 180 | 15584114,Male,24,23000,0 181 | 15673367,Female,31,34000,0 182 | 15685576,Male,26,16000,0 183 | 15774727,Female,31,71000,0 184 | 15694288,Female,32,117000,1 185 | 15603319,Male,33,43000,0 186 | 15759066,Female,33,60000,0 187 | 15814816,Male,31,66000,0 188 | 15724402,Female,20,82000,0 189 | 15571059,Female,33,41000,0 190 | 15674206,Male,35,72000,0 191 | 15715160,Male,28,32000,0 192 | 15730448,Male,24,84000,0 193 | 15662067,Female,19,26000,0 194 | 15779581,Male,29,43000,0 195 | 15662901,Male,19,70000,0 196 | 15689751,Male,28,89000,0 197 | 15667742,Male,34,43000,0 198 | 15738448,Female,30,79000,0 199 | 15680243,Female,20,36000,0 200 | 15745083,Male,26,80000,0 201 | 15708228,Male,35,22000,0 202 | 15628523,Male,35,39000,0 203 | 15708196,Male,49,74000,0 204 | 15735549,Female,39,134000,1 205 | 15809347,Female,41,71000,0 206 | 15660866,Female,58,101000,1 207 | 15766609,Female,47,47000,0 208 | 15654230,Female,55,130000,1 209 | 15794566,Female,52,114000,0 210 | 15800890,Female,40,142000,1 211 | 15697424,Female,46,22000,0 212 | 15724536,Female,48,96000,1 213 | 15735878,Male,52,150000,1 214 | 15707596,Female,59,42000,0 215 | 15657163,Male,35,58000,0 216 | 15622478,Male,47,43000,0 217 | 15779529,Female,60,108000,1 218 | 15636023,Male,49,65000,0 219 | 15582066,Male,40,78000,0 220 | 15666675,Female,46,96000,0 221 | 15732987,Male,59,143000,1 222 | 15789432,Female,41,80000,0 223 | 15663161,Male,35,91000,1 224 | 15694879,Male,37,144000,1 225 | 15593715,Male,60,102000,1 226 | 15575002,Female,35,60000,0 227 | 15622171,Male,37,53000,0 228 | 15795224,Female,36,126000,1 229 | 15685346,Male,56,133000,1 230 | 15691808,Female,40,72000,0 231 | 15721007,Female,42,80000,1 232 | 15794253,Female,35,147000,1 233 | 15694453,Male,39,42000,0 234 | 15813113,Male,40,107000,1 235 | 15614187,Male,49,86000,1 236 | 15619407,Female,38,112000,0 237 | 15646227,Male,46,79000,1 238 | 15660541,Male,40,57000,0 239 | 15753874,Female,37,80000,0 240 | 15617877,Female,46,82000,0 241 | 15772073,Female,53,143000,1 242 | 15701537,Male,42,149000,1 243 | 15736228,Male,38,59000,0 244 | 15780572,Female,50,88000,1 245 | 15769596,Female,56,104000,1 246 | 15586996,Female,41,72000,0 247 | 15722061,Female,51,146000,1 248 | 15638003,Female,35,50000,0 249 | 15775590,Female,57,122000,1 250 | 15730688,Male,41,52000,0 251 | 15753102,Female,35,97000,1 252 | 15810075,Female,44,39000,0 253 | 15723373,Male,37,52000,0 254 | 15795298,Female,48,134000,1 255 | 15584320,Female,37,146000,1 256 | 15724161,Female,50,44000,0 257 | 15750056,Female,52,90000,1 258 | 15609637,Female,41,72000,0 259 | 15794493,Male,40,57000,0 260 | 15569641,Female,58,95000,1 261 | 15815236,Female,45,131000,1 262 | 15811177,Female,35,77000,0 263 | 15680587,Male,36,144000,1 264 | 15672821,Female,55,125000,1 265 | 15767681,Female,35,72000,0 266 | 15600379,Male,48,90000,1 267 | 15801336,Female,42,108000,1 268 | 15721592,Male,40,75000,0 269 | 15581282,Male,37,74000,0 270 | 15746203,Female,47,144000,1 271 | 15583137,Male,40,61000,0 272 | 15680752,Female,43,133000,0 273 | 15688172,Female,59,76000,1 274 | 15791373,Male,60,42000,1 275 | 15589449,Male,39,106000,1 276 | 15692819,Female,57,26000,1 277 | 15727467,Male,57,74000,1 278 | 15734312,Male,38,71000,0 279 | 15764604,Male,49,88000,1 280 | 15613014,Female,52,38000,1 281 | 15759684,Female,50,36000,1 282 | 15609669,Female,59,88000,1 283 | 15685536,Male,35,61000,0 284 | 15750447,Male,37,70000,1 285 | 15663249,Female,52,21000,1 286 | 15638646,Male,48,141000,0 287 | 15734161,Female,37,93000,1 288 | 15631070,Female,37,62000,0 289 | 15761950,Female,48,138000,1 290 | 15649668,Male,41,79000,0 291 | 15713912,Female,37,78000,1 292 | 15586757,Male,39,134000,1 293 | 15596522,Male,49,89000,1 294 | 15625395,Male,55,39000,1 295 | 15760570,Male,37,77000,0 296 | 15566689,Female,35,57000,0 297 | 15725794,Female,36,63000,0 298 | 15673539,Male,42,73000,1 299 | 15705298,Female,43,112000,1 300 | 15675791,Male,45,79000,0 301 | 15747043,Male,46,117000,1 302 | 15736397,Female,58,38000,1 303 | 15678201,Male,48,74000,1 304 | 15720745,Female,37,137000,1 305 | 15637593,Male,37,79000,1 306 | 15598070,Female,40,60000,0 307 | 15787550,Male,42,54000,0 308 | 15603942,Female,51,134000,0 309 | 15733973,Female,47,113000,1 310 | 15596761,Male,36,125000,1 311 | 15652400,Female,38,50000,0 312 | 15717893,Female,42,70000,0 313 | 15622585,Male,39,96000,1 314 | 15733964,Female,38,50000,0 315 | 15753861,Female,49,141000,1 316 | 15747097,Female,39,79000,0 317 | 15594762,Female,39,75000,1 318 | 15667417,Female,54,104000,1 319 | 15684861,Male,35,55000,0 320 | 15742204,Male,45,32000,1 321 | 15623502,Male,36,60000,0 322 | 15774872,Female,52,138000,1 323 | 15611191,Female,53,82000,1 324 | 15674331,Male,41,52000,0 325 | 15619465,Female,48,30000,1 326 | 15575247,Female,48,131000,1 327 | 15695679,Female,41,60000,0 328 | 15713463,Male,41,72000,0 329 | 15785170,Female,42,75000,0 330 | 15796351,Male,36,118000,1 331 | 15639576,Female,47,107000,1 332 | 15693264,Male,38,51000,0 333 | 15589715,Female,48,119000,1 334 | 15769902,Male,42,65000,0 335 | 15587177,Male,40,65000,0 336 | 15814553,Male,57,60000,1 337 | 15601550,Female,36,54000,0 338 | 15664907,Male,58,144000,1 339 | 15612465,Male,35,79000,0 340 | 15810800,Female,38,55000,0 341 | 15665760,Male,39,122000,1 342 | 15588080,Female,53,104000,1 343 | 15776844,Male,35,75000,0 344 | 15717560,Female,38,65000,0 345 | 15629739,Female,47,51000,1 346 | 15729908,Male,47,105000,1 347 | 15716781,Female,41,63000,0 348 | 15646936,Male,53,72000,1 349 | 15768151,Female,54,108000,1 350 | 15579212,Male,39,77000,0 351 | 15721835,Male,38,61000,0 352 | 15800515,Female,38,113000,1 353 | 15591279,Male,37,75000,0 354 | 15587419,Female,42,90000,1 355 | 15750335,Female,37,57000,0 356 | 15699619,Male,36,99000,1 357 | 15606472,Male,60,34000,1 358 | 15778368,Male,54,70000,1 359 | 15671387,Female,41,72000,0 360 | 15573926,Male,40,71000,1 361 | 15709183,Male,42,54000,0 362 | 15577514,Male,43,129000,1 363 | 15778830,Female,53,34000,1 364 | 15768072,Female,47,50000,1 365 | 15768293,Female,42,79000,0 366 | 15654456,Male,42,104000,1 367 | 15807525,Female,59,29000,1 368 | 15574372,Female,58,47000,1 369 | 15671249,Male,46,88000,1 370 | 15779744,Male,38,71000,0 371 | 15624755,Female,54,26000,1 372 | 15611430,Female,60,46000,1 373 | 15774744,Male,60,83000,1 374 | 15629885,Female,39,73000,0 375 | 15708791,Male,59,130000,1 376 | 15793890,Female,37,80000,0 377 | 15646091,Female,46,32000,1 378 | 15596984,Female,46,74000,0 379 | 15800215,Female,42,53000,0 380 | 15577806,Male,41,87000,1 381 | 15749381,Female,58,23000,1 382 | 15683758,Male,42,64000,0 383 | 15670615,Male,48,33000,1 384 | 15715622,Female,44,139000,1 385 | 15707634,Male,49,28000,1 386 | 15806901,Female,57,33000,1 387 | 15775335,Male,56,60000,1 388 | 15724150,Female,49,39000,1 389 | 15627220,Male,39,71000,0 390 | 15672330,Male,47,34000,1 391 | 15668521,Female,48,35000,1 392 | 15807837,Male,48,33000,1 393 | 15592570,Male,47,23000,1 394 | 15748589,Female,45,45000,1 395 | 15635893,Male,60,42000,1 396 | 15757632,Female,39,59000,0 397 | 15691863,Female,46,41000,1 398 | 15706071,Male,51,23000,1 399 | 15654296,Female,50,20000,1 400 | 15755018,Male,36,33000,0 401 | 15594041,Female,49,36000,1 -------------------------------------------------------------------------------- /2.Logistic-regression_final/app.py: -------------------------------------------------------------------------------- 1 | from wsgiref import simple_server 2 | from flask import Flask, request, app 3 | from flask import Response 4 | from flask_cors import CORS 5 | from logistic_deploy import predObj 6 | 7 | app = Flask(__name__) 8 | CORS(app) 9 | app.config['DEBUG'] = True 10 | 11 | 12 | class ClientApi: 13 | 14 | def __init__(self): 15 | self.predObj = predObj() 16 | 17 | @app.route("/predict", methods=['POST']) 18 | def predictRoute(): 19 | try: 20 | if request.json['data'] is not None: 21 | data = request.json['data'] 22 | print('data is: ', data) 23 | pred=predObj() 24 | res = pred.predict_log(data) 25 | 26 | #result = clntApp.predObj.predict_log(data) 27 | print('result is ',res) 28 | return Response(res) 29 | except ValueError: 30 | return Response("Value not found") 31 | except Exception as e: 32 | print('exception is ',e) 33 | return Response(e) 34 | 35 | 36 | if __name__ == "__main__": 37 | clntApp = ClientApi() 38 | host = '0.0.0.0' 39 | port = 5000 40 | app.run(debug=True) 41 | #httpd = simple_server.make_server(host, port, app) 42 | # print("Serving on %s %d" % (host, port)) 43 | #httpd.serve_forever() -------------------------------------------------------------------------------- /2.Logistic-regression_final/cf1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/cf1.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/cf2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/cf2.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/confusionMatrix.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/confusionMatrix.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/derivative.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/derivative.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | __pycache__ -------------------------------------------------------------------------------- /2.Logistic-regression_final/logisticRegression.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/logisticRegression.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/logistic_deploy.py: -------------------------------------------------------------------------------- 1 | #Let's start with importing necessary libraries 2 | import pickle 3 | import numpy as np 4 | import pandas as pd 5 | 6 | class predObj: 7 | 8 | def predict_log(self, dict_pred): 9 | with open("standardScalar.sav", 'rb') as f: 10 | scalar = pickle.load(f) 11 | 12 | with open("modelForPrediction.sav", 'rb') as f: 13 | model = pickle.load(f) 14 | data_df = pd.DataFrame(dict_pred,index=[1,]) 15 | scaled_data = scalar.transform(data_df) 16 | predict = model.predict(scaled_data) 17 | if predict[0] ==1 : 18 | result = 'Diabetic' 19 | else: 20 | result ='Non-Diabetic' 21 | 22 | return result 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /2.Logistic-regression_final/logistic_function.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/logistic_function.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/logistic_regression.py: -------------------------------------------------------------------------------- 1 | # Logistic Regression 2 | 3 | # Importing the libraries 4 | import numpy as np 5 | import matplotlib.pyplot as plt 6 | import pandas as pd 7 | 8 | # Importing the dataset 9 | dataset = pd.read_csv('Social_Network_Ads.csv') 10 | X = dataset.iloc[:, [2, 3]].values 11 | y = dataset.iloc[:, 4].values 12 | 13 | # Splitting the dataset into the Training set and Test set 14 | from sklearn.model_selection import train_test_split 15 | X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25, random_state = 0) 16 | 17 | # Feature Scaling 18 | from sklearn.preprocessing import StandardScaler 19 | sc = StandardScaler() 20 | X_train = sc.fit_transform(X_train) 21 | X_test = sc.transform(X_test) 22 | 23 | # Fitting Logistic Regression to the Training set 24 | from sklearn.linear_model import LogisticRegression 25 | classifier = LogisticRegression(random_state = 0) 26 | classifier.fit(X_train, y_train) 27 | 28 | # Predicting the Test set results 29 | y_pred = classifier.predict(X_test) 30 | 31 | # Making the Confusion Matrix 32 | from sklearn.metrics import confusion_matrix 33 | cm = confusion_matrix(y_test, y_pred) 34 | 35 | # Visualising the Training set results 36 | from matplotlib.colors import ListedColormap 37 | X_set, y_set = X_train, y_train 38 | X1, X2 = np.meshgrid(np.arange(start = X_set[:, 0].min() - 1, stop = X_set[:, 0].max() + 1, step = 0.01), 39 | np.arange(start = X_set[:, 1].min() - 1, stop = X_set[:, 1].max() + 1, step = 0.01)) 40 | plt.contourf(X1, X2, classifier.predict(np.array([X1.ravel(), X2.ravel()]).T).reshape(X1.shape), 41 | alpha = 0.75, cmap = ListedColormap(('red', 'green'))) 42 | plt.xlim(X1.min(), X1.max()) 43 | plt.ylim(X2.min(), X2.max()) 44 | for i, j in enumerate(np.unique(y_set)): 45 | plt.scatter(X_set[y_set == j, 0], X_set[y_set == j, 1], 46 | c = ListedColormap(('red', 'green'))(i), label = j) 47 | plt.title('Logistic Regression (Training set)') 48 | plt.xlabel('Age') 49 | plt.ylabel('Estimated Salary') 50 | plt.legend() 51 | plt.show() 52 | 53 | # Visualising the Test set results 54 | from matplotlib.colors import ListedColormap 55 | X_set, y_set = X_test, y_test 56 | X1, X2 = np.meshgrid(np.arange(start = X_set[:, 0].min() - 1, stop = X_set[:, 0].max() + 1, step = 0.01), 57 | np.arange(start = X_set[:, 1].min() - 1, stop = X_set[:, 1].max() + 1, step = 0.01)) 58 | plt.contourf(X1, X2, classifier.predict(np.array([X1.ravel(), X2.ravel()]).T).reshape(X1.shape), 59 | alpha = 0.75, cmap = ListedColormap(('red', 'green'))) 60 | plt.xlim(X1.min(), X1.max()) 61 | plt.ylim(X2.min(), X2.max()) 62 | for i, j in enumerate(np.unique(y_set)): 63 | plt.scatter(X_set[y_set == j, 0], X_set[y_set == j, 1], 64 | c = ListedColormap(('red', 'green'))(i), label = j) 65 | plt.title('Logistic Regression (Test set)') 66 | plt.xlabel('Age') 67 | plt.ylabel('Estimated Salary') 68 | plt.legend() 69 | plt.show() -------------------------------------------------------------------------------- /2.Logistic-regression_final/logit.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/logit.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/manip1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/manip1.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/modelForPrediction.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/modelForPrediction.sav -------------------------------------------------------------------------------- /2.Logistic-regression_final/multi.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/multi.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/prediction.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/prediction.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/projectStructure.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/projectStructure.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2019.11.28 2 | Click==7.0 3 | Flask==1.1.1 4 | Flask-Cors==3.0.8 5 | gunicorn==20.0.4 6 | itsdangerous==1.1.0 7 | Jinja2==2.10.3 8 | joblib==0.14.1 9 | MarkupSafe==1.1.1 10 | numpy==1.18.0 11 | pandas==0.25.3 12 | python-dateutil==2.8.1 13 | pytz==2019.3 14 | scikit-learn==0.22 15 | scipy==1.4.1 16 | six==1.13.0 17 | Werkzeug==0.16.0 18 | wincertstore==0.2 19 | -------------------------------------------------------------------------------- /2.Logistic-regression_final/sandardScalar.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/sandardScalar.sav -------------------------------------------------------------------------------- /2.Logistic-regression_final/sigmoid.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/sigmoid.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/tandardScalar.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/tandardScalar.sav -------------------------------------------------------------------------------- /2.Logistic-regression_final/testing_pipeline.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/testing_pipeline.PNG -------------------------------------------------------------------------------- /2.Logistic-regression_final/tradeoff.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/2.Logistic-regression_final/tradeoff.PNG -------------------------------------------------------------------------------- /3.Decision tree/DecisionTree_DEPLOYMENT/Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn app:app -------------------------------------------------------------------------------- /3.Decision tree/DecisionTree_DEPLOYMENT/app.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | from wsgiref import simple_server 3 | from flask import Flask, request, app 4 | from flask import Response 5 | from flask_cors import CORS 6 | import pandas as pd 7 | 8 | app = Flask(__name__) 9 | CORS(app) 10 | app.config['DEBUG'] = True 11 | 12 | 13 | 14 | @app.route("/predict", methods=['POST']) 15 | def predictRoute(): 16 | try: 17 | if request.json['data'] is not None: 18 | data = request.json['data'] 19 | print('data is: ', data) 20 | res = predict_log(data) 21 | print('result is ',res) 22 | return Response(res) 23 | except ValueError: 24 | return Response("Value not found") 25 | except Exception as e: 26 | print('exception is ',e) 27 | return Response(e) 28 | 29 | def predict_log(dict_pred): 30 | with open("standardScalar.sav", 'rb') as f: 31 | scalar = pickle.load(f) 32 | 33 | with open("modelForPrediction.sav", 'rb') as f: 34 | model = pickle.load(f) 35 | with open("pca_model.sav", 'rb') as f: 36 | pca_model = pickle.load(f) 37 | 38 | data_df = pd.DataFrame(dict_pred,index=[1,]) 39 | scaled_data = scalar.transform(data_df) 40 | principal_data = pca_model.transform(scaled_data) 41 | predict = model.predict(principal_data) 42 | if predict[0] == 3: 43 | result = 'Bad' 44 | elif predict[0] == 4 : 45 | result = 'Below Average' 46 | elif predict[0]==5: 47 | result = 'Average' 48 | elif predict[0] == 6: 49 | result = 'Good' 50 | elif predict[0] == 7: 51 | result = 'Very Good' 52 | else : 53 | result = 'Excellent' 54 | 55 | return result 56 | if __name__ == "__main__": 57 | host = '0.0.0.0' 58 | port = 5000 59 | app.run(debug=True) 60 | #httpd = simple_server.make_server(host, port, app) 61 | # print("Serving on %s %d" % (host, port)) 62 | #httpd.serve_forever() -------------------------------------------------------------------------------- /3.Decision tree/DecisionTree_DEPLOYMENT/modelForPrediction.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/DecisionTree_DEPLOYMENT/modelForPrediction.sav -------------------------------------------------------------------------------- /3.Decision tree/DecisionTree_DEPLOYMENT/pca_model.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/DecisionTree_DEPLOYMENT/pca_model.sav -------------------------------------------------------------------------------- /3.Decision tree/DecisionTree_DEPLOYMENT/requirements.txt: -------------------------------------------------------------------------------- 1 | backcall==0.1.0 2 | certifi==2019.11.28 3 | Click==7.0 4 | colorama==0.4.3 5 | cycler==0.10.0 6 | decorator==4.4.1 7 | Flask==1.1.1 8 | Flask-Cors==3.0.8 9 | graphviz==0.13.2 10 | ipython==7.11.1 11 | ipython-genutils==0.2.0 12 | itsdangerous==1.1.0 13 | jedi==0.15.2 14 | Jinja2==2.10.3 15 | joblib==0.14.1 16 | kiwisolver==1.1.0 17 | MarkupSafe==1.1.1 18 | matplotlib==3.1.2 19 | numpy==1.18.0 20 | pandas==0.25.3 21 | parso==0.5.2 22 | pickleshare==0.7.5 23 | prompt-toolkit==3.0.2 24 | pydotplus==2.0.2 25 | Pygments==2.5.2 26 | pyparsing==2.4.6 27 | python-dateutil==2.8.1 28 | pytz==2019.3 29 | scikit-learn==0.22 30 | scipy==1.4.1 31 | six==1.13.0 32 | sklearn==0.0 33 | traitlets==4.3.3 34 | wcwidth==0.1.8 35 | Werkzeug==0.16.0 36 | wincertstore==0.2 37 | gunicorn==20.0.4 -------------------------------------------------------------------------------- /3.Decision tree/DecisionTree_DEPLOYMENT/standardScalar.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/DecisionTree_DEPLOYMENT/standardScalar.sav -------------------------------------------------------------------------------- /3.Decision tree/Decision_tree-deploy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/Decision_tree-deploy.png -------------------------------------------------------------------------------- /3.Decision tree/Decision_tree1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/Decision_tree1.png -------------------------------------------------------------------------------- /3.Decision tree/MLApplicationFlow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/MLApplicationFlow.png -------------------------------------------------------------------------------- /3.Decision tree/app.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | from wsgiref import simple_server 3 | from flask import Flask, request, app 4 | from flask import Response 5 | from flask_cors import CORS 6 | import pandas as pd 7 | 8 | app = Flask(__name__) 9 | CORS(app) 10 | app.config['DEBUG'] = True 11 | 12 | 13 | 14 | @app.route("/predict", methods=['POST']) 15 | def predictRoute(): 16 | try: 17 | if request.json['data'] is not None: 18 | data = request.json['data'] 19 | print('data is: ', data) 20 | res = predict_log(data) 21 | print('result is ',res) 22 | return Response(res) 23 | except ValueError: 24 | return Response("Value not found") 25 | except Exception as e: 26 | print('exception is ',e) 27 | return Response(e) 28 | 29 | def predict_log(dict_pred): 30 | with open("standardScalar.sav", 'rb') as f: 31 | scalar = pickle.load(f) 32 | 33 | with open("modelForPrediction.sav", 'rb') as f: 34 | model = pickle.load(f) 35 | with open("pca_model.sav", 'rb') as f: 36 | pca_model = pickle.load(f) 37 | 38 | data_df = pd.DataFrame(dict_pred,index=[1,]) 39 | scaled_data = scalar.transform(data_df) 40 | principal_data = pca_model.transform(scaled_data) 41 | predict = model.predict(principal_data) 42 | if predict[0] == 3: 43 | result = 'Bad' 44 | elif predict[0] == 4 : 45 | result = 'Below Average' 46 | elif predict[0]==5: 47 | result = 'Average' 48 | elif predict[0] == 6: 49 | result = 'Good' 50 | elif predict[0] == 7: 51 | result = 'Very Good' 52 | else : 53 | result = 'Excellent' 54 | 55 | return result 56 | if __name__ == "__main__": 57 | host = '0.0.0.0' 58 | port = 5000 59 | app.run(debug=True) 60 | #httpd = simple_server.make_server(host, port, app) 61 | # print("Serving on %s %d" % (host, port)) 62 | #httpd.serve_forever() -------------------------------------------------------------------------------- /3.Decision tree/class_distribution.csv: -------------------------------------------------------------------------------- 1 | Class,Gender,Stay in hostel 2 | 9,M,Yes 3 | 10,F,No 4 | 8,F,Yes 5 | 8,F,No 6 | 9,M,Yes 7 | 10,M,No 8 | 11,F,Yes 9 | 11,M,Yes 10 | 8,F,Yes 11 | 9,M,No 12 | 11,M,No 13 | 11,M,Yes 14 | 10,F,No 15 | 10,M,Yes 16 | -------------------------------------------------------------------------------- /3.Decision tree/cv1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/cv1.png -------------------------------------------------------------------------------- /3.Decision tree/cv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/cv2.png -------------------------------------------------------------------------------- /3.Decision tree/cv3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/cv3.png -------------------------------------------------------------------------------- /3.Decision tree/cv4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/cv4.png -------------------------------------------------------------------------------- /3.Decision tree/data_class.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/data_class.PNG -------------------------------------------------------------------------------- /3.Decision tree/entropy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/entropy.png -------------------------------------------------------------------------------- /3.Decision tree/entropy1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/entropy1.png -------------------------------------------------------------------------------- /3.Decision tree/entropy_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/entropy_tree.png -------------------------------------------------------------------------------- /3.Decision tree/example/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/1.png -------------------------------------------------------------------------------- /3.Decision tree/example/10.1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/10.1.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/10.2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/10.2.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/11.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/11.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/12.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/12.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/13.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/13.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/14.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/14.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/15.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/15.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/16.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/16.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/2.png -------------------------------------------------------------------------------- /3.Decision tree/example/3.1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/3.1.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/3.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/4.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/5.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/6.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/7.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/8.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/8.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/9.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/9.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/entropyVsgini.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/entropyVsgini.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/formula_entropy.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/formula_entropy.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/gini.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/gini.PNG -------------------------------------------------------------------------------- /3.Decision tree/example/inform_gain.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/example/inform_gain.PNG -------------------------------------------------------------------------------- /3.Decision tree/formula1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/formula1.png -------------------------------------------------------------------------------- /3.Decision tree/formula2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/formula2.png -------------------------------------------------------------------------------- /3.Decision tree/formula3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/formula3.png -------------------------------------------------------------------------------- /3.Decision tree/ginni.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/ginni.png -------------------------------------------------------------------------------- /3.Decision tree/hypr_params.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/hypr_params.PNG -------------------------------------------------------------------------------- /3.Decision tree/info_gain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/info_gain.png -------------------------------------------------------------------------------- /3.Decision tree/modelForPrediction.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/modelForPrediction.sav -------------------------------------------------------------------------------- /3.Decision tree/mytree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/mytree.png -------------------------------------------------------------------------------- /3.Decision tree/pca_model.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/pca_model.sav -------------------------------------------------------------------------------- /3.Decision tree/standardScalar.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/standardScalar.sav -------------------------------------------------------------------------------- /3.Decision tree/testing_pipeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/testing_pipeline.png -------------------------------------------------------------------------------- /3.Decision tree/tree_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/tree_example.png -------------------------------------------------------------------------------- /3.Decision tree/tree_explain.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/3.Decision tree/tree_explain.PNG -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/1.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/2.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/3.PNG -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/6.PNG -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/7.PNG -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/8.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/Ensemble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/Ensemble.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/MLApplicationFlow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/MLApplicationFlow.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/cv1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/cv1.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/cv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/cv2.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/cv3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/cv3.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/cv4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/cv4.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/dep1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/dep1.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/dep2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/dep2.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/dep3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/dep3.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/dep4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/dep4.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/dep5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/dep5.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/dep6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/dep6.png -------------------------------------------------------------------------------- /4.EnsembleLearning_And_RandomForest/modelForPrediction.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/4.EnsembleLearning_And_RandomForest/modelForPrediction.sav -------------------------------------------------------------------------------- /5.KNN/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/1.png -------------------------------------------------------------------------------- /5.KNN/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/10.png -------------------------------------------------------------------------------- /5.KNN/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/11.png -------------------------------------------------------------------------------- /5.KNN/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/12.png -------------------------------------------------------------------------------- /5.KNN/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/13.png -------------------------------------------------------------------------------- /5.KNN/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/14.png -------------------------------------------------------------------------------- /5.KNN/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/15.png -------------------------------------------------------------------------------- /5.KNN/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/2.png -------------------------------------------------------------------------------- /5.KNN/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/3.png -------------------------------------------------------------------------------- /5.KNN/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/4.png -------------------------------------------------------------------------------- /5.KNN/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/5.png -------------------------------------------------------------------------------- /5.KNN/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/6.png -------------------------------------------------------------------------------- /5.KNN/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/7.png -------------------------------------------------------------------------------- /5.KNN/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/8.png -------------------------------------------------------------------------------- /5.KNN/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/9.png -------------------------------------------------------------------------------- /5.KNN/MLApplicationFlow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/MLApplicationFlow.png -------------------------------------------------------------------------------- /5.KNN/app.py: -------------------------------------------------------------------------------- 1 | from wsgiref import simple_server 2 | from flask import Flask, request, app 3 | from flask import Response 4 | from flask_cors import CORS 5 | from logistic_deploy import predObj 6 | 7 | app = Flask(__name__) 8 | CORS(app) 9 | app.config['DEBUG'] = True 10 | 11 | 12 | class ClientApi: 13 | 14 | def __init__(self): 15 | self.predObj = predObj() 16 | 17 | @app.route("/predict", methods=['POST']) 18 | def predictRoute(): 19 | try: 20 | if request.json['data'] is not None: 21 | data = request.json['data'] 22 | print('data is: ', data) 23 | pred=predObj() 24 | res = pred.predict_log(data) 25 | 26 | #result = clntApp.predObj.predict_log(data) 27 | print('result is ',res) 28 | return Response(res) 29 | except ValueError: 30 | return Response("Value not found") 31 | except Exception as e: 32 | print('exception is ',e) 33 | return Response(e) 34 | 35 | 36 | if __name__ == "__main__": 37 | clntApp = ClientApi() 38 | host = '0.0.0.0' 39 | port = 5000 40 | app.run(debug=True) 41 | #httpd = simple_server.make_server(host, port, app) 42 | # print("Serving on %s %d" % (host, port)) 43 | #httpd.serve_forever() -------------------------------------------------------------------------------- /5.KNN/cv1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/cv1.png -------------------------------------------------------------------------------- /5.KNN/cv2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/cv2.png -------------------------------------------------------------------------------- /5.KNN/cv3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/cv3.png -------------------------------------------------------------------------------- /5.KNN/cv4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/cv4.png -------------------------------------------------------------------------------- /5.KNN/deploy/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/deploy/1.png -------------------------------------------------------------------------------- /5.KNN/deploy/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/deploy/2.png -------------------------------------------------------------------------------- /5.KNN/deploy/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/deploy/3.png -------------------------------------------------------------------------------- /5.KNN/deploy/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/deploy/4.png -------------------------------------------------------------------------------- /5.KNN/deploy/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/deploy/5.png -------------------------------------------------------------------------------- /5.KNN/deploy/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/5.KNN/deploy/6.png -------------------------------------------------------------------------------- /5.KNN/kNN_deployment/app.py: -------------------------------------------------------------------------------- 1 | import pickle 2 | from flask import Flask, request, app 3 | from flask import Response 4 | from flask_cors import CORS 5 | import pandas as pd 6 | from sklearn.neighbors import KNeighborsClassifier 7 | 8 | app = Flask(__name__) 9 | CORS(app) 10 | app.config['DEBUG'] = True 11 | 12 | def predict_log(dict_pred): 13 | with open("standardScalar.sav", 'rb') as f: 14 | scalar = pickle.load(f) 15 | 16 | with open("modelForPrediction.sav", 'rb') as f: 17 | model = pickle.load(f) 18 | 19 | data_df = pd.DataFrame(dict_pred,index=[1,]) 20 | scaled_data = scalar.transform(data_df) 21 | predict = model.predict(scaled_data) 22 | if predict[0] == 0: 23 | result = 'Non-Diabetic' 24 | else : 25 | result = 'Diabetic' 26 | 27 | return result 28 | 29 | 30 | @app.route("/predict", methods=['POST']) 31 | def predictRoute(): 32 | try: 33 | if request.json['data'] is not None: 34 | data = request.json['data'] 35 | print('data is: ', data) 36 | res = predict_log(data) 37 | print('result is ',res) 38 | return Response(res) 39 | except ValueError: 40 | return Response("Value not found") 41 | except Exception as e: 42 | print('exception is ',e) 43 | return Response(e) 44 | 45 | 46 | if __name__ == "__main__": 47 | host = '0.0.0.0' 48 | port = 5000 49 | app.run(debug=True) 50 | #httpd = simple_server.make_server(host, port, app) 51 | # print("Serving on %s %d" % (host, port)) 52 | #httpd.serve_forever() -------------------------------------------------------------------------------- /5.KNN/kNN_deployment/knn.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | from sklearn.neighbors import KNeighborsClassifier 4 | #Let's start with importing necessary libraries 5 | from sklearn.preprocessing import StandardScaler 6 | from sklearn.model_selection import train_test_split, GridSearchCV 7 | from sklearn.model_selection import KFold 8 | 9 | data = pd.read_csv("diabetes.csv") # Reading the Data 10 | data.head() 11 | 12 | # replacing zero values with the mean of the column 13 | data['BMI'] = data['BMI'].replace(0,data['BMI'].mean()) 14 | data['BloodPressure'] = data['BloodPressure'].replace(0,data['BloodPressure'].mean()) 15 | data['Glucose'] = data['Glucose'].replace(0,data['Glucose'].mean()) 16 | data['Insulin'] = data['Insulin'].replace(0,data['Insulin'].mean()) 17 | data['SkinThickness'] = data['SkinThickness'].replace(0,data['SkinThickness'].mean()) 18 | 19 | q = data['Pregnancies'].quantile(0.98) 20 | # we are removing the top 2% data from the Pregnancies column 21 | data_cleaned = data[data['Pregnancies'] shows most variance, PC2 shows 2nd most variance 22 | 23 | - why do we rotate the PC's 24 | Ans - Because if we dont rotate it, we'll have to find the dist between 2 points 25 | using euclidean dist which is problamatic in case of higher dimensions 26 | (curse of dimensionality) and it does not serve the purpose of PCA to 27 | reduce the calculation. Whereas after rotating when PC1 becomes the 28 | X - axis the calculation to find the dist between 2 data points is 29 | x2 - x1, which simpler than euclidean distance. 30 | 31 | - why clockwise and not anti - clockwise? 32 | Ans - if we have a +ve data point and we project it to PC1 and when we rotate 33 | it clockwise, the +ve stays +ve(x-axis), but if we rotate it in anticlockwise 34 | the +ve number beocmes -ve(negative x-axis). That is in anticlockwise 35 | rotation the signs will get inversed. 36 | 37 | - Apply PCA only on continous data and not on categorical data 38 | Scenario - lets say we have 200 continous and 100 categorical features 39 | 1.we separete the continous and categorical features an perform PCA on 40 | continous data. 41 | 2.Let's say we got 30 PC of 200 features. 42 | 3.Now we concat this 30 PC and 100 categorical columns and train the data 43 | using this features. 44 | 45 | - PCA will not necessarily increase the accuracy, that is not the job of the PCA, 46 | its main job is to reduce the training time by reducing the dimensionality. -------------------------------------------------------------------------------- /8.PCA/PCA_intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/PCA_intro.png -------------------------------------------------------------------------------- /8.PCA/PCA_intro1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/PCA_intro1.png -------------------------------------------------------------------------------- /8.PCA/axis_rotate.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/axis_rotate.PNG -------------------------------------------------------------------------------- /8.PCA/best_fit.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/best_fit.PNG -------------------------------------------------------------------------------- /8.PCA/covariance.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/covariance.PNG -------------------------------------------------------------------------------- /8.PCA/fig_code/ML_flow_chart.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tutorial Diagrams 3 | ----------------- 4 | 5 | This script plots the flow-charts used in the scikit-learn tutorials. 6 | """ 7 | 8 | import numpy as np 9 | import pylab as pl 10 | from matplotlib.patches import Circle, Rectangle, Polygon, Arrow, FancyArrow 11 | 12 | def create_base(box_bg = '#CCCCCC', 13 | arrow1 = '#88CCFF', 14 | arrow2 = '#88FF88', 15 | supervised=True): 16 | fig = pl.figure(figsize=(9, 6), facecolor='w') 17 | ax = pl.axes((0, 0, 1, 1), 18 | xticks=[], yticks=[], frameon=False) 19 | ax.set_xlim(0, 9) 20 | ax.set_ylim(0, 6) 21 | 22 | patches = [Rectangle((0.3, 3.6), 1.5, 1.8, zorder=1, fc=box_bg), 23 | Rectangle((0.5, 3.8), 1.5, 1.8, zorder=2, fc=box_bg), 24 | Rectangle((0.7, 4.0), 1.5, 1.8, zorder=3, fc=box_bg), 25 | 26 | Rectangle((2.9, 3.6), 0.2, 1.8, fc=box_bg), 27 | Rectangle((3.1, 3.8), 0.2, 1.8, fc=box_bg), 28 | Rectangle((3.3, 4.0), 0.2, 1.8, fc=box_bg), 29 | 30 | Rectangle((0.3, 0.2), 1.5, 1.8, fc=box_bg), 31 | 32 | Rectangle((2.9, 0.2), 0.2, 1.8, fc=box_bg), 33 | 34 | Circle((5.5, 3.5), 1.0, fc=box_bg), 35 | 36 | Polygon([[5.5, 1.7], 37 | [6.1, 1.1], 38 | [5.5, 0.5], 39 | [4.9, 1.1]], fc=box_bg), 40 | 41 | FancyArrow(2.3, 4.6, 0.35, 0, fc=arrow1, 42 | width=0.25, head_width=0.5, head_length=0.2), 43 | 44 | FancyArrow(3.75, 4.2, 0.5, -0.2, fc=arrow1, 45 | width=0.25, head_width=0.5, head_length=0.2), 46 | 47 | FancyArrow(5.5, 2.4, 0, -0.4, fc=arrow1, 48 | width=0.25, head_width=0.5, head_length=0.2), 49 | 50 | FancyArrow(2.0, 1.1, 0.5, 0, fc=arrow2, 51 | width=0.25, head_width=0.5, head_length=0.2), 52 | 53 | FancyArrow(3.3, 1.1, 1.3, 0, fc=arrow2, 54 | width=0.25, head_width=0.5, head_length=0.2), 55 | 56 | FancyArrow(6.2, 1.1, 0.8, 0, fc=arrow2, 57 | width=0.25, head_width=0.5, head_length=0.2)] 58 | 59 | if supervised: 60 | patches += [Rectangle((0.3, 2.4), 1.5, 0.5, zorder=1, fc=box_bg), 61 | Rectangle((0.5, 2.6), 1.5, 0.5, zorder=2, fc=box_bg), 62 | Rectangle((0.7, 2.8), 1.5, 0.5, zorder=3, fc=box_bg), 63 | FancyArrow(2.3, 2.9, 2.0, 0, fc=arrow1, 64 | width=0.25, head_width=0.5, head_length=0.2), 65 | Rectangle((7.3, 0.85), 1.5, 0.5, fc=box_bg)] 66 | else: 67 | patches += [Rectangle((7.3, 0.2), 1.5, 1.8, fc=box_bg)] 68 | 69 | for p in patches: 70 | ax.add_patch(p) 71 | 72 | pl.text(1.45, 4.9, "Training\nText,\nDocuments,\nImages,\netc.", 73 | ha='center', va='center', fontsize=14) 74 | 75 | pl.text(3.6, 4.9, "Feature\nVectors", 76 | ha='left', va='center', fontsize=14) 77 | 78 | pl.text(5.5, 3.5, "Machine\nLearning\nAlgorithm", 79 | ha='center', va='center', fontsize=14) 80 | 81 | pl.text(1.05, 1.1, "New Text,\nDocument,\nImage,\netc.", 82 | ha='center', va='center', fontsize=14) 83 | 84 | pl.text(3.3, 1.7, "Feature\nVector", 85 | ha='left', va='center', fontsize=14) 86 | 87 | pl.text(5.5, 1.1, "Predictive\nModel", 88 | ha='center', va='center', fontsize=12) 89 | 90 | if supervised: 91 | pl.text(1.45, 3.05, "Labels", 92 | ha='center', va='center', fontsize=14) 93 | 94 | pl.text(8.05, 1.1, "Expected\nLabel", 95 | ha='center', va='center', fontsize=14) 96 | pl.text(8.8, 5.8, "Supervised Learning Model", 97 | ha='right', va='top', fontsize=18) 98 | 99 | else: 100 | pl.text(8.05, 1.1, 101 | "Likelihood\nor Cluster ID\nor Better\nRepresentation", 102 | ha='center', va='center', fontsize=12) 103 | pl.text(8.8, 5.8, "Unsupervised Learning Model", 104 | ha='right', va='top', fontsize=18) 105 | 106 | 107 | 108 | def plot_supervised_chart(annotate=False): 109 | create_base(supervised=True) 110 | if annotate: 111 | fontdict = dict(color='r', weight='bold', size=14) 112 | pl.text(1.9, 4.55, 'X = vec.fit_transform(input)', 113 | fontdict=fontdict, 114 | rotation=20, ha='left', va='bottom') 115 | pl.text(3.7, 3.2, 'clf.fit(X, y)', 116 | fontdict=fontdict, 117 | rotation=20, ha='left', va='bottom') 118 | pl.text(1.7, 1.5, 'X_new = vec.transform(input)', 119 | fontdict=fontdict, 120 | rotation=20, ha='left', va='bottom') 121 | pl.text(6.1, 1.5, 'y_new = clf.predict(X_new)', 122 | fontdict=fontdict, 123 | rotation=20, ha='left', va='bottom') 124 | 125 | def plot_unsupervised_chart(): 126 | create_base(supervised=False) 127 | 128 | 129 | if __name__ == '__main__': 130 | plot_supervised_chart(False) 131 | plot_supervised_chart(True) 132 | plot_unsupervised_chart() 133 | pl.show() 134 | 135 | 136 | -------------------------------------------------------------------------------- /8.PCA/fig_code/__init__.py: -------------------------------------------------------------------------------- 1 | from .data import * 2 | from .figures import * 3 | 4 | from .sgd_separator import plot_sgd_separator 5 | from .linear_regression import plot_linear_regression 6 | from .helpers import plot_iris_knn 7 | -------------------------------------------------------------------------------- /8.PCA/fig_code/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/fig_code/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /8.PCA/fig_code/__pycache__/data.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/fig_code/__pycache__/data.cpython-37.pyc -------------------------------------------------------------------------------- /8.PCA/fig_code/__pycache__/figures.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/fig_code/__pycache__/figures.cpython-37.pyc -------------------------------------------------------------------------------- /8.PCA/fig_code/__pycache__/helpers.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/fig_code/__pycache__/helpers.cpython-37.pyc -------------------------------------------------------------------------------- /8.PCA/fig_code/__pycache__/linear_regression.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/fig_code/__pycache__/linear_regression.cpython-37.pyc -------------------------------------------------------------------------------- /8.PCA/fig_code/__pycache__/sgd_separator.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/fig_code/__pycache__/sgd_separator.cpython-37.pyc -------------------------------------------------------------------------------- /8.PCA/fig_code/data.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | 4 | def linear_data_sample(N=40, rseed=0, m=3, b=-2): 5 | rng = np.random.RandomState(rseed) 6 | 7 | x = 10 * rng.rand(N) 8 | dy = m / 2 * (1 + rng.rand(N)) 9 | y = m * x + b + dy * rng.randn(N) 10 | 11 | return (x, y, dy) 12 | 13 | 14 | def linear_data_sample_big_errs(N=40, rseed=0, m=3, b=-2): 15 | rng = np.random.RandomState(rseed) 16 | 17 | x = 10 * rng.rand(N) 18 | dy = m / 2 * (1 + rng.rand(N)) 19 | dy[20:25] *= 10 20 | y = m * x + b + dy * rng.randn(N) 21 | 22 | return (x, y, dy) 23 | 24 | 25 | def sample_light_curve(phased=True): 26 | from astroML.datasets import fetch_LINEAR_sample 27 | data = fetch_LINEAR_sample() 28 | t, y, dy = data[18525697].T 29 | 30 | if phased: 31 | P_best = 0.580313015651 32 | t /= P_best 33 | 34 | return (t, y, dy) 35 | 36 | 37 | def sample_light_curve_2(phased=True): 38 | from astroML.datasets import fetch_LINEAR_sample 39 | data = fetch_LINEAR_sample() 40 | t, y, dy = data[10022663].T 41 | 42 | if phased: 43 | P_best = 0.61596079804 44 | t /= P_best 45 | 46 | return (t, y, dy) 47 | 48 | -------------------------------------------------------------------------------- /8.PCA/fig_code/figures.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | import warnings 4 | 5 | 6 | def plot_venn_diagram(): 7 | fig, ax = plt.subplots(subplot_kw=dict(frameon=False, xticks=[], yticks=[])) 8 | ax.add_patch(plt.Circle((0.3, 0.3), 0.3, fc='red', alpha=0.5)) 9 | ax.add_patch(plt.Circle((0.6, 0.3), 0.3, fc='blue', alpha=0.5)) 10 | ax.add_patch(plt.Rectangle((-0.1, -0.1), 1.1, 0.8, fc='none', ec='black')) 11 | ax.text(0.2, 0.3, '$x$', size=30, ha='center', va='center') 12 | ax.text(0.7, 0.3, '$y$', size=30, ha='center', va='center') 13 | ax.text(0.0, 0.6, '$I$', size=30) 14 | ax.axis('equal') 15 | 16 | 17 | def plot_example_decision_tree(): 18 | fig = plt.figure(figsize=(10, 4)) 19 | ax = fig.add_axes([0, 0, 0.8, 1], frameon=False, xticks=[], yticks=[]) 20 | ax.set_title('Example Decision Tree: Animal Classification', size=24) 21 | 22 | def text(ax, x, y, t, size=20, **kwargs): 23 | ax.text(x, y, t, 24 | ha='center', va='center', size=size, 25 | bbox=dict(boxstyle='round', ec='k', fc='w'), **kwargs) 26 | 27 | text(ax, 0.5, 0.9, "How big is\nthe animal?", 20) 28 | text(ax, 0.3, 0.6, "Does the animal\nhave horns?", 18) 29 | text(ax, 0.7, 0.6, "Does the animal\nhave two legs?", 18) 30 | text(ax, 0.12, 0.3, "Are the horns\nlonger than 10cm?", 14) 31 | text(ax, 0.38, 0.3, "Is the animal\nwearing a collar?", 14) 32 | text(ax, 0.62, 0.3, "Does the animal\nhave wings?", 14) 33 | text(ax, 0.88, 0.3, "Does the animal\nhave a tail?", 14) 34 | 35 | text(ax, 0.4, 0.75, "> 1m", 12, alpha=0.4) 36 | text(ax, 0.6, 0.75, "< 1m", 12, alpha=0.4) 37 | 38 | text(ax, 0.21, 0.45, "yes", 12, alpha=0.4) 39 | text(ax, 0.34, 0.45, "no", 12, alpha=0.4) 40 | 41 | text(ax, 0.66, 0.45, "yes", 12, alpha=0.4) 42 | text(ax, 0.79, 0.45, "no", 12, alpha=0.4) 43 | 44 | ax.plot([0.3, 0.5, 0.7], [0.6, 0.9, 0.6], '-k') 45 | ax.plot([0.12, 0.3, 0.38], [0.3, 0.6, 0.3], '-k') 46 | ax.plot([0.62, 0.7, 0.88], [0.3, 0.6, 0.3], '-k') 47 | ax.plot([0.0, 0.12, 0.20], [0.0, 0.3, 0.0], '--k') 48 | ax.plot([0.28, 0.38, 0.48], [0.0, 0.3, 0.0], '--k') 49 | ax.plot([0.52, 0.62, 0.72], [0.0, 0.3, 0.0], '--k') 50 | ax.plot([0.8, 0.88, 1.0], [0.0, 0.3, 0.0], '--k') 51 | ax.axis([0, 1, 0, 1]) 52 | 53 | 54 | def visualize_tree(estimator, X, y, boundaries=True, 55 | xlim=None, ylim=None): 56 | estimator.fit(X, y) 57 | 58 | if xlim is None: 59 | xlim = (X[:, 0].min() - 0.1, X[:, 0].max() + 0.1) 60 | if ylim is None: 61 | ylim = (X[:, 1].min() - 0.1, X[:, 1].max() + 0.1) 62 | 63 | x_min, x_max = xlim 64 | y_min, y_max = ylim 65 | xx, yy = np.meshgrid(np.linspace(x_min, x_max, 100), 66 | np.linspace(y_min, y_max, 100)) 67 | Z = estimator.predict(np.c_[xx.ravel(), yy.ravel()]) 68 | 69 | # Put the result into a color plot 70 | Z = Z.reshape(xx.shape) 71 | plt.figure() 72 | plt.pcolormesh(xx, yy, Z, alpha=0.2, cmap='rainbow') 73 | plt.clim(y.min(), y.max()) 74 | 75 | # Plot also the training points 76 | plt.scatter(X[:, 0], X[:, 1], c=y, s=50, cmap='rainbow') 77 | plt.axis('off') 78 | 79 | plt.xlim(x_min, x_max) 80 | plt.ylim(y_min, y_max) 81 | plt.clim(y.min(), y.max()) 82 | 83 | # Plot the decision boundaries 84 | def plot_boundaries(i, xlim, ylim): 85 | if i < 0: 86 | return 87 | 88 | tree = estimator.tree_ 89 | 90 | if tree.feature[i] == 0: 91 | plt.plot([tree.threshold[i], tree.threshold[i]], ylim, '-k') 92 | plot_boundaries(tree.children_left[i], 93 | [xlim[0], tree.threshold[i]], ylim) 94 | plot_boundaries(tree.children_right[i], 95 | [tree.threshold[i], xlim[1]], ylim) 96 | 97 | elif tree.feature[i] == 1: 98 | plt.plot(xlim, [tree.threshold[i], tree.threshold[i]], '-k') 99 | plot_boundaries(tree.children_left[i], xlim, 100 | [ylim[0], tree.threshold[i]]) 101 | plot_boundaries(tree.children_right[i], xlim, 102 | [tree.threshold[i], ylim[1]]) 103 | 104 | if boundaries: 105 | plot_boundaries(0, plt.xlim(), plt.ylim()) 106 | 107 | 108 | def plot_tree_interactive(X, y): 109 | from sklearn.tree import DecisionTreeClassifier 110 | 111 | def interactive_tree(depth=1): 112 | clf = DecisionTreeClassifier(max_depth=depth, random_state=0) 113 | visualize_tree(clf, X, y) 114 | 115 | from IPython.html.widgets import interact 116 | return interact(interactive_tree, depth=[1, 5]) 117 | 118 | 119 | def plot_kmeans_interactive(min_clusters=1, max_clusters=6): 120 | from IPython.html.widgets import interact 121 | from sklearn.metrics.pairwise import euclidean_distances 122 | from sklearn.datasets.samples_generator import make_blobs 123 | 124 | with warnings.catch_warnings(): 125 | warnings.filterwarnings('ignore') 126 | 127 | X, y = make_blobs(n_samples=300, centers=4, 128 | random_state=0, cluster_std=0.60) 129 | 130 | def _kmeans_step(frame=0, n_clusters=4): 131 | rng = np.random.RandomState(2) 132 | labels = np.zeros(X.shape[0]) 133 | centers = rng.randn(n_clusters, 2) 134 | 135 | nsteps = frame // 3 136 | 137 | for i in range(nsteps + 1): 138 | old_centers = centers 139 | if i < nsteps or frame % 3 > 0: 140 | dist = euclidean_distances(X, centers) 141 | labels = dist.argmin(1) 142 | 143 | if i < nsteps or frame % 3 > 1: 144 | centers = np.array([X[labels == j].mean(0) 145 | for j in range(n_clusters)]) 146 | nans = np.isnan(centers) 147 | centers[nans] = old_centers[nans] 148 | 149 | 150 | # plot the data and cluster centers 151 | plt.scatter(X[:, 0], X[:, 1], c=labels, s=50, cmap='rainbow', 152 | vmin=0, vmax=n_clusters - 1); 153 | plt.scatter(old_centers[:, 0], old_centers[:, 1], marker='o', 154 | c=np.arange(n_clusters), 155 | s=200, cmap='rainbow') 156 | plt.scatter(old_centers[:, 0], old_centers[:, 1], marker='o', 157 | c='black', s=50) 158 | 159 | # plot new centers if third frame 160 | if frame % 3 == 2: 161 | for i in range(n_clusters): 162 | plt.annotate('', centers[i], old_centers[i], 163 | arrowprops=dict(arrowstyle='->', linewidth=1)) 164 | plt.scatter(centers[:, 0], centers[:, 1], marker='o', 165 | c=np.arange(n_clusters), 166 | s=200, cmap='rainbow') 167 | plt.scatter(centers[:, 0], centers[:, 1], marker='o', 168 | c='black', s=50) 169 | 170 | plt.xlim(-4, 4) 171 | plt.ylim(-2, 10) 172 | 173 | if frame % 3 == 1: 174 | plt.text(3.8, 9.5, "1. Reassign points to nearest centroid", 175 | ha='right', va='top', size=14) 176 | elif frame % 3 == 2: 177 | plt.text(3.8, 9.5, "2. Update centroids to cluster means", 178 | ha='right', va='top', size=14) 179 | 180 | 181 | return interact(_kmeans_step, frame=[0, 50], 182 | n_clusters=[min_clusters, max_clusters]) 183 | 184 | 185 | def plot_image_components(x, coefficients=None, mean=0, components=None, 186 | imshape=(8, 8), n_components=6, fontsize=12): 187 | if coefficients is None: 188 | coefficients = x 189 | 190 | if components is None: 191 | components = np.eye(len(coefficients), len(x)) 192 | 193 | mean = np.zeros_like(x) + mean 194 | 195 | 196 | fig = plt.figure(figsize=(1.2 * (5 + n_components), 1.2 * 2)) 197 | g = plt.GridSpec(2, 5 + n_components, hspace=0.3) 198 | 199 | def show(i, j, x, title=None): 200 | ax = fig.add_subplot(g[i, j], xticks=[], yticks=[]) 201 | ax.imshow(x.reshape(imshape), interpolation='nearest') 202 | if title: 203 | ax.set_title(title, fontsize=fontsize) 204 | 205 | show(slice(2), slice(2), x, "True") 206 | 207 | approx = mean.copy() 208 | show(0, 2, np.zeros_like(x) + mean, r'$\mu$') 209 | show(1, 2, approx, r'$1 \cdot \mu$') 210 | 211 | for i in range(0, n_components): 212 | approx = approx + coefficients[i] * components[i] 213 | show(0, i + 3, components[i], r'$c_{0}$'.format(i + 1)) 214 | show(1, i + 3, approx, 215 | r"${0:.2f} \cdot c_{1}$".format(coefficients[i], i + 1)) 216 | plt.gca().text(0, 1.05, '$+$', ha='right', va='bottom', 217 | transform=plt.gca().transAxes, fontsize=fontsize) 218 | 219 | show(slice(2), slice(-2, None), approx, "Approx") 220 | 221 | 222 | def plot_pca_interactive(data, n_components=6): 223 | from sklearn.decomposition import PCA 224 | from IPython.html.widgets import interact 225 | 226 | pca = PCA(n_components=n_components) 227 | Xproj = pca.fit_transform(data) 228 | 229 | def show_decomp(i=0): 230 | plot_image_components(data[i], Xproj[i], 231 | pca.mean_, pca.components_) 232 | 233 | interact(show_decomp, i=(0, data.shape[0] - 1)); 234 | -------------------------------------------------------------------------------- /8.PCA/fig_code/helpers.py: -------------------------------------------------------------------------------- 1 | """ 2 | Small helpers for code that is not shown in the notebooks 3 | """ 4 | 5 | from sklearn import neighbors, datasets, linear_model 6 | import pylab as pl 7 | import numpy as np 8 | from matplotlib.colors import ListedColormap 9 | 10 | # Create color maps for 3-class classification problem, as with iris 11 | cmap_light = ListedColormap(['#FFAAAA', '#AAFFAA', '#AAAAFF']) 12 | cmap_bold = ListedColormap(['#FF0000', '#00FF00', '#0000FF']) 13 | 14 | def plot_iris_knn(): 15 | iris = datasets.load_iris() 16 | X = iris.data[:, :2] # we only take the first two features. We could 17 | # avoid this ugly slicing by using a two-dim dataset 18 | y = iris.target 19 | 20 | knn = neighbors.KNeighborsClassifier(n_neighbors=3) 21 | knn.fit(X, y) 22 | 23 | x_min, x_max = X[:, 0].min() - .1, X[:, 0].max() + .1 24 | y_min, y_max = X[:, 1].min() - .1, X[:, 1].max() + .1 25 | xx, yy = np.meshgrid(np.linspace(x_min, x_max, 100), 26 | np.linspace(y_min, y_max, 100)) 27 | Z = knn.predict(np.c_[xx.ravel(), yy.ravel()]) 28 | 29 | # Put the result into a color plot 30 | Z = Z.reshape(xx.shape) 31 | pl.figure() 32 | pl.pcolormesh(xx, yy, Z, cmap=cmap_light) 33 | 34 | # Plot also the training points 35 | pl.scatter(X[:, 0], X[:, 1], c=y, cmap=cmap_bold) 36 | pl.xlabel('sepal length (cm)') 37 | pl.ylabel('sepal width (cm)') 38 | pl.axis('tight') 39 | 40 | 41 | def plot_polynomial_regression(): 42 | rng = np.random.RandomState(0) 43 | x = 2*rng.rand(100) - 1 44 | 45 | f = lambda t: 1.2 * t**2 + .1 * t**3 - .4 * t **5 - .5 * t ** 9 46 | y = f(x) + .4 * rng.normal(size=100) 47 | 48 | x_test = np.linspace(-1, 1, 100) 49 | 50 | pl.figure() 51 | pl.scatter(x, y, s=4) 52 | 53 | X = np.array([x**i for i in range(5)]).T 54 | X_test = np.array([x_test**i for i in range(5)]).T 55 | regr = linear_model.LinearRegression() 56 | regr.fit(X, y) 57 | pl.plot(x_test, regr.predict(X_test), label='4th order') 58 | 59 | X = np.array([x**i for i in range(10)]).T 60 | X_test = np.array([x_test**i for i in range(10)]).T 61 | regr = linear_model.LinearRegression() 62 | regr.fit(X, y) 63 | pl.plot(x_test, regr.predict(X_test), label='9th order') 64 | 65 | pl.legend(loc='best') 66 | pl.axis('tight') 67 | pl.title('Fitting a 4th and a 9th order polynomial') 68 | 69 | pl.figure() 70 | pl.scatter(x, y, s=4) 71 | pl.plot(x_test, f(x_test), label="truth") 72 | pl.axis('tight') 73 | pl.title('Ground truth (9th order polynomial)') 74 | 75 | 76 | -------------------------------------------------------------------------------- /8.PCA/fig_code/linear_regression.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | from sklearn.linear_model import LinearRegression 4 | 5 | 6 | def plot_linear_regression(): 7 | a = 0.5 8 | b = 1.0 9 | 10 | # x from 0 to 10 11 | x = 30 * np.random.random(20) 12 | 13 | # y = a*x + b with noise 14 | y = a * x + b + np.random.normal(size=x.shape) 15 | 16 | # create a linear regression classifier 17 | clf = LinearRegression() 18 | clf.fit(x[:, None], y) 19 | 20 | # predict y from the data 21 | x_new = np.linspace(0, 30, 100) 22 | y_new = clf.predict(x_new[:, None]) 23 | 24 | # plot the results 25 | ax = plt.axes() 26 | ax.scatter(x, y) 27 | ax.plot(x_new, y_new) 28 | 29 | ax.set_xlabel('x') 30 | ax.set_ylabel('y') 31 | 32 | ax.axis('tight') 33 | 34 | 35 | if __name__ == '__main__': 36 | plot_linear_regression() 37 | plt.show() 38 | -------------------------------------------------------------------------------- /8.PCA/fig_code/sgd_separator.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import matplotlib.pyplot as plt 3 | from sklearn.linear_model import SGDClassifier 4 | from sklearn.datasets.samples_generator import make_blobs 5 | 6 | def plot_sgd_separator(): 7 | # we create 50 separable points 8 | X, Y = make_blobs(n_samples=50, centers=2, 9 | random_state=0, cluster_std=0.60) 10 | 11 | # fit the model 12 | clf = SGDClassifier(loss="hinge", alpha=0.01, 13 | n_iter=200, fit_intercept=True) 14 | clf.fit(X, Y) 15 | 16 | # plot the line, the points, and the nearest vectors to the plane 17 | xx = np.linspace(-1, 5, 10) 18 | yy = np.linspace(-1, 5, 10) 19 | 20 | X1, X2 = np.meshgrid(xx, yy) 21 | Z = np.empty(X1.shape) 22 | for (i, j), val in np.ndenumerate(X1): 23 | x1 = val 24 | x2 = X2[i, j] 25 | p = clf.decision_function(np.array([[x1, x2]])) 26 | Z[i, j] = p[0] 27 | levels = [-1.0, 0.0, 1.0] 28 | linestyles = ['dashed', 'solid', 'dashed'] 29 | colors = 'k' 30 | 31 | ax = plt.axes() 32 | ax.contour(X1, X2, Z, levels, colors=colors, linestyles=linestyles) 33 | ax.scatter(X[:, 0], X[:, 1], c=Y, cmap=plt.cm.Paired) 34 | 35 | ax.axis('tight') 36 | 37 | 38 | if __name__ == '__main__': 39 | plot_sgd_separator() 40 | plt.show() 41 | -------------------------------------------------------------------------------- /8.PCA/glass.data: -------------------------------------------------------------------------------- 1 | index,RI,Na,Mg,Al,Si,K,Ca,Ba,Fe,Class 2 | 1,1.52101,13.64,4.49,1.10,71.78,0.06,8.75,0.00,0.00,1 3 | 2,1.51761,13.89,3.60,1.36,72.73,0.48,7.83,0.00,0.00,1 4 | 3,1.51618,13.53,3.55,1.54,72.99,0.39,7.78,0.00,0.00,1 5 | 4,1.51766,13.21,3.69,1.29,72.61,0.57,8.22,0.00,0.00,1 6 | 5,1.51742,13.27,3.62,1.24,73.08,0.55,8.07,0.00,0.00,1 7 | 6,1.51596,12.79,3.61,1.62,72.97,0.64,8.07,0.00,0.26,1 8 | 7,1.51743,13.30,3.60,1.14,73.09,0.58,8.17,0.00,0.00,1 9 | 8,1.51756,13.15,3.61,1.05,73.24,0.57,8.24,0.00,0.00,1 10 | 9,1.51918,14.04,3.58,1.37,72.08,0.56,8.30,0.00,0.00,1 11 | 10,1.51755,13.00,3.60,1.36,72.99,0.57,8.40,0.00,0.11,1 12 | 11,1.51571,12.72,3.46,1.56,73.20,0.67,8.09,0.00,0.24,1 13 | 12,1.51763,12.80,3.66,1.27,73.01,0.60,8.56,0.00,0.00,1 14 | 13,1.51589,12.88,3.43,1.40,73.28,0.69,8.05,0.00,0.24,1 15 | 14,1.51748,12.86,3.56,1.27,73.21,0.54,8.38,0.00,0.17,1 16 | 15,1.51763,12.61,3.59,1.31,73.29,0.58,8.50,0.00,0.00,1 17 | 16,1.51761,12.81,3.54,1.23,73.24,0.58,8.39,0.00,0.00,1 18 | 17,1.51784,12.68,3.67,1.16,73.11,0.61,8.70,0.00,0.00,1 19 | 18,1.52196,14.36,3.85,0.89,71.36,0.15,9.15,0.00,0.00,1 20 | 19,1.51911,13.90,3.73,1.18,72.12,0.06,8.89,0.00,0.00,1 21 | 20,1.51735,13.02,3.54,1.69,72.73,0.54,8.44,0.00,0.07,1 22 | 21,1.51750,12.82,3.55,1.49,72.75,0.54,8.52,0.00,0.19,1 23 | 22,1.51966,14.77,3.75,0.29,72.02,0.03,9.00,0.00,0.00,1 24 | 23,1.51736,12.78,3.62,1.29,72.79,0.59,8.70,0.00,0.00,1 25 | 24,1.51751,12.81,3.57,1.35,73.02,0.62,8.59,0.00,0.00,1 26 | 25,1.51720,13.38,3.50,1.15,72.85,0.50,8.43,0.00,0.00,1 27 | 26,1.51764,12.98,3.54,1.21,73.00,0.65,8.53,0.00,0.00,1 28 | 27,1.51793,13.21,3.48,1.41,72.64,0.59,8.43,0.00,0.00,1 29 | 28,1.51721,12.87,3.48,1.33,73.04,0.56,8.43,0.00,0.00,1 30 | 29,1.51768,12.56,3.52,1.43,73.15,0.57,8.54,0.00,0.00,1 31 | 30,1.51784,13.08,3.49,1.28,72.86,0.60,8.49,0.00,0.00,1 32 | 31,1.51768,12.65,3.56,1.30,73.08,0.61,8.69,0.00,0.14,1 33 | 32,1.51747,12.84,3.50,1.14,73.27,0.56,8.55,0.00,0.00,1 34 | 33,1.51775,12.85,3.48,1.23,72.97,0.61,8.56,0.09,0.22,1 35 | 34,1.51753,12.57,3.47,1.38,73.39,0.60,8.55,0.00,0.06,1 36 | 35,1.51783,12.69,3.54,1.34,72.95,0.57,8.75,0.00,0.00,1 37 | 36,1.51567,13.29,3.45,1.21,72.74,0.56,8.57,0.00,0.00,1 38 | 37,1.51909,13.89,3.53,1.32,71.81,0.51,8.78,0.11,0.00,1 39 | 38,1.51797,12.74,3.48,1.35,72.96,0.64,8.68,0.00,0.00,1 40 | 39,1.52213,14.21,3.82,0.47,71.77,0.11,9.57,0.00,0.00,1 41 | 40,1.52213,14.21,3.82,0.47,71.77,0.11,9.57,0.00,0.00,1 42 | 41,1.51793,12.79,3.50,1.12,73.03,0.64,8.77,0.00,0.00,1 43 | 42,1.51755,12.71,3.42,1.20,73.20,0.59,8.64,0.00,0.00,1 44 | 43,1.51779,13.21,3.39,1.33,72.76,0.59,8.59,0.00,0.00,1 45 | 44,1.52210,13.73,3.84,0.72,71.76,0.17,9.74,0.00,0.00,1 46 | 45,1.51786,12.73,3.43,1.19,72.95,0.62,8.76,0.00,0.30,1 47 | 46,1.51900,13.49,3.48,1.35,71.95,0.55,9.00,0.00,0.00,1 48 | 47,1.51869,13.19,3.37,1.18,72.72,0.57,8.83,0.00,0.16,1 49 | 48,1.52667,13.99,3.70,0.71,71.57,0.02,9.82,0.00,0.10,1 50 | 49,1.52223,13.21,3.77,0.79,71.99,0.13,10.02,0.00,0.00,1 51 | 50,1.51898,13.58,3.35,1.23,72.08,0.59,8.91,0.00,0.00,1 52 | 51,1.52320,13.72,3.72,0.51,71.75,0.09,10.06,0.00,0.16,1 53 | 52,1.51926,13.20,3.33,1.28,72.36,0.60,9.14,0.00,0.11,1 54 | 53,1.51808,13.43,2.87,1.19,72.84,0.55,9.03,0.00,0.00,1 55 | 54,1.51837,13.14,2.84,1.28,72.85,0.55,9.07,0.00,0.00,1 56 | 55,1.51778,13.21,2.81,1.29,72.98,0.51,9.02,0.00,0.09,1 57 | 56,1.51769,12.45,2.71,1.29,73.70,0.56,9.06,0.00,0.24,1 58 | 57,1.51215,12.99,3.47,1.12,72.98,0.62,8.35,0.00,0.31,1 59 | 58,1.51824,12.87,3.48,1.29,72.95,0.60,8.43,0.00,0.00,1 60 | 59,1.51754,13.48,3.74,1.17,72.99,0.59,8.03,0.00,0.00,1 61 | 60,1.51754,13.39,3.66,1.19,72.79,0.57,8.27,0.00,0.11,1 62 | 61,1.51905,13.60,3.62,1.11,72.64,0.14,8.76,0.00,0.00,1 63 | 62,1.51977,13.81,3.58,1.32,71.72,0.12,8.67,0.69,0.00,1 64 | 63,1.52172,13.51,3.86,0.88,71.79,0.23,9.54,0.00,0.11,1 65 | 64,1.52227,14.17,3.81,0.78,71.35,0.00,9.69,0.00,0.00,1 66 | 65,1.52172,13.48,3.74,0.90,72.01,0.18,9.61,0.00,0.07,1 67 | 66,1.52099,13.69,3.59,1.12,71.96,0.09,9.40,0.00,0.00,1 68 | 67,1.52152,13.05,3.65,0.87,72.22,0.19,9.85,0.00,0.17,1 69 | 68,1.52152,13.05,3.65,0.87,72.32,0.19,9.85,0.00,0.17,1 70 | 69,1.52152,13.12,3.58,0.90,72.20,0.23,9.82,0.00,0.16,1 71 | 70,1.52300,13.31,3.58,0.82,71.99,0.12,10.17,0.00,0.03,1 72 | 71,1.51574,14.86,3.67,1.74,71.87,0.16,7.36,0.00,0.12,2 73 | 72,1.51848,13.64,3.87,1.27,71.96,0.54,8.32,0.00,0.32,2 74 | 73,1.51593,13.09,3.59,1.52,73.10,0.67,7.83,0.00,0.00,2 75 | 74,1.51631,13.34,3.57,1.57,72.87,0.61,7.89,0.00,0.00,2 76 | 75,1.51596,13.02,3.56,1.54,73.11,0.72,7.90,0.00,0.00,2 77 | 76,1.51590,13.02,3.58,1.51,73.12,0.69,7.96,0.00,0.00,2 78 | 77,1.51645,13.44,3.61,1.54,72.39,0.66,8.03,0.00,0.00,2 79 | 78,1.51627,13.00,3.58,1.54,72.83,0.61,8.04,0.00,0.00,2 80 | 79,1.51613,13.92,3.52,1.25,72.88,0.37,7.94,0.00,0.14,2 81 | 80,1.51590,12.82,3.52,1.90,72.86,0.69,7.97,0.00,0.00,2 82 | 81,1.51592,12.86,3.52,2.12,72.66,0.69,7.97,0.00,0.00,2 83 | 82,1.51593,13.25,3.45,1.43,73.17,0.61,7.86,0.00,0.00,2 84 | 83,1.51646,13.41,3.55,1.25,72.81,0.68,8.10,0.00,0.00,2 85 | 84,1.51594,13.09,3.52,1.55,72.87,0.68,8.05,0.00,0.09,2 86 | 85,1.51409,14.25,3.09,2.08,72.28,1.10,7.08,0.00,0.00,2 87 | 86,1.51625,13.36,3.58,1.49,72.72,0.45,8.21,0.00,0.00,2 88 | 87,1.51569,13.24,3.49,1.47,73.25,0.38,8.03,0.00,0.00,2 89 | 88,1.51645,13.40,3.49,1.52,72.65,0.67,8.08,0.00,0.10,2 90 | 89,1.51618,13.01,3.50,1.48,72.89,0.60,8.12,0.00,0.00,2 91 | 90,1.51640,12.55,3.48,1.87,73.23,0.63,8.08,0.00,0.09,2 92 | 91,1.51841,12.93,3.74,1.11,72.28,0.64,8.96,0.00,0.22,2 93 | 92,1.51605,12.90,3.44,1.45,73.06,0.44,8.27,0.00,0.00,2 94 | 93,1.51588,13.12,3.41,1.58,73.26,0.07,8.39,0.00,0.19,2 95 | 94,1.51590,13.24,3.34,1.47,73.10,0.39,8.22,0.00,0.00,2 96 | 95,1.51629,12.71,3.33,1.49,73.28,0.67,8.24,0.00,0.00,2 97 | 96,1.51860,13.36,3.43,1.43,72.26,0.51,8.60,0.00,0.00,2 98 | 97,1.51841,13.02,3.62,1.06,72.34,0.64,9.13,0.00,0.15,2 99 | 98,1.51743,12.20,3.25,1.16,73.55,0.62,8.90,0.00,0.24,2 100 | 99,1.51689,12.67,2.88,1.71,73.21,0.73,8.54,0.00,0.00,2 101 | 100,1.51811,12.96,2.96,1.43,72.92,0.60,8.79,0.14,0.00,2 102 | 101,1.51655,12.75,2.85,1.44,73.27,0.57,8.79,0.11,0.22,2 103 | 102,1.51730,12.35,2.72,1.63,72.87,0.70,9.23,0.00,0.00,2 104 | 103,1.51820,12.62,2.76,0.83,73.81,0.35,9.42,0.00,0.20,2 105 | 104,1.52725,13.80,3.15,0.66,70.57,0.08,11.64,0.00,0.00,2 106 | 105,1.52410,13.83,2.90,1.17,71.15,0.08,10.79,0.00,0.00,2 107 | 106,1.52475,11.45,0.00,1.88,72.19,0.81,13.24,0.00,0.34,2 108 | 107,1.53125,10.73,0.00,2.10,69.81,0.58,13.30,3.15,0.28,2 109 | 108,1.53393,12.30,0.00,1.00,70.16,0.12,16.19,0.00,0.24,2 110 | 109,1.52222,14.43,0.00,1.00,72.67,0.10,11.52,0.00,0.08,2 111 | 110,1.51818,13.72,0.00,0.56,74.45,0.00,10.99,0.00,0.00,2 112 | 111,1.52664,11.23,0.00,0.77,73.21,0.00,14.68,0.00,0.00,2 113 | 112,1.52739,11.02,0.00,0.75,73.08,0.00,14.96,0.00,0.00,2 114 | 113,1.52777,12.64,0.00,0.67,72.02,0.06,14.40,0.00,0.00,2 115 | 114,1.51892,13.46,3.83,1.26,72.55,0.57,8.21,0.00,0.14,2 116 | 115,1.51847,13.10,3.97,1.19,72.44,0.60,8.43,0.00,0.00,2 117 | 116,1.51846,13.41,3.89,1.33,72.38,0.51,8.28,0.00,0.00,2 118 | 117,1.51829,13.24,3.90,1.41,72.33,0.55,8.31,0.00,0.10,2 119 | 118,1.51708,13.72,3.68,1.81,72.06,0.64,7.88,0.00,0.00,2 120 | 119,1.51673,13.30,3.64,1.53,72.53,0.65,8.03,0.00,0.29,2 121 | 120,1.51652,13.56,3.57,1.47,72.45,0.64,7.96,0.00,0.00,2 122 | 121,1.51844,13.25,3.76,1.32,72.40,0.58,8.42,0.00,0.00,2 123 | 122,1.51663,12.93,3.54,1.62,72.96,0.64,8.03,0.00,0.21,2 124 | 123,1.51687,13.23,3.54,1.48,72.84,0.56,8.10,0.00,0.00,2 125 | 124,1.51707,13.48,3.48,1.71,72.52,0.62,7.99,0.00,0.00,2 126 | 125,1.52177,13.20,3.68,1.15,72.75,0.54,8.52,0.00,0.00,2 127 | 126,1.51872,12.93,3.66,1.56,72.51,0.58,8.55,0.00,0.12,2 128 | 127,1.51667,12.94,3.61,1.26,72.75,0.56,8.60,0.00,0.00,2 129 | 128,1.52081,13.78,2.28,1.43,71.99,0.49,9.85,0.00,0.17,2 130 | 129,1.52068,13.55,2.09,1.67,72.18,0.53,9.57,0.27,0.17,2 131 | 130,1.52020,13.98,1.35,1.63,71.76,0.39,10.56,0.00,0.18,2 132 | 131,1.52177,13.75,1.01,1.36,72.19,0.33,11.14,0.00,0.00,2 133 | 132,1.52614,13.70,0.00,1.36,71.24,0.19,13.44,0.00,0.10,2 134 | 133,1.51813,13.43,3.98,1.18,72.49,0.58,8.15,0.00,0.00,2 135 | 134,1.51800,13.71,3.93,1.54,71.81,0.54,8.21,0.00,0.15,2 136 | 135,1.51811,13.33,3.85,1.25,72.78,0.52,8.12,0.00,0.00,2 137 | 136,1.51789,13.19,3.90,1.30,72.33,0.55,8.44,0.00,0.28,2 138 | 137,1.51806,13.00,3.80,1.08,73.07,0.56,8.38,0.00,0.12,2 139 | 138,1.51711,12.89,3.62,1.57,72.96,0.61,8.11,0.00,0.00,2 140 | 139,1.51674,12.79,3.52,1.54,73.36,0.66,7.90,0.00,0.00,2 141 | 140,1.51674,12.87,3.56,1.64,73.14,0.65,7.99,0.00,0.00,2 142 | 141,1.51690,13.33,3.54,1.61,72.54,0.68,8.11,0.00,0.00,2 143 | 142,1.51851,13.20,3.63,1.07,72.83,0.57,8.41,0.09,0.17,2 144 | 143,1.51662,12.85,3.51,1.44,73.01,0.68,8.23,0.06,0.25,2 145 | 144,1.51709,13.00,3.47,1.79,72.72,0.66,8.18,0.00,0.00,2 146 | 145,1.51660,12.99,3.18,1.23,72.97,0.58,8.81,0.00,0.24,2 147 | 146,1.51839,12.85,3.67,1.24,72.57,0.62,8.68,0.00,0.35,2 148 | 147,1.51769,13.65,3.66,1.11,72.77,0.11,8.60,0.00,0.00,3 149 | 148,1.51610,13.33,3.53,1.34,72.67,0.56,8.33,0.00,0.00,3 150 | 149,1.51670,13.24,3.57,1.38,72.70,0.56,8.44,0.00,0.10,3 151 | 150,1.51643,12.16,3.52,1.35,72.89,0.57,8.53,0.00,0.00,3 152 | 151,1.51665,13.14,3.45,1.76,72.48,0.60,8.38,0.00,0.17,3 153 | 152,1.52127,14.32,3.90,0.83,71.50,0.00,9.49,0.00,0.00,3 154 | 153,1.51779,13.64,3.65,0.65,73.00,0.06,8.93,0.00,0.00,3 155 | 154,1.51610,13.42,3.40,1.22,72.69,0.59,8.32,0.00,0.00,3 156 | 155,1.51694,12.86,3.58,1.31,72.61,0.61,8.79,0.00,0.00,3 157 | 156,1.51646,13.04,3.40,1.26,73.01,0.52,8.58,0.00,0.00,3 158 | 157,1.51655,13.41,3.39,1.28,72.64,0.52,8.65,0.00,0.00,3 159 | 158,1.52121,14.03,3.76,0.58,71.79,0.11,9.65,0.00,0.00,3 160 | 159,1.51776,13.53,3.41,1.52,72.04,0.58,8.79,0.00,0.00,3 161 | 160,1.51796,13.50,3.36,1.63,71.94,0.57,8.81,0.00,0.09,3 162 | 161,1.51832,13.33,3.34,1.54,72.14,0.56,8.99,0.00,0.00,3 163 | 162,1.51934,13.64,3.54,0.75,72.65,0.16,8.89,0.15,0.24,3 164 | 163,1.52211,14.19,3.78,0.91,71.36,0.23,9.14,0.00,0.37,3 165 | 164,1.51514,14.01,2.68,3.50,69.89,1.68,5.87,2.20,0.00,5 166 | 165,1.51915,12.73,1.85,1.86,72.69,0.60,10.09,0.00,0.00,5 167 | 166,1.52171,11.56,1.88,1.56,72.86,0.47,11.41,0.00,0.00,5 168 | 167,1.52151,11.03,1.71,1.56,73.44,0.58,11.62,0.00,0.00,5 169 | 168,1.51969,12.64,0.00,1.65,73.75,0.38,11.53,0.00,0.00,5 170 | 169,1.51666,12.86,0.00,1.83,73.88,0.97,10.17,0.00,0.00,5 171 | 170,1.51994,13.27,0.00,1.76,73.03,0.47,11.32,0.00,0.00,5 172 | 171,1.52369,13.44,0.00,1.58,72.22,0.32,12.24,0.00,0.00,5 173 | 172,1.51316,13.02,0.00,3.04,70.48,6.21,6.96,0.00,0.00,5 174 | 173,1.51321,13.00,0.00,3.02,70.70,6.21,6.93,0.00,0.00,5 175 | 174,1.52043,13.38,0.00,1.40,72.25,0.33,12.50,0.00,0.00,5 176 | 175,1.52058,12.85,1.61,2.17,72.18,0.76,9.70,0.24,0.51,5 177 | 176,1.52119,12.97,0.33,1.51,73.39,0.13,11.27,0.00,0.28,5 178 | 177,1.51905,14.00,2.39,1.56,72.37,0.00,9.57,0.00,0.00,6 179 | 178,1.51937,13.79,2.41,1.19,72.76,0.00,9.77,0.00,0.00,6 180 | 179,1.51829,14.46,2.24,1.62,72.38,0.00,9.26,0.00,0.00,6 181 | 180,1.51852,14.09,2.19,1.66,72.67,0.00,9.32,0.00,0.00,6 182 | 181,1.51299,14.40,1.74,1.54,74.55,0.00,7.59,0.00,0.00,6 183 | 182,1.51888,14.99,0.78,1.74,72.50,0.00,9.95,0.00,0.00,6 184 | 183,1.51916,14.15,0.00,2.09,72.74,0.00,10.88,0.00,0.00,6 185 | 184,1.51969,14.56,0.00,0.56,73.48,0.00,11.22,0.00,0.00,6 186 | 185,1.51115,17.38,0.00,0.34,75.41,0.00,6.65,0.00,0.00,6 187 | 186,1.51131,13.69,3.20,1.81,72.81,1.76,5.43,1.19,0.00,7 188 | 187,1.51838,14.32,3.26,2.22,71.25,1.46,5.79,1.63,0.00,7 189 | 188,1.52315,13.44,3.34,1.23,72.38,0.60,8.83,0.00,0.00,7 190 | 189,1.52247,14.86,2.20,2.06,70.26,0.76,9.76,0.00,0.00,7 191 | 190,1.52365,15.79,1.83,1.31,70.43,0.31,8.61,1.68,0.00,7 192 | 191,1.51613,13.88,1.78,1.79,73.10,0.00,8.67,0.76,0.00,7 193 | 192,1.51602,14.85,0.00,2.38,73.28,0.00,8.76,0.64,0.09,7 194 | 193,1.51623,14.20,0.00,2.79,73.46,0.04,9.04,0.40,0.09,7 195 | 194,1.51719,14.75,0.00,2.00,73.02,0.00,8.53,1.59,0.08,7 196 | 195,1.51683,14.56,0.00,1.98,73.29,0.00,8.52,1.57,0.07,7 197 | 196,1.51545,14.14,0.00,2.68,73.39,0.08,9.07,0.61,0.05,7 198 | 197,1.51556,13.87,0.00,2.54,73.23,0.14,9.41,0.81,0.01,7 199 | 198,1.51727,14.70,0.00,2.34,73.28,0.00,8.95,0.66,0.00,7 200 | 199,1.51531,14.38,0.00,2.66,73.10,0.04,9.08,0.64,0.00,7 201 | 200,1.51609,15.01,0.00,2.51,73.05,0.05,8.83,0.53,0.00,7 202 | 201,1.51508,15.15,0.00,2.25,73.50,0.00,8.34,0.63,0.00,7 203 | 202,1.51653,11.95,0.00,1.19,75.18,2.70,8.93,0.00,0.00,7 204 | 203,1.51514,14.85,0.00,2.42,73.72,0.00,8.39,0.56,0.00,7 205 | 204,1.51658,14.80,0.00,1.99,73.11,0.00,8.28,1.71,0.00,7 206 | 205,1.51617,14.95,0.00,2.27,73.30,0.00,8.71,0.67,0.00,7 207 | 206,1.51732,14.95,0.00,1.80,72.99,0.00,8.61,1.55,0.00,7 208 | 207,1.51645,14.94,0.00,1.87,73.11,0.00,8.67,1.38,0.00,7 209 | 208,1.51831,14.39,0.00,1.82,72.86,1.41,6.47,2.88,0.00,7 210 | 209,1.51640,14.37,0.00,2.74,72.85,0.00,9.45,0.54,0.00,7 211 | 210,1.51623,14.14,0.00,2.88,72.61,0.08,9.18,1.06,0.00,7 212 | 211,1.51685,14.92,0.00,1.99,73.06,0.00,8.40,1.59,0.00,7 213 | 212,1.52065,14.36,0.00,2.02,73.42,0.00,8.44,1.64,0.00,7 214 | 213,1.51651,14.38,0.00,1.94,73.61,0.00,8.48,1.57,0.00,7 215 | 214,1.51711,14.23,0.00,2.08,73.36,0.00,8.62,1.67,0.00,7 216 | -------------------------------------------------------------------------------- /8.PCA/glass.names: -------------------------------------------------------------------------------- 1 | 1. Title: Glass Identification Database 2 | 3 | 2. Sources: 4 | (a) Creator: B. German 5 | -- Central Research Establishment 6 | Home Office Forensic Science Service 7 | Aldermaston, Reading, Berkshire RG7 4PN 8 | (b) Donor: Vina Spiehler, Ph.D., DABFT 9 | Diagnostic Products Corporation 10 | (213) 776-0180 (ext 3014) 11 | (c) Date: September, 1987 12 | 13 | 3. Past Usage: 14 | -- Rule Induction in Forensic Science 15 | -- Ian W. Evett and Ernest J. Spiehler 16 | -- Central Research Establishment 17 | Home Office Forensic Science Service 18 | Aldermaston, Reading, Berkshire RG7 4PN 19 | -- Unknown technical note number (sorry, not listed here) 20 | -- General Results: nearest neighbor held its own with respect to the 21 | rule-based system 22 | 23 | 4. Relevant Information:n 24 | Vina conducted a comparison test of her rule-based system, BEAGLE, the 25 | nearest-neighbor algorithm, and discriminant analysis. BEAGLE is 26 | a product available through VRS Consulting, Inc.; 4676 Admiralty Way, 27 | Suite 206; Marina Del Ray, CA 90292 (213) 827-7890 and FAX: -3189. 28 | In determining whether the glass was a type of "float" glass or not, 29 | the following results were obtained (# incorrect answers): 30 | 31 | Type of Sample Beagle NN DA 32 | Windows that were float processed (87) 10 12 21 33 | Windows that were not: (76) 19 16 22 34 | 35 | The study of classification of types of glass was motivated by 36 | criminological investigation. At the scene of the crime, the glass left 37 | can be used as evidence...if it is correctly identified! 38 | 39 | 5. Number of Instances: 214 40 | 41 | 6. Number of Attributes: 10 (including an Id#) plus the class attribute 42 | -- all attributes are continuously valued 43 | 44 | 7. Attribute Information: 45 | 1. Id number: 1 to 214 46 | 2. RI: refractive index 47 | 3. Na: Sodium (unit measurement: weight percent in corresponding oxide, as 48 | are attributes 4-10) 49 | 4. Mg: Magnesium 50 | 5. Al: Aluminum 51 | 6. Si: Silicon 52 | 7. K: Potassium 53 | 8. Ca: Calcium 54 | 9. Ba: Barium 55 | 10. Fe: Iron 56 | 11. Type of glass: (class attribute) 57 | -- 1 building_windows_float_processed 58 | -- 2 building_windows_non_float_processed 59 | -- 3 vehicle_windows_float_processed 60 | -- 4 vehicle_windows_non_float_processed (none in this database) 61 | -- 5 containers 62 | -- 6 tableware 63 | -- 7 headlamps 64 | 65 | 8. Missing Attribute Values: None 66 | 67 | Summary Statistics: 68 | Attribute: Min Max Mean SD Correlation with class 69 | 2. RI: 1.5112 1.5339 1.5184 0.0030 -0.1642 70 | 3. Na: 10.73 17.38 13.4079 0.8166 0.5030 71 | 4. Mg: 0 4.49 2.6845 1.4424 -0.7447 72 | 5. Al: 0.29 3.5 1.4449 0.4993 0.5988 73 | 6. Si: 69.81 75.41 72.6509 0.7745 0.1515 74 | 7. K: 0 6.21 0.4971 0.6522 -0.0100 75 | 8. Ca: 5.43 16.19 8.9570 1.4232 0.0007 76 | 9. Ba: 0 3.15 0.1750 0.4972 0.5751 77 | 10. Fe: 0 0.51 0.0570 0.0974 -0.1879 78 | 79 | 9. Class Distribution: (out of 214 total instances) 80 | -- 163 Window glass (building windows and vehicle windows) 81 | -- 87 float processed 82 | -- 70 building windows 83 | -- 17 vehicle windows 84 | -- 76 non-float processed 85 | -- 76 building windows 86 | -- 0 vehicle windows 87 | -- 51 Non-window glass 88 | -- 13 containers 89 | -- 9 tableware 90 | -- 29 headlamps 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /8.PCA/intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/intro.png -------------------------------------------------------------------------------- /8.PCA/move_average.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/move_average.PNG -------------------------------------------------------------------------------- /8.PCA/points.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/points.PNG -------------------------------------------------------------------------------- /8.PCA/projected_points.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/projected_points.PNG -------------------------------------------------------------------------------- /8.PCA/scree.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/scree.PNG -------------------------------------------------------------------------------- /8.PCA/table.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/8.PCA/table.PNG -------------------------------------------------------------------------------- /9.Naive_Bayes/Assignment/Naive_Bayes.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": null, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "1.\tWhat is conditional probability?\n" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": null, 22 | "metadata": {}, 23 | "outputs": [], 24 | "source": [] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": null, 29 | "metadata": {}, 30 | "outputs": [], 31 | "source": [ 32 | "\n", 33 | "2.\tDiscuss Bayes’s theorem." 34 | ] 35 | }, 36 | { 37 | "cell_type": "code", 38 | "execution_count": null, 39 | "metadata": {}, 40 | "outputs": [], 41 | "source": [] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": null, 46 | "metadata": {}, 47 | "outputs": [], 48 | "source": [ 49 | "\n", 50 | "3.\tExplain the step by step working of Naïve Bayes." 51 | ] 52 | }, 53 | { 54 | "cell_type": "code", 55 | "execution_count": null, 56 | "metadata": {}, 57 | "outputs": [], 58 | "source": [] 59 | }, 60 | { 61 | "cell_type": "code", 62 | "execution_count": null, 63 | "metadata": {}, 64 | "outputs": [], 65 | "source": [ 66 | "\n", 67 | "4.\tHow is Naïve Bayes different from other classification algorithms?" 68 | ] 69 | }, 70 | { 71 | "cell_type": "code", 72 | "execution_count": null, 73 | "metadata": {}, 74 | "outputs": [], 75 | "source": [] 76 | }, 77 | { 78 | "cell_type": "code", 79 | "execution_count": null, 80 | "metadata": {}, 81 | "outputs": [], 82 | "source": [ 83 | "\n", 84 | "5.\tWhy is the algorithm called Naïve Bayes?" 85 | ] 86 | }, 87 | { 88 | "cell_type": "code", 89 | "execution_count": null, 90 | "metadata": {}, 91 | "outputs": [], 92 | "source": [] 93 | }, 94 | { 95 | "cell_type": "code", 96 | "execution_count": null, 97 | "metadata": {}, 98 | "outputs": [], 99 | "source": [ 100 | "\n", 101 | "6.\tWhat is Gaussian Naïve Bayes?" 102 | ] 103 | }, 104 | { 105 | "cell_type": "code", 106 | "execution_count": null, 107 | "metadata": {}, 108 | "outputs": [], 109 | "source": [] 110 | }, 111 | { 112 | "cell_type": "code", 113 | "execution_count": null, 114 | "metadata": {}, 115 | "outputs": [], 116 | "source": [ 117 | "\n", 118 | "7.\tWhat are the advantages and disadvantages of Naïve Bayes?" 119 | ] 120 | }, 121 | { 122 | "cell_type": "code", 123 | "execution_count": null, 124 | "metadata": {}, 125 | "outputs": [], 126 | "source": [] 127 | } 128 | ], 129 | "metadata": { 130 | "kernelspec": { 131 | "display_name": "Python 3", 132 | "language": "python", 133 | "name": "python3" 134 | }, 135 | "language_info": { 136 | "codemirror_mode": { 137 | "name": "ipython", 138 | "version": 3 139 | }, 140 | "file_extension": ".py", 141 | "mimetype": "text/x-python", 142 | "name": "python", 143 | "nbconvert_exporter": "python", 144 | "pygments_lexer": "ipython3", 145 | "version": "3.7.4" 146 | } 147 | }, 148 | "nbformat": 4, 149 | "nbformat_minor": 4 150 | } 151 | -------------------------------------------------------------------------------- /9.Naive_Bayes/MLApplicationFlow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/MLApplicationFlow.png -------------------------------------------------------------------------------- /9.Naive_Bayes/__pycache__/nb_deploy.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/__pycache__/nb_deploy.cpython-37.pyc -------------------------------------------------------------------------------- /9.Naive_Bayes/app_creation.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/app_creation.PNG -------------------------------------------------------------------------------- /9.Naive_Bayes/application.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, request, app 2 | from flask import Response 3 | from flask_cors import CORS 4 | from nb_deploy import predObj 5 | 6 | application = Flask(__name__) # initializing a flask app 7 | app=application 8 | CORS(app) 9 | app.config['DEBUG'] = True 10 | 11 | 12 | class ClientApi: 13 | 14 | def __init__(self): 15 | self.predObj = predObj() 16 | 17 | @app.route("/predict", methods=['POST']) 18 | def predictRoute(): 19 | try: 20 | if request.json['data'] is not None: 21 | data = request.json['data'] 22 | print('data is: ', data) 23 | pred=predObj() 24 | res = pred.predict_log(data) 25 | 26 | #result = clntApp.predObj.predict_log(data) 27 | print('result is ',res) 28 | return Response(res) 29 | except ValueError: 30 | return Response("Value not found") 31 | except Exception as e: 32 | print('exception is ',e) 33 | return Response(e) 34 | 35 | 36 | if __name__ == "__main__": 37 | clntApp = ClientApi() 38 | host = '0.0.0.0' 39 | port = 5000 40 | app.run(debug=True) 41 | #httpd = simple_server.make_server(host, port, app) 42 | # print("Serving on %s %d" % (host, port)) 43 | #httpd.serve_forever() -------------------------------------------------------------------------------- /9.Naive_Bayes/aws_buildapp.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/aws_buildapp.PNG -------------------------------------------------------------------------------- /9.Naive_Bayes/fig1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/fig1.PNG -------------------------------------------------------------------------------- /9.Naive_Bayes/fig2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/fig2.PNG -------------------------------------------------------------------------------- /9.Naive_Bayes/fig3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/fig3.PNG -------------------------------------------------------------------------------- /9.Naive_Bayes/fig4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/fig4.PNG -------------------------------------------------------------------------------- /9.Naive_Bayes/final_result.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/final_result.PNG -------------------------------------------------------------------------------- /9.Naive_Bayes/for_deployment.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/for_deployment.zip -------------------------------------------------------------------------------- /9.Naive_Bayes/formula.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/formula.PNG -------------------------------------------------------------------------------- /9.Naive_Bayes/modelForPrediction.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/modelForPrediction.sav -------------------------------------------------------------------------------- /9.Naive_Bayes/nb_deploy.py: -------------------------------------------------------------------------------- 1 | #Let's start with importing necessary libraries 2 | import pickle 3 | import pandas as pd 4 | 5 | class predObj: 6 | 7 | def predict_log(self, dict_pred): 8 | with open("standardScalar.sav", 'rb') as f: 9 | scalar = pickle.load(f) 10 | 11 | with open("modelForPrediction.sav", 'rb') as f: 12 | model = pickle.load(f) 13 | data_df = pd.DataFrame(dict_pred,index=[1,]) 14 | scaled_data = scalar.transform(data_df) 15 | predict = model.predict(scaled_data) 16 | #predict = model.predict(data_df) 17 | if predict[0] ==1 : 18 | result = 'Diabetic' 19 | else: 20 | result ='Non-Diabetic' 21 | 22 | return result 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /9.Naive_Bayes/project_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/project_structure.png -------------------------------------------------------------------------------- /9.Naive_Bayes/requirements.txt: -------------------------------------------------------------------------------- 1 | certifi==2019.11.28 2 | Click==7.0 3 | Flask==1.1.1 4 | Flask-Cors==3.0.8 5 | itsdangerous==1.1.0 6 | Jinja2==2.10.3 7 | joblib==0.14.1 8 | MarkupSafe==1.1.1 9 | numpy==1.18.1 10 | pandas==0.25.3 11 | python-dateutil==2.8.1 12 | pytz==2019.3 13 | scikit-learn==0.22.1 14 | scipy==1.4.1 15 | six==1.14.0 16 | Werkzeug==0.16.0 17 | wincertstore==0.2 18 | -------------------------------------------------------------------------------- /9.Naive_Bayes/standardScalar.sav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/standardScalar.sav -------------------------------------------------------------------------------- /9.Naive_Bayes/testing_pipeline.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/testing_pipeline.PNG -------------------------------------------------------------------------------- /9.Naive_Bayes/zip.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/9.Naive_Bayes/zip.PNG -------------------------------------------------------------------------------- /Hyperparameter Tunning.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ankit-c2104/Machine-Learning-Notes/3c7fdf5fa47dbb8f16cf15a34e072722ddd49820/Hyperparameter Tunning.docx -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Machine-Learning-Notes 2 | This file contains notes on important concept of Machine Learning 3 | --------------------------------------------------------------------------------