Exemple #1
0
        public double[] countHiddenValue(IrisItem irisItem, Matrix gausianMatrix, int jumlahCluster)
        {
            double[] hiddenValue = new double[jumlahCluster];
            double[] iris = irisItem.toArray();
            double[,] gausian = gausianMatrix.ToArray();

            for (int i = 0; i < jumlahCluster; i++)
            {
                double temp = 0;
                for (int j = 0; j < iris.Length; j++)
                {
                    temp += (iris[j] * gausianMatrix[i, j]);
                }

                temp = 1 / (1 + Math.Exp(-1 * temp));
                temp = (temp > 0.6) ? 1 : 0;
                hiddenValue[i] = temp;
            }

            return hiddenValue;
        }
Exemple #2
0
        public Matrix getBobot(IrisItem item, List<ClusterItem> listCluster)
        {
            double[,] temp = new double[listCluster.Count, 4];
            double[] iris = item.toArray();

            for (int i = 0; i < listCluster.Count; i++)
            {
                for (int j = 0; j < iris.Length; j++)
                {
                    temp[i, j] = getBobot(listCluster[i].toArray(), iris[j], getVariance(listCluster[i].toArray(), listCluster.Count));
                }
            }

            Matrix gausianMatrix = DenseMatrix.OfArray(temp);
            return gausianMatrix;
        }