IRC logs of #shogun for Saturday, 2019-01-26

--- Log opened Sat Jan 26 00:00:44 2019
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun01:02
-!- mode/#shogun [+o wiking] by ChanServ01:02
-!- wiking [~wiking@huwico/staff/wiking] has quit [Ping timeout: 240 seconds]01:06
-!- tangy [491d7f98@gateway/web/freenode/ip.73.29.127.152] has joined #shogun06:18
-!- tangy [491d7f98@gateway/web/freenode/ip.73.29.127.152] has quit [Client Quit]06:19
-!- shubham808 [~atom@14.139.240.247] has joined #shogun08:02
-!- gf712 [560fc4e5@gateway/web/freenode/ip.86.15.196.229] has joined #shogun12:52
-!- wiking [~wiking@c-185-45-237-122.customer.ggaweb.ch] has joined #shogun13:22
-!- wiking [~wiking@c-185-45-237-122.customer.ggaweb.ch] has quit [Changing host]13:22
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun13:22
-!- mode/#shogun [+o wiking] by ChanServ13:22
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection]13:26
-!- shubham808 [~atom@14.139.240.247] has quit [Ping timeout: 245 seconds]13:42
-!- gf712 [560fc4e5@gateway/web/freenode/ip.86.15.196.229] has quit [Ping timeout: 256 seconds]13:49
-!- shubham808 [~atom@14.139.240.247] has joined #shogun13:57
-!- wiking [~wiking@c-185-45-237-122.customer.ggaweb.ch] has joined #shogun15:27
-!- wiking [~wiking@c-185-45-237-122.customer.ggaweb.ch] has quit [Changing host]15:27
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun15:27
-!- mode/#shogun [+o wiking] by ChanServ15:27
-!- wiking [~wiking@huwico/staff/wiking] has quit [Ping timeout: 268 seconds]15:32
-!- shubham808 [~atom@14.139.240.247] has quit [Ping timeout: 272 seconds]17:16
-!- HeikoS [5aae0442@gateway/web/cgi-irc/kiwiirc.com/ip.90.174.4.66] has joined #shogun18:01
-!- mode/#shogun [+o HeikoS] by ChanServ18:01
@HeikoSlisitsyn yo18:01
@HeikoSwuwei[m] yo18:13
wuwei[m]HeikoS: hey18:14
@HeikoSwuwei[m] cool that the example now works!18:14
wuwei[m]yeah18:14
@HeikoSwhat do you think about the api necessary?18:14
@HeikoSand the fact that we cannot change the machine using put de-facto18:14
@HeikoSat least from swig18:14
@HeikoSin c++ people can do it if they want18:14
wuwei[m]in c++ they can call put<CMachine*>18:15
wuwei[m]but meta examples do work now18:15
wuwei[m]for c++18:15
@HeikoSyes18:16
wuwei[m]is it possible to somehow hack the meta geneator?18:16
@HeikoSyes but let's not do that18:16
@HeikoSanother solution I could imagine is to offer an "as_machine"18:16
@HeikoSeval.put("machine", pipeline.as_machine())18:17
wuwei[m]yes this should work18:17
@HeikoSis that better than the argument?18:17
@HeikoSwhat do you think?18:17
wuwei[m]I feel as_machine is better18:19
wuwei[m]because we have pipeline as a base type18:19
wuwei[m]so users can cast it to machine18:19
wuwei[m]btw in meta, we will have Machine variable to save the intermediate result18:20
wuwei[m]Machine m = eval.as_machine()18:20
wuwei[m]i mean, Machine m = pipeline.as_machine()18:21
wuwei[m]and then eval.put18:21
@HeikoSwuwei[m] true18:33
@HeikoSyou wanna try adding that? But also keep the old code please so we can discuss and then decide18:33
wuwei[m]sure18:34
@HeikoSif you want18:34
@HeikoSwe can actually add something to the meta generator, a very small change18:34
@HeikoSso in the meta example we can write18:34
@HeikoSobj.put_machine("foo", bar)18:34
@HeikoSand then we can add a line18:35
@HeikoSin python.cpp18:35
@HeikoSunder MethodCall18:35
@HeikoSthat is18:35
@HeikoSah no it doesnt work18:35
@HeikoScrap sorry .)18:35
@HeikoSOk I think then we just add an "as_machine" in the swig code18:36
wuwei[m]why it doesnt work18:36
@HeikoSbecause18:36
@HeikoS"put_machine": "$object.put($arguments)"18:37
@HeikoSwe cannot "insert" as_machine18:37
@HeikoSas the arguments are only accessible as a group18:37
wuwei[m]i see18:37
@HeikoSI mean we can change this later18:37
@HeikoSbut for now, why not explicitly do it?18:37
@HeikoS"as_machine": "$object.as_machine($arguments)"18:38
@HeikoSin python18:38
@HeikoSand in cpp.json, we would have18:38
@HeikoS            "put_machine": "$object->put<CMachine>($arguments)"18:38
@HeikoSthen we only need to add "as_machine" cast to the swig interface code, not libshogun18:39
@HeikoSwould this work?18:39
wuwei[m]cool18:39
@HeikoSwuwei[m] then we need to touch the json dictionaries every time we need such upcasting18:40
@HeikoSwhich kinda sucks18:40
@HeikoSbut it only happens for shogun base classes that inherit from each other, so there is only a limited number18:40
wuwei[m]but pipeline is the only exception now?18:40
@HeikoSon the other hand, the method you implemented in the PR does not require any modification of the dictionaries18:40
@HeikoSyes seems like18:41
@HeikoSlet's try it then18:41
@HeikoSwe can hack the meta lang later to access the arguments when replacing method calls18:41
wuwei[m]yes that's possible18:42
wuwei[m]in python "as_machine": "$object.as_machine($arguments)", do we still need as_machine in libshogun?18:43
@HeikoShttps://github.com/shogun-toolbox/shogun/issues/449018:45
@HeikoSwuwei[m] no as_machine needed in libshogun18:45
@HeikoSwe would either just use obj->as<CMachine>18:45
@HeikoSbut we do not even need that if we use a templated put18:46
@HeikoSobj->put<CMachine>("bla", pipeline=)18:46
@HeikoSthat works18:46
@HeikoSso you can already do18:46
@HeikoS            "put_machine": "$object->put<CMachine>($arguments)"18:46
@HeikoSwuwei[m] I suggest the following18:47
@HeikoSfor now, you add the "as_machine" in swig, and then change the meta example to use it explicitly and store the casted variable before putting it18:47
@HeikoSand then once esben has hacked the meta generator, we can change it to put_machine18:47
@HeikoSwuwei[m] good?18:47
wuwei[m]how python works?18:48
@HeikoSwhat do you mean?18:48
wuwei[m]do we need put pipeline in swig?18:48
wuwei[m]eval.put("machine", pipeline)18:48
@HeikoSwell yes if there is no factory18:49
@HeikoSthat has the CMachine argument18:49
@HeikoSand our current pattern kinda of is to only construct objects that are "empty"18:50
wuwei[m]so we will add "as_machine" and put pipeline in swig?18:52
@HeikoSwhat do you mean with "put pipeline in swig?"?18:53
wuwei[m]the other option we talked about before18:55
wuwei[m]some special handling when pipeline is used in put18:56
@HeikoSah19:01
@HeikoSyeah let's not that19:01
@HeikoSI think the best candidates is either what you have done in the PR19:01
@HeikoSor the "as_machine" in swig c++ code19:01
wuwei[m]my question is what's as_machine in python19:02
@HeikoSyou have to add it19:04
@HeikoSin shogun.oi19:04
@HeikoSshogun.i19:04
@HeikoSthere you can write c++ code that is added to the python interface19:05
wuwei[m]ah i see19:05
wuwei[m]lets do this19:05
@HeikoSCMachine* CPipeline::as_machine()19:05
@HeikoSyou can even only add it to CPipeline as that is exposed to swig anyways19:05
@HeikoSand then swig generates the python call19:05
wuwei[m]cool, will try it19:06
@HeikoSnice19:07
@HeikoSas said, keep this code so we could go back if needed19:07
@HeikoSok I am off, thanks wuwei[m] !19:10
wuwei[m]see you later19:11
@HeikoSwuwei[m] one thing19:16
@HeikoSwuwei[m] you can actually just pass the pipeline object to "machine"19:16
@HeikoSno need to add "as_machine"19:16
@HeikoSjust to19:16
@HeikoSeval.put("machine", machine(pipeline))19:17
@HeikoSwuwei[m] see what I mean?19:17
wuwei[m]i see19:17
wuwei[m]didn't know that19:17
@HeikoSI forgot it, but that was exactly the point :)19:17
@HeikoSso we dont need "as_*"19:17
@HeikoSok I am really off now19:17
-!- HeikoS [5aae0442@gateway/web/cgi-irc/kiwiirc.com/ip.90.174.4.66] has quit [Ping timeout: 246 seconds]19:22
-!- shubham808 [~atom@14.139.240.247] has joined #shogun19:54
-!- wiking [~wiking@huwico/staff/wiking] has joined #shogun20:38
-!- mode/#shogun [+o wiking] by ChanServ20:38
-!- shubham808 [~atom@14.139.240.247] has quit [Quit: Leaving.]21:41
-!- wiking [~wiking@huwico/staff/wiking] has quit [Remote host closed the connection]22:19
--- Log closed Sun Jan 27 00:00:45 2019

Generated by irclog2html.py 2.10.0 by Marius Gedminas - find it at mg.pov.lt!