Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //###########################
- //## Paweł Kalinowski ##
- //## S11348 ##
- //###########################
- using System;
- using System.Collections;
- namespace SimplePerceptronNetBEP.Classes.TestValues
- {
- class NeuralNetworkTestData
- {
- internal class TestSet
- {
- public double[] input;
- public double[] output;
- public TestSet(double[] inpuDoubles, double[] outpuDoubles)
- {
- input = inpuDoubles;
- output = outpuDoubles;
- }
- }
- private readonly ArrayList lst;
- private readonly Random rand;
- //poprawne
- private readonly double[] _test1Input =
- {
- 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 1, 0, 1, 1, 0,
- 1, 0, 1, 1, 1, 1, 1, 1, 1
- };
- private readonly double[] _test2Input =
- {
- 0, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0, 1,
- 0, 1, 0, 0, 0, 1, 0, 1, 1,
- 1, 1, 1, 1, 1, 0, 1, 1, 1
- };
- private readonly double[] _test3Input =
- {
- 0, 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 1, 1, 0, 0, 0, 0, 0, 0, 1,
- 1, 1, 1, 0, 0, 0, 0, 0, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 0
- };
- private readonly double[] _test7Input =
- {
- 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 1, 0, 0, 0, 1, 0,
- 0, 0, 1, 0, 1, 0, 1, 1, 0,
- 1, 0, 1, 1, 1, 1, 1, 1, 1
- };
- private readonly double[] _test8Input =
- {
- 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 1, 0, 1,
- 0, 1, 1, 0, 0, 0, 0, 1, 1,
- 1, 1, 0, 1, 1, 1, 1, 1, 1
- };
- private readonly double[] _test9Input =
- {
- 0, 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 0, 1, 1, 1
- };
- private readonly double[] _test12Input =
- {
- 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1,
- 1, 0, 0, 0, 1, 0, 1, 0, 0,
- 1, 0, 0, 1, 0, 1, 0, 0, 1,
- 1, 1, 0, 1, 1, 1, 1, 1, 1
- };
- private readonly double[] _test13Input =
- {
- 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 1, 0, 0,
- 1, 0, 1, 0, 0, 0, 1, 0, 1,
- 1, 1, 0, 1, 1, 1, 1, 1, 1
- };
- private readonly double[] _test14Input =
- {
- 0, 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 1, 1, 1, 0, 0,
- 0, 0, 0, 1, 1, 1, 0, 0, 1,
- 0, 1, 1, 1, 1, 1, 1, 1, 1
- };
- private readonly double[] _test15Input =
- {
- 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 1, 0, 1, 0, 0, 0, 1, 0, 0,
- 1, 1, 1, 0, 0, 1, 0, 0, 0,
- 1, 0, 1, 1, 1, 1, 1, 1, 1
- };
- private readonly double[] _test16Input =
- {
- 0, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 1, 1, 0, 0, 1, 0,
- 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 1, 0, 1, 1, 1, 1, 1, 1
- };
- private readonly double[] _test17Input =
- {
- 0, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 0,
- 1, 1, 0, 0, 0, 0, 0, 1, 1,
- 1, 1, 1, 1, 1, 1, 0, 1, 1
- };
- //niepoprawne
- private readonly double[] _test4Input =
- {
- 0, 1, 0, 1, 0, 1, 0, 1, 0,
- 1, 0, 0, 0, 0, 1, 0, 0, 1,
- 1, 1, 0, 0, 0, 0, 1, 0, 1,
- 1, 0, 1, 0, 1, 1, 1, 0, 1,
- 1, 1, 0, 1, 0, 1, 1, 1, 0
- };
- private readonly double[] _test5Input =
- {
- 1, 1, 1, 0, 0, 0, 0, 1, 0,
- 0, 1, 1, 0, 0, 0, 0, 0, 1,
- 1, 0, 0, 1, 0, 1, 0, 0, 1,
- 0, 1, 1, 0, 0, 1, 0, 0, 1,
- 0, 0, 0, 0, 1, 0, 1, 1, 0
- };
- private readonly double[] _test6Input =
- {
- 0, 0, 0, 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 1, 0, 0, 0, 0, 1,
- 1, 1, 0, 1, 0, 0, 1, 0, 1,
- 1, 0, 0, 1, 0, 0, 0, 0, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 0
- };
- private readonly double[] _test10Input =
- {
- 0, 0, 0, 1, 0, 0, 0, 1, 0,
- 0, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 1, 0, 1, 0, 0, 1, 0, 0,
- 1, 1, 0, 1, 1, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 1, 1, 1, 1
- };
- private readonly double[] _test11Input =
- {
- 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 0, 0, 0,
- 1, 1, 0, 1, 0, 0, 1, 0, 1,
- 1, 0, 0, 1, 0, 0, 0, 1, 1,
- 1, 0, 1, 1, 1, 1, 1, 1, 1
- };
- public readonly double[] _testSuccess =
- {
- 1//,1,1,1,1
- };
- private readonly double[] _testFail =
- {
- 0
- };
- public NeuralNetworkTestData()
- {
- rand = new Random();
- lst = new ArrayList
- {
- new TestSet(_test1Input, _testSuccess),
- new TestSet(_test2Input, _testSuccess),
- new TestSet(_test3Input, _testSuccess),
- new TestSet(_test4Input, _testFail),//new double[]{0,0,0,0,0}),
- new TestSet(_test5Input, _testFail),//new double[]{0,0,0,1,0}),
- new TestSet(_test6Input, _testFail),//new double[]{0,0,0,0,1}),
- new TestSet(_test7Input, _testSuccess),
- new TestSet(_test8Input, _testSuccess),
- new TestSet(_test9Input, _testSuccess),
- new TestSet(_test10Input, _testFail),//new double[]{0,1,1,0,1}),
- new TestSet(_test11Input, _testFail),//new double[]{1,1,0,1,1})
- new TestSet(_test12Input, _testSuccess),
- new TestSet(_test13Input, _testSuccess),
- new TestSet(_test14Input, _testSuccess),
- new TestSet(_test15Input, _testSuccess),
- new TestSet(_test16Input, _testSuccess),
- new TestSet(_test17Input, _testSuccess),
- };
- }
- public TestSet GetTestSet()
- {
- return (TestSet) lst[(rand.Next(1, 17))-1];
- }
- //public double[] GetTestMatrix()
- //{
- // int whichTest = rand.Next(1, 3);
- // switch (whichTest)
- // {
- // case 1:
- // {
- // return _test1Input;
- // }
- // case 2:
- // {
- // return _test2Input;
- // }
- // case 3:
- // {
- // return _test3Input;
- // }
- // default:
- // {
- // return null;
- // }
- // }
- //}
- //public double[] GetProperResult()
- //{
- // return _testOutput;
- //}
- //public void SetTestMatrix(double[] input, double[] resultSet)
- //{
- // int whichTest = rand.Next(1, 3);
- // double[] test = new double[45];
- // switch (whichTest)
- // {
- // case 1:
- // {
- // test = _test1Input;
- // break;
- // }
- // case 2:
- // {
- // test = _test2Input;
- // break;
- // }
- // case 3:
- // {
- // test = _test3Input;
- // break;
- // }
- // default :{break;}
- // }
- // input = test;
- // resultSet = _testOutput;
- //}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement