Spaces:
Sleeping
Sleeping
Update cancer.py
Browse files
cancer.py
CHANGED
|
@@ -33,12 +33,12 @@ def preprocess_data(df):
|
|
| 33 |
]), categorical_features)
|
| 34 |
], remainder='passthrough')
|
| 35 |
|
| 36 |
-
|
| 37 |
y = df['Cancer_Present'] # Target column
|
| 38 |
-
return train_test_split(
|
| 39 |
|
| 40 |
# Train Model
|
| 41 |
-
def train_model(
|
| 42 |
models = {
|
| 43 |
'Decision Tree': DecisionTreeClassifier(),
|
| 44 |
'Logistic Regression': LogisticRegression(),
|
|
|
|
| 33 |
]), categorical_features)
|
| 34 |
], remainder='passthrough')
|
| 35 |
|
| 36 |
+
x = df.drop('Cancer_Present', axis=1) # Drop target column
|
| 37 |
y = df['Cancer_Present'] # Target column
|
| 38 |
+
return train_test_split(x, y, test_size=0.2, random_state=23), preprocess
|
| 39 |
|
| 40 |
# Train Model
|
| 41 |
+
def train_model(x_train, y_train, preprocess, model_name):
|
| 42 |
models = {
|
| 43 |
'Decision Tree': DecisionTreeClassifier(),
|
| 44 |
'Logistic Regression': LogisticRegression(),
|