Re: Is there a package that handles random forest algorithm in nim?
Thank you for your answer, @mratsim! > No there is none Oh, I see. > > though I'll probably add one to Arraymancer at one point. > Depending on how > familiar you are with C++, it might be easier to wrap XGBoost or LightGBM or > ask someone to wrap them using nimterop. I wait to be added the code of random forest or other, because I have never written c++. Thank you!
Re: problem with nimpy and nimAes
Thanks for reply you are right the returned data is not valid utf-8 and I also try to change the return type to array, it seems doesn’t work either.
Re: Begginer's question - pointers and refs
Yes you are right. I was thinking about type definiton while the question was about variable definition. Thanks.
Re: problem with nimpy and nimAes
Nimpy encodes your string to a sequence of bytes using utf-8 (in proc pyStringToNim). When returning $output1, nimpy needs to do the inverse of this encoding step. The error is probably raised because the encrypted data is not valid utf-8, which causes the decoding to throw an exception. My suggestion would be to change your function to use a return type that maps to a python bytes object. (bytes is the recommended type for storing binary data in python3.)
Re: Begginer's question - pointers and refs
@aguspiza, I think you are confused about mutability/immutability, var and ref. var means mutable. ref means object on the heap with reference semantics. They are somewhat orthogonal concepts.
Re: "Nim needs better documentation" - share your thoughts
I think I have 0.19.0 in docset, I don't remember who provided the links though (iirc it was from a dropbox).
Re: strutils find
There is awesome [String Matching Algorithms Research Tool](https://smart-tool.github.io/smart/).
Re: strutils find
Well one easy heuristic is to only use the lookup table if the search substring's length is >= 4 and otherwise use the bruteforce algorithm. It's of course tricky to figure out a good criterion for a standard library implementation. PRs are welcome.
strutils find
playing around with text search (strutils.find) I realized, that the nim find implementation uses a Boyer-Moore algorithm. This is nice in many cases, but there are scenarios where a naive brute force search is faster (small search patterns and/or a simple one shot search like find("nim is a great programming language", "great")). The situation gets worse, when a stupid user like me uses the find repeatedly without precalculating the SkipTable. - I know stupid programmers write stupid code. Now I tried to find a better find algorithm. After some googling my first stop was a Knuth-Morris-Pratt, but in all my benchmarks a simple brute force find was better (Maybe someone can show me an artificial search string and pattern where KMP shines? ). Than I had a genius idea and "invented" a rolling hash search. After implementing it, I googled again and found out that I re-"invented" a naive form of the Rabin-Karp algorithm :) But to my astonishment my naive implementation works very well. In all my tests, it is always better than the naive brute force search. In many cases it beats the BM and when it looses it is not so bad. But I want to make some more tests to be sure. Can someone show me some real world test where BM shines - my current observation is the longer the pattern, the better is BM. When it turns out like I guess, I would like to suggest the following for the strutils find: * find a cut off size for patterns where BM is likely to be better than RK * for smaller patterns use the RK * for longer patterns use the BM what do you think ?
Re: "Nim needs better documentation" - share your thoughts
https://github.com/wicast/nim-docset
Re: "Nim needs better documentation" - share your thoughts
Hi, I just discovered Zeal browser and that made docs reading (like terrible GNU docs) less painful. [https://www.casimages.com/i/19032110495424237016167956.png.html](https://www.casimages.com/i/19032110495424237016167956.png.html) A VS code extension can open the docs from editor. [https://github.com/deerawan/vscode-dash](https://github.com/deerawan/vscode-dash) So why not saving Nim pages in a docset format ?