BVLC / caffe

Caffe: a fast open framework for deep learning.
http://caffe.berkeleyvision.org/
Other
34.03k stars 18.7k forks source link

Too large MLP loss #6844

Open starkdm opened 4 years ago

starkdm commented 4 years ago

I solve the problem of regression. 5 values are predicted from the 20 previous values of 2 exogenous variables. All values in data and labels are in the range from 0 to 1. What could be the reason for so large error?

model.prototxt

name: "MLP"

layer {
  name: "input"
  type: "Input"
  top: "data"
  top: "labels"
  input_param {
    shape: { dim: 5000 dim: 2 dim: 1 dim: 20 }
    shape: { dim: 5000 dim: 1 dim: 1 dim: 5 }
  }
  include {
    phase: TRAIN
  }
}

layer {
  name: "input"
  type: "Input"
  top: "data"
  input_param {
    shape: { dim: 100 dim: 2 dim: 1 dim: 20 }
  }
  include {
    phase: TEST
  }
}

layer {
  name: "fc1"
  type: "InnerProduct"
  bottom: "data"
  top: "fc1"
  inner_product_param {
    num_output: 50
    weight_filler {
      type: "msra"
    }
    bias_filler {
      type: "constant"
      value: 1
    }
  }
}

layer {
  name: "s1"
  type: "Sigmoid"
  bottom: "fc1"
  top: "s1"
}

layer {
  name: "fc2"
  type: "InnerProduct"
  bottom: "s1"
  top: "fc2"
  inner_product_param {
    num_output: 5
    weight_filler {
      type: "msra"
    }
    bias_filler {
      type: "constant"
      value: 1
    }
  }
}

layer {
  name: "output"
  type: "Sigmoid"
  bottom: "fc2"
  top: "s2"
}

layer {
  name: "loss"
  type: "EuclideanLoss"
  bottom: "s2"
  bottom: "labels"
  top: "loss"
  include {
    phase: TRAIN
  }
}

solver.prototxt

net: "model.prototxt"
base_lr: 0.01
lr_policy: "fixed"
max_iter: 500
momentum: 0.45
solver_mode: CPU
display: 10
snapshot_prefix: "mlp"
type: "Adam"

Output

I1005 21:38:24.438515 18200 solver.cpp:218] Iteration 0 (0 iter/s, 0.033s/10 iters), loss = 2.1907e+131
I1005 21:38:24.438515 18200 solver.cpp:237]     Train net output #0: loss = 2.1907e+131 (* 1 = 2.1907e+131 loss)
I1005 21:38:24.440623 18200 sgd_solver.cpp:105] Iteration 0, lr = 0.01
I1005 21:38:24.689244 18200 solver.cpp:218] Iteration 10 (40 iter/s, 0.25s/10 iters), loss = 2.1907e+131
I1005 21:38:24.690243 18200 solver.cpp:237]     Train net output #0: loss = 2.1907e+131 (* 1 = 2.1907e+131 loss)
I1005 21:38:24.691956 18200 sgd_solver.cpp:105] Iteration 10, lr = 0.01
I1005 21:38:25.043009 18200 solver.cpp:218] Iteration 20 (28.4091 iter/s, 0.352s/10 iters), loss = 2.1907e+131
I1005 21:38:25.044751 18200 solver.cpp:237]     Train net output #0: loss = 2.1907e+131 (* 1 = 2.1907e+131 loss)
I1005 21:38:25.045539 18200 sgd_solver.cpp:105] Iteration 20, lr = 0.01
I1005 21:38:25.680462 18200 solver.cpp:218] Iteration 30 (15.7233 iter/s, 0.636s/10 iters), loss = 2.1907e+131
I1005 21:38:25.699206 18200 solver.cpp:237]     Train net output #0: loss = 2.1907e+131 (* 1 = 2.1907e+131 loss)

Operating system: Windows 10