首页 \ 问答 \ 使用GradientBoostedTrees和spark mllib可以获得类概率吗?(Is it possible to obtain class probabilities using GradientBoostedTrees with spark mllib?)

使用GradientBoostedTrees和spark mllib可以获得类概率吗?(Is it possible to obtain class probabilities using GradientBoostedTrees with spark mllib?)

我目前正在使用spark mllib。

我使用Gradient Boosting算法和类GradientBoostedTrees创建了一个文本分类器:

梯度提升树木

目前我获得预测以了解新元素的类别,但我想获得类别概率(硬判决之前的输出值)。

在其他mllib算法(如逻辑回归)中,您可以从分类器中删除阈值以获取类概率,但我找不到使用GradientBosstedTrees执行相同过程的方法。


I am currently working with spark mllib.

I have created a text classifier using the Gradient Boosting algorithm with the class GradientBoostedTrees:

Gradient Boosted Trees

Currently I obtain the predictions to know the class of new elements but I would like to obtain the class probabilities (the value of the output before the hard decision).

In other mllib algorithms like logistic regression you can remove the threshold from the classifier to obtain the class probabilities but I can not find a way to do the same procedure with GradientBosstedTrees.


原文:https://stackoverflow.com/questions/34208496
更新时间:2024-04-10 08:04

最满意答案

这个怎么样?

onCreate(){
  CustomView cv = new CustomView();
  ... draw something 
}

class CustomView{
   onDraw(){
   }
}

onCreate(){
  CustomView cv = new CustomView();
  cv.initialDraw = true;
}
class CustomView(
  boolean initialDraw = false;

  onDraw(){
    if(initialDraw){
      ...draw something
      initialDraw = false;
    }
  }
}

How about this?

onCreate(){
  CustomView cv = new CustomView();
  ... draw something 
}

class CustomView{
   onDraw(){
   }
}

to

onCreate(){
  CustomView cv = new CustomView();
  cv.initialDraw = true;
}
class CustomView(
  boolean initialDraw = false;

  onDraw(){
    if(initialDraw){
      ...draw something
      initialDraw = false;
    }
  }
}

相关问答

更多
  • 我添加了一个AsyncTask来加载图像,现在边距正确显示。 我仍然不知道为什么会这样,但确实如此。 我认为这是因为ProgressDialog强制视图重绘自己。 I added an AsyncTask to load the images, and now the margins are displayed correctly. I still don't know why this works, but it does. I think it is because a ProgressDialog f ...
  • 我认为这应该回答你的问题: http://developer.android.com/reference/android/view/ViewParent.html#requestLayout () “当某些事情发生了变化时,调用此视图父级的子级布局,这将调度视图树的布局传递。” I think this should answer your question: http://developer.android.com/reference/android/view/ViewParent.html#reques ...
  • 您需要创建一个varibale并从Activity中设置它。 例如: private int mHeight = 0; @Override protected void onDraw(Canvas canvas) { paint.setColor(Color.RED); paint2.setColor(Color.DKGRAY); canvas.drawRect(150, 0, 200, 150 + mHeight, paint); canvas.drawRect(20 ...
  • 每次在TextView上调用setText()时,UI工具包需要重新布局并重新绘制UI。 由于每次调用onDraw()时都是这样做的,所以基本上已经创建了一个无限的绘制循环。 在你的绘图方法中还有其他的问题:你不应该每次都做一个findViewById() ,你不应该每次都创建一个新的SimpleDateFormat ,你不应该每次都创建新的Date对象等等。 Every time you call setText() on a TextView the UI toolkit needs to relayo ...
  • 您没有设置正确的坐标。 table.setLeft(20)是从左边距到对象左边的值,table.setRight(30)是从对象的左边距到右边。 所以,总是table.setRight> table.SetLeft同样适用于顶部和底部。 You are not setting the coordinates right. table.setLeft(20) is the value from left margin to the left side of the object, table.setRight ...
  • 每33毫秒调用一次 您可以使用Handler来实现此功能。 每次DrawCanvas执行OnDraw方法时,都可以向Handler发送消息,当您在Handler收到消息时,可以调用DrawCanvas的Invalidate方法,此Invalidate方法将调用OnDraw方法。 它会继续下去。 例如 : class DrawCanvas : View { MyHandler mHandler; ... private void init(Context ctx) { ...
  • 好,我知道了。 问题是我使用PUREMVC Mediator和Notification。 在第一次加载时,一切都很好,因为返回DynamicForm C数据的异步方法是在我已经创建了VLayout B后发送成功通知,因此addMember方法添加并显示DynamicForm C. 在第二次加载时,我使用已经从DB收集的数据,因此在创建VLayout B之前没有处理异步方法并且通知到达,所以基本上没有绘制DynamicForm C. 我的解决方案:我重新排序了一些代码行,以确保我总是在页面创建之后调用通过No ...
  • 我通过扩展FrameLayout而不是RelativeLayout成功扩展我的布局,我不知道......如果有人能解释为什么它使用FrameLayout而不是RelativeLayout ... I succeed to scale my layout by extending FrameLayout instead of RelativeLayout and I don't know... If someone can explain why it's working with a FrameLayout ...
  • 这个怎么样? onCreate(){ CustomView cv = new CustomView(); ... draw something } class CustomView{ onDraw(){ } } 至 onCreate(){ CustomView cv = new CustomView(); cv.initialDraw = true; } class CustomView( boolean initialDraw = false; onDraw() ...
  • 正如亨利指出的那样,我最初的概念是一个坏主意。 一个更可行的架构是让TCP线程控制重绘,而不是让重绘线程控制TCP数据交换,特别是因为没有必要(至少在我的情况下)在TCP更新之间重绘屏幕。 因此,我在我的View对象的构造函数中实现了这个线程: (new Thread() { public void run() { while (looping) { try { // Get t ...

相关文章

更多

最新问答

更多
  • 您如何使用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)