IRC logs of #shogun for Tuesday, 2018-07-03

--- Log opened Tue Jul 03 00:00:52 2018
-!- witness_ [uid10044@gateway/web/irccloud.com/x-fdfpugnyekzyzdmv] has joined #shogun11:29
@HeikoSlisitsyn: hi11:31
@HeikoSlisitsyn: I was more asking about some other design question we have11:32
@HeikoSlisitsyn: but yeah the lazy would be good as well11:32
@HeikoSlisitsyn: as for lazy thoughts11:55
@HeikoSI need some mechanism to "filter out" these lazy any instances in clone/equals. Once that is possible (or maybe it is already), we can merge and use this. thanks for taking care11:55
lisitsynoops12:12
lisitsynHeikoS: could you please highlight me all the times so if I get distracted you don't stay unanswered :)12:12
@HeikoSlisitsyn: sure :)12:13
lisitsynso what's the q?12:13
@HeikoSlisitsyn: multiple12:14
@HeikoSlisitsyn: first for the lazy12:14
@HeikoScan I filter out the lazy anys?12:15
@HeikoSlisitsyn: for clone/equals?12:15
lisitsynyeah we can add just another flag12:15
lisitsyneasy12:15
@HeikoSlisitsyn: ok cool, because once that is there, we can merge it12:15
lisitsynlets just avoid clutter though12:15
@HeikoSlisitsyn: agree12:15
lisitsynyeah and I have to check the test12:15
@HeikoSlisitsyn: ok the other q is about dispatching12:15
lisitsynsurprising it crashed something else12:15
lisitsynok12:15
@HeikoShave you seen the LARS pr?12:15
lisitsynnot yet let me glance12:16
@HeikoSlisitsyn:  https://github.com/shogun-toolbox/shogun/pull/435012:16
@HeikoSgoal: we want to make the train methods templated, so we know the feature type inside, and algorithm authors dont need to dispatch the type12:16
@HeikoSproblem: templated methods cannot be virtual12:16
lisitsynah yeah12:16
@HeikoSone idea (in the PR): have a macro generate dispatching code12:17
lisitsynI actually checked the mail but I didn't have much to say12:17
lisitsynbut do we have that many instances of that tempate?12:17
@HeikoSfloat16/32/6412:17
@HeikoSmore for string features12:17
lisitsynaha I see12:18
@HeikoSthats option A, do the dispatching in the subclass12:18
lisitsynanother question I'd sk12:18
@HeikoSoption b would be different12:18
lisitsyndo we really need to see the types in the code?12:18
@HeikoSlisitsyn: well12:18
@HeikoSgood q12:18
@HeikoSlinalg is typed12:18
lisitsyncan we coffin-like do something without knowing the type?12:18
@HeikoSwe can make it untyped12:18
@HeikoSbut then the same problem is just pushed further down12:18
@HeikoSat some point you need the type12:19
@HeikoSand I fear that the lower it is, the more often we need to dispatch12:19
@HeikoSimagine it was in linalg12:19
@HeikoSneed to dispatch in every single call12:19
lisitsynyes that's true12:19
@HeikoSalso shoguns algorithms are written against fixed types most of the time, not everywhere though12:19
@HeikoSso option B is the other extreme: make everything typed12:19
@HeikoSi.e. make all algorithms a template that has the feature type12:20
lisitsynbut how does that work?12:20
@HeikoSthen we can have virtual train_machine methods12:20
lisitsyndo we write templated code in CLARS?12:20
@HeikoSyes12:20
@HeikoScheck it12:20
lisitsynaha I see12:20
@HeikoStrain_machine dispatches12:20
lisitsynyeah I am checking12:20
@HeikoSand then calls train_machine_templated12:20
@HeikoSlisitsyn: so moving the template into the class def would just make everything typed at compile time12:21
lisitsynok so the problem is basically in a untyped bottleneck that should call the templated code12:21
@HeikoSyes12:21
@HeikoSand this could be avoided via moving it all up in the hierarchy12:21
@HeikoSthe extreme case is making CMachine templated12:21
@HeikoSlisitsyn: this has a few more implications of course12:22
lisitsynsounds like static polymorphismish thingy12:22
@HeikoSyes exactly12:22
lisitsynCRTP is used sometimes12:22
@HeikoSyes exactly12:22
@HeikoSbut think about the user12:22
@HeikoSfrom C++ this means that you need to know what feature type you have at instantiation of the machine12:22
@HeikoSwhich is OK, since we are c++12:22
@HeikoSfor swig, one could have a special wrapper12:22
@HeikoSthat would accept CFeatures*12:23
@HeikoSand then does all the dispatching to the C++ calls12:23
lisitsynyeah but why not to add some intermediate CRTP CTypedMachine?12:23
@HeikoSbut then doing this requires a lot of changes to shogun, as we dont use static polymorphism12:23
@HeikoSor that12:23
@HeikoSpoint is everything is typed12:23
lisitsynI mean CTypedMachine does dispatching into templated methods of type T12:24
@HeikoSand then there is a special dispatcher machine12:24
@HeikoSyeah12:24
@HeikoSbut then there are things like12:24
@HeikoSxvalidation12:24
lisitsynyou can even 'dispatch or die'12:24
@HeikoSwhich uses the CMachine and CFeatures interface12:24
@HeikoSi.e. thats not static polymorphism12:24
@HeikoSso there is some refactoring required12:24
@HeikoSunless we add this class you meant12:25
@HeikoSah another thing12:25
@HeikoSfrom swig12:25
@HeikoSwe still want12:25
@HeikoSsvm = machine("LibSVM")12:25
lisitsynbut this does not matter much I think12:25
@HeikoSbut we cannot instantiate the C++ machine yet, as we dont know the type12:25
@HeikoSso that only would happen when calling12:25
@HeikoSsvm.train(features)12:25
lisitsynhmm let's use some shared notebook so I can outline some code for you12:26
lisitsyndocs?12:26
@HeikoSI guess in summary, option B means: clearly separate a typed interface from an untyped one12:26
@HeikoSyeah sure12:26
@HeikoSit is not like I dont know how to do these things12:26
@HeikoSit is I am asking what we should do12:26
@HeikoSthe macro in the PR is a minimal solution that kind of sidesteps the problem12:26
lisitsynhttps://docs.google.com/document/d/1qNsj2sTvM5R8GUTaj306olimPQyERnXRX1TkVOX6KSg/edit?usp=sharing12:27
@HeikoSlisitsyn: but I am now thinking that there maybe should be a fully typed interface12:27
@HeikoSwhere all data types are template parameters12:27
@HeikoSIll be back in a sec12:27
lisitsynHeikoS: ok is that a solution?12:30
@HeikoSlisitsyn: back12:31
@HeikoSchecking12:31
@HeikoSlisitsyn: i think this doesnt work12:33
@HeikoSlisitsyn: I had this idea as well12:33
lisitsynwhy?12:33
@HeikoSbut we got a compiler error12:33
lisitsynI think that's resolvable12:33
@HeikoSbecause inside CTypedMachine, ::train is not visible or?12:33
lisitsynit is because TypedMachine is templated against T12:34
@HeikoSit is a mixin type of dispatcher12:34
@HeikoSlet me dig out my old gist so we can compare12:34
lisitsynHeikoS: it might be that templated train should become static12:34
@HeikoShttps://gist.github.com/karlnapf/95a9c72a642d61ec268a39407f8761b212:34
lisitsynbut that's also fine, you can pass this into it12:34
lisitsynHeikoS: I think some SFINAE detecting the function and then fall-backing into SG_NOTIMPLEMENTED might resolve all the things12:35
lisitsynHeikoS: you might need to make it static12:36
@HeikoShttps://gist.github.com/karlnapf/95a9c72a642d61ec268a39407f8761b2#file-dispatch_features-cpp-L3812:36
@HeikoSthis line didnt compile12:36
lisitsynT::train_machine_dense<float64_t>(this, f->as<CDenseFeatures<float64_t>())12:36
@HeikoSy12:36
lisitsynthis should work12:36
@HeikoSah man12:36
@HeikoSeasy :D12:36
@HeikoSok12:37
@HeikoSIll ask shubham to try that12:37
@HeikoSI like this solution12:37
lisitsynit should work from my point of view but lets see12:37
lisitsynit needs some trickery with method_or_fallback12:37
lisitsynotherwise all the subclasses would have to implement all the stuff12:37
@HeikoSyeah sure12:38
@HeikoSI was hoping for a compiler error12:38
@HeikoSif the downstream class doenst implement12:38
@HeikoStrain_dense12:38
@HeikoSand then we need one of those dispatchers for every feature class12:38
lisitsynthis might slowdown things at compilation time quite a bit12:40
lisitsyn:D12:40
lisitsynoh lets see12:40
@HeikoSyeah12:40
@HeikoSlisitsyn: ok so we have 3 options then12:40
@HeikoSa the macro12:40
@HeikoSb the mixin12:40
@HeikoSc making everything static and dispatch in wrapper classes12:40
lisitsynyeah it seems so12:40
@HeikoSClass CLARS : public CTypedMachine<CLARS>12:42
@HeikoSthis klind of stuff12:42
@HeikoSlisitsyn: you sure about this line12:43
lisitsynyes, why not?12:43
@HeikoSclassic CRTP12:44
@HeikoSmind boggling12:44
lisitsynit might be mixin like in your example12:44
lisitsynah12:44
lisitsynit is kind of useful sometimes12:44
@HeikoSin my example it is the other way artound12:44
@HeikoSas the mixing inherits from CLinearMachine12:44
@HeikoSthats the key difference12:44
@HeikoSand CLinearMachine::train is not defined12:45
@HeikoSthats why we had the error12:45
@HeikoSbut in your case12:45
@HeikoSCTypedMachine inherits from CLARS12:45
@HeikoSso the T::train is defined (if the user doies that)12:45
@HeikoSnot user, developer12:45
@HeikoSlisitsyn: ok thanks!12:47
@HeikoSreally useful!12:47
lisitsynglad to help :P12:47
@HeikoSlisitsyn: whats your thoughts on multiple inheritance in that example13:07
@HeikoSi.e. CLinearMachine13:07
@HeikoSlisitsyn: thought on that?15:28
@HeikoSwiking: will you host the zoom?16:00
@HeikoSotherwise we can use hangouts16:00
@HeikoSpls ping me if youi want to join16:01
wuweiheiko: i'm here16:04
-!- witness_ [uid10044@gateway/web/irccloud.com/x-fdfpugnyekzyzdmv] has quit [Quit: Connection closed for inactivity]17:05
-!- travis-ci [~travis-ci@ec2-54-161-216-78.compute-1.amazonaws.com] has joined #shogun17:08
travis-ciit's Wuwei Lin's turn to pay the next round of drinks for the massacre he caused in shogun-toolbox/shogun: https://travis-ci.org/shogun-toolbox/shogun/builds/39960421317:08
-!- travis-ci [~travis-ci@ec2-54-161-216-78.compute-1.amazonaws.com] has left #shogun []17:08
@HeikoSlisitsyn: static typing might also be a way towards making Some possible as not more incompatible types between Some<CFeatures> and Some<CDenseFeatures>17:19
-!- HeikoS [~heiko@2a00:23c5:e10a:5c00:5d03:1daf:b851:6a31] has quit [Quit: Leaving.]18:55
-!- travis-ci [~travis-ci@ec2-54-234-101-19.compute-1.amazonaws.com] has joined #shogun19:08
travis-ciit's Shubham Shukla's turn to pay the next round of drinks for the massacre he caused in shubham808/shogun: https://travis-ci.org/shubham808/shogun/builds/39966441219:08
-!- travis-ci [~travis-ci@ec2-54-234-101-19.compute-1.amazonaws.com] has left #shogun []19:08
-!- travis-ci [~travis-ci@ec2-54-161-216-78.compute-1.amazonaws.com] has joined #shogun19:36
travis-ciit's Shubham Shukla's turn to pay the next round of drinks for the massacre he caused in shubham808/shogun: https://travis-ci.org/shubham808/shogun/builds/39965441119:36
-!- travis-ci [~travis-ci@ec2-54-161-216-78.compute-1.amazonaws.com] has left #shogun []19:36
-!- travis-ci [~travis-ci@ec2-54-234-101-19.compute-1.amazonaws.com] has joined #shogun19:45
travis-ciit's Shubham Shukla's turn to pay the next round of drinks for the massacre he caused in shubham808/shogun: https://travis-ci.org/shubham808/shogun/builds/39967520219:45
-!- travis-ci [~travis-ci@ec2-54-234-101-19.compute-1.amazonaws.com] has left #shogun []19:45
--- Log closed Wed Jul 04 00:00:53 2018

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