<jupyter_start><jupyter_text><jupyter_code>import numpy as np
def onehotcylinder(cylinders):
  if cylinders == 3:
    cylinder = np.array([1,0,0,0,0])
  elif cylinders == 4:
    cylinder = np.array([0,1,0,0,0])
  elif cylinders == 5:
    cylinder = np.array([0,0,1,0,0])
  elif cylinders == 6:
    cylinder = np.array([0,0,0,1,0])
  else : # 8
    cylinder = np.array([0,0,0,0,1])  
  return cylinder
displacement = 307.0
horsepower = 130.0
weight = 3504.0
accel = 12.0
cylinders = 8
origin = 1

## if cylinders = 8, origin = 1 --> onehot encoding
import numpy as np

x_continus = np.array([displacement, horsepower, weight, accel])
# cylinder = np.array([0,0,0,0,1]) # 8
cylinder = onehotcylinder(cylinders)
org = np.array([1,0,0]) # 1
# np.concatenate((a, b), axis=None)
result = np.concatenate((x_continus, cylinder, org), axis=None)
result.shape, result
# [307.0,130.0,3504.0,12.0, 0,0,0,0,1]
# result.reshape(1, 12) 
result = result.reshape(-1, result.size)
result, result.shape, result.size,<jupyter_output><empty_output><jupyter_text>function 이해<jupyter_code>21 + 14
32 + 45
def sum():
  first = 32 
  second = 45
  result = first + second
  return result
sum()
# f01 = 32
# s02 = 21
def sum(f01, s02):
  first = s02 
  second = f01
  result = first + second
  return result, second, first
_, r02, r03 = sum(21,564)
print(r01, r02)
# def differenceVars(*var01, **args02)
def diffparam(*var_list, **var_dict):
  print(var_dict)
  result01 = len(var_list)
  return result01
diffparam(1,2,3, a=2, b=3)
diffparam(1,2,3,5,6, c=5, d=6, a=2, b=3)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16751269035532995, 'fraction_numerical': 0.09390862944162437, 'mean_word_length': 4.533333333333333, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, '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': '240107', 'license': 'Apache-2.0', 'n_tokens_mistral': 745, 'n_tokens_neox': 665, 'n_words': 146, 'path': 'python_function.ipynb', 'repo_name': 'SanghunOh/test_python', 'size': '1576'}