News for hackers. Stuff that matters.

kakadzhun

Re:Post-GPT Computing on Friday March 24, 2023 @09:40AM (#35288920)
If Reinforcement Learning is anything to go by, then a naive implementation of learning from past models will overfit to the previous model and start performing worse than even earlier models.

There was a paper by someone @ Microsoft who tried to train a boardgame playing AI like this. The "best" models started losing to beginner level players from some point onwards.

Re:Design of GNU Parallel on Sunday March 19, 2023 @04:53AM (#35217204)
Try this resource instead. Although it is 100 pages, the introductory part is already useful in and of itself!

https://zenodo.org/record/1146014/files/GNU_Parallel_2018.pd...

Re:Being Ridiculed for My Open Source Project (2013) on Monday November 07, 2022 @03:23AM (#33502819)
Her emotional response was definitely not wrong nor an issue. Criticism is hard to take for anyone, but the tweets weren't even criticism, just plain mocking. What do you believe was her mistake? Sobbing about it for an emotional release, or trying to put something out in the open source world?
Re:Numpy is absurd on Saturday July 09, 2022 @02:35PM (#32037995)

    import numpy as np
    print(np.__version__)
    a = np.array([1,2,3])
    b = np.array([1])

    print(a in b)
    print(b in a)
    print(np.isin(a, b))
    print(np.isin(b, a))
    print(np.isin(a.astype(float), b))
    print(np.isin(a, b.astype(float))))

    1.21.6
    True
    True
    [ True False False]
    [ True]
    [ True False False]
    [ True False False]
I've always wondered whether there is an upper limit to mental endurance regarding the will to live, e.g. would you grow tired of life after a certain point?

What if you were truly immortal, wouldn't you be driven mad soon enough?

Re:Ask HN: Tools you have made for yourself? on Saturday June 12, 2021 @02:18PM (#27486395)
Script to filter out records of a .jsonl file based on some property (e.g. only want records w/ a timestamp greater than 163623...):

    import sys
    import orjson
    import argparse

    if __name__ == '__main__':
        parser = argparse.ArgumentParser()
        parser.add_argument('expr')
        parser.add_argument('file', nargs='?')
        args = parser.parse_args()
        expression = compile(args.expr, '<string>', 'eval', optimize=0)

        if args.file:
            stream = open(args.file, 'f')
        else:
            stream = sys.stdin

        try:
            for line in stream:
                json = orjson.loads(line)
                if eval(expression, {}, json):
                    print(line.strip())
        finally:
            if args.file:
                stream.close()
Even if Reinforcement Learning is 'enough', it will be held back by whatever methods used to implement it (e.g. Deep Neural Networks). As the algorithms get more advanced, from some point onwards, to build the general AI, you first need a general AI to tell you the correct hyperparameters so that the pile of methods would work well in tandem.

Last but not least, you will be bound by your inability to accurately communicate exactly the behaviour you want out of the AI because you are incapable of writing down a mathematical function that would induce the behaviour in the learner. And then you wonder why the general AI decided to pull the plug on your grandma and try to use that resource for something else instead.

Reduce, reuse, recycle. According to a HN user (don't remember who) this was THE slogan before making everything "green". "Green" makes it easier to sell you the feeling of being environmentally friendly, while reducing consumption... doesn't give you anything :- )
Re:Pgvector – vector similarity search for Postgres on Thursday April 22, 2021 @01:57PM (#26905759)
https://github.com/joosephook/sqlite3-numpy

Minimal working example of storing numpy vectors in sqlite3 using Python:

    import sqlite3
    from scipy.spatial.distance import cdist
    import numpy as np

    class Vector:
        def __init__(self, arg):
            self.arg = arg

        def __str__(self):
            return 'Vector({!r})'.format(self.arg)


    def adapter_func(obj: np.ndarray):
        return obj.tobytes()

    def converter_func(data: bytes):
        return np.frombuffer(data)

    sqlite3.register_adapter(Vector, adapter_func)
    sqlite3.register_converter(f"{Vector.__name__}", converter_func)

    if __name__ == '__main__':
        with sqlite3.connect(":memory:", detect_types=sqlite3.PARSE_DECLTYPES) as con:
            cur = con.cursor()
            cur.execute("create table test(v vector)")
            cur.execute("insert into test(v) values (?)", (np.random.random(1280),))
            cur.execute("insert into test(v) values (?)", (np.random.random(1280),))

            cur.execute('select v from test')
            vectors = []
            for v, in cur.fetchall():
                print(v.shape, v)
                assert isinstance(v, np.ndarray)
                vectors.append(v)

            assert len(vectors) == 2
            print(cdist(vectors[:1], vectors[1:], metric='cosine')[0])

            cur.close()
Could you elaborate on what you believe you'd get for free in a static language compared to type-annotated and -checked Python? I'm curious as I'm in a similar situation, but not in a company, but as a researcher.
Re:NumPy 1.20 on Friday February 12, 2021 @04:27AM (#26111930)
Consider this:

  In [1]: np.argmax(np.array([[1,2,3],[1,9,3],[1,2,3]]).flat)
  Out[2]: 4
Re:Spinning Up in Deep RL on Monday August 17, 2020 @03:10AM (#24184753)
If you want to play around with Spinning Up in a Docker container, then make sure you git clone the repository, then pip install -e repository. For whatever reason, if you try to directly install it with pip, it doesn't work, at least last time I tried it. Here's a Dockerfile and docker-compose.yaml I created some time ago: https://github.com/joosephook/spinningup-dockerfile
Re:The 5.7 kernel is out on Tuesday June 02, 2020 @03:34PM (#23395295)
I had the same problem on Ubuntu 18.04, terrible lag spikes and similar messages regarding i915. After installing the least new kernel (5.3.1), it solved the issue: not one hang since.