knn分类 knn_对初学者有清晰了解的knn分类器项目

knn分类 knn

The best way to learn machine learning concepts is by doing a project. In this article, I am going to describe some key machine learning concepts using a project.

学习机器学习概念的最好方法是做一个项目。 在本文中,我将使用项目描述一些关键的机器学习概念。

In this article, I will explain a classification model in detail which is a major type of supervised machine learning. The model we will work on is called a KNN classifier as the title says.

在本文中,我将详细解释分类模型,这是监督型机器学习的主要类型。 如标题所示,我们将使用的模型称为KNN分类器。

The KNN classifier is a very popular and well known supervised machine learning technique. This article will explain the KNN classifier with a simple but complete project.

KNN分类器是一种非常流行且广为人知的监督式机器学习技术。 本文将通过一个简单但完整的项目来说明KNN分类器。

什么是监督学习模型? (What is a supervised learning model?)

I will explain it in detail. But here is what Wikipedia has to say:

我将详细解释。 但是,这是维基百科必须说的:

Supervised learning is the machine learning task of learning a function that maps an input to an output based on example input-output pairs. It infers a function from labeled training data consisting of a set of training examples.

监督学习是学习一个功能的机器学习任务,该功能基于示例输入-输出对将输入映射到输出。 它从标记的训练数据(由一组训练示例组成)中推断出功能。

Supervised learning models take input features (X) and output (y) to train a model. The goal of the model is to define a function that can use the input features and calculate the output.

监督学习模型采用输入特征(X)和输出(y)来训练模型。 该模型的目标是定义一个可以使用输入要素并计算输出的函数。

An example will make it more clear

一个例子将使其更加清晰

Here is a dataset that contains the mass, width, height, and color_score of some fruit samples.

这是一个数据集,其中包含一些水果样本的质量,宽度,高度和color_score。

Image for post

The purpose of this dataset was to train a model so that if we input the mass, width, height, and color-score to the model, the model can let us know the name of the fruit. Like if we input the mass, width, height, and color_score of a piece of fruit as 175, 7.3, 7.2, 0.61 respectively, the model should output the name of the fruit as an apple.

该数据集的目的是训练模型,以便我们在模型中输入质量,宽度,高度和颜色分数时,模型可以让我们知道水果的名称。 就像如果我们将一块水果的质量,宽度,高度和color_score分别输入为175、7.3、7.2、0.61一样,模型应该将水果的名称输出为苹果。

Here mass, width, height, and color_score are the input features(X). And the name of the fruit is the output variable or label(y).

质量,宽度,高度和color_score是输入要素(X)。 水果的名称是输出变量或label(y)。

This example may sound silly to you. But this is the mechanism that is used in very high level supervised machine learning models.

这个例子听起来很愚蠢。 但这是在非常高级的有监督的机器学习模型中使用的机制。

I will show a practical example with a real dataset later.

稍后,我将展示带有实际数据集的实际示例。

KNN分类器 (KNN Classifier)

The KNN classifier is an example of a memory-based machine learning model.

KNN分类器是基于内存的机器学习模型的示例。

That means this model memorizes the labeled training examples and they use that to classify the objects it hasn’t seen before.

这意味着该模型可以存储标记的训练示例,并使用它们对以前从未见过的对象进行分类。

The k in KNN classifier is the number of training examples it will retrieve in order to predict a new test example.

KNN分类器中的k是为了预测新的测试示例而将检索到的训练示例的数量。

KNN classifier works in three steps:

KNN分类器分为三个步骤:

  1. When it is given a new instance or example to classify, it will retrieve training examples that it m
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值