Spark Structured Streaming and Spark-Ml Regression
Is it possible to apply Spark-Ml regression to streaming sources? I see there is StreamingLogisticRegressionWithSGD
but It's for older RDD API and I couldn't use It with structured streaming sources.
- How I'm supposed to apply regressions on structured streaming sources?
- (A little OT) If I cannot use streaming API for regression how can I commit offsets or so to source in a batch processing way? (Kafka sink)
apache-spark apache-spark-sql apache-spark-ml
add a comment |
Is it possible to apply Spark-Ml regression to streaming sources? I see there is StreamingLogisticRegressionWithSGD
but It's for older RDD API and I couldn't use It with structured streaming sources.
- How I'm supposed to apply regressions on structured streaming sources?
- (A little OT) If I cannot use streaming API for regression how can I commit offsets or so to source in a batch processing way? (Kafka sink)
apache-spark apache-spark-sql apache-spark-ml
add a comment |
Is it possible to apply Spark-Ml regression to streaming sources? I see there is StreamingLogisticRegressionWithSGD
but It's for older RDD API and I couldn't use It with structured streaming sources.
- How I'm supposed to apply regressions on structured streaming sources?
- (A little OT) If I cannot use streaming API for regression how can I commit offsets or so to source in a batch processing way? (Kafka sink)
apache-spark apache-spark-sql apache-spark-ml
Is it possible to apply Spark-Ml regression to streaming sources? I see there is StreamingLogisticRegressionWithSGD
but It's for older RDD API and I couldn't use It with structured streaming sources.
- How I'm supposed to apply regressions on structured streaming sources?
- (A little OT) If I cannot use streaming API for regression how can I commit offsets or so to source in a batch processing way? (Kafka sink)
apache-spark apache-spark-sql apache-spark-ml
apache-spark apache-spark-sql apache-spark-ml
asked Jan 14 '18 at 11:17
ReithReith
1,563819
1,563819
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Today (Spark 2.2 / 2.3) there is no support for machine learning in Structured Streaming and there is no ongoing work in this direction. Please follow SPARK-16424 to track future progress.
You can however:
Train iterative, non-distributed models using forEach sink and some form of external state storage. At a high level regression model could be implemented like this:
- Fetch latest model when calling
ForeachWriter.open
and initialize loss accumulator (not in a Spark sense, just local variable) for the partition. - Compute loss for each record in
ForeachWriter.process
and update accumulator. - Push loses to external store when calling
ForeachWriter.close
. - This would leave external storage in charge with computing gradient and updating model with implementation dependent on the store.
- Fetch latest model when calling
Try to hack SQL queries (see https://github.com/holdenk/spark-structured-streaming-ml by Holden Karau)
Thanks. Can you elaborate more about forEach method? As I understand It's a method to do some action (like writing to db) on eachRow
. But for applying regression I need to do some action (training and evaluating) on a dataset.
– Reith
Jan 14 '18 at 11:41
Thanks. I think I'll give up with streaming API since by external storage which computes gradients I feel I won't get any help from spark-ml.
– Reith
Jan 14 '18 at 11:50
True, although it might sound more serious than it is. After all with GD it is just a one line with any decent linear algebra lib. But if you're looking for built-in support in Structured Streaming there is none at the moment.
– hi-zir
Jan 14 '18 at 11:57
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48249017%2fspark-structured-streaming-and-spark-ml-regression%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Today (Spark 2.2 / 2.3) there is no support for machine learning in Structured Streaming and there is no ongoing work in this direction. Please follow SPARK-16424 to track future progress.
You can however:
Train iterative, non-distributed models using forEach sink and some form of external state storage. At a high level regression model could be implemented like this:
- Fetch latest model when calling
ForeachWriter.open
and initialize loss accumulator (not in a Spark sense, just local variable) for the partition. - Compute loss for each record in
ForeachWriter.process
and update accumulator. - Push loses to external store when calling
ForeachWriter.close
. - This would leave external storage in charge with computing gradient and updating model with implementation dependent on the store.
- Fetch latest model when calling
Try to hack SQL queries (see https://github.com/holdenk/spark-structured-streaming-ml by Holden Karau)
Thanks. Can you elaborate more about forEach method? As I understand It's a method to do some action (like writing to db) on eachRow
. But for applying regression I need to do some action (training and evaluating) on a dataset.
– Reith
Jan 14 '18 at 11:41
Thanks. I think I'll give up with streaming API since by external storage which computes gradients I feel I won't get any help from spark-ml.
– Reith
Jan 14 '18 at 11:50
True, although it might sound more serious than it is. After all with GD it is just a one line with any decent linear algebra lib. But if you're looking for built-in support in Structured Streaming there is none at the moment.
– hi-zir
Jan 14 '18 at 11:57
add a comment |
Today (Spark 2.2 / 2.3) there is no support for machine learning in Structured Streaming and there is no ongoing work in this direction. Please follow SPARK-16424 to track future progress.
You can however:
Train iterative, non-distributed models using forEach sink and some form of external state storage. At a high level regression model could be implemented like this:
- Fetch latest model when calling
ForeachWriter.open
and initialize loss accumulator (not in a Spark sense, just local variable) for the partition. - Compute loss for each record in
ForeachWriter.process
and update accumulator. - Push loses to external store when calling
ForeachWriter.close
. - This would leave external storage in charge with computing gradient and updating model with implementation dependent on the store.
- Fetch latest model when calling
Try to hack SQL queries (see https://github.com/holdenk/spark-structured-streaming-ml by Holden Karau)
Thanks. Can you elaborate more about forEach method? As I understand It's a method to do some action (like writing to db) on eachRow
. But for applying regression I need to do some action (training and evaluating) on a dataset.
– Reith
Jan 14 '18 at 11:41
Thanks. I think I'll give up with streaming API since by external storage which computes gradients I feel I won't get any help from spark-ml.
– Reith
Jan 14 '18 at 11:50
True, although it might sound more serious than it is. After all with GD it is just a one line with any decent linear algebra lib. But if you're looking for built-in support in Structured Streaming there is none at the moment.
– hi-zir
Jan 14 '18 at 11:57
add a comment |
Today (Spark 2.2 / 2.3) there is no support for machine learning in Structured Streaming and there is no ongoing work in this direction. Please follow SPARK-16424 to track future progress.
You can however:
Train iterative, non-distributed models using forEach sink and some form of external state storage. At a high level regression model could be implemented like this:
- Fetch latest model when calling
ForeachWriter.open
and initialize loss accumulator (not in a Spark sense, just local variable) for the partition. - Compute loss for each record in
ForeachWriter.process
and update accumulator. - Push loses to external store when calling
ForeachWriter.close
. - This would leave external storage in charge with computing gradient and updating model with implementation dependent on the store.
- Fetch latest model when calling
Try to hack SQL queries (see https://github.com/holdenk/spark-structured-streaming-ml by Holden Karau)
Today (Spark 2.2 / 2.3) there is no support for machine learning in Structured Streaming and there is no ongoing work in this direction. Please follow SPARK-16424 to track future progress.
You can however:
Train iterative, non-distributed models using forEach sink and some form of external state storage. At a high level regression model could be implemented like this:
- Fetch latest model when calling
ForeachWriter.open
and initialize loss accumulator (not in a Spark sense, just local variable) for the partition. - Compute loss for each record in
ForeachWriter.process
and update accumulator. - Push loses to external store when calling
ForeachWriter.close
. - This would leave external storage in charge with computing gradient and updating model with implementation dependent on the store.
- Fetch latest model when calling
Try to hack SQL queries (see https://github.com/holdenk/spark-structured-streaming-ml by Holden Karau)
edited Jan 14 '18 at 11:43
community wiki
3 revs
user8371915
Thanks. Can you elaborate more about forEach method? As I understand It's a method to do some action (like writing to db) on eachRow
. But for applying regression I need to do some action (training and evaluating) on a dataset.
– Reith
Jan 14 '18 at 11:41
Thanks. I think I'll give up with streaming API since by external storage which computes gradients I feel I won't get any help from spark-ml.
– Reith
Jan 14 '18 at 11:50
True, although it might sound more serious than it is. After all with GD it is just a one line with any decent linear algebra lib. But if you're looking for built-in support in Structured Streaming there is none at the moment.
– hi-zir
Jan 14 '18 at 11:57
add a comment |
Thanks. Can you elaborate more about forEach method? As I understand It's a method to do some action (like writing to db) on eachRow
. But for applying regression I need to do some action (training and evaluating) on a dataset.
– Reith
Jan 14 '18 at 11:41
Thanks. I think I'll give up with streaming API since by external storage which computes gradients I feel I won't get any help from spark-ml.
– Reith
Jan 14 '18 at 11:50
True, although it might sound more serious than it is. After all with GD it is just a one line with any decent linear algebra lib. But if you're looking for built-in support in Structured Streaming there is none at the moment.
– hi-zir
Jan 14 '18 at 11:57
Thanks. Can you elaborate more about forEach method? As I understand It's a method to do some action (like writing to db) on each
Row
. But for applying regression I need to do some action (training and evaluating) on a dataset.– Reith
Jan 14 '18 at 11:41
Thanks. Can you elaborate more about forEach method? As I understand It's a method to do some action (like writing to db) on each
Row
. But for applying regression I need to do some action (training and evaluating) on a dataset.– Reith
Jan 14 '18 at 11:41
Thanks. I think I'll give up with streaming API since by external storage which computes gradients I feel I won't get any help from spark-ml.
– Reith
Jan 14 '18 at 11:50
Thanks. I think I'll give up with streaming API since by external storage which computes gradients I feel I won't get any help from spark-ml.
– Reith
Jan 14 '18 at 11:50
True, although it might sound more serious than it is. After all with GD it is just a one line with any decent linear algebra lib. But if you're looking for built-in support in Structured Streaming there is none at the moment.
– hi-zir
Jan 14 '18 at 11:57
True, although it might sound more serious than it is. After all with GD it is just a one line with any decent linear algebra lib. But if you're looking for built-in support in Structured Streaming there is none at the moment.
– hi-zir
Jan 14 '18 at 11:57
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48249017%2fspark-structured-streaming-and-spark-ml-regression%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown