This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-12
Channels
- # ai (1)
- # aleph (11)
- # announcements (9)
- # aws (1)
- # beginners (61)
- # chlorine-clover (2)
- # clj-kondo (1)
- # clojure (35)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (1)
- # clojure-filipino (1)
- # clojure-france (2)
- # clojure-hk (1)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-sg (1)
- # clojure-taiwan (1)
- # clojure-uk (1)
- # clojured (14)
- # clojurescript (45)
- # cursive (8)
- # data-science (2)
- # events (1)
- # fulcro (2)
- # gratitude (4)
- # helix (1)
- # honeysql (3)
- # introduce-yourself (1)
- # malli (4)
- # minecraft (4)
- # nbb (23)
- # off-topic (57)
- # polylith (4)
- # reagent (2)
- # sci (23)
- # shadow-cljs (7)
- # vim (1)
- # xtdb (17)
I am trying to make a CLJ library also usable for CLJS projects for the first time. Does anybody know about a blog, documentation or best practices? It is Leiningen based, and after some reading I’m under the impression that switching to deps would make the whole procedure easier… :thinking_face:
Not much to say here - in the end, it's just a JAR somewhere.
But:
• Common code should be in .cljc
with platform-specific stuff in reader conditionals
• It's simpler and easier to store all macros in .clj
files
• deps.edn
will also allow your library to be used as a Git dep
Given that your library also works with CLJ, you probably don't care about NPM dependencies, so that's not an issue.
Forgot to add that information: I have the need to add npm dependencies. My API is a wrapper around a Java library, and the same wrapper should now delegate the call to a very similar npm library.
Already moved the code to .cljc
files and don’t have any macros
In this case, specify your dependencies in a deps.cljs
file at the root of your projects. Alternatively, just document them in the README.
There's been a discussion about it in #clojurescript with some links and advice, should be easy to find via the Search panel.
Will read into that, thanks!
except for adding a deps.cljs file to declare the npm-deps everything else stays the same
How AI looks in Clojure? Do we have good libraries? Or in Java?
Like for example tensorflow
?
In other words I am thinking if it makes sense to do AI in Clojure vs Python.
https://github.com/uncomplicate/bayadera ? it looks legacy
thank you for the links. Although I think it moves mi closer to think “doing this in clj is not worth it”
There's definitely people doing AI and ML in Clojure, what are your criteria for "worth it" ?
If your question is "can you", the answer is yes you can. If the question is: "Are there more libraries, frameworks, books and tutorials than for Python", the answer is no, Python has the richest ML ecosystem of all languages. That said, you can use Python libraries from Clojure using libpython-clj, bit you won't find the level of tooling and tutorials/books that you'd have in pure Python.
This website has kinks to all the tooling/libs that exist: https://scicloj.github.io/ for various categories for ML/AI in Clojure
> There’s definitely people doing AI and ML in Clojure, what are your criteria for “worth it” ? simplicity. If I can do this in Clojure it doesn’t mean it is good idea. Amount of energy and complexity doing this in Clojure vs Python even when I don’t know Python.
If the solution is to use Clojure libpython-clj
to use Python, then it sounds using Python directly is simpler.
unless I don’t have to use Python to do AI and still will be on the same level of simplicity as if I would use Python
Hum... this is hard to answer. If you have zero experience, Python will have a million times more tutorial, books and videos, etc. So its probably best to use Python. But, there's this which is a big investment, but you learn a lot: https://aiprobook.com/numerical-linear-algebra-for-programmers/ and https://aiprobook.com/deep-learning-for-programmers/ That said, you might be best starting with Python to learn, because of how much material it has. Then revisit Clojure afterwards.
To summarise this do I correctly understand in your opinion doing Python in Clojure make sense? Why? Or do you mean not use Python at all in Clojure for AI make sense?
let me ask in that way: what is the use case / benefits to use Clojure over Python for AI?
I think the “use case” is the point here. Why would choose Clojure over Python for AI?
My summary is, you'll find it easier to learn AI using Python even if you don't know Python but know Clojure. But if you know and like Clojure, doing AI in it is more fun and brings more joy, using the REPL is still really nice, even though notebooks aren't too far from it, and all the Lisp, FP, and everything else you might still miss from Clojure. The only reason to choose Clojure over Python would be because you prefer using Clojure over Python. You could make a case that productionizing some models is easier in Clojure, especially if your services are already in JVM world or Clojure and not in Python. Like taking a trained model / feature computation from Python and putting it in production can be trickier if your prod services are not Python, sometimes you have to rewrite the same thing in your own language, though nowadays you can often put that in a separate microservice running Python in a container.
Clojure is kind of great for data manipulation and processing, which is a big part of AI, but it lacks the amount of tooling/libs specific to AI that Python has and all the documentation about them. That's kind of a pro/cons, like Clojure is a good choice to build AI libs/tooling on, but it doesn't yet have a solid universal toolkit for it that's widely used.
Other, not mentioned, option is https://github.com/deepjavalibrary/djl and/or clojure wrapper for it: https://github.com/scicloj/clj-djl