0Pricing
Deep Learning Academy · บทเรียน

เขียนเพอร์เซ็ปตรอนตั้งแต่ต้น

เซลล์ประสาทในโค้ด Python เพียงไม่กี่บรรทัด

เขียนเพอร์เซ็ปตรอนตั้งแต่ต้น เป็นบทเรียน Deep Learning Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Deep Learning Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

What Is a Perceptron

A perceptron is one neuron plus a learning rule. It is the original trainable building block of neural networks, and you can code it from scratch. 🛠️

Start with Weights

First create the weights and a bias. Starting them at zero is fine for a perceptron; learning will move them where they need to be.

weights = [0.0, 0.0]
bias = 0.0

Predict with a Step

The predict step computes the weighted sum, then applies the step function to return 0 or 1.

score = w[0]*x[0] + w[1]*x[1] + bias
return 1 if score >= 0 else 0

Measure the Error

Compare the prediction to the true label. The error is simply target minus prediction: 0 when right, plus or minus one when wrong.

error = target - prediction

The Update Rule

The update rule nudges each weight by the error times the input. Wrong guesses push the weights toward the correct answer.

w[i] += lr * error * x[i]

Update the Bias Too

The bias learns the same way, but its input is always 1. So you simply add the learning rate times the error.

bias += lr * error

The Learning Rate

The learning rate scales how big each update is. Small values learn slowly but steadily; large ones can overshoot the answer.

lr = 0.1

One Pass: an Epoch

Looping once over every training example is called an epoch. You usually repeat for several epochs until mistakes stop.

The Training Loop

Each step of training predicts, measures error, and updates the weights and bias. Repeat across the dataset to learn.

for x, target in data:
    err = target - predict(x)
    update(x, err)

It Learns AND

Feed it the AND truth table and the perceptron converges fast. Both inputs must be 1 for it to output 1.

Convergence Guarantee

If the data is linearly separable, the perceptron is guaranteed to find a separating line. That promise is the convergence theorem.

Quick Check

Recall how a perceptron corrects itself.

Recap

A perceptron predicts with a step, measures error, and updates weights by lr times error times input. Repeat over epochs and it learns separable data. ✅

คำถามที่พบบ่อย

บทเรียน “เขียนเพอร์เซ็ปตรอนตั้งแต่ต้น” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “เขียนเพอร์เซ็ปตรอนตั้งแต่ต้น” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Deep Learning Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “เขียนเพอร์เซ็ปตรอนตั้งแต่ต้น”

เซลล์ประสาทในโค้ด Python เพียงไม่กี่บรรทัด คุณปฏิบัติ Deep Learning Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Deep Learning Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Deep Learning Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน

บทเรียน “เขียนเพอร์เซ็ปตรอนตั้งแต่ต้น” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Deep Learning Academy นี้ได้ไหม

ได้ บทเรียน Deep Learning Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. น้ำหนัก ไบแอส และผลรวมถ่วงน้ำหนัก
  2. ฟังก์ชันขั้นบันไดและการตัดสินใจเชิงเส้น
  3. เขียนเพอร์เซ็ปตรอนตั้งแต่ต้น
  4. ปัญหา XOR: เหตุใดเซลล์ประสาทเดียวจึงไม่พอ
← กลับไปที่ Deep Learning Academy