forked from SciSharp/Numpy.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnp.random.gen.cs
More file actions
2890 lines (2831 loc) · 127 KB
/
np.random.gen.cs
File metadata and controls
2890 lines (2831 loc) · 127 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2020 by Meinrad Recheis (Member of SciSharp)
// Code generated by CodeMinion: https://github.com/SciSharp/CodeMinion
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Python.Runtime;
using Numpy.Models;
#if PYTHON_INCLUDED
using Python.Included;
#endif
namespace Numpy
{
public static partial class np
{
public static partial class random {
/// <summary>
/// Random values in a given shape.<br></br>
///
/// Create an array of the given shape and populate it with
/// random samples from a uniform distribution
/// over [0, 1).<br></br>
///
/// Notes
///
/// This is a convenience function.<br></br>
/// If you want an interface that
/// takes a shape-tuple as the first argument, refer to
/// np.random.random_sample .
/// </summary>
/// <returns>
/// Random values.
/// </returns>
public static float rand()
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
dynamic py = __self__.InvokeMethod("rand");
return ToCsharp<float>(py);
}
}
public static partial class random {
/// <summary>
/// Return a sample (or samples) from the “standard normal” distribution.<br></br>
///
/// If positive, int_like or int-convertible arguments are provided,
/// randn generates an array of shape (d0, d1, ..., dn), filled
/// with random floats sampled from a univariate “normal” (Gaussian)
/// distribution of mean 0 and variance 1 (if any of the are
/// floats, they are first converted to integers by truncation).<br></br>
/// A single
/// float randomly sampled from the distribution is returned if no
/// argument is provided.<br></br>
///
/// This is a convenience function.<br></br>
/// If you want an interface that takes a
/// tuple as the first argument, use numpy.random.standard_normal instead.<br></br>
///
/// Notes
///
/// For random samples from , use:
///
/// sigma * np.random.randn(...) + mu
/// </summary>
/// <returns>
/// A (d0, d1, ..., dn)-shaped array of floating-point samples from
/// the standard normal distribution, or a single such float if
/// no parameters were supplied.
/// </returns>
public static float randn()
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
dynamic py = __self__.InvokeMethod("randn");
return ToCsharp<float>(py);
}
}
public static partial class random {
/// <summary>
/// Return random integers from low (inclusive) to high (exclusive).<br></br>
///
/// Return random integers from the “discrete uniform” distribution of
/// the specified dtype in the “half-open” interval [low, high).<br></br>
/// If
/// high is None (the default), then results are from [0, low).
/// </summary>
/// <param name="low">
/// Lowest (signed) integer to be drawn from the distribution (unless
/// high=None, in which case this parameter is one above the
/// highest such integer).
/// </param>
/// <param name="high">
/// If provided, one above the largest (signed) integer to be drawn
/// from the distribution (see above for behavior if high=None).
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// Default is None, in which case a
/// single value is returned.
/// </param>
/// <param name="dtype">
/// Desired dtype of the result.<br></br>
/// All dtypes are determined by their
/// name, i.e., ‘int64’, ‘int’, etc, so byteorder is not available
/// and a specific precision may have different C types depending
/// on the platform.<br></br>
/// The default value is ‘np.int’.
/// </param>
/// <returns>
/// size-shaped array of random integers from the appropriate
/// distribution, or a single such random int if size not provided.
/// </returns>
public static NDarray<int> randint(int low, int? high = null, int[] size = null, Dtype dtype = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
low,
});
var kwargs=new PyDict();
if (high!=null) kwargs["high"]=ToPython(high);
if (size!=null) kwargs["size"]=ToPython(size);
if (dtype!=null) kwargs["dtype"]=ToPython(dtype);
dynamic py = __self__.InvokeMethod("randint", pyargs, kwargs);
return ToCsharp<NDarray<int>>(py);
}
}
public static partial class random {
/// <summary>
/// Random integers of type np.int between low and high, inclusive.<br></br>
///
/// Return random integers of type np.int from the “discrete uniform”
/// distribution in the closed interval [low, high].<br></br>
/// If high is
/// None (the default), then results are from [1, low].<br></br>
/// The np.int
/// type translates to the C long type used by Python 2 for “short”
/// integers and its precision is platform dependent.<br></br>
///
/// This function has been deprecated.<br></br>
/// Use randint instead.<br></br>
///
/// Notes
///
/// To sample from N evenly spaced floating-point numbers between a and b,
/// use:
/// </summary>
/// <param name="low">
/// Lowest (signed) integer to be drawn from the distribution (unless
/// high=None, in which case this parameter is the highest such
/// integer).
/// </param>
/// <param name="high">
/// If provided, the largest (signed) integer to be drawn from the
/// distribution (see above for behavior if high=None).
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// Default is None, in which case a
/// single value is returned.
/// </param>
/// <returns>
/// size-shaped array of random integers from the appropriate
/// distribution, or a single such random int if size not provided.
/// </returns>
public static NDarray<int> random_integers(int low, int? high = null, int[] size = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
low,
});
var kwargs=new PyDict();
if (high!=null) kwargs["high"]=ToPython(high);
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("random_integers", pyargs, kwargs);
return ToCsharp<NDarray<int>>(py);
}
}
public static partial class random {
/// <summary>
/// Return random floats in the half-open interval [0.0, 1.0).<br></br>
///
/// Results are from the “continuous uniform” distribution over the
/// stated interval.<br></br>
/// To sample multiply
/// the output of random_sample by (b-a) and add a:
/// </summary>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// Default is None, in which case a
/// single value is returned.
/// </param>
/// <returns>
/// Array of random floats of shape size (unless size=None, in which
/// case a single float is returned).
/// </returns>
public static NDarray<float> random_sample(params int[] size)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("random_sample", pyargs, kwargs);
return ToCsharp<NDarray<float>>(py);
}
}
public static partial class random {
/// <summary>
/// Return random floats in the half-open interval [0.0, 1.0).<br></br>
///
/// Results are from the “continuous uniform” distribution over the
/// stated interval.<br></br>
/// To sample multiply
/// the output of random_sample by (b-a) and add a:
/// </summary>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// Default is None, in which case a
/// single value is returned.
/// </param>
/// <returns>
/// Array of random floats of shape size (unless size=None, in which
/// case a single float is returned).
/// </returns>
public static NDarray<float> random_(params int[] size)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("random", pyargs, kwargs);
return ToCsharp<NDarray<float>>(py);
}
}
public static partial class random {
/// <summary>
/// Return random floats in the half-open interval [0.0, 1.0).<br></br>
///
/// Results are from the “continuous uniform” distribution over the
/// stated interval.<br></br>
/// To sample multiply
/// the output of random_sample by (b-a) and add a:
/// </summary>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// Default is None, in which case a
/// single value is returned.
/// </param>
/// <returns>
/// Array of random floats of shape size (unless size=None, in which
/// case a single float is returned).
/// </returns>
public static NDarray<float> ranf(params int[] size)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("ranf", pyargs, kwargs);
return ToCsharp<NDarray<float>>(py);
}
}
public static partial class random {
/// <summary>
/// Return random floats in the half-open interval [0.0, 1.0).<br></br>
///
/// Results are from the “continuous uniform” distribution over the
/// stated interval.<br></br>
/// To sample multiply
/// the output of random_sample by (b-a) and add a:
/// </summary>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// Default is None, in which case a
/// single value is returned.
/// </param>
/// <returns>
/// Array of random floats of shape size (unless size=None, in which
/// case a single float is returned).
/// </returns>
public static NDarray<float> sample(params int[] size)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("sample", pyargs, kwargs);
return ToCsharp<NDarray<float>>(py);
}
}
public static partial class random {
/// <summary>
/// Generates a random sample from a given 1-D array
/// </summary>
/// <param name="a">
/// If an ndarray, a random sample is generated from its elements.<br></br>
///
/// If an int, the random sample is generated as if a were np.arange(a)
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// Default is None, in which case a
/// single value is returned.
/// </param>
/// <param name="replace">
/// Whether the sample is with or without replacement
/// </param>
/// <param name="p">
/// The probabilities associated with each entry in a.<br></br>
///
/// If not given the sample assumes a uniform distribution over all
/// entries in a.
/// </param>
/// <returns>
/// The generated random samples
/// </returns>
public static NDarray choice(NDarray a, int[] size = null, bool? replace = true, NDarray p = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
if (replace!=true) kwargs["replace"]=ToPython(replace);
if (p!=null) kwargs["p"]=ToPython(p);
dynamic py = __self__.InvokeMethod("choice", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Generates a random sample from a given 1-D array
/// </summary>
/// <param name="a">
/// If an ndarray, a random sample is generated from its elements.<br></br>
///
/// If an int, the random sample is generated as if a were np.arange(a)
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// Default is None, in which case a
/// single value is returned.
/// </param>
/// <param name="replace">
/// Whether the sample is with or without replacement
/// </param>
/// <param name="p">
/// The probabilities associated with each entry in a.<br></br>
///
/// If not given the sample assumes a uniform distribution over all
/// entries in a.
/// </param>
/// <returns>
/// The generated random samples
/// </returns>
public static NDarray choice(int a, int[] size = null, bool? replace = true, NDarray p = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
a,
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
if (replace!=true) kwargs["replace"]=ToPython(replace);
if (p!=null) kwargs["p"]=ToPython(p);
dynamic py = __self__.InvokeMethod("choice", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Return random bytes.
/// </summary>
/// <param name="length">
/// Number of random bytes.
/// </param>
/// <returns>
/// String of length length.
/// </returns>
public static string bytes(int length)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
length,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("bytes", pyargs, kwargs);
return ToCsharp<string>(py);
}
}
public static partial class random {
/// <summary>
/// Modify a sequence in-place by shuffling its contents.<br></br>
///
/// This function only shuffles the array along the first axis of a
/// multi-dimensional array.<br></br>
/// The order of sub-arrays is changed but
/// their contents remains the same.
/// </summary>
/// <param name="x">
/// The array or list to be shuffled.
/// </param>
public static void shuffle(NDarray x)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
x,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("shuffle", pyargs, kwargs);
}
}
public static partial class random {
/// <summary>
/// Randomly permute a sequence, or return a permuted range.<br></br>
///
/// If x is a multi-dimensional array, it is only shuffled along its
/// first index.
/// </summary>
/// <param name="x">
/// If x is an integer, randomly permute np.arange(x).<br></br>
///
/// If x is an array, make a copy and shuffle the elements
/// randomly.
/// </param>
/// <returns>
/// Permuted sequence or array range.
/// </returns>
public static NDarray permutation(NDarray x)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
x,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("permutation", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Randomly permute a sequence, or return a permuted range.<br></br>
///
/// If x is a multi-dimensional array, it is only shuffled along its
/// first index.
/// </summary>
/// <param name="x">
/// If x is an integer, randomly permute np.arange(x).<br></br>
///
/// If x is an array, make a copy and shuffle the elements
/// randomly.
/// </param>
/// <returns>
/// Permuted sequence or array range.
/// </returns>
public static NDarray permutation(int x)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
x,
});
var kwargs=new PyDict();
dynamic py = __self__.InvokeMethod("permutation", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Draw samples from a Beta distribution.<br></br>
///
/// The Beta distribution is a special case of the Dirichlet distribution,
/// and is related to the Gamma distribution.<br></br>
/// It has the probability
/// distribution function
///
/// where the normalisation, B, is the beta function,
///
/// It is often seen in Bayesian inference and order statistics.
/// </summary>
/// <param name="a">
/// Alpha, positive (>0).
/// </param>
/// <param name="b">
/// Beta, positive (>0).
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// If size is None (default),
/// a single value is returned if a and b are both scalars.<br></br>
///
/// Otherwise, np.broadcast(a, b).size samples are drawn.
/// </param>
/// <returns>
/// Drawn samples from the parameterized beta distribution.
/// </returns>
public static NDarray beta(NDarray<float> a, NDarray<float> b, int[] size = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
a,
b,
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("beta", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Draw samples from a binomial distribution.<br></br>
///
/// Samples are drawn from a binomial distribution with specified
/// parameters, n trials and p probability of success where
/// n an integer >= 0 and p is in the interval [0,1].<br></br>
/// (n may be
/// input as a float, but it is truncated to an integer in use)
///
/// Notes
///
/// The probability density for the binomial distribution is
///
/// where is the number of trials, is the probability
/// of success, and is the number of successes.<br></br>
///
/// When estimating the standard error of a proportion in a population by
/// using a random sample, the normal distribution works well unless the
/// product p*n <=5, where p = population proportion estimate, and n =
/// number of samples, in which case the binomial distribution is used
/// instead.<br></br>
/// For example, a sample of 15 people shows 4 who are left
/// handed, and 11 who are right handed.<br></br>
/// Then p = 4/15 = 27%. 0.27*15 = 4,
/// so the binomial distribution should be used in this case.<br></br>
///
/// References
/// </summary>
/// <param name="n">
/// Parameter of the distribution, >= 0.<br></br>
/// Floats are also accepted,
/// but they will be truncated to integers.
/// </param>
/// <param name="p">
/// Parameter of the distribution, >= 0 and <=1.
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// If size is None (default),
/// a single value is returned if n and p are both scalars.<br></br>
///
/// Otherwise, np.broadcast(n, p).size samples are drawn.
/// </param>
/// <returns>
/// Drawn samples from the parameterized binomial distribution, where
/// each sample is equal to the number of successes over the n trials.
/// </returns>
public static NDarray binomial(NDarray<int> n, NDarray<float> p, int[] size = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
n,
p,
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("binomial", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Draw samples from a binomial distribution.<br></br>
///
/// Samples are drawn from a binomial distribution with specified
/// parameters, n trials and p probability of success where
/// n an integer >= 0 and p is in the interval [0,1].<br></br>
/// (n may be
/// input as a float, but it is truncated to an integer in use)
///
/// Notes
///
/// The probability density for the binomial distribution is
///
/// where is the number of trials, is the probability
/// of success, and is the number of successes.<br></br>
///
/// When estimating the standard error of a proportion in a population by
/// using a random sample, the normal distribution works well unless the
/// product p*n <=5, where p = population proportion estimate, and n =
/// number of samples, in which case the binomial distribution is used
/// instead.<br></br>
/// For example, a sample of 15 people shows 4 who are left
/// handed, and 11 who are right handed.<br></br>
/// Then p = 4/15 = 27%. 0.27*15 = 4,
/// so the binomial distribution should be used in this case.<br></br>
///
/// References
/// </summary>
/// <param name="n">
/// Parameter of the distribution, >= 0.<br></br>
/// Floats are also accepted,
/// but they will be truncated to integers.
/// </param>
/// <param name="p">
/// Parameter of the distribution, >= 0 and <=1.
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// If size is None (default),
/// a single value is returned if n and p are both scalars.<br></br>
///
/// Otherwise, np.broadcast(n, p).size samples are drawn.
/// </param>
/// <returns>
/// Drawn samples from the parameterized binomial distribution, where
/// each sample is equal to the number of successes over the n trials.
/// </returns>
public static NDarray binomial(int n, NDarray<float> p, int[] size = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
n,
p,
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("binomial", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Draw samples from a chi-square distribution.<br></br>
///
/// When df independent random variables, each with standard normal
/// distributions (mean 0, variance 1), are squared and summed, the
/// resulting distribution is chi-square (see Notes).<br></br>
/// This distribution
/// is often used in hypothesis testing.<br></br>
///
/// Notes
///
/// The variable obtained by summing the squares of df independent,
/// standard normally distributed random variables:
///
/// is chi-square distributed, denoted
///
/// The probability density function of the chi-squared distribution is
///
/// where is the gamma function,
///
/// References
/// </summary>
/// <param name="df">
/// Number of degrees of freedom, should be > 0.
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// If size is None (default),
/// a single value is returned if df is a scalar.<br></br>
/// Otherwise,
/// np.array(df).size samples are drawn.
/// </param>
/// <returns>
/// Drawn samples from the parameterized chi-square distribution.
/// </returns>
public static NDarray chisquare(NDarray<float> df, int[] size = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
df,
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("chisquare", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Draw samples from the Dirichlet distribution.<br></br>
///
/// Draw size samples of dimension k from a Dirichlet distribution.<br></br>
/// A
/// Dirichlet-distributed random variable can be seen as a multivariate
/// generalization of a Beta distribution.<br></br>
/// Dirichlet pdf is the conjugate
/// prior of a multinomial in Bayesian inference.<br></br>
///
/// Notes
///
/// Uses the following property for computation: for each dimension,
/// draw a random sample y_i from a standard gamma generator of shape
/// alpha_i, then
/// is
/// Dirichlet distributed.<br></br>
///
/// References
/// </summary>
/// <param name="alpha">
/// Parameter of the distribution (k dimension for sample of
/// dimension k).
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// Default is None, in which case a
/// single value is returned.
/// </param>
/// <returns>
/// The drawn samples, of shape (size, alpha.ndim).
/// </returns>
public static NDarray dirichlet(NDarray alpha, int[] size = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
alpha,
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("dirichlet", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Draw samples from an exponential distribution.<br></br>
///
/// Its probability density function is
///
/// for x > 0 and 0 elsewhere.<br></br>
/// is the scale parameter,
/// which is the inverse of the rate parameter .
/// The rate parameter is an alternative, widely used parameterization
/// of the exponential distribution [3].<br></br>
///
/// The exponential distribution is a continuous analogue of the
/// geometric distribution.<br></br>
/// It describes many common situations, such as
/// the size of raindrops measured over many rainstorms [1], or the time
/// between page requests to Wikipedia [2].<br></br>
///
/// References
/// </summary>
/// <param name="scale">
/// The scale parameter, .
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// If size is None (default),
/// a single value is returned if scale is a scalar.<br></br>
/// Otherwise,
/// np.array(scale).size samples are drawn.
/// </param>
/// <returns>
/// Drawn samples from the parameterized exponential distribution.
/// </returns>
public static NDarray exponential(NDarray<float> scale = null, int[] size = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
});
var kwargs=new PyDict();
if (scale!=null) kwargs["scale"]=ToPython(scale);
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("exponential", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Draw samples from an F distribution.<br></br>
///
/// Samples are drawn from an F distribution with specified parameters,
/// dfnum (degrees of freedom in numerator) and dfden (degrees of
/// freedom in denominator), where both parameters should be greater than
/// zero.<br></br>
///
/// The random variate of the F distribution (also known as the
/// Fisher distribution) is a continuous probability distribution
/// that arises in ANOVA tests, and is the ratio of two chi-square
/// variates.<br></br>
///
/// Notes
///
/// The F statistic is used to compare in-group variances to between-group
/// variances.<br></br>
/// Calculating the distribution depends on the sampling, and
/// so it is a function of the respective degrees of freedom in the
/// problem.<br></br>
/// The variable dfnum is the number of samples minus one, the
/// between-groups degrees of freedom, while dfden is the within-groups
/// degrees of freedom, the sum of the number of samples in each group
/// minus the number of groups.<br></br>
///
/// References
/// </summary>
/// <param name="dfnum">
/// Degrees of freedom in numerator, should be > 0.
/// </param>
/// <param name="dfden">
/// Degrees of freedom in denominator, should be > 0.
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// If size is None (default),
/// a single value is returned if dfnum and dfden are both scalars.<br></br>
///
/// Otherwise, np.broadcast(dfnum, dfden).size samples are drawn.
/// </param>
/// <returns>
/// Drawn samples from the parameterized Fisher distribution.
/// </returns>
public static NDarray f(NDarray<float> dfnum, NDarray<float> dfden, int[] size = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
dfnum,
dfden,
});
var kwargs=new PyDict();
if (size!=null) kwargs["size"]=ToPython(size);
dynamic py = __self__.InvokeMethod("f", pyargs, kwargs);
return ToCsharp<NDarray>(py);
}
}
public static partial class random {
/// <summary>
/// Draw samples from a Gamma distribution.<br></br>
///
/// Samples are drawn from a Gamma distribution with specified parameters,
/// shape (sometimes designated “k”) and scale (sometimes designated
/// “theta”), where both parameters are > 0.<br></br>
///
/// Notes
///
/// The probability density for the Gamma distribution is
///
/// where is the shape and the scale,
/// and is the Gamma function.<br></br>
///
/// The Gamma distribution is often used to model the times to failure of
/// electronic components, and arises naturally in processes for which the
/// waiting times between Poisson distributed events are relevant.<br></br>
///
/// References
/// </summary>
/// <param name="shape">
/// The shape of the gamma distribution.<br></br>
/// Should be greater than zero.
/// </param>
/// <param name="scale">
/// The scale of the gamma distribution.<br></br>
/// Should be greater than zero.<br></br>
///
/// Default is equal to 1.
/// </param>
/// <param name="size">
/// Output shape.<br></br>
/// If the given shape is, e.g., (m, n, k), then
/// m * n * k samples are drawn.<br></br>
/// If size is None (default),
/// a single value is returned if shape and scale are both scalars.<br></br>
///
/// Otherwise, np.broadcast(shape, scale).size samples are drawn.
/// </param>
/// <returns>
/// Drawn samples from the parameterized gamma distribution.
/// </returns>
public static NDarray gamma(Shape shape, NDarray<float> scale = null, int[] size = null)
{
//auto-generated code, do not change
var random = self.GetAttr("random");
var __self__=random;
var pyargs=ToTuple(new object[]
{
shape,
});
var kwargs=new PyDict();
if (scale!=null) kwargs["scale"]=ToPython(scale);
if (size!=null) kwargs["size"]=ToPython(size);