PyBrain で予測を行うプロジェクトに取り組んでいますが、出力レイヤーがドメイン [0..1] の値のみを生成するように、NN の出力のドメインを簡単な方法で制限する方法を知りたいです。
現在、ネットの一部のアクティベーションで負の値を取得しています。
これが可能であることを示すと思われるメソッドまたはメソッドパラメーターに出くわすことなく、PyBrain のドキュメントを検索しました。以下の関連コードサンプル:
self.pybrain_net_date = buildNetwork(self.pb_indim, hidden_dim, hidden_dim, 1, hiddenclass=SigmoidLayer, outclass=LinearLayer, bias=True)
self.pybrain_net_amount = buildNetwork(self.pb_indim, hidden_dim, hidden_dim, 1, hiddenclass=SigmoidLayer, outclass=LinearLayer, bias=True)
trainer_date = BackpropTrainer(self.pybrain_net_date, self.pbds_train_date)
trainer_amount = BackpropTrainer(self.pybrain_net_amount, self.pbds_train_amount)
print trainer_date.trainUntilConvergence(self.pbds_train_date, 30, verbose=True, validationProportion=0.20)
print trainer_amount.trainUntilConvergence(self.pbds_train_amount, 30, verbose=True, validationProportion=0.20)
for index, row in input_dataframe.iterrows():
date = neuralnet_date.activate(row)
amount = neuralnet_amount.activate(row)
prediction_df['Expected Date'].ix[index] = date
prediction_df['Expected Amount'].ix[index] = amount