使用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:
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
最满意答案
这个怎么样?
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 ...
-
使用onDraw方法ScaledRelativeLayout错误缩放(ScaledRelativeLayout wrong scale with the onDraw method)[2022-04-08]
我通过扩展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() ...
-
在Android中,我需要在onDraw()方法中通过TCP获取数据(In Android, I need to get data via TCP in an onDraw() method)[2022-03-30]
正如亨利指出的那样,我最初的概念是一个坏主意。 一个更可行的架构是让TCP线程控制重绘,而不是让重绘线程控制TCP数据交换,特别是因为没有必要(至少在我的情况下)在TCP更新之间重绘屏幕。 因此,我在我的View对象的构造函数中实现了这个线程: (new Thread() { public void run() { while (looping) { try { // Get t ...