当前位置: 首页>>代码示例>>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;未经允许,请勿转载。