/// <summary> /// Uczenie warstwy wyjsciowej /// </summary> /// <param name="outputDesirableData"></param> private void OutputLayerLearning(List <double[]> outputDesirableData) { greenMatrix = CreateGreenMatrix(); double[,] invertedGreenmatrix = Pseudoinverse.Solve(greenMatrix); for (int i = 0; i < neuronOutputLayer.Count; i++) { double[] weight = Matrix.Multiply(invertedGreenmatrix, outputDesirableData[i]); ((LinearNeuron)neuronOutputLayer[i]).Weights = weight; } }
public static void SVDMemoryUse() { int sizeX = 4000, sizeY = 5000; double[,] matrix = new double[sizeX, sizeY]; for (int i = 0; i < sizeX; i++) { for (int j = 0; j < sizeY; j++) { matrix[i, j] = i + j; } } double[,] svdA = Pseudoinverse.Solve(matrix); Console.WriteLine("Macierz wynikowa."); Console.WriteLine(Matrix.ToString(svdA)); GC.SuppressFinalize(matrix); GC.SuppressFinalize(svdA); matrix = null; svdA = null; }
public void SVDtest() { double[,] a = StartMatrix(); double[,] svdA = Pseudoinverse.Solve(a); Console.WriteLine("Macierz wynikowa."); Console.WriteLine(Matrix.ToString(svdA)); svdA = Pseudoinverse.Solve(svdA); Console.WriteLine("Macierz po kolejnej operacji SVD wynikowa."); Console.WriteLine(Matrix.ToString(svdA)); for (int i = 0; i < svdA.GetLength(0); i++) { for (int j = 0; j < svdA.GetLength(1); j++) { if (Math.Abs(svdA[i, j] - a[i, j]) > 0.05) { Assert.IsTrue(false); } } } Assert.IsTrue(true); }