Train
Install the ModelFox CLI
If you haven't already, install the ModelFox CLI.
Get the data
The heart disease dataset contains information from cardiac patients such as their age, cholesterol, and stress test results. Below are some example rows.
age | gender | chest_pain | resting_blood_pressure | cholesterol | fasting_blood_sugar | resting_ecg_result | exercise_max_heart_rate | exercise_induced_angina | exercise_st_depression | exercise_st_slope | fluoroscopy_vessels_colored | thal | diagnosis |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
63 | male | typical angina | 145 | 233 | true | probable or definite left ventricular hypertrophy | 150 | no | 2.3 | downsloping | 0.0 | fixed defect | Negative |
67 | male | asymptomatic | 160 | 286 | false | probable or definite left ventricular hypertrophy | 108 | yes | 1.5 | flat | 3.0 | normal | Positive |
67 | male | asymptomatic | 120 | 229 | false | probable or definite left ventricular hypertrophy | 129 | yes | 2.6 | flat | 2.0 | reversible defect | Positive |
The last column, called diagnosis, is either Positive if the patient has heart disease or Negative if they don’t.
Train
We can train a model to predict the diagnosis column using the modelfox train command, passing in the path to the CSV file and the name of the column we want to predict, called the target column.
$ modelfox train --file heart_disease.csv --target diagnosis
The CLI automatically transforms the data into features, trains a number of models to predict the target column, and writes the best model to a .modelfox file. We can use this file to make predictions from our code.