HNHacker News
TopNewBestAskShowJobs

zardeh

342 karma · joined December 29, 2013

submissionscomments
zardeh··on Python 3 comes to Scrapy
What?

Py2/3 shouldn't impact CV code at all. THe major issue should be installation, which is generally a solved problem. OpenCV, and the scipy stack fully support python3, and are some of the best documented libraries I've ever encountered (better than the bit of matlab I've used for robotics at least)

I'm curious as to what problems you encountered?

zardeh··on How convolutional neural networks see the world
This would be a textbook example of overfitting, yes?
zardeh··on Using D and std.ndslice as a Numpy Replacement
Its that microbenchmarks are useless. If it was worth my time, I could come back and use any of the available python tools (cython, numba, etc.) to compile that function to native code from python syntax and achieve native speed. Or I could write a D implementation of {{some relatively complex matrix algorithm}} and compare it to numpy, showing it was slower.

You could then respond by saying that I wasn't using D optimally, and I'd agree.

zardeh··on Using D and std.ndslice as a Numpy Replacement
Is D or the compiler doing something sneaky and inlining something, because I'd expect doing 100x more things to take 100x more time for a linear algorithm,but it takes you on the order of 10x more time. Does the original function run in <1ns for you?

Edit:

Because as I showed above, Pypy managed to JIT inline the entire benchmark, so I wouldn't be surprised at all if a clever compiler managed to do something sneaky.

zardeh··on Using D and std.ndslice as a Numpy Replacement
Sure, but the claim he's making is that D is faster than the numpy numerical algorithms. This is patently false. The C or fortan code that is doing the numerical calculation is as fast or faster than the D code he's running. Al of the difference comes from the initialization of O(n) pyobjects to represent the returned values.

If he claimed that handwritten D code was faster than equivalent python, I'd say "duh", but he claimed that the numerical libraries are faster. I take issue to the statement that D will be faster than numpy for real world calculations, because the numpy code will run the actual math faster, and the python overhead will still be on the order of nano or milliseconds.

zardeh··on Using D and std.ndslice as a Numpy Replacement
That still doesn't matter. So much of the work is being done in python that you're benchmarking the overhead of python, not the numpy speed.

I mean this is a terrible benchmark. Comparing to pure python, the numpy code is about 4-5x faster on my machine, whereas in reasonable real world benchmarks, numpy is hundreds of times faster than pure python.

For reference my benchmark was

    %timeit [sum(row)/len(row) for row in mat]
and it completed in about 900us, given mat was a python 2d array.

These results are as valuable as the ones pypy gave me:

    pypy -mtimeit -s "[sum(row)/len(row) for row in [[range(100000)[i*j] for i in range(100)] for j in range(1000)]]"  
    1000000000 loops, best of 3: 0.00101 usec per loop
Edit:

In other words, because the code returns a python array of length 1000, what you're benchmarking is python's speed of array instantiation vs. Ds mathematical speed. Its obvious that D will win. The only fair way to benchmark the mathematics here is if you compare the D implementation of O(n) algorithm that returns a single value, or an O(n^2) algorithm that returns a 1d array or single value etc. Otherwise the python overhead of creating O(n) objects will overshadow the actual mathematical calculations on those O(n) objects.

zardeh··on Using D and std.ndslice as a Numpy Replacement
And here we have a case of why microbenchmarks don't work. What you're measuring here isn't a speed difference in the mathematical code, its a constant time overhead from calling into the numerical libs. Up your array size by 100 times and this will become evident.

Why do I say this? Because inlining the python function to

means = numpy.mean(numpy.arange(100000).reshape((100, 1000)), axis=0)

from the original example in the article cut the benchmark time in down from around 215us to 205 us in my testing. That was done by removing a single python bytecode instruction.

Its quite likely that the D numerical code is actually slower than the LAPACK based python numerical code, but you're hiding this in the constant time overhead of a few python function calls.

zardeh··on Why `print` became a function in Python 3
You do if it causes language development to stagnate.
zardeh··on Why Python 3 Exists
protobuff supports 3.0 (though apparently the pip3 version still requires you to manually run 2to3, but then it works) and there's already a port of fabric (ish) by the original author to py3. And Ansible should be python2 until distros start shipping py3 by default, (which they have so I assume Ansible3 will come out soonTM).

If you're willing to do a bit more than "pip install x", well I guess it doesn't work, back to py2, you can use almost everything on py3. (and yes requests is ported too)

zardeh··on SEC Approves Plan to Issue Overstock.com Stock via Blockchain
Who said you trusted each other?
zardeh··on Python 3 makes it easier to develop high-quality software
Such as....

The entire scipy stack, ntlk, tensorflow has partial 3.0 support and plans to support both, caffe, theano, etc.

There are few to no libraries that don't support, or don't plan to soon support both.

zardeh··on Python Decorators in 12 Steps (2012)
you are exactly correct.
zardeh··on Python Decorators in 12 Steps (2012)
consider the example

    @decorator_without_args
    def function():
        pass
this is equivalent to

    function = decorator_without_args(function)
now consider the other case, where the decorator takes in some args:

    @dec_with_args("hello", "world")
    def func():
        pass
this is equivalent to

    function = decorator_with_args("hello", "world")(function)
Or in other words, the expression after @ needs to evaluate to a Callable which is then called on the function you are decorating, so with @a_decorator, you call a_decorator on your function. When you use @with_args(1, 2, 3), you are calling the function "with_args" and then the result of that function is your decorator. So an example of this working is like so:

    debug_list = []
    other_list = []
    def dynamic_debug_decorator(output_list=debug_list):
        # dynamic debug decorator should return a decorator function
        # realistically, ddd is a decorator factory, not a decorator
        def debug_decorator(function):
            # so this is our real decorator
            def decorated_function(*args, **kwargs):
                # and this is the new function we return
                output_list.append(function)  # because silly example
                return function(*args, **kwargs)
            return decorated_function
        return debug_decorator
so now using that decorator:

    @dynamic_debug_decorator  
    def function():
        pass
this fails, because dynamic debug decorator takes a list, but is now receiving a function. Instead we need to call it like so:

    @dynamic_debug_decorator
    def function():
        pass
this works, using the default values.
zardeh··on GitHub Raises $250M at $2B Valuation
I think rails (https://github.com/rails/rails) would qualify.
zardeh··on Ellen Pao Is Stepping Down as Reddit’s Chief
Reddits stated policy was to remove harassment (and harrassing subs). So fph harrassed users and broke that policy. Coontown, while also racist and imo worse, stays in its box, doesn't brigade, doesn't target specific people, and generally just says racist stuff about news articles and posts memes.
zardeh··on Ellen Pao Is Stepping Down as Reddit’s Chief
No, she intended to post something in an admin sub and didn't. https://www.reddit.com/r/announcements/comments/3cbo4m/we_ap...

And they've officially denied shadowbanning anyone in that thread.

zardeh··on Ellen Pao Is Stepping Down as Reddit’s Chief
there is no /r/all for irc or newsgroups.
zardeh··on Show HN: This page exists only if someone is looking at it
Implement it as a merkle tree so that you can reference parents and know it will only evolve forward.
zardeh··on Lisp implemented in under 1K of JavaScript
So, uhmm,

    def parse(s): return json.loads('['+re.sub('([")])\s*(["(])','\g<1>,\g<2>',re.sub('[^()\s]+','"\g<0>"',s)).replace('(','[').replace(')',']')+']')
works for python, I'm assuming javascript has something equally small
zardeh··on Type hinting for Python
Here's the problem: `a<b>c` is already valid python. `3<5>2` evaluates to true, because python allows operator overloading. Because the < and > operators can be overloaded, there is no guarantee that an object of type "class" will not have them (this would, I believe, require some metaclass hackery, but still).

So, given that `object<int>()` throws a type error in python and not a syntax error, you can't unambiguously parse that.

zardeh··on Marriott Hotels fined $600,000 by FCC for jamming Wi-Fi hotspots [pdf]
Furthermore, at scale, interference sucks.
zardeh··on BugJuggler: plans for a 21 m tall robot that juggles cars
As a reasonably proficient juggler and a less than reasonably proficient roboticist:

The only functional juggling robot at any scale is housed inside a case and doesn't use an arm, it can juggle at exactly one width, and doesn't use any form of complex reverse kinematics.

There isn't any kind of "arm" on any scale that is currently capable of juggling (that I've seen anyway). Some get close, but the only videos are of slower forms where they get assistance from people or interact with people.

That also entirely ignores the physics of the situation. To get a 1000kg car to move up the 8 or so meters from catch to head height, and then catch it again, the forces are enormous. You'd need to apply nearly 80K newtons of force over a second or so to slow the object down on the catch.

zardeh··on The greatest juggler alive quit to open a construction business
Wayne Gretzky?
zardeh··on Ask HN: Is there a tablet/laptop hybrid that works well with Linux?
Not him, but I use a Yoga 1 as my main laptop (CS undergrad) and I run ubuntu 13.10 on it. Getting wifi working takes a bit of work, and I don't have full functionality (though you can get it working with some scripts, I just don't care) in terms of screen rotation, but the laptop is pretty great.

Pluses: The touchscreen works and support multitouch its a very solid laptop Wifi and bluetooth drivers are available Installation was pretty painless, it took me some research to get around the shenanigans that are UEFI, but there are guides on the web

Minuses: automatic screen rotation is apparently impossible making wifi work is a struggle and it occasionally needs to have the drivers recompiled after updates, I simply have the file in my main directory and do so as needed There's almost no linux stuff that makes use of multitouch, so the point is moot

zardeh··on Ask HN: Trying to pin down both algorithm and problem it solves ...
Are you by any chance thinking of a http://en.wikipedia.org/wiki/Bloom_filter?
zardeh··on Bogo-bogosort
bogosort does that already.

I ran it on an the array [0,1,2,3,4,5,6] and it took between 3 hundred million and 1 billion operations (by my marginally accurate counter) and between 6 and 20 minutes, but mine was in python, not C.

← PreviousPage 6 of 6