<jupyter_start><jupyter_text>Data 중에서 object값은 확인하고 제거해야 한다<jupyter_code>pd_data.columns = ['mpg','cylinders','displacement','horsepower','weight',
              'acceleration','model year','origin','name']

pd_data<jupyter_output><empty_output><jupyter_text>x축과 y축을 어떤값을 선정할것인지 요구에 따라 선택해야 한다<jupyter_code>x = pd_data[['weight']]
y = pd_data[['mpg']]
x.shape , y.shape
from sklearn.model_selection import train_test_split
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 LinearRegression
lr = LinearRegression()<jupyter_output><empty_output><jupyter_text>https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html<jupyter_code># lr.fit(x,y)
lr.fit( X_train , Y_train)
# total data
lr.coef_ , lr.intercept_  # lr.coef_ x의 붙는 숫자 , lr.intercept_ 는 더해지는 숫자
# split data with 1 column
lr.coef_ , lr.intercept_<jupyter_output><empty_output><jupyter_text>y = -0.00767661x + 46.31736442<jupyter_code>lr.score(x,y)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13119266055045872, 'fraction_numerical': 0.01834862385321101, 'mean_word_length': 6.73758865248227, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 1, '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': '542802', 'license': 'Apache-2.0', 'n_tokens_mistral': 513, 'n_tokens_neox': 528, 'n_words': 70, 'path': 'autompg_col1_regression.ipynb', 'repo_name': 'Ethan-Jeong/test_machinelearning', 'size': '1090'}