create account

How to Predict Chronic Kidney Disease with Watson Machine Learning by cerebralace

View this thread on: hive.blogpeakd.comecency.com
· @cerebralace · (edited)
$2.92
How to Predict Chronic Kidney Disease with Watson Machine Learning
<html>
<p>Today, we will be analyzing a very common scenario in clinical medicine – chronic kidney disease. Without diving into nephrology class, chronic kidney disease is a condition that manifests in several chronic disorders, most notably in Type II Diabetes Mellitus, and is characterized by an increase in serum creatinine (well above the normal value of 1.2 mg/dL). We will be using the Watson Machine Learning service within IBM Data Science Experience to examine a sample data set from the <a href="https://archive.ics.uci.edu/ml/datasets/Chronic_Kidney_Disease">University of California, Irvine (UCI)</a>, which provides a detailed study of hospital admissions over time and includes the following parameters that are critical to diagnosing chronic kidney disease: the level of serum creatinine, which illustrates how well your kidneys can filter, the age of the patient and whether or not the patient has Type II Diabetes Mellitus. &nbsp;&nbsp;&nbsp;</p>
<p>For those of you unfamiliar with Data Science Experience (DSX), the following video should be instructional as well as very uplifting: &nbsp;&nbsp;</p>
<p>https://www.youtube.com/watch?v=1HjzkLRdP5k &nbsp;&nbsp;</p>
<p>Now without further ado, let’s start! &nbsp;&nbsp;</p>
<h1>Load the data &nbsp;&nbsp;</h1>
<p><br></br></p>
https://steemitimages.com/DQmbRWNevxpsTwd7Xv3xMqEKoUEUPXekpohBZ7f8pk7vSoV/Screen%20Shot%202017-06-21%20at%203.43.02%20PM.png 
<p><br></br></p>
<ol>
  <li>After you start DSX (if you haven’t already, <a href="datascience.ibm.com">sign up here</a> right now), first <strong>Open a new project</strong>. &nbsp;</li>
  <li>Go to the <a href="https://github.ibm.com/dap/dap-planning/files/13589/chronic_kidney_disease_file.csv.zip">GitHub repository</a> for the University of California, Irvine and download the <em>chronic_kidney_disease_full.csv</em> file to your computer.&nbsp;</li>
  <li>Take the downloaded dataset and load it into an <strong>Object Storage</strong> container in DSX.&nbsp;</li>
  <li>Also, add the data file to the <strong>Data Assets</strong> for your new project. &nbsp;</li>
  <li>Now instead of creating a notebook to run analytics, we will be building a model using the Watson Machine Learning (Watson ML) service. Thus, select <strong>Create model</strong>, enter a name and description, select <strong>Manual</strong> and then <strong>Create</strong>. We are selecting the Manual option for our ML model because I would like to show you the underlying process for generating a machine learning model. Next time, you can choose the Automatic option. ;)</li>
  <li>Choose the <em>chronic_kidney_disease_full.csv</em> data file and proceed with <strong>Next</strong>. &nbsp;</li>
</ol>
<h1>Transform the data &nbsp;&nbsp;</h1>
<p><br></br></p>
https://steemitimages.com/DQmcQrbuGJhjHeMhafqQyRmAKfPic7DMoXBBvXPizmmCvD7/Screen%20Shot%202017-06-21%20at%204.12.42%20PM.png 
<p><br></br></p>
<p>If we had chosen the automatic preparation option, then the service would have automatically selected a default set of transformers with which to transform our dataset. However since we are dealing with a lot of categorical data points, it is best to choose the Manual option in order for us to select our own transformers and estimators.&nbsp;</p>
<p>For this example, we will be first transforming our data with a <strong>StringIndexer</strong> transformer in order to convert the String fields to indices and then use a <strong>OneHotEncoder</strong> transformer; this is to ensure that the indices will continue to be represented as numbers instead of being organized by frequency. In general, whenever you are performing machine learning on any set of data, you must ensure that categorical data fields (those that are Strings) must be converted first to index form in order for them to be analyzed correctly by a machine learning algorithm. &nbsp;&nbsp;&nbsp;</p>
<ol>
  <li>First, select your transformer under the <strong>Prepare data set</strong> page by clicking <strong>Add a Transformer.</strong> Here you can first choose <strong>StringIndexer</strong> and upon clicking <strong>Configure</strong>, you can set the input column as “<strong>dm</strong>” (for diabetes mellitus) and the output column as “<strong>dm_code</strong>.” Don’t forget to hit <strong>Save</strong>!&nbsp;</li>
  <li>Now, select your next transformer by clicking <strong>Add a Transformer</strong> again and this time selecting <strong>OneHotEncoder</strong> followed by <strong>Configure</strong>. You can set the input column as “<strong>dm_code</strong>” and the output column as “<strong>dm_vector</strong>.” Hit <strong>Save</strong> to finalize your changes.&nbsp;</li>
  <li>As soon as you click <strong>Next</strong>, the data transformation will officially begin! &nbsp;&nbsp;</li>
</ol>
<p>When the data transformation is complete, you should be presented with the following screen displaying your current model: &nbsp;&nbsp;</p>
https://steemitimages.com/DQmSjitLNxRBpQZ3G2u6SRg1vWnB528RQFL35yZfQuwJX9E/Screen%20Shot%202017-06-21%20at%204.14.47%20PM.png
<h1>Train the data &nbsp;&nbsp;</h1>
<p><br></br></p>
https://steemitimages.com/DQmTQfvMFDzKa3TydmuqW2ZfpUDS6HPGy82UjPR75vpznPX/Screen%20Shot%202017-06-21%20at%204.16.55%20PM.png
<p><br></br></p>
<p>Undoubtedly the defining step in any machine learning analysis – picking your machine learning algorithm! Now if we had chosen the Automatic option, we would have seen the Cognitive Assistant in Data Science (CADS) select the most appropriate algorithm for our data. But since this is most likely your first rodeo with machine learning, I will be showing you how to manually select a machine learning algorithm to train your data. &nbsp;For our data set, we will be using logistic regression to build our machine learning model. Why logistic regression you ask? Well, logistic regression will allow you to use multiple variables to represent your dataset (we are looking at creatinine, age and diabetes after all!) and will also provide you with a nifty little value for estimating the strength of the prediction. &nbsp;&nbsp;&nbsp;</p>
<ol>
  <li>Under the <strong>Select a technique</strong> page, specify "class” for the label column.&nbsp;</li>
  <li>Select <strong>Binary classification</strong> for the technique.&nbsp;</li>
  <li>Click <strong>Add Estimators</strong> in order to include an estimator and here you will select <strong>Logistic Regression</strong> and click <strong>Add</strong>. Interestingly enough, logistic regression is listed here in the binary classification transformers and not in the list of those for regression.&nbsp;</li>
  <li>Leave the validation split at the default percentages and begin to train your model by clicking <strong>Next.</strong>&nbsp;</li>
  <li>Now you can navigate to the <strong>Select model</strong> page, where you can click on the model that you just created and save by clicking <strong>Save</strong> twice. &nbsp;&nbsp;</li>
</ol>
<h1>Deploy the model &nbsp;&nbsp;</h1>
<p><br></br></p>
https://yppaservicebroker-blue.ng.bluemix.net/images/ml-screen-1.png 
<p><br></br></p>
<p>Now that you’ve trained and created a model, you must deploy it in order to check our data and run some sample predictions. So let’s hop to it! &nbsp;&nbsp;</p>
<ol>
  <li>Go to the <strong>Deployments</strong> section on the model page and click <strong>Add Deployment.</strong>&nbsp;</li>
  <li>Choose the <strong>Online</strong> deployment option, type in a name for the deployment and specify 15 for the Average Requests and 100 for the Peak requests. &nbsp;</li>
  <li>Go ahead and click <strong>Deploy.</strong> &nbsp;</li>
  <li>Now that you have a deployed model, you can finally make some predictions!&nbsp;</li>
  <li>After you select your deployed model from the projects page, click to view the model and in the Details tab, locate the Scoring End Point, which you can use to supply test data.&nbsp;</li>
  <li>You can find <strong>Input Data</strong> in the <strong>Test API</strong> tab which you can feel free to change in order to see various predictions and click on the <strong>Predict</strong> button each time to check results. &nbsp;&nbsp;</li>
</ol>
<h1>You did it! &nbsp;&nbsp;</h1>
<p>Congratulations! In just a few painless steps, you have created your very own machine learning model that you can use to predict whether a certain patient has chronic kidney disease. If you have more time to play around with the tool, you will discover that there is a positive correlation between chronic kidney disease and all three of our parameters – serum creatinine, age and diabetes mellitus! Thus if either the serum creatinine or the age of a patient increases, especially a patient with Type II Diabetes Mellitus, the likelihood of chronic kidney disease goes up proportionally as well. &nbsp;&nbsp;</p>
<p>I hope you all learned something useful from today’s impromptu lab session! I plan to show you guys even more cool and interesting ways to leverage data science and technology to solve use-cases across various industries, so get even more excited! Looking forward to your thoughts and suggestions in the comments below. &nbsp;&nbsp;</p>
<p><strong>Image Sources:</strong>&nbsp;</p>
<ol>
  <li>Screenshot from https://archive.ics.uci.edu/ml/datasets/Chronic_Kidney_Disease</li>
  <li>Screenshots taken from <a href="datascience.ibm.com">IBM Data Science Experience</a> for a specific clinical scenario&nbsp;&nbsp;</li>
</ol>
<p><strong>Until next time, keep acing life!</strong> &nbsp;</p>
https://steemitimages.com/DQmS2xwQCmCy5BX4ewNjK9Rc5vrTrcEc9o83VG4kHs5jExN/YouTube%20channel%20art.png
</html>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorcerebralace
permlinkhow-to-predict-chronic-kidney-disease-with-watson-machine-learning
categorytechnology
json_metadata{"tags":["technology","science","blog","health","machine-learning"],"image":["https://img.youtube.com/vi/1HjzkLRdP5k/0.jpg","https://steemitimages.com/DQmbRWNevxpsTwd7Xv3xMqEKoUEUPXekpohBZ7f8pk7vSoV/Screen%20Shot%202017-06-21%20at%203.43.02%20PM.png","https://steemitimages.com/DQmcQrbuGJhjHeMhafqQyRmAKfPic7DMoXBBvXPizmmCvD7/Screen%20Shot%202017-06-21%20at%204.12.42%20PM.png","https://steemitimages.com/DQmSjitLNxRBpQZ3G2u6SRg1vWnB528RQFL35yZfQuwJX9E/Screen%20Shot%202017-06-21%20at%204.14.47%20PM.png","https://steemitimages.com/DQmTQfvMFDzKa3TydmuqW2ZfpUDS6HPGy82UjPR75vpznPX/Screen%20Shot%202017-06-21%20at%204.16.55%20PM.png","https://yppaservicebroker-blue.ng.bluemix.net/images/ml-screen-1.png","https://steemitimages.com/DQmS2xwQCmCy5BX4ewNjK9Rc5vrTrcEc9o83VG4kHs5jExN/YouTube%20channel%20art.png"],"links":["https://archive.ics.uci.edu/ml/datasets/Chronic_Kidney_Disease","https://www.youtube.com/watch?v=1HjzkLRdP5k","datascience.ibm.com","https://github.ibm.com/dap/dap-planning/files/13589/chronic_kidney_disease_file.csv.zip"],"app":"steemit/0.1","format":"html"}
created2017-06-21 20:59:39
last_update2017-06-22 06:13:27
depth0
children9
last_payout2017-06-28 20:59:39
cashout_time1969-12-31 23:59:59
total_payout_value2.366 HBD
curator_payout_value0.556 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length9,620
author_reputation4,663,797,600,203
root_title"How to Predict Chronic Kidney Disease with Watson Machine Learning"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id5,545,729
net_rshares215,871,809,998
author_curate_reward""
vote details (43)
@minnowsupport ·
<p>Congratulations!  This post has been upvoted from the communal account, @minnowsupport, by Ace from the Minnow Support Project.  It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, and someguy123.  The goal is to help Steemit grow by supporting Minnows and creating a social network.  Please find us in the <a href="https://discord.gg/HYj4yvw">Peace, Abundance, and Liberty Network (PALnet) Discord Channel</a>.  It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.</p>

<p>If you like what we're doing please upvote this comment so we can continue to build the community account that's supporting all members.</p>
properties (22)
authorminnowsupport
permlinkre-cerebralace-how-to-predict-chronic-kidney-disease-with-watson-machine-learning-20170621t211736954z
categorytechnology
json_metadata{"tags":["technology"],"app":"cosgrove/0.0.1"}
created2017-06-21 21:17:36
last_update2017-06-21 21:17:36
depth1
children0
last_payout2017-06-28 21:17:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length704
author_reputation148,902,805,319,183
root_title"How to Predict Chronic Kidney Disease with Watson Machine Learning"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id5,547,559
net_rshares0
@randowhale ·
$0.05
This post received a 1.1% upvote from @randowhale thanks to @allasyummyfood!  For more information, [click here](https://steemit.com/steemit/@randowhale/introducing-randowhale-will-you-get-the-100-vote-give-it-a-shot)!
👍  
properties (23)
authorrandowhale
permlinkre-how-to-predict-chronic-kidney-disease-with-watson-machine-learning-20170621t215130
categorytechnology
json_metadata"{"format": "markdown", "app": "randowhale/0.1"}"
created2017-06-21 21:51:30
last_update2017-06-21 21:51:30
depth1
children1
last_payout2017-06-28 21:51:30
cashout_time1969-12-31 23:59:59
total_payout_value0.052 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length218
author_reputation47,657,457,485,459
root_title"How to Predict Chronic Kidney Disease with Watson Machine Learning"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id5,550,809
net_rshares3,955,401,236
author_curate_reward""
vote details (1)
@cerebralace ·
WOW thanks @randowhale and even bigger thanks to @allasyummyfood! You absolutely rock!!!  I'm so honored to get my first @randowhale - cheers Alla!
properties (22)
authorcerebralace
permlinkre-randowhale-re-how-to-predict-chronic-kidney-disease-with-watson-machine-learning-20170621t215130-20170621t215331745z
categorytechnology
json_metadata{"tags":["technology"],"users":["randowhale","allasyummyfood"],"app":"steemit/0.1"}
created2017-06-21 21:53:30
last_update2017-06-21 21:53:30
depth2
children0
last_payout2017-06-28 21:53:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length147
author_reputation4,663,797,600,203
root_title"How to Predict Chronic Kidney Disease with Watson Machine Learning"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id5,550,993
net_rshares0
@richq11 ·
Well my friend... You got the upvote, but you lost me after the first paragraph! I'm currently fighting my doctor over Hep C... (which I don't have). Every time my liver test comes back off she insists it's Hep. I keep telling her I have Malaria... that's why the test is abnormal. Plus I don't have any symptoms! She says there aren't any. That's great... you want to treat me for something with no symptoms or adverse effects... Sounds great- for you!
properties (22)
authorrichq11
permlinkre-cerebralace-how-to-predict-chronic-kidney-disease-with-watson-machine-learning-20170621t220435157z
categorytechnology
json_metadata{"tags":["technology"],"app":"steemit/0.1"}
created2017-06-21 22:04:03
last_update2017-06-21 22:04:03
depth1
children5
last_payout2017-06-28 22:04:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length453
author_reputation393,276,103,934,313
root_title"How to Predict Chronic Kidney Disease with Watson Machine Learning"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id5,551,976
net_rshares0
@cerebralace ·
Lol that's exactly why I've decided to devote my efforts to improving medical technology, especially on the software side, instead of fighting a losing battle in the hospital and in the clinics, where the situation is always rigged against the patient unfortunately. 

Part of the problem is that medical schools these days aren't educating young doctors the right way to practice medicine - instead of teaching them how to perform a proper history and physical exam, they actually emphasize that you memorize all of the tests required to be ordered in every check-up!  As a result, most doctors in the States DO NOT know how to diagnose. Very sad indeed!

I'm glad you took the time to read my post and don't worry if you didn't understand it the first time around - this was a very technical post designed to be digested while playing along with DSX. You've inspired me now to write more about my experiences in medical school and explain what needs to be fixed in healthcare today. Thanks @richq11!
properties (22)
authorcerebralace
permlinkre-richq11-re-cerebralace-how-to-predict-chronic-kidney-disease-with-watson-machine-learning-20170621t221504015z
categorytechnology
json_metadata{"tags":["technology"],"users":["richq11"],"app":"steemit/0.1"}
created2017-06-21 22:15:03
last_update2017-06-21 22:15:03
depth2
children4
last_payout2017-06-28 22:15:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,001
author_reputation4,663,797,600,203
root_title"How to Predict Chronic Kidney Disease with Watson Machine Learning"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id5,553,009
net_rshares0
@richq11 ·
Med schools teach young doctors to TREAT rather than Cure... that's where the money is. Doctors are just becoming shills for big pharma
properties (22)
authorrichq11
permlinkre-cerebralace-re-richq11-re-cerebralace-how-to-predict-chronic-kidney-disease-with-watson-machine-learning-20170621t225342273z
categorytechnology
json_metadata{"tags":["technology"],"app":"steemit/0.1"}
created2017-06-21 22:53:06
last_update2017-06-21 22:53:06
depth3
children3
last_payout2017-06-28 22:53:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length135
author_reputation393,276,103,934,313
root_title"How to Predict Chronic Kidney Disease with Watson Machine Learning"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id5,556,427
net_rshares0