首页 \ 问答 \ Spark Streaming - 可以对数据流使用离线模型(Spark Streaming - Can an offline model be used against a data stream)

Spark Streaming - 可以对数据流使用离线模型(Spark Streaming - Can an offline model be used against a data stream)

在这个链接--LINK中 ,提到已经离线构建的机器学习模型可以用于对流数据进行测试。

摘自Apache Spark Streaming MLlib链接:

你也可以轻松使用MLlib提供的机器学习算法。首先,有流媒体机器学习算法(例如Streaming Linear Regression,Streaming KMeans等),它们可以同时学习流数据以及应用模型流媒体数据。 除此之外,对于更大类的机器学习算法,您可以离线学习学习模型(即使用历史数据),然后在线应用流数据模型。有关详细信息,请参阅MLlib指南。

  1. 这是否意味着可以使用像Spark中构建的Random Forest模型这样的复杂学习模型来测试Spark Streaming程序中的流数据? 它是否像引用已构建的“模型”一样简单,并在Spark Streaming程序中调用“predictOnValues()”?

  2. 在这种情况下,现有的火花流机器学习算法(AND)之间的主要区别是这种方法是流式算法将随着时间的推移而演变,而离线(对抗)在线流式方法仍然会使用它的见解早些时候学过没有任何在线学习的可能性?

我做对了吗? 如果我对上述两点的理解是正确的,请告诉我。


In this link - LINK, it is mentioned that a machine learning model which has been constructed offline can be used against streaming data for testing.

Excerpt from the Apache Spark Streaming MLlib link:

" You can also easily use machine learning algorithms provided by MLlib. First of all, there are streaming machine learning algorithms (e.g. Streaming Linear Regression, Streaming KMeans, etc.) which can simultaneously learn from the streaming data as well as apply the model on the streaming data. Beyond these, for a much larger class of machine learning algorithms, you can learn a learning model offline (i.e. using historical data) and then apply the model online on streaming data. See the MLlib guide for more details. "

  1. Does this mean that one can use a complex learning model like Random Forest model built in Spark for testing against streaming data in Spark Streaming program? Is it as simple as referring to the "Model" which has been built and calling "predictOnValues()" over it in Spark Streaming program?

  2. In this case, would the main difference between the existing spark streaming machine learning algorithms (AND) this approach be the fact that the streaming algorithms will evolve over time and the offline(against)online stream approach would still be using the insights from what it had learnt earlier without any possibility of online learning?

Am I getting this right? Please let me know if my understanding for both the points mentioned above is correct.


原文:https://stackoverflow.com/questions/40188693
更新时间:2023-08-23 19:08

最满意答案

您应该使用Handler进行此类操作。

让runnable在完成操作后发布消息,然后执行hview.postInvalidate(); 方法调用。

有很多指南如何做到这一点。

一些链接包括: http//developer.android.com/reference/android/os/Handler.html

http://androidexample.com/Thread_With_Handlers_-_Android_Example/index.php?view=article_discription&aid=58&aaid=83

http://www.vogella.com/tutorials/AndroidBackgroundProcessing/article.html


You should really use a Handler for this kind of operation.

Have the runnable post a message once it's done with it's operation and then do the hview.postInvalidate(); method call.

There are tons of guides how to do it.

Some links include: http://developer.android.com/reference/android/os/Handler.html

http://androidexample.com/Thread_With_Handlers_-_Android_Example/index.php?view=article_discription&aid=58&aaid=83

http://www.vogella.com/tutorials/AndroidBackgroundProcessing/article.html

相关问答

更多
  • 当在“主”线程中发生一些长时间的操作时,会发生ANR。 这是事件循环线程,如果它很忙,Android无法处理应用程序中的任何其他GUI事件,从而抛出ANR对话框。 现在,在你发布的跟踪中,主线程似乎做得很好,没有问题。 它在MessageQueue中空闲,等待另一个消息进来。在您的情况下,ANR可能是更长的操作,而不是永久阻止线程的事情,因此事件线程在操作完成后恢复,并且您的跟踪已经过去在ANR之后。 检测ANR发生的地方如果是永久性块(例如僵尸获取某些锁)是容易的,但如果只是暂时的延迟,则更难。 首先,查 ...
  • 您应该使用Handler进行此类操作。 让runnable在完成操作后发布消息,然后执行hview.postInvalidate(); 方法调用。 有很多指南如何做到这一点。 一些链接包括: http : //developer.android.com/reference/android/os/Handler.html http://androidexample.com/Thread_With_Handlers_-_Android_Example/index.php?view=article_discrip ...
  • 看起来像带有layout_height="wrap_content" NestedScrollView会破坏子级RecyclerViews所有优化。 无论来自具有layout_height="match_parent"的父视图( SwipeRefreshLayout )的约束如何,它都为它们提供了无限空间。 因此, RecyclerView会立即为适配器中的所有模型创建视图持有者。 记录显示,它们每个需要20-60ms才能为100行带来2-5秒滞后。 我们将记录添加到onCreateViewHolder() ...
  • 我面临着同样的问题,当我在调试时遇到代码“抛出RuntimeException”,但我也有一个ANR。 我拥有的唯一线索是它在我的应用程序中配置Google Analytics时开始发生。 这是你的情况吗,@ Alpha? 我没有超越,因为我有点像这样处理,但有一天我会用分析专门为这个问题进行调试。 编辑:该问题已在Google Play Services 8.4中解决。 我们终于可以报告未捕获的异常! 该应用程序似乎被阻止了几秒钟,但最终抛出异常并报告没有ANR。 I am facing the same ...
  • What is this leaked window? 您的案例中出现WindowLeaked exception是因为您在完成活动之前未MyProgressDialog 。 因此它泄漏了与之相关的内存。 一般情况: WindowLeaked exception通常发生在当某些异步任务在开始它的活动被完成之后完成时发生。这种类型的异常主要发生在Dialogs ,在活动上下文之前我们没有关闭对话框销毁。 因此,最好在显示对话框之前进行检查,如下所示: if(getActivity()!= null && ...
  • 根据您的描述,似乎在UI线程内调用bindService不是ANR的根本原因。 您应该调用bindService而不生成用户线程。 一个主要原因是,这会导致内存泄漏。 当配置发生变化时,只要线程仍处于活动状态,它就不会给Activity执行垃圾收集的机会。 这是因为您的用户线程仍然保持对Activity引用。 ANR根本原因应来自Recognizer或mConnection 。 如果您可以发布它们的实施细节,这可以帮助我们帮助您。 问自己以下问题 您是否在mConnection的onServiceConne ...
  • 我使用与Firebase和Google Play服务完全相同的ANR。 我在升级到Google Play Services 9.0.0,App Hangs in DynamiteModulesC中的答案解决了我的问题 - 删除了常规播放服务,只包含了您需要的特定播放服务库。 I had the exact same ANR as you using Firebase and Google Play Services. I solved my problem with the answer in After ...
  • 这个Runnable怎么能在这里阻止UI线程? Runnable没有阻塞主应用程序线程(又名“UI线程”)。 onSensorChanged()阻塞了主应用程序线程,因为在主应用程序线程上调用onSensorChanged() ,因此您在主应用程序线程上执行磁盘I / O. How could this Runnable be blocking the UI thread here? The Runnable is not blocking the main application thread (a.k. ...
  • 这似乎是游戏服务9+的问题。 我的第一个解决方法是回滚游戏服务到8.4.0,一切都恢复正常。 我一直在寻找解决方案,因为上面的内容并不能让我满意 我发现问题是具体的'通用游戏服务',我不明白为什么它适用于8.4.0而不是9+。 我的解决方案是删除下面的行 compile "com.google.android.gms:play-services:9.0.2" 并保持具体(这是最好的方式,无论问题有多少) compile "com.google.android.gms:play-services-analy ...
  • ANR(应用程序无响应)意味着您要锁定UI线程太长时间。 通常,这意味着您要在UI线程上进行网络调用或类似的事情。 Well don't I feel like a git this is the cause: at au.com.shiftyjelly.pocketcasts.server.x.onPostExecute(SourceFile:1) at android.os.AsyncTask.finish(AsyncTask.java:417) So everything is asynchr ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)