mirror of
https://github.com/jneug/zeichenmaschine.git
synced 2026-04-14 14:43:33 +02:00
Weitere Tests eingefügt und verbessert
This commit is contained in:
@@ -16,6 +16,23 @@ class MLMatrixTest {
|
|||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ParameterizedTest
|
||||||
|
@ValueSource( classes = {DoubleMatrix.class, MatrixFactory.ColtMatrix.class} )
|
||||||
|
void get( Class<? extends MLMatrix> mType ) {
|
||||||
|
MatrixFactory.matrixType = mType;
|
||||||
|
|
||||||
|
MLMatrix M = MatrixFactory.create(new double[][]{
|
||||||
|
{1, 2, 3},
|
||||||
|
{4, 5, 6}
|
||||||
|
});
|
||||||
|
|
||||||
|
assertEquals(mType, M.getClass());
|
||||||
|
|
||||||
|
assertEquals(1.0, M.get(0,0));
|
||||||
|
assertEquals(4.0, M.get(1,0));
|
||||||
|
assertEquals(6.0, M.get(1,2));
|
||||||
|
}
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@ValueSource( classes = {DoubleMatrix.class, MatrixFactory.ColtMatrix.class} )
|
@ValueSource( classes = {DoubleMatrix.class, MatrixFactory.ColtMatrix.class} )
|
||||||
void initializeOne( Class<? extends MLMatrix> mType ) {
|
void initializeOne( Class<? extends MLMatrix> mType ) {
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ class NeuralNetworkTest {
|
|||||||
@BeforeAll
|
@BeforeAll
|
||||||
static void setupMatrixLibrary() {
|
static void setupMatrixLibrary() {
|
||||||
Constants.setSeed(1001);
|
Constants.setSeed(1001);
|
||||||
MatrixFactory.matrixType = MatrixFactory.ColtMatrix.class;
|
//MatrixFactory.matrixType = MatrixFactory.ColtMatrix.class;
|
||||||
//MatrixFactory.matrixType = DoubleMatrix.class;
|
MatrixFactory.matrixType = DoubleMatrix.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Test
|
/*@Test
|
||||||
@@ -153,12 +153,11 @@ class NeuralNetworkTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private List<TestData> createTrainingSet( int trainingSetSize, CalcType operation ) {
|
private List<TestData> createTrainingSet( int trainingSetSize, CalcType operation ) {
|
||||||
Random random = new Random();
|
|
||||||
List<TestData> tuples = new ArrayList<>();
|
List<TestData> tuples = new ArrayList<>();
|
||||||
|
|
||||||
for( int i = 0; i < trainingSetSize; i++ ) {
|
for( int i = 0; i < trainingSetSize; i++ ) {
|
||||||
double s1 = random.nextDouble() * 0.5;
|
double s1 = Constants.random() * 0.5;
|
||||||
double s2 = random.nextDouble() * 0.5;
|
double s2 = Constants.random() * 0.5;
|
||||||
|
|
||||||
switch( operation ) {
|
switch( operation ) {
|
||||||
case ADD:
|
case ADD:
|
||||||
|
|||||||
Reference in New Issue
Block a user