Live data from Hacker News

cPerceptron: A neural network (Simple Perceptron) implemented in PHP.

github.com

11–20 of 20 posts

Re: cPerceptron: A neural network (Simple Perceptron) implemented in PHP.

#11
That's pretty neatly written code!

If you've mastered PHP then you could easily make the switch to C or C++ for a very large speedboost while still being able to recycle a large chunk of your code. PHP and C look quite alike (drop the $ signs and add declarations and you're halfway there).

Neat to see you interested in doing more advanced stuff than just web bits and pieces.

Re: cPerceptron: A neural network (Simple Perceptron) implemented in PHP.

#12

This makes me think I should upload my random computational intelligence assignments and get sweet, delicious karma. Edit: OK, I was a bit snarky, but I'm serious. I see these things on HN all the time. These are, quite literally, undergraduate projects. I don't see people upvoting "My First Stack" or "Check out this Pet Shop I wrote in J2EE". Computational intelligence is not some land of super wise geniuses that me…

> This makes me think I should upload my random computational intelligence assignments and get sweet, delicious karma.

Does karma matter that much to you?

> Edit: OK, I was a bit snarky, but I'm serious.

Well, what's stopping you? The fear of getting people to hate at you like this in comments? Really, you can do much better than this.

> I see these things on HN all the time. These are, quite literally, undergraduate projects.

They are people taking steps on the ladder to proficiency, as such they should be encouraged rather than be beaten down.

> I don't see people upvoting "My First Stack" or "Check out this Pet Shop I wrote in J2EE".

I don't see people submitting those either, which is one reason they're not being voted up. Once upon a time you too were a beginner. And in the eyes of many you probably still are.

> Computational intelligence is not some land of super wise geniuses that mere mortals cannot ascend to. It's all pretty straightforward.

Exactly! And what better way to demonstrate that by showing it, in a language that is generally despised.

> Eg, my Ant Colony Optimiser for a Travelling Salesman Problem:

> https://github.com/jchester/ruby-ry48p-aco

> and my Genetic Algorithm for optimising Ackley's Function:

> https://github.com/jchester/ruby-ackley-genetic-algorithm

That's pretty neat code ;)

Re: cPerceptron: A neural network (Simple Perceptron) implemented in PHP.

#13
post #10

I find it quite interesting how PHP developers try their best to encrypt their function names as much as possible? rdmFloat? Why not randomFloat or random_float? This particular example isn't very problematic, but I see this pattern in PHP way more than in other languages.

Naming things is tricky. I got into programming when 6 character assembly labels were the norm. You can imagine what that led to. I still catch myself dropping vowels from function names every now and then (rndflt anybody?).

What's pretty good about this code is that it is neatly laid out, the modularity is just about right and it solves a particular problem and provides a bit of text showing how the bits get put together to make it work.

As such it beats a very large number of the github projects out there. Brevity in function names is easily forgiven when the code itself is this easy to read.

But I'm with you on the basic principle and I'd vote for random_float. iNeverCouldGetTheHangOfCamelcase.

Re: cPerceptron: A neural network (Simple Perceptron) implemented in PHP.

#14
post #2

Nice. Sort of the computational equivalent of 'A model of Neuschwannstein Castle made out of spaghetti'.

The code isn't all that bad, the spaghetti reference might give that impression.

PHP gets a bad rap because 'it's not a real language after all' but frankly I don't care what language you use if you write neat code like this that's an automatic 'pass'.

You can write spaghetti code in any language, but this isn't it.

Re: cPerceptron: A neural network (Simple Perceptron) implemented in PHP.

#15
post #10

I find it quite interesting how PHP developers try their best to encrypt their function names as much as possible? rdmFloat? Why not randomFloat or random_float? This particular example isn't very problematic, but I see this pattern in PHP way more than in other languages.

The guy didn't follow any of the accepted conventions, so please stop with the generalizations already.

Re: cPerceptron: A neural network (Simple Perceptron) implemented in PHP.

#16

This makes me think I should upload my random computational intelligence assignments and get sweet, delicious karma. Edit: OK, I was a bit snarky, but I'm serious. I see these things on HN all the time. These are, quite literally, undergraduate projects. I don't see people upvoting "My First Stack" or "Check out this Pet Shop I wrote in J2EE". Computational intelligence is not some land of super wise geniuses that me…

> This makes me think I should upload my random computational intelligence assignments and get sweet, delicious karma. Does karma matter that much to you? > Edit: OK, I was a bit snarky, but I'm serious. Well, what's stopping you? The fear of getting people to hate at you like this in comments? Really, you can do much better than this. > I see these things on HN all the time. These are, quite literally, undergraduate…

> Does karma matter that much to you?

Revealed preferences suggest that it does :(

> That's pretty neat code ;)

Flattery will get you karma beyond your wildest dreams (for wildest dreams = 1).

Re: cPerceptron: A neural network (Simple Perceptron) implemented in PHP.

#17
post #2

Nice. Sort of the computational equivalent of 'A model of Neuschwannstein Castle made out of spaghetti'.

The code isn't all that bad, the spaghetti reference might give that impression. PHP gets a bad rap because 'it's not a real language after all' but frankly I don't care what language you use if you write neat code like this that's an automatic 'pass'. You can write spaghetti code in any language, but this isn't it.

I suspect that comment was more about the analogy of building detailed models out of pasta; in other words, that the subtext was that it looks like a painstaking technical feat achieved with strange materials for the purpose. And maybe in that respect all the more impressive.

PHP gets a bad rap because of problems with its design and implementation and some loosy-goosy culture (though most of these can be worked around or smoothed over by a framework and personal discipline, core language issues can be a form of technical debt). Really fixing this might require a breaking new version like Perl 6 or Python 3. But of course you can still build things with it. Like models of Neuschwannstein Castle ;)

Re: cPerceptron: A neural network (Simple Perceptron) implemented in PHP.

#18

Earlier quoted context omitted.

> This makes me think I should upload my random computational intelligence assignments and get sweet, delicious karma. Does karma matter that much to you? > Edit: OK, I was a bit snarky, but I'm serious. Well, what's stopping you? The fear of getting people to hate at you like this in comments? Really, you can do much better than this. > I see these things on HN all the time. These are, quite literally, undergraduate…

> Does karma matter that much to you? Revealed preferences suggest that it does :( > That's pretty neat code ;) Flattery will get you karma beyond your wildest dreams (for wildest dreams = 1).

> Flattery will get you karma beyond your wildest dreams (for wildest dreams = 1).

It's encouragement, not flattery.

Re: cPerceptron: A neural network (Simple Perceptron) implemented in PHP.

#20
post #10

I find it quite interesting how PHP developers try their best to encrypt their function names as much as possible? rdmFloat? Why not randomFloat or random_float? This particular example isn't very problematic, but I see this pattern in PHP way more than in other languages.

Meh I see it in a lot of C++ code too. I don't understand it, especially from people who use an IDE so they shouldn't be typing those full names out anyway.
Post reply on HN