基于多特征的数据分类问题

2024-09-27 18:23:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图根据一些预先指定的标签对数据进行分类,得到如下4列:

room_class                          room_cluster  room_inb   room_view

Standard single sea view            Standard      single     sea
Deluxe twin Single                  Deluxe        single     -
Suite Superior room ocean view      Suite           -        ocean
Superior Double twin                Superior      Double     -
Deluxe Double room sea view         Deluxe        Double     sea

前面我研究了一个基于Knn分类器的学习模型,只有一个特征列,如下所示:

room_class                          room_cluster 

Standard single sea view            Standard    
Deluxe twin Single                  Deluxe        
Suite Superior room ocean view      Suite           
Superior Double twin                Superior      
Deluxe Double room sea view         Deluxe      

我首先将字符串值填充到数值上,所以'room\u class'将是'Y'集,'room\u cluster'将是具有相同结构的'X',然后在它们上面运行Knn。但是现在在我想使用的主数据中又添加了两行。如何组合这三行,即'room\u cluster,room\u inb,房间视图进入X,同时保持房间类别Y,然后在其上训练模型

示例:训练后,模型应将输入分类为以下输出。

输入:带海景的双人高级套房

预期产量
客房集群:高级
客房:双人房
客房景观:海洋

编辑:这是我针对单个功能集提出的问题:
Classification accuracy based on single Feature set


Tags: 模型viewtwinstandardclasssuiteroomdouble

热门问题