<jupyter_start><jupyter_text>* Bunch는 Dictionary를 따온 것임<jupyter_code>iris
x = iris.data
y = iris.target
x.shape, y.shape, type(x), type(y)<jupyter_output><empty_output><jupyter_text>* 타입명이 numpy이기 때문에 numpy 명령어만을 사용할 수 있다 / Pandas 명령어 등은 사용 불가함에 유의!<jupyter_code>import numpy as np
np.unique(y)<jupyter_output><empty_output><jupyter_text>* x는 독립변수, y는 종속변수<jupyter_code>from sklearn.model_selection import train_test_split
x, y
x_train, x_test, y_train,y_test = train_test_split(x, y)
x_train.shape, x_test.shape, y_train.shape, y_test.shape
from sklearn.linear_model import LogisticRegression
logR = LogisticRegression()
logR.fit(x_train, y_train)
logR.coef_, logR.intercept_<jupyter_output><empty_output><jupyter_text>* y = -0.40760465x1 + 0.92201009x2 -2.3062051x3 -0.99740765x4 + 8.98178884... 이렇게 3개의 직선식이 생성<jupyter_code>logR.predict_proba(x_train[100:104])
logR.predict(x_train[100:104])
from sklearn import metrics
y_pred = logR.predict(x_train)
y_pred.shape, y_train.shape
y_pred
y_train
metrics.classification_report(y_train, y_pred)
print(metrics.classification_report(y_train, y_pred))
metrics.confusion_matrix(y_train, y_pred)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11206159110350727, 'fraction_numerical': 0.05218135158254919, 'mean_word_length': 8.069767441860465, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '212866', 'license': 'Apache-2.0', 'n_tokens_mistral': 571, 'n_tokens_neox': 569, 'n_words': 86, 'path': 'iris_logisticregression.ipynb', 'repo_name': 'creamcheesesteak/test_machinelearning', 'size': '1169'}