엔드 투 엔드 Machine Learning
Joshua Stapleton
Machine Learning Engineer

로지스틱 회귀
sklearn.linear_model.LogisticRegression서포트 벡터 분류기
sklearn.svm.SVC의사결정나무
sklearn.tree.DecisionTreeClassifier랜덤 포레스트
sklearn.ensemble.RandomForestClassifier딥러닝 모델
K-최근접 이웃(KNN)
XGBoost
모델:
원칙:
sklearn.model_selection.train_test_split 사용 가능# Importing necessary libraries from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression# Split the data into training and testing sets (80:20) X_train, X_test, y_train, y_test = train_test_split(features, heart_disease_y, test_size=0.2, random_state=42)# Define the models logistic_model = LogisticRegression(max_iter=200)# Train the model logistic_model.fit(X_train, y_train)
# Jane Doe's health data, for example: [age, cholesterol level, blood pressure, etc.] jane_doe_data = [45, 230, 120, ...]# Reshape the data to 2D, because scikit-learn expects a 2D array-like input jane_doe_data = jane_doe_data.reshape(1, -1)# Use the model to predict Jane's heart disease diagnosis probabilities jane_doe_probabilities = logistic_model.predict_proba(jane_doe_data) jane_doe_prediction = logistic_model.predict(jane_doe_data)
# Print the probabilities
print(f"Jane Doe's predicted probabilities: {jane_doe_probabilities[0]}")
print(f"Jane Doe's predicted health condition: {jane_doe_prediction[0]}")
Jane Doe's predicted health condition probabilities: [0.2 0.8]Jane Doe's predicted health condition: 1
엔드 투 엔드 Machine Learning