<jupyter_start><jupyter_text><jupyter_code>import numpy as np
np.__version__
displacement =  307.0
horsepower = 130.0
weight = 3504.0
accel = 12.0
cylinders = 8
origin = 1
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
onehotcylinder(4)
x_continus  = np.array([ displacement,horsepower,weight, accel ])
onehotcylinder(cylinders)
org = np.array([1,0,0]) # 1 
type(x_continus) , type(cylinder) , type(org) , cylinder
# np.concatenate((a, b), axis=None)
result = np.round(np.concatenate((x_continus, cylinder , org ), axis=None))

result.shape , result 
# result.reshape(1,12) # result.reshape(-1,result.size)
result = result.reshape(-1,result.size) # 
result
result.size  , result<jupyter_output><empty_output><jupyter_text>Function 이해<jupyter_code>first = 21
second = 14
first + second  

def sum(f01,s02):
  first = s02
  second = f01
  result = first + second  
  return result
sum(31,22)
def sum(f1,f2,f3):
  f = f1
  s = f2
  t = f3
  result = f * s * t
  return result
sum(21,32,2), sum(31,63,41)
def diffparam(*var_list, **var_dict): # * List , ** Dictionary
  
  print(var_dict)
  result01 = len(var_list)
  
  return result01
diffparam(1,2,3, a=2,b=3 )<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15456362425049966, 'fraction_numerical': 0.06662225183211193, 'mean_word_length': 4.383512544802867, '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': '330186', 'license': 'Apache-2.0', 'n_tokens_mistral': 680, 'n_tokens_neox': 628, 'n_words': 126, 'path': 'python_function.ipynb', 'repo_name': 'Ethan-Jeong/test_python', 'size': '1501'}