Desen tanıma

Sinir Ağları , Yüz Tanıma gibi uygulamalarda kullanılmaktadır.

Bu uygulamalar Örüntü Tanıma'yı kullanır .

Bu tür Sınıflandırma bir Perceptron ile yapılabilir .

Desen Sınıflandırma

Dağınık xy noktalarına sahip bir uzayda bir düz çizgi (doğrusal bir grafik) hayal edin.

Çizginin üstündeki ve altındaki noktaları nasıl sınıflandırabilirsiniz?

Bir algılayıcı, doğrunun formülünü bilmeden, doğru üzerindeki noktaları tanımak üzere eğitilebilir.

Algılayıcı

Bir Perceptron genellikle verileri iki parçaya sınıflandırmak için kullanılır.

Bir Perceptron, Lineer İkili Sınıflandırıcı olarak da bilinir.


Perceptron Nasıl Programlanır

Bir algılayıcının nasıl programlanacağı hakkında daha fazla bilgi edinmek için, aşağıdakileri yapacak çok basit bir JavaScript programı oluşturacağız:

  1. Basit bir çizici oluşturun
  2. 500 rastgele xy noktası oluşturun
  3. xy noktalarını göster
  4. Bir çizgi işlevi oluşturun: f(x)
  5. Çizgiyi göster
  6. İstenen cevapları hesaplayın
  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