當前位置: 首頁>>代碼示例>>C#>>正文


C# Matrix.SetRowToOneValue方法代碼示例

本文整理匯總了C#中System.Matrix.SetRowToOneValue方法的典型用法代碼示例。如果您正苦於以下問題:C# Matrix.SetRowToOneValue方法的具體用法?C# Matrix.SetRowToOneValue怎麽用?C# Matrix.SetRowToOneValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Matrix的用法示例。


在下文中一共展示了Matrix.SetRowToOneValue方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestSetRowToOneValue

		[Test()] public void TestSetRowToOneValue()
		{
			var matrix = new Matrix<int>(5, 5);
			int[] row = { 1, 2, 3, 4, 5 };
			for (int i = 0; i < 5; i++)
				matrix.SetRow(i, row);
			matrix.SetRowToOneValue(3, 10);
			int[] testrow = { 10, 10, 10, 10, 10 };
			Assert.AreEqual(testrow, matrix.GetRow(3));
		}
開發者ID:WisonHuang,項目名稱:MyMediaLite,代碼行數:10,代碼來源:MatrixTest.cs

示例2: InitModel

		///
		protected internal override void InitModel()
		{
			base.InitModel();

			x = new Matrix<float>(item_attributes.NumberOfColumns, NumFactors);
			x.InitNormal(InitMean, InitStdDev);
			q = new Matrix<float>(MaxItemID + 1, NumFactors);
			q.InitNormal(InitMean, InitStdDev);

			// set factors to zero for items without training examples
			for (int i = 0; i < ratings.CountByItem.Count; i++)
				if (ratings.CountByItem[i] == 0)
					q.SetRowToOneValue(i, 0);
		}
開發者ID:WisonHuang,項目名稱:MyMediaLite,代碼行數:15,代碼來源:GSVDPlusPlus.cs

示例3: InitModel

        ///
        protected internal override void InitModel()
        {
            base.InitModel();

            p = new Matrix<float>(MaxUserID + 1, NumFactors);
            p.InitNormal(InitMean, InitStdDev);
            y = new Matrix<float>(MaxItemID + 1, NumFactors);
            y.InitNormal(InitMean, InitStdDev);

            // set factors to zero for items without training examples
            for (int i = 0; i < ratings.CountByItem.Count; i++)
                if (ratings.CountByItem[i] == 0)
                    y.SetRowToOneValue(i, 0);
            for (int i = ratings.CountByItem.Count; i <= MaxItemID; i++)
            {
                y.SetRowToOneValue(i, 0);
                item_factors.SetRowToOneValue(i, 0);
            }

            // set factors to zero for users without training examples (rest is done in MatrixFactorization.cs)
            for (int u = ratings.CountByUser.Count; u <= MaxUserID; u++)
                p.SetRowToOneValue(u, 0);

            user_bias = new float[MaxUserID + 1];
            item_bias = new float[MaxItemID + 1];
        }
開發者ID:Spirit-Dongdong,項目名稱:MyMediaLite,代碼行數:27,代碼來源:SVDPlusPlus.cs

示例4: InitModel

        ///
        protected override void InitModel()
        {
            x = new Matrix<float>(MaxUserID + 1, NumFactors);
            x.InitNormal(InitMean, InitStdDev);

            // set factors to zero for users without training examples
            for (int user_id = 0; user_id < x.NumberOfRows; user_id++)
                if (user_id > ratings.MaxUserID || ratings.CountByUser[user_id] == 0)
                    x.SetRowToOneValue(user_id, 0);

            base.InitModel();
        }
開發者ID:bemde,項目名稱:MyMediaLite,代碼行數:13,代碼來源:SigmoidUserAsymmetricFactorModel.cs

示例5: InitModel

        ///
        protected internal override void InitModel()
        {
            y = new Matrix<float>(MaxItemID + 1, NumFactors);
            y.InitNormal(InitMean, InitStdDev);

            // set factors to zero for items without training examples
            for (int item_id = 0; item_id < y.NumberOfRows; item_id++)
                if (item_id > ratings.MaxItemID || ratings.CountByItem[item_id] == 0)
                    y.SetRowToOneValue(item_id, 0);

            base.InitModel();
        }
開發者ID:Spirit-Dongdong,項目名稱:MyMediaLite,代碼行數:13,代碼來源:SigmoidItemAsymmetricFactorModel.cs

示例6: InitModel

        /// <summary>Initialize the model data structure</summary>
        protected virtual void InitModel()
        {
            // init factor matrices
            user_factors = new Matrix<float>(MaxUserID + 1, NumFactors);
            item_factors = new Matrix<float>(MaxItemID + 1, NumFactors);
            user_factors.InitNormal(InitMean, InitStdDev);
            item_factors.InitNormal(InitMean, InitStdDev);

            // set factors to zero for users and items without training examples
            for (int u = 0; u < ratings.CountByUser.Count; u++)
                if (ratings.CountByUser[u] == 0)
                    user_factors.SetRowToOneValue(u, 0);
            for (int i = 0; i < ratings.CountByItem.Count; i++)
                if (ratings.CountByItem[i] == 0)
                    item_factors.SetRowToOneValue(i, 0);
        }
開發者ID:mvreg,項目名稱:MyMediaLite,代碼行數:17,代碼來源:ThreadSafeMatrixFactorization.cs

示例7: InitModel

        ///
        protected internal override void InitModel()
        {
            base.InitModel ();

            p = new Matrix<float> (MaxUserID + 1, NumFactors);
            p.InitNormal (InitMean, InitStdDev);
            y = new Matrix<float> (MaxItemID + 1, NumFactors);
            y.InitNormal (InitMean, InitStdDev);

            // set factors to zero for items without training examples
            for (int i = 0; i < ratings.CountByItem.Count; i++)
                if (ratings.CountByItem [i] == 0)
                    y.SetRowToOneValue (i, 0);
            for (int i = ratings.CountByItem.Count; i <= MaxItemID; i++) {
                y.SetRowToOneValue (i, 0);
                item_factors.SetRowToOneValue (i, 0);
            }
            // set factors to zero for users without training examples (rest is done in MatrixFactorization.cs)
            for (int u = ratings.CountByUser.Count; u <= MaxUserID; u++) {
                p.SetRowToOneValue (u, 0);
            }
            user_bias = new float[MaxUserID + 1];
            item_bias = new float[MaxItemID + 1];

            h = new Matrix<float>[AdditionalUserAttributes.Count + 1];
            h [0] = new Matrix<float> (UserAttributes.NumberOfColumns, ItemAttributes.NumberOfColumns);
            h [0].InitNormal (InitMean, InitStdDev);
            for (int d = 0; d < AdditionalUserAttributes.Count; d++) {
                h [d + 1] = new Matrix<float> (AdditionalUserAttributes [d].NumberOfColumns, ItemAttributes.NumberOfColumns);
                h [d + 1].InitNormal (InitMean, InitStdDev);
            }
        }
開發者ID:wendelad,項目名稱:RecSys,代碼行數:33,代碼來源:DemoMFUserItemAtt.cs

示例8: InitModel

        ///
        protected override void InitModel()
        {
            base.InitModel();

            p = new Matrix<float>(MaxUserID + 1, NumFactors);
            p.InitNormal(InitMean, InitStdDev);
            y = new Matrix<float>(MaxItemID + 1, NumFactors);
            y.InitNormal(InitMean, InitStdDev);

            // set factors to zero for items without training examples
            for (int i = 0; i <= MaxItemID; i++)
                if (ratings.CountByItem[i] == 0)
                    y.SetRowToOneValue(i, 0);

            user_bias = new float[MaxUserID + 1];
            item_bias = new float[MaxItemID + 1];
        }
開發者ID:dylanhogg,項目名稱:MyMediaLite,代碼行數:18,代碼來源:SVDPlusPlus.cs


注:本文中的System.Matrix.SetRowToOneValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。