<jupyter_start><jupyter_text><jupyter_code># 단층 퍼셉트론 AND 게이트
def AND_gate(x1, x2):
  w1=0.5 # 가중치1
  w2=0.5 # 가중치2
  b=-0.7 # 편향
  result=x1*w1 + x2*w2 + b
  if result <= 0:
    return 0
  else:
    return 1
AND_gate(0,0), AND_gate(0,1), AND_gate(1,0), AND_gate(1,1)
# NAND 게이트
def NAND_gate(x1, x2):
    w1=-0.5 #가중치1
    w2=-0.5 #가중치2
    b=0.7 #편향
    result = x1*w1 + x2*w2 + b
    if result <= 0:
        return 0
    else:
        return 1
NAND_gate(0,0), NAND_gate(0,1), NAND_gate(1,0), NAND_gate(1,1)
# OR 게이트
def OR_gate(x1, x2):
    w1=0.6
    w2=0.6
    b=-0.5
    result = x1*w1 + x2*w2 + b
    if result <= 0:
        return 0
    else:
        return 1
OR_gate(0,0), OR_gate(0,1), OR_gate(1,0), OR_gate(1,1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16644474034620507, 'fraction_numerical': 0.1051930758988016, 'mean_word_length': 2.598086124401914, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '287726', 'license': 'MIT', 'n_tokens_mistral': 425, 'n_tokens_neox': 446, 'n_words': 80, 'path': 'colab/Perceptron.ipynb', 'repo_name': 'cateto/python4NLP', 'size': '751'}