首页 \ 问答 \ Python - 决策树和处理唯一标签/功能(Python - Decision Trees and Handling Unique Labels/features)

Python - 决策树和处理唯一标签/功能(Python - Decision Trees and Handling Unique Labels/features)

不确定标题是否完全正确,对此感到抱歉。 我是机器学习的新手,我正在使用Scikit和决策树。

这就是我想要做的; 我希望获取所有输入并包含一个独特的功能,即客户端ID。 现在,客户端ID是唯一的,无法以特征在决策树分析中的正常方式进行总结。 现在发生的事情是树正在将客户端ID作为任何其他整数值,然后将其分支,例如,客户端ID小于430的路径与430以上的路径不同。这不正确而不是我想要的去做。 我想做的是让决策树理解不能以这种方式分析特定字段,每个客户端都有自己的分支。 这可能与决策树有关吗?

我确实有一些解决方法,其中一个是为每个客户开发独特的决策树,但培训这将是一场噩梦。 我还可以做另一种解决方法,并且假设我们有800个客户端,我会用一个字段创建800个功能,但这也很疯狂。


Not sure if the title makes complete sense so sorry about that. I'm new to Machine Learning and I'm using Scikit and decision trees.

Here's what I want to do; I want to take all of my inputs and include a unique feature which is a client ID. Now, the client ID is unique and can't be summed up in the normal way a feature would in decision tree analysis. What's happening now is that the tree is taking the client ID's as any other integer value and then branching it saying for instance, client ID's less than 430 go in a different path than those over 430. This isn't correct and not what I want to do. What I want to do is make the decision tree understand that the specific field can't be analyzed in such a way and each client will have their own branch. Is this possible with decision trees?

I do have a couple workarounds, one of which would be to develop unique decision trees for each client but training this would be a nightmare. I could also do another workaround, and lets say we have 800 clients, I would create 800 features with a bit field, but this is also crazy.


原文:https://stackoverflow.com/questions/42373494
更新时间:2021-09-20 21:09

最满意答案

这个问题将有助于理解这种行为


this question will be helpful to understand this behavior

相关问答

更多
  • [C ++ 11标准。] 12.1.5。 如果类X没有用户声明的构造函数,则没有参数的构造函数被隐式声明为默认值(8.4)。 12..1 ......“如果它们使用得太多,那么实现将隐式定义它们”...... 因此,如果你删除apple::apple() ,实现可能不会创建apple::apple()除非它实际被调用,因此不需要引用fruit::fruit() 。 如上所述,代码不会调用apple::apple() 。 [ C++11 standard.] 12.1.5. If there is no us ...
  • 这适用于本机C ++,因为它使用链接器。 如果没有人要求,会对缺少的成员实施感到满意。 但是这在托管代码中不起作用,它不使用链接器。 您的类定义将复制到程序集元数据中,并且绑定会在运行时动态发生。 这要求所有声明的成员都有一个表示,否则元数据将不完整,并且不支持,因为这会破坏反射。 即使是私人会员。 没有什么特别难以解决的, {}对于私有构造函数来说是一个非常好的实现。 This works in native C++ because it uses a linker. Which is happy wit ...
  • 这个问题将有助于理解这种行为 this question will be helpful to understand this behavior
  • = default告诉编译器使用默认实现。 这也意味着您无法提供自己的 。 如果您不希望编译器创建一个,只需删除= default : class Fraction { // ... Fraction(const Fraction&); // NO =default }; 顺便说一句,“默认构造函数”是在您不提供任何参数时调用的构造函数,例如 Fraction my_frac; // default constructor called 如果要禁用默认构造函数,请使用=delete : clas ...
  • 它与移动构造函数无关。它与默认构造函数有关。 尝试这个: class Y { public: Y(const Y&) {} }; struct hasY { hasY() = default; hasY(hasY&&) = default; Y mem; }; hasY hy; // This will cause an error because there is no default constructor 现在,如果添加默认构造函数: Y(){} ,则错误将消失。 ...
  • 我认为你问的是错误的问题,而不是试图禁止初始化,你应该这样做,即拼写你的ctor: Foo(int a) : x((a==0) ? Bar(12,'a', 34) : Bar(13)) {} 这不会导致任何副本或移动(请参阅此处 ),并且不会产生任何惯用。 I think you are asking the wrong question, instead of trying to inhibit initialization, you should just do it, i.e. spell your ...
  • 禁用默认构造的集中方法是使默认构造函数不可访问。 你写道:“我想知道是否有解决方案来防止程序员编写代码(隐式或不是)使用默认拷贝构造函数,如果对象不是POD。” 大概你的意思是你希望编译器对任何非POD对象的默认构造做出反应。 对不起,没有与编译器无关的方式。 原因:诸如智能指针和容器(如std::vector很多非POD类依赖于缺省构造才有用。 g ++编译器有一个选项-Weffc++来警告违反Scott Meyers的Effective C ++指南 ,但据我所知 - 我可能是错的 - 这不包括你的情况 ...
  • 没有涉及虚拟继承,所以不能由C来构造A.因此,C的构造函数调用B的构造函数,B又调用A的构造函数。没有任何假定的访问说明符违规。 对于虚拟继承的情况,我们注意到从成员初始化列表中省略的子对象的构造由 [class.base.init / 9] 在非委托构造函数中,如果给定的可能构造的子对象不是由mem-initializer-id指定的(包括没有mem-initializer-list的情况,因为构造函数没有ctor-initializer),那么 ... ... 否则,实体默认初始化。 所以上面的子句似乎 ...
  • 如果您的Subset()类具有复制构造函数,那么您可以执行以下操作: std::vector::const_iterator it ; // use iterators for ( it = other.subsets.begin() ; it != other.subsets.end() ; ++it ) subset.push_back( new Subset( *it )) ; // add a copy of original subset. 如果您的Subset()没 ...
  • 它与COM无关,只是框架以这种方式构建,并且DirectShow BaseClasses中的构造函数参数是将所有内容组合在一起所必需的 - 类,祖先,实例化工厂。 使用COM类而不注册可能是也可能不可能。 我怀疑你可能有兴趣在没有注册的情况下使用DirectShow过滤器,并且有一篇关于该主题的好文章: 使用没有注册的过滤器 。 It has nothing to do with COM, it is just the framework is built this way and constructor ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)