当前位置: 首页>>代码示例>>C#>>正文


C# Matrix.Select方法代码示例

本文整理汇总了C#中System.Matrix.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix.Select方法的具体用法?C# Matrix.Select怎么用?C# Matrix.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Matrix的用法示例。


在下文中一共展示了Matrix.Select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPalette

        internal Matrix[] GetPalette()
        {
            Matrix[] m = new Matrix[256];
            m = m.Select(me => Matrix.Identity).ToArray();
            int i = 0;

            foreach (Node n in JointNodes)
            {
                var node = n;

                Matrix currentMat = node.PreComputed;
                while (node.Parent != null)
                {
                    node = node.Parent;
                    currentMat *= node.PreComputed;
                }

                m[i] = BindMatrix * InverseBindMatrix[i] * currentMat;
                i++;
            }
            return m;
        }
开发者ID:Romiinet,项目名称:SharpDX_Demo,代码行数:22,代码来源:SkinData.cs

示例2: Init

        internal void Init(SharpModel model)
        {
            Matrix[] m = new Matrix[256];
            m = m.Select(me => Matrix.Identity).ToArray();

            List<Matrix> tempMatrices = new List<Matrix>();
            for (int i = 0; i < JointNames.Count; i++)
            {
                string s = JointNames[i];
                var node = model.GetNodeByName(s);

                JointNodes.Add(node);
            }
        }
开发者ID:JWEC,项目名称:SharpDX_Demo,代码行数:14,代码来源:SkinData.cs

示例3: TrainTestSplit

        /// <summary>
        /// Split arrays or matrices into random train and test subsets
        /// </summary>
        /// <param name="arrays">Array of matrices with same row number.</param>
        /// <param name="testSize">Should be between 0.0 and 1.0 and represent the
        /// proportion of the dataset to include in the test split. If <c>null</c>,
        /// the value is automatically set to the complement of the train size.
        /// If train size is also <c> null</c>, test size is set to 0.25.</param>
        /// <param name="trainSize">Should be between 0.0 and 1.0 and represent the
        /// proportion of the dataset to include in the train split. If <c>null</c>,
        /// the value is automatically set to the complement of the test size.</param>
        /// <param name="randomState">Pseudo-random number generator state used for random sampling.</param>
        /// <returns>List containing train-test split of input array.</returns>
        public static IList<Tuple<Matrix<double>, Matrix<double>>> TrainTestSplit(
            Matrix<double>[] arrays,
            double? testSize = null,
            double? trainSize = null,
            Random randomState = null)
        {
            /*
    Examples
    --------
    >>> import numpy as np
    >>> from sklearn.cross_validation import train_test_split
    >>> a, b = np.arange(10).reshape((5, 2)), range(5)
    >>> a
    array([[0, 1],
           [2, 3],
           [4, 5],
           [6, 7],
           [8, 9]])
    >>> list(b)
    [0, 1, 2, 3, 4]


    >>> a_train, a_test, b_train, b_test = train_test_split(
    ...     a, b, test_size=0.33, random_state=42)
    ...
    >>> a_train
    array([[4, 5],
           [0, 1],
           [6, 7]])
    >>> b_train
    array([2, 0, 3])
    >>> a_test
    array([[2, 3],
           [8, 9]])
    >>> b_test
    array([1, 4])


  */
            int nArrays = arrays.Length;
            if (nArrays == 0)
            {
                throw new ArgumentException("At least one array required as input");
            }

            if (arrays.Any(a => a.RowCount != arrays[0].RowCount))
            {
                throw new ArgumentException("All arrays must have same row count");
            }

            if (testSize == null && trainSize == null)
            {
                testSize = 0.25;
            }

            int nSamples = arrays[0].RowCount;
            var cv = ShuffleSplit(
                nSamples,
                testSize: testSize,
                trainSize: trainSize,
                randomState: randomState);

            var r = cv.First();
            int[] train = r.TrainIndices;
            int[] test = r.TestIndices;

            return arrays.Select(a => Tuple.Create(a.RowsAt(train), a.RowsAt(test))).ToList();
        }
开发者ID:geoparsYoti,项目名称:Sharpkit.Learn,代码行数:81,代码来源:CrossValidation.cs


注:本文中的System.Matrix.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。