<jupyter_start><jupyter_text>Load Pickle with linear regression<jupyter_code>import pickle
lr = pickle.load(open('./saves/auto-mpg_lr.pkl','rb'))
type(lr)
scaler = pickle.load(open('./saves/autompg_standard_scaler.pkl','rb'))
type(scaler)<jupyter_output><empty_output><jupyter_text>Predict with Linear Regression<jupyter_code>displacement =  307.0
horsepower = 130.0
weight = 3504.0
accel = 12.0
cylinders = 8
origin = 1

if cylinders == 3:
  cylinder = [1,0,0,0,0]
elif cylinders == 4:
  cylinder = [0,1,0,0,0]
elif cylinders == 5:
  cylinder = [0,0,1,0,0]
elif cylinders == 6:
  cylinder =  [0,0,0,1,0]
elif cylinders == 8:
  cylinder =  [0,0,0,0,1]

if origin == 1:
  org = [1,0,0]
elif cylinders == 2:
  org = [0,1,0,]
else:
  org = [0,0,1]

x_custom = [[displacement,horsepower,weight, accel , cylinder , org]]

# [307.0 ,130.0 ,3504.0,12.0]]
x_custom
x_custom = scaler.transform(x_custom)
# x_custom.shape
# result = lr.predict(x_custom)
# result[0]
x_custom = scaler.transform([[307.0 ,130.0 ,3504.0,12.0, 0,0,0,0,1 ,1,0,0]])
x_custom.shape<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.181058495821727, 'fraction_numerical': 0.09285051067780872, 'mean_word_length': 5.341176470588235, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '595256', 'license': 'Apache-2.0', 'n_tokens_mistral': 531, 'n_tokens_neox': 482, 'n_words': 86, 'path': 'autompg_linearregression_service.ipynb', 'repo_name': 'Ethan-Jeong/test_visuallization', 'size': '1077'}