我正在开发一个代码,我需要建立一个联合和二维数组的交集。
代码
System.out.print("True set of assigned by us\n");
for (int s = 0 ; s < count ; s++)
{
for(int z = 0; z < 5 ; z++)
{
System.out.print(" " + known_matrix[s][z]);
}
System.out.println("\n");
}
Instances testset = filteredInstaces1.stringFreeStructure();
for(String rm : arrayList)
{
int counter =0;
rm = rm.replaceAll("[^\\p{L}\\p{Z}]", "");
Instance testInstance = makeInstance(rm, testset);
filter.input(testInstance);
Instance filteredInstance = filter.output();
double[] result = tree.distributionForInstance(filteredInstance);
System.out.print("\n====== RESULT ====== \tCLASSIFIED AS:\t\n");
int [][] zMatrix = new int[11][5];
// Threshold code
for(int c = 0; c < 5;c++)
{
if(counter >= count)
break;
System.out.print(result[c] + "\t" );
// Z matrix
int y = 0;
max = 0.0;
if(result[c] >= 0.0 )
{
zMatrix[y][c] = 1;
max = 0.0;
}
y++;
if(result[c] >= 0.1 )
{
zMatrix[y][c] = 1;
max = 0.1;
}
y++;
if(result[c] >= 0.2 )
{
zMatrix[y][c] = 1;
max = 0.2;
}
y++;
if(result[c] >= 0.3 )
{
zMatrix[y][c] = 1;
max = 0.3;
}
y++;
if(result[c] >= 0.4 )
{
zMatrix[y][c] = 1;
max = 0.4;
}
y++;
if(result[c] >= 0.5 )
{
zMatrix[y][c] = 1;
max = 0.5;
}
y++;
if(result[c] > 0.6 )
{
zMatrix[y][c] = 1;
max = 0.6;
}
y++;
if(result[c] >= 0.7 )
{
zMatrix[y][c] = 1;
max = 0.7;
}
y++;
if(result[c] >= 0.8 )
{
zMatrix[y][c] = 1;
max = 0.8;
}
y++;
if(result[c] >= 0.9 )
{
zMatrix[y][c] = 1;
max = 0.9;
}
y++;
if(result[c] == 1.0)
{
zMatrix[y][c] = 1;
max = 1.0;
}
}
counter++;
System.out.println("\nPredictable matrix\n");
double v = 0.0;
for(int g1 = 0; g1 < 11 ; g1++)
{
System.out.print(v + "-->" );
for(int g2=0; g2 < 5; g2++)
{
System.out.print("\t" + zMatrix[g1][g2]);
}
v = t.rounding(v + (0.1));
System.out.println();
}
我需要做一个known_matrix [] []和zMatrix [] []的交集。
请建议我一个解决方案。 (忽略上面的错误编码部分,我需要做一些更改)
输入数据集:
已知矩阵[] []:
1 1 0 0 0
0 1 0 1 0
0 1 0 0 0
zMatrix [] []:
1 1 1 1 1
1 1 0 1 0
1 1 0 1 0
1 0 0 0 0
1 0 0 0 0
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 1 0 0
0 1 0 0 0
0 0 1 0 0