Hi,
Is there here someone who used Flink-HTM library https://github.com/htm-community/flink-htm? I'm trying to implement it in my project but I have some fundamental question to complete my thesis work. Regards, Andrea |
Hi, maybe creating an issue in the GitHub project will notify the project members? On Thu, Aug 24, 2017 at 5:19 PM, AndreaKinn <[hidden email]> wrote: Hi, |
I think this is not a good idea, I don't know if it's a bug or a my fault.
I believe I integrated correctly flink-HTM in my project (but I'm not sure, Flink-HTM is still an embryonal phase I think) and simply I can't see any output after the HTM elaboration, even there are no errors on console. I watched just a video presentation of Eron Wright on youtube about Flink-HTM example in Scala and an output is obviously generate. Instead, I use Java version of Flink-HTM |
Can you give us some detail on how flink-HTM is integrated in your project ? Cheers On Sun, Aug 27, 2017 at 6:28 AM, AndreaKinn <[hidden email]> wrote: I think this is not a good idea, I don't know if it's a bug or a my fault. |
Sure.
Firstly I followed the steps showed here to build the project: flink-htm github In my project I want to perform anomaly detection of values in a stream. I have a Kafka broker as source: DataStream<Tuple6<String, String, Date, String, String, Double>> stream = env .addSource(new FlinkKafkaConsumer010<>(TOPIC, new CustomDeserializer(), properties)) .assignTimestampsAndWatermarks(new CustomTimestampExtractor()) .keyBy(0); The double field of Tuple6 is my target value. I tried to follow the example find in the code download by GitHub, so I transformed my streams of Tuple6 in a stream of KafkaRecord (an object who has just a field value) DataStream<Harness.KafkaRecord> kafkaStream = stream.map(new MapFunction<Tuple6<String, String, Date, String, String, Double>, Harness.KafkaRecord>(){ @Override public Harness.KafkaRecord map(Tuple6<String, String, Date, String, String, Double> value) throws Exception { return new Harness.KafkaRecord(value.f5); } }); Note that if I print stream or kafkaStream everything works fine. So I used HTM functions as in the example: DataStream<Tuple2<Double,Double>> result = HTM.learn(kafkaStream, new Harness.AnomalyNetwork()) .select(new InferenceSelectFunction<Harness.KafkaRecord, Tuple2<Double, Double>>() { @Override public Tuple2<Double,Double> select(Tuple2<Harness.KafkaRecord, NetworkInference> inference) throws Exception { return new Tuple2<Double, Double>( 3.333333 //fake value inference.f1.getAnomalyScore()); } }); I set my network in a way very similar to that described in example. I just indicated my value is a "double" instead of a "number" and changed the encoder from "ScalarEncoder" to "RandomDistributedScalarEncoder". I have no error during the execution but if I try to print "result" nothing is printed. Just for attempt, I tried to print datastream on a file, nothing anyway. |
Free forum by Nabble | Edit this page |