-
Notifications
You must be signed in to change notification settings - Fork 0
/
Classify.cs
48 lines (47 loc) · 1.21 KB
/
Classify.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
namespace NN_BP
{
class Classify
{
public static bool IsClassifyPassForMnist(double[]expect,double[] actual )
{
if(expect.Length!=actual.Length || expect.Length<1)
{
return false;
}
int expect_index = 0;
int actual_index = 0;
double max = expect[0];
for (int i = 1; i < expect.Length; ++i)
{
if (max < expect[i])
{
expect_index = i;
max = expect[i];
}
}
max = actual[0];
for (int i = 1; i < actual.Length; ++i)
{
if (max < actual[i])
{
actual_index = i;
max = actual[i];
}
}
if (expect_index == actual_index)
{
return true;
}
else
{
return false;
}
}
}
}