Esempio n. 1
0
        private void TestTransponce()
        {
            MatrixSetUp provider = new MatrixSetUp(5, 3);

            double[,] U     = provider.U;
            double[,] trans = MyMatrix <double> .Transpose(U);

            Utils <double> .PrintMatrix(U);

            Console.WriteLine("trasponowana:\n");
            Utils <double> .PrintMatrix(trans);
        }
Esempio n. 2
0
        public ALS(int prodAmount, int d, double reg)
        {
            this.d   = d;
            this.reg = reg;
            Provider = new MatrixSetUp(prodAmount, d);  // give this argument for ALS

            SetValues(Provider);

            // SetTestVal();

            // Set3x3Test();

            int usersCount    = Ratings.GetLength(0);
            int productsConut = Ratings.GetLength(1);

            /*
             * Console.WriteLine($"testowe dane ratings userxproduct [{usersCount}x{productsConut}]");
             *
             *
             * Console.WriteLine("\n P  \n");
             * Utils<double>.PrintMatrix(P);
             * Console.WriteLine("\n U  \n");
             * Utils<double>.PrintMatrix(U);
             */
            for (int fun = 0; fun < 10; fun++)
            {
                for (int i = 0; i < iteration; i++)
                {
                    for (int u = 0; u < usersCount; u++)   //wazne tylko do u < d  potem sie liczy, ale nie wpisuje do U, bo jest za małych rozmiarów ...
                    {
                        StepForU(u);
                    }

                    for (int p = 0; p < productsConut; p++)
                    {
                        StepForP(p);
                    }
                }
                ObjectiveFunction.Calculate(Ratings, U, P, d, reg);
            }
        }
Esempio n. 3
0
 private void SetValues(MatrixSetUp Provider)
 {
     U       = Provider.U;
     P       = Provider.P;
     Ratings = Provider.Ratings;
 }