> if intelligence is ultimately a function of power input, what is the shape of the curve?
According to a quick google search, the human body consumes ~145W of power over 24h (eating 3000kcals/day). The brain needs ~20% of that so 29W/day. Much less than our current designs of software & (especially) hardware for AI.
I think you mean the brain uses 29W (i.e. not 29W/day). Also, I suspect that burgers are a higher entropy energy source than electricity so perhaps it is even less than that.
You're absolutely right, it is totally redundant. You could reduce the entire thing even more in size by doing only `D Float Float`, removing the `TypeSynonymInstances` pragma and removing the `VectorSpace`, instead using normal Float operations for the derivatives in the Num, Floating and Fractional instances. Further, you can remove the `diff` function entirely if you want, since it's doing something very simple; calling `f` using a `D` instead of a normal Float, Int, etc. So you would simply get the function applied to x and it's derivative by doing `(\x -> x^2) (D 2 1)`, setting the derivative to 1 and x=2.
However, I think the Float' and `diff` etc. is at least a little helpful in understanding it. I got it from SPJ's talk, which I linked to in the file. Also, it makes it easier (e.g. in the case of `diff`) to later add onto the Autodiff, for example by implementing reverse mode, Jacobians, etc.
As I wrote in the Markdown file, there's also a usable package for Haskell called `ad` on Hackage. It has both forward and backward autodiff and prevents expression swell, among other things. This gist is just for illustration purposes.
Since the type was made an instance of the Num typeclass, any function that can be used with Num's, can now be used on the type (Dual d). As per the Prelude[1], ^ is part of the Num typeclass. Same thing for * for Floating[2]. The hyperbolic tangent can also be used without being explicitly coded, as it can be derived using cosh and sinh!
>forced me to learn stuff like: how to manage a monad transformer stack, how to make http requests, how to parse and serialize json, how to write to a database, etc..
I am currently just before this stage. I can use Haskell for stuff like projecteuler.net problems but I haven't written a single useful, real-world program without copy-pasting some code.
I tried doing something with http requests to an API for stock trading but I failed to understand how to make a request. There are a few packages but they all have their flaws (e.g. no https) and aren't really developed that much.
My question is: did you write all these things with mostly only the Prelude of Haskell or did you use packages for all those things you listed (http requests, json data, databases etc.)?
I'd love some pointers in the right direction for http requests as well as maybe ideas for initial real-world project ideas that are exciting (I don't care for the standard ones you find online).
Yeah, the goal was (rather, is---I'm still working on it!) to learn more about real-world Haskell by actually learning how to use packages and forcing myself to read the Hackage docs, so for this project I pretty liberally import a new library whenever I need something.
The "req" package is very intuitive to use for requests, and plays nicely with "aeson" for parsing JSON. I'm also using "persistent" to manage a sqlite database.
For project ideas, try to scratch a personal itch. If you're solving a problem (or a daily frustration) that's important to you, you'll be more motivated to follow through! For me, I had been using the beets (https://beets.io/) command line tool to manage tags for my music library, but it isn't really optimized for my use case, and I thought I could do better. So I decided to write a cli [1] with Haskell to tag all my local music files with metadata from Discogs/MusicBrainz, modeled after the beets tagging loop. I'm also working on a more advanced tagging system that uses Datalog inference rules, inspired by a blog post [2].
Try using wreq[0] instead. Here's also a post[1] which describes someone else facing the same pains earlier that you're currently having. For anything to do with JSON, you need Aeson[2]. For working with databases, Persistent[3] and Esqueleto[4] (they're designed to work together) work great.
According to a quick google search, the human body consumes ~145W of power over 24h (eating 3000kcals/day). The brain needs ~20% of that so 29W/day. Much less than our current designs of software & (especially) hardware for AI.