Group Abstract Group Abstract

Message Boards Message Boards

Help with "NetEncoder[{Scalar,...}]" deprecation warning in neural network model (Titanic data)

Posted 1 day ago

Hi everyone,

I'm developing a neural network model using the Titanic dataset, and I recently encountered the following warning:

"NetEncoder[{Scalar, ...}]" setting has been deprecated. Use "Real" or "Integer" bare port specifications instead.

In response, I tried changing "age"->"Real" , but the warning persists and doesn't resolve the issue.

Any suggestions on how to fix or properly update the encoder settings would be greatly appreciated.

Here are codes.

titanicdata = ExampleData[{"Dataset", "Titanic"}];
titanicdata = DeleteMissing[titanicdata, 1, 2];
{trainingData, testData} = 
 TakeDrop[RandomSample@titanicdata, 800]; Take[trainingData, 5]

net1 = NetGraph[{CatenateLayer[], LinearLayer[10], 
   BatchNormalizationLayer[], LinearLayer[],
   LogisticSigmoid}, {{NetPort["age"], NetPort["class"], 
     NetPort["sex"]} -> 1, 1 -> 2 -> 3 -> 4 -> 5 -> NetPort["survived"]},
   "age" -> "Scalar", 
  "class" -> NetEncoder[{"Class", {"1st", "2nd", "3rd"}, "UnitVector"}],
   "sex" -> NetEncoder[{"Class", {"male", "female"}, "UnitVector"}], 
  "survived" -> "Boolean"]
POSTED BY: Sangdon Lee

If you want your real number wrapper in a list (to work with CatenateLayer) the best thing is probably to use a function encoder as follows "age" -> NetEncoder[{"Function", List, 1}]

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard