Closed LiuYuHui closed 3 years ago
Nice! Can you show a python code snippet that uses this?
for example sg.create_machine("liblinear")
, such exception will be thrown.
---------------------------------------------------------------------------
SystemError Traceback (most recent call last)
<ipython-input-2-a1dac361590b> in <module>
----> 1 sg.create_machine("liblinear")
~/shogun/build/src/interfaces/python/shogun.py in _internal_factory(name, *args, **kwargs)
107 def _internal_factory(name, *args, **kwargs):
108
--> 109 new_obj = _obj(name, *args)
110 for k,v in kwargs.items():
111 new_obj.put(k, v)
SystemError: Class liblinear does not exist. Did you mean LibLinear ?
for example
sg.create_machine("liblinear")
, such exception will be thrown.--------------------------------------------------------------------------- SystemError Traceback (most recent call last) <ipython-input-2-a1dac361590b> in <module> ----> 1 sg.create_machine("liblinear") ~/shogun/build/src/interfaces/python/shogun.py in _internal_factory(name, *args, **kwargs) 107 def _internal_factory(name, *args, **kwargs): 108 --> 109 new_obj = _obj(name, *args) 110 for k,v in kwargs.items(): 111 new_obj.put(k, v) SystemError: Class liblinear does not exist. Did you mean LibLinear ?
Nice! @karlnapf could you check if that error message is sufficient, please?
for example
sg.create_machine("liblinear")
, such exception will be thrown.--------------------------------------------------------------------------- SystemError Traceback (most recent call last) <ipython-input-2-a1dac361590b> in <module> ----> 1 sg.create_machine("liblinear") ~/shogun/build/src/interfaces/python/shogun.py in _internal_factory(name, *args, **kwargs) 107 def _internal_factory(name, *args, **kwargs): 108 --> 109 new_obj = _obj(name, *args) 110 for k,v in kwargs.items(): 111 new_obj.put(k, v) SystemError: Class liblinear does not exist. Did you mean LibLinear ?
Nice! @karlnapf could you check if that error message is sufficient, please?
Love it. I think it is decent. I guess doing something like `"Machine \"liblinear\ does not exist. Did you mean \"LibLinear\""? is hard (adding the type?).
Love it. I think it is decent. I guess doing something like
"Machine "liblinear\ does not exist. Did you mean "LibLinear""? is hard (adding the type?). Yes, that should be possible, we just need to overload a struct with a
string_viewmember for the name and in
create_objectuse
T` to lookup the name. Unfortunately I cannot think of a way to automate that part.template <typename T> struct name_lookup { static constexpr std::string_view name = "SGObject"; };
template <>
struct name_lookup
// get the name
name_lookup
@LiuYuHui can I merge this?
@LiuYuHui can I merge this?
yes :D
Thanks, this is great :)
fixes #4475