패턴 인식

신경망 은 얼굴 인식과 같은 애플리케이션에 사용됩니다.

이러한 응용 프로그램은 패턴 인식 을 사용 합니다.

이러한 유형의 분류 는 Perceptron 으로 수행할 수 있습니다 .

패턴 분류

xy 포인트가 흩어져 있는 공간의 해협선(선형 그래프)을 상상해 보십시오.

선의 위와 아래에 있는 점을 어떻게 분류할 수 있습니까?

퍼셉트론은 선에 대한 공식을 몰라도 선 위의 점을 인식하도록 훈련될 수 있습니다.

퍼셉트론

퍼셉트론은 종종 데이터를 두 부분으로 분류하는 데 사용됩니다.

퍼셉트론은 선형 이진 분류기라고도 합니다.


퍼셉트론을 프로그래밍하는 방법

퍼셉트론을 프로그래밍하는 방법에 대해 더 배우기 위해 다음과 같은 매우 간단한 JavaScript 프로그램을 만들 것입니다.

  1. 간단한 플로터 만들기
  2. 500개의 임의 xy 포인트 생성
  3. xy 포인트 표시
  4. 라인 함수 생성: f(x)
  5. 라인 표시
  6. 원하는 답변을 계산
  7. Display the desired answers

Create a Simple Plotter

Use the simple plotter object described in the AI Plotter Chapter.

Example

const plotter = new XYPlotter("myCanvas");
plotter.transformXY();

const xMax = plotter.xMax;
const yMax = plotter.yMax;
const xMin = plotter.xMin;
const yMin = plotter.yMin;

Create Random X Y Points

Create as many xy points as wanted.

Let the x values be random, between 0 and maximum.

Let the y values be random, between 0 and maximum.

Display the points in the plotter:

Example

const numPoints = 500;
const xPoints = [];
const yPoints = [];
for (let i = 0; i < numPoints; i++) {
  xPoints[i] = Math.random() * xMax;
  yPoints[i] = Math.random() * yMax;
}


Create a Line Function

Display the line in the plotter:

Example

function f(x) {
  return x * 1.2 + 50;
}


Compute Desired Answers

Compute the desired answers based on the line function:

y = x * 1.2 + 50.

The desired answer is 1 if y is over the line and 0 if y is under the line.

Store the desired answers in an array (desired[]).

Example

let desired = [];
for (let i = 0; i < numPoints; i++) {
  desired[i] = 0;
  if (yPoints[i] > f(xPoints[i])) {desired[i] = 1;}
}

Display the Desired Answers

For each point, if desired[i] = 1 display a blue point, else display a black point.

Example

for (let i = 0; i < numPoints; i++) {
  let color = "blue";
  if (desired[i]) color = "black";
  plotter.plotPoint(xPoints[i], yPoints[i], color);
}


How to Train a Perceptron

In the next chapters, you will learn more about how to Train the Perceptron