Hi there,

I am totally new to neural networks and am trying to train a network now. I am using a php script from tremani.nl for the neural network. Now what I wonder is that. How long does it usually take to train a network? I mean I am training it now for 24 hours and it´s still not finished, but probably I only set up wrong parameters?

Here is what I am trying to train:

$n->addTestData(array ("0.0001", 0.000615, 0, 0.01, 0.225, 0, 0, 0.00000166666666667), array (0.0027));
$n->addTestData(array ("0.0001", 0.0000000086, 0, 0.001, 0.025, 0, 0, 0), array (0.00085));
$n->addTestData(array ("0.0001", 0.00000006175, 0, 0, 0.025, 0, 0, 0), array (0.000891));
$n->addTestData(array ("0.0001", 0.000000005725, 0, 0, 0.025, 0, 0, 0), array (0.0015));
$n->addTestData(array ("0.0001", 0.001015, 0, 0.021, 0.225, 0, 0, 0.00000583333333333), array (0.002895));
$n->addTestData(array ("0.0001", 0.00000013375, 0, 0.003, 0.025, 0, 0, 0), array (0.001558));
$n->addTestData(array ("0.0001", 0.00018425, 0, 0.015, 0.025, 0, 0, 0.00000166666666667), array (0.008945));

So basically I got 8 inputting neurons and 1 output. For the correlation isn´t too big, I thought I should use probably more neurons between the input and the output layer, so I use 320 neurons in between.

For mean square error I use 0.0003 (since all resulting numbers are rather little, so that would probably be alike a +_20% error range).

For learning rate I use 0.1 and for momentum I use 0.8.

So basically I would be interested wether my values are chosen totally wrong? Additionally to that I would like to know, how long a regular neural network does need to train on average?

Thx :)

Dani AI

Generated

To @omega — quick diagnosis and practical fixes (and a brief primer for )

Your long run time almost always comes from three things working together: input scaling, an oversized network for the amount of data, and a slow/trivial training loop. The dataset shown in the thread has very small-valued inputs and many zeros, a single-target output, and only a handful of examples; training a single hidden layer with hundreds of units on that will be slow, unstable and prone to extreme overfitting. Ignore the joke from ; is right that properly prepared time-series or stock-style data usually trains quickly.

Actionable checklist (start here, in order):

  • Normalize inputs and outputs (standardize or min-max) so every feature is on a similar scale.
  • Cut the hidden size dramatically — try a single hidden layer with 4–32 units, not 320.
  • Use a validation split and early stopping instead of an ultra-tight MSE target. Stop when validation error stops improving.
  • Reduce the learning rate (e.g. 0.01 → 0.001) if training oscillates; momentum ~0.5–0.9 is fine but tune if unstable.
  • Test how many epochs one pass takes (time/epoch). If PHP is slow, export the data and prototype in a library with diagnostics (faster iteration).
  • For very small datasets try linear/ridge regression first — simpler models often win.

Minimal example (conceptual) — scale then try a small MLP:

# scale X,y, then fit a small regressor
Xs = MinMaxScaler().fit_transform(X)
ys = MinMaxScaler().fit_transform(y.reshape(-1,1)).ravel()
model = MLPRegressor(hidden_layer_sizes=(16,), learning_rate_init=0.01, max_iter=1000)
model.fit(Xs, ys)

Summary: focus first on preprocessing and model size. With 8 inputs and a small training set you should see useful convergence in minutes or hours, not days.

Recommended Answers

All 5 Replies

Wow! what are you talking about ? Sorry for my ignorance, but what are neurons ? learning rate ? momentum ?

It's a joke. He's pulling your chain.

It's his first post.

Everyone knows that it takes exactly (%43h7c99bdE23% * (3.14159^2 / 64)) nanoseconds to train a neural network for the first time. :) of course, it could take less the second time.

I am afraid it´s not a joke... in fact I would be happy if it would and I would not be frozen by that problem for days now... as mentioned it´s the first time I use neural networks. Of course I know that learning time differs a lot, but what I meant is if my variables are setup a way that makes it impossiple anyway to train the network I could stop the training right away... despite of that I use only a few hundret pairs so to say for training atm while I would have several thousands yet to to train... now if training a few hundreds already takes so far several days (and I am not sure for how much more days the training would last) training several thousands would probably take years....

Really no joke, just trying to work with neural networks for the first time...

, these are values to be set when trying to train and work with neural networks...

, Sorry. This is the first time I am seeing something like this! hmm..maybe someone who knows bout it should answer !

Actually, just in regards to this, he's definitely serious as I'm working on something similar and have been for quite some time. Neural networks don't actually take that long to learn pattern sets for things like stock data especially if you provide a good training set followed with the outputs you're looking for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.