1

分類を実行するために、ENCOG を使用して単純なニューラル ネットワークを構築したいと考えています。XOR を示す例を見つけました。入力を含む double 配列と、学習プロセスの理想的な出力を含む別の配列があります。したがって、データセットは次のようになります。

 /// Input f o r the XOR f unc t i on .
 public static double [ ] [ ] XORInput = {
 new[ ] { 0.0 , 0.0 },
 new[ ] { 1.0 , 0.0 },
 new[ ] { 0.0 , 1.0 },
 new[ ] { 1.0 , 1.0}
 } ;

 /// I d e a l output f o r the XOR f unc t i on .
 public static double [ ] [ ] XORIdeal = {
 new[ ] { 0.0 } ,
 new[ ] { 1.0 } ,
 new[ ] { 1.0 } ,
 new[ ] {0.0}
 } ;

 // create training data
        IMLDataSet trainingSet = new BasicMLDataSet(XORInput, XORIdeal);

次に、ネットワーク自体が作成され、学習プロセスが初期化されます

 // train the neural network
        IMLTrain train = new ResilientPropagation(network, trainingSet);

XORInput、XORIdealの代わりに使用できるように、txtファイルから独自のデータセットをロードする方法を知りたいです。

私が試してみました:

 string[] ins = File.ReadAllLines(path);
 double [] inputs = new double[ins.Length]

 for(int i=0; i<ins.Length; i++)
 {
 inputs[i] = Double.Parse(ins[i]);
 } 

編集:これは私の入力がどのように見えるかです:

166 163 180 228
165 162 160 226
166 163 180 228
166 164 180 228
171 162 111 225

そしてアウト:

0 0 1

0 0 1

0 1 0

1 0 0

0 1 0

これは機能していません。txt ファイルのすべての要素にインデックスを付けていないためだと思います。私はここで立ち往生しています。誰でも助けてもらえますか?ありがとうございました。

4

1 に答える 1