public unsafe void SetGroup(int[] groups)
 {
     if (groups != null)
     {
         fixed(int *ptr = groups)
         LightGbmInterfaceUtils.Check(WrappedLightGbmInterface.DatasetSetField(_handle, "group", (IntPtr)ptr, groups.Length,
                                                                               WrappedLightGbmInterface.CApiDType.Int32));
     }
 }
        public unsafe void SetLabel(float[] labels)
        {
            Contracts.AssertValue(labels);
            Contracts.Assert(labels.Length == GetNumRows());

            fixed(float *ptr = labels)
            LightGbmInterfaceUtils.Check(WrappedLightGbmInterface.DatasetSetField(_handle, "label", (IntPtr)ptr, labels.Length,
                                                                                  WrappedLightGbmInterface.CApiDType.Float32));
        }
        // Not used now. Can use for the continued train.
        public unsafe void SetInitScore(double[] initScores)
        {
            if (initScores != null)
            {
                Contracts.Assert(initScores.Length % GetNumRows() == 0);

                fixed(double *ptr = initScores)
                LightGbmInterfaceUtils.Check(WrappedLightGbmInterface.DatasetSetField(_handle, "init_score", (IntPtr)ptr, initScores.Length,
                                                                                      WrappedLightGbmInterface.CApiDType.Float64));
            }
        }
 public unsafe void SetWeights(float[] weights)
 {
     if (weights != null)
     {
         Contracts.Assert(weights.Length == GetNumRows());
         // Skip SetWeights if all weights are same.
         bool allSame = true;
         for (int i = 1; i < weights.Length; ++i)
         {
             if (weights[i] != weights[0])
             {
                 allSame = false;
                 break;
             }
         }
         if (!allSame)
         {
             fixed(float *ptr = weights)
             LightGbmInterfaceUtils.Check(WrappedLightGbmInterface.DatasetSetField(_handle, "weight", (IntPtr)ptr, weights.Length,
                                                                                   WrappedLightGbmInterface.CApiDType.Float32));
         }
     }
 }