{"id":14954475,"url":"https://github.com/tsimpdim/heart-disease","last_synced_at":"2026-03-14T13:04:20.628Z","repository":{"id":90663331,"uuid":"205548002","full_name":"TsimpDim/Heart-Disease","owner":"TsimpDim","description":"A Machine Learning approach on detecting heart disease","archived":false,"fork":false,"pushed_at":"2019-08-31T13:49:00.000Z","size":52,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T00:12:25.719Z","etag":null,"topics":["machine-learning","machinelearning","python","python3","statistical-learning","tensorflow","tensorflow-experiments","whatamidoing"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TsimpDim.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-31T13:28:02.000Z","updated_at":"2020-05-19T09:23:54.000Z","dependencies_parsed_at":"2023-07-09T03:45:27.907Z","dependency_job_id":null,"html_url":"https://github.com/TsimpDim/Heart-Disease","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"6a028b02d56418efcccad9aad6813e43ce40ddb1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TsimpDim%2FHeart-Disease","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TsimpDim%2FHeart-Disease/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TsimpDim%2FHeart-Disease/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TsimpDim%2FHeart-Disease/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TsimpDim","download_url":"https://codeload.github.com/TsimpDim/Heart-Disease/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243012664,"owners_count":20221606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["machine-learning","machinelearning","python","python3","statistical-learning","tensorflow","tensorflow-experiments","whatamidoing"],"created_at":"2024-09-24T13:03:42.470Z","updated_at":"2025-12-16T12:03:03.706Z","avatar_url":"https://github.com/TsimpDim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Heart Disease\n\nUsing examples from the [relevant Google course](https://developers.google.com/machine-learning/crash-course/ml-intro) `heart-disease.py` shows an effort to predict heart disease in patients using the [UCI Dataset](https://archive.ics.uci.edu/ml/datasets/Heart+Disease) and [`Tensorflow`](https://www.tensorflow.org/).\nThis repo should more or less be treated as an example of a ML algorithm not working :wink:\n\n![?](https://i.kym-cdn.com/photos/images/newsfeed/000/234/765/b7e.jpg)\n\n### Things going wrong\nThis example really doesn't have a lot going for itself, however it was a good first step.\n\n* The sample data (300) is really not enough for predictions of this sort\n* The features themselves are very specific and there is a lot of them\n* Model overfits\n* Should probably use higher-level interfaces like `keras`\n\n### Example output\n```\npython3 heart-disease.py\n\n********** Sample Data **********\n\n     age  sex  cp  trestbps  chol  fbs  restecg  thalach  exang  oldpeak  slope  ca  thal  target\n32    44    1   1       130   219    0        0      188      0      0.0      2   0     2       1\n113   43    1   0       110   211    0        1      161      0      0.0      2   0     3       1\n221   55    1   0       140   217    0        1      111      1      5.6      0   0     3       0\n139   64    1   0       128   263    0        1      105      1      0.2      1   1     3       1\n151   71    0   0       112   149    0        1      125      0      1.6      1   0     2       1\n..   ...  ...  ..       ...   ...  ...      ...      ...    ...      ...    ...  ..   ...     ...\n93    54    0   1       132   288    1        0      159      1      0.0      2   1     2       1\n150   66    1   0       160   228    0        0      138      0      2.3      2   0     1       1\n112   64    0   2       140   313    0        1      133      0      0.2      2   0     3       1\n98    43    1   2       130   315    0        1      162      0      1.9      2   1     2       1\n203   68    1   2       180   274    1        0      150      1      1.6      1   0     3       0\n\n[303 rows x 14 columns]\n\n********** Description **********\n\n        age   sex    cp  trestbps  chol   fbs  restecg  thalach  exang  oldpeak  slope    ca  thal  target\ncount 303.0 303.0 303.0     303.0 303.0 303.0    303.0    303.0  303.0    303.0  303.0 303.0 303.0   303.0\nmean   54.4   0.7   1.0     131.6 246.3   0.1      0.5    149.6    0.3      1.0    1.4   0.7   2.3     0.5\nstd     9.1   0.5   1.0      17.5  51.8   0.4      0.5     22.9    0.5      1.2    0.6   1.0   0.6     0.5\nmin    29.0   0.0   0.0      94.0 126.0   0.0      0.0     71.0    0.0      0.0    0.0   0.0   0.0     0.0\n25%    47.5   0.0   0.0     120.0 211.0   0.0      0.0    133.5    0.0      0.0    1.0   0.0   2.0     0.0\n50%    55.0   1.0   1.0     130.0 240.0   0.0      1.0    153.0    0.0      0.8    1.0   0.0   2.0     1.0\n75%    61.0   1.0   2.0     140.0 274.5   0.0      1.0    166.0    1.0      1.6    2.0   1.0   3.0     1.0\nmax    77.0   1.0   3.0     200.0 564.0   1.0      2.0    202.0    1.0      6.2    2.0   4.0   3.0     1.0\n\n********** Training Model **********\n\nPeriod 0: 0.6843756228731918 0.691124163583721\nPeriod 1: 0.6652756149318683 0.6719344953134975\nPeriod 2: 0.6514210314225196 0.6579788043144807\nPeriod 3: 0.6403290075102784 0.6467800838236305\nPeriod 4: 0.6309682877789531 0.6373090153188931\nPeriod 5: 0.6228579913928365 0.6290863118622144\nPeriod 6: 0.6156909426076357 0.6218054346492188\nPeriod 7: 0.6092839660687579 0.6152840060390814\nPeriod 8: 0.6034780636858598 0.6093629584532761\nPeriod 9: 0.598165947397939 0.6039352436818675\nPeriod 10: 0.5932899243824563 0.5989437030177499\nPeriod 11: 0.5887859979525862 0.5943242633620437\nPeriod 12: 0.5846168458865866 0.5900401412391936\nPeriod 13: 0.5807349688889774 0.5860436288192699\nPeriod 14: 0.5771066699827863 0.5823011216758961\nPeriod 15: 0.5737155201842229 0.5787966427855701\nPeriod 16: 0.570521026239598 0.5754890635001646\nPeriod 17: 0.5675260194240582 0.572382273463638\nPeriod 18: 0.5647124365814402 0.5694581986882421\nPeriod 19: 0.5620510123777308 0.5666867496108104\nPeriod 20: 0.5595265737735989 0.5640529594891495\nPeriod 21: 0.5571498042189259 0.5615684315566639\nPeriod 22: 0.5549018259035892 0.5592140287749348\nPeriod 23: 0.5527639287462933 0.5569706065637489\nPeriod 24: 0.5507376578961869 0.5548400067629832\nPeriod 25: 0.5487996021972823 0.5527984042975036\nPeriod 26: 0.5469479830767151 0.5508437819761439\nPeriod 27: 0.5451965438547228 0.5489913592678084\nPeriod 28: 0.5435331293043427 0.5472284531451985\nPeriod 29: 0.541948537160021 0.5455457116538099\n\n********** Training Finished With **********\n\nlearning rate 5e-07\nsteps 500000\nbatch_size 10\n\n********** Weights **********\n\n\nglobal_step 500010\nlinear/linear_model/age/weights [[0.0005494]]\nlinear/linear_model/age/weights/part_0/Ftrl [[6.718108e+10]]\nlinear/linear_model/age/weights/part_0/Ftrl_1 [[-2.8480118e+08]]\nlinear/linear_model/bias_weights [0.00055954]\nlinear/linear_model/bias_weights/part_0/Ftrl [24626112.]\nlinear/linear_model/bias_weights/part_0/Ftrl_1 [-5553443.5]\nlinear/linear_model/ca/weights [[9.981024e-05]]\nlinear/linear_model/ca/weights/part_0/Ftrl [[5741845.5]]\nlinear/linear_model/ca/weights/part_0/Ftrl_1 [[-478333.56]]\nlinear/linear_model/chol/weights [[0.00055665]]\nlinear/linear_model/chol/weights/part_0/Ftrl [[1.3346874e+12]]\nlinear/linear_model/chol/weights/part_0/Ftrl_1 [[-1.2861844e+09]]\nlinear/linear_model/cp/weights [[0.00056528]]\nlinear/linear_model/cp/weights/part_0/Ftrl [[68083460.]]\nlinear/linear_model/cp/weights/part_0/Ftrl_1 [[-9328477.]]\nlinear/linear_model/exang/weights [[-9.899928e-05]]\nlinear/linear_model/exang/weights/part_0/Ftrl [[921382.3]]\nlinear/linear_model/exang/weights/part_0/Ftrl_1 [[190056.16]]\nlinear/linear_model/fbs/weights [[0.00034351]]\nlinear/linear_model/fbs/weights/part_0/Ftrl [[1407571.1]]\nlinear/linear_model/fbs/weights/part_0/Ftrl_1 [[-815094.9]]\nlinear/linear_model/oldpeak/weights [[0.00028214]]\nlinear/linear_model/oldpeak/weights/part_0/Ftrl [[10813546.]]\nlinear/linear_model/oldpeak/weights/part_0/Ftrl_1 [[-1855589.8]]\nlinear/linear_model/restecg/weights [[0.00055331]]\nlinear/linear_model/restecg/weights/part_0/Ftrl [[9823649.]]\nlinear/linear_model/restecg/weights/part_0/Ftrl_1 [[-3468432.5]]\nlinear/linear_model/sex/weights [[0.00047899]]\nlinear/linear_model/sex/weights/part_0/Ftrl [[8775053.]]\nlinear/linear_model/sex/weights/part_0/Ftrl_1 [[-2837810.8]]\nlinear/linear_model/slope/weights [[0.00057025]]\nlinear/linear_model/slope/weights/part_0/Ftrl [[66868464.]]\nlinear/linear_model/slope/weights/part_0/Ftrl_1 [[-9326202.]]\nlinear/linear_model/thal/weights [[0.00053834]]\nlinear/linear_model/thal/weights/part_0/Ftrl [[1.07644856e+08]]\nlinear/linear_model/thal/weights/part_0/Ftrl_1 [[-11170724.]]\nlinear/linear_model/thalach/weights [[0.00056917]]\nlinear/linear_model/thalach/weights/part_0/Ftrl [[6.533299e+11]]\nlinear/linear_model/thalach/weights/part_0/Ftrl_1 [[-9.201104e+08]]\nlinear/linear_model/trestbps/weights [[0.00055516]]\nlinear/linear_model/trestbps/weights/part_0/Ftrl [[4.1273852e+11]]\nlinear/linear_model/trestbps/weights/part_0/Ftrl_1 [[-7.1332506e+08]]\n```\n\n![RMSE over Periods](/Figure_1.png?raw=true \"RMSE over Periods\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsimpdim%2Fheart-disease","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsimpdim%2Fheart-disease","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsimpdim%2Fheart-disease/lists"}