6 instantiations of Single
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (1)
Attributes\AttributeTests.cs (1)
4988enumerator.Current.VerifyNamedArgumentValue(0, "X", TypedConstantKind.Primitive, new Single());
PresentationCore (4)
System\Windows\Media\Animation\Generated\SingleAnimation.cs (4)
222Single from = new Single(); 223Single to = new Single(); 224Single accumulated = new Single(); 225Single foundation = new Single();
PresentationFramework (1)
System\Windows\Markup\Baml2006\WpfGeneratedKnownTypes.cs (1)
9826DefaultConstructor = delegate () { return new System.Single(); },
2707 references to Single
Aspire.Dashboard (3)
Components\Controls\SummaryDetailsView.razor.cs (3)
188var totalSize = (float)(args.Panel1Size + args.Panel2Size); 190var panel1Fraction = (args.Panel1Size / totalSize); 318var newTotalSize = (float)(panel1Size + panel2Size);
dotnet-svcutil-lib (37)
FrameworkFork\Microsoft.CodeDom\Compiler\CodeGenerator.cs (3)
1778else if (e.Value is Single) 1780GenerateSingleFloatValue((Single)e.Value); 1810protected virtual void GenerateSingleFloatValue(Single s)
FrameworkFork\Microsoft.CodeDom\Microsoft\CSharpCodeProvider.cs (3)
1380else if (e.Value is Single) 1382GenerateSingleFloatValue((Single)e.Value); 2281private void GenerateSingleFloatValue(Single s)
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\XmlBinaryReader.cs (3)
3294map[(int)BinXmlToken.SQL_REAL] = typeof(Single); 4296Single v = GetSingle(_tokDataPos); 4449private Single GetSingle(int offset)
FrameworkFork\Microsoft.Xml\Xml\schema\GenerateConverter.cs (2)
22public static Type[] InterfaceTypes = { typeof(Boolean), typeof(DateTime), typeof(Decimal), typeof(Double), typeof(Int32), typeof(Int64), typeof(Single), typeof(String), typeof(Object) }; 861if (type == typeof(Single)) return "float";
FrameworkFork\Microsoft.Xml\Xml\Serialization\PrimitiveXmlSerializers.cs (2)
75WriteElementStringRaw(@"float", @"", Microsoft.Xml.XmlConvert.ToString((System.Single)((System.Single)o)));
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriter.cs (1)
3569Writer.Write(((Single)value).ToString("R", NumberFormatInfo.InvariantInfo));
FrameworkFork\Microsoft.Xml\Xml\XmlConvert.cs (11)
790public static string ToString(Single value) 792if (Single.IsNegativeInfinity(value)) return "-INF"; 793if (Single.IsPositiveInfinity(value)) return "INF"; 1132public static Single ToSingle(string s) 1135if (s == "-INF") return Single.NegativeInfinity; 1136if (s == "INF") return Single.PositiveInfinity; 1137float f = Single.Parse(s, NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent, NumberFormatInfo.InvariantInfo); 1145internal static Exception TryToSingle(string s, out Single result) 1150result = Single.NegativeInfinity; 1155result = Single.PositiveInfinity; 1158else if (!Single.TryParse(s, NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent, NumberFormatInfo.InvariantInfo, out result))
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\ExtensionQuery.cs (2)
123if (value is Single) return (double)(Single)value;
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\TypeCode.cs (1)
55else if (type == typeof(Single))
FrameworkFork\System.Runtime.Serialization\System\Xml\ValueHandle.cs (4)
323public Single ToSingle() 331if ((value >= Single.MinValue && value <= Single.MaxValue) || double.IsInfinity(value) || double.IsNaN(value)) 332return (Single)value;
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBaseReader.cs (1)
1559public override Single ReadContentAsFloat()
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryReader.cs (2)
546public override Single ReadContentAsFloat() 1638public override Single ReadContentAsFloat()
FrameworkFork\System.ServiceModel\Extensions\ReflectionExtensions.cs (1)
149if (type == typeof(Single))
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\PrimitiveOperationFormatter.cs (1)
750value = Array.Empty<Single>();
Microsoft.AspNetCore.Components (4)
BindConverter.cs (4)
948/// Attempts to convert a value to a <see cref="System.Single"/>. 960/// Attempts to convert a value to a nullable <see cref="System.Single"/>. 983if (!float.TryParse(text, NumberStyles.Number, culture ?? CultureInfo.CurrentCulture, out var converted)) 1008if (!float.TryParse(text, NumberStyles.Number, culture ?? CultureInfo.CurrentCulture, out var converted))
Microsoft.AspNetCore.Components.Server (2)
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReaderExtensions.cs (2)
254/// Reads a <see cref="Single"/> as big endian. 256/// <returns>False if there wasn't enough data for a <see cref="Single"/>.</returns>
Microsoft.AspNetCore.Components.Tests (2)
EventCallbackFactoryBinderExtensionsTest.cs (2)
235var value = (float)17; 241var expectedValue = (float)42;
Microsoft.AspNetCore.Mvc.TagHelpers (1)
InputTagHelper.cs (1)
46{ nameof(Single), InputType.Text.ToString().ToLowerInvariant() },
Microsoft.AspNetCore.OpenApi (1)
Schemas\OpenApiJsonSchema.Helpers.cs (1)
120if (reader.TryGetSingle(out var floatValue) && !float.IsInfinity(floatValue))
Microsoft.AspNetCore.SignalR.Tests (1)
NativeAotTests.cs (1)
358await foreach (var item in source)
Microsoft.Build (1)
Resources\Constants.cs (1)
358availableStaticMethods.TryAdd("System.Single", new Tuple<string, Type>(null, typeof(Single)));
Microsoft.CodeAnalysis.CSharp (1)
Utilities\ValueSetFactory.FloatingValueSet.cs (1)
17/// A value set implementation for <see cref="System.Single"/> and <see cref="System.Double"/>.
Microsoft.CodeAnalysis.CSharp.Features (1)
Diagnostics\Analyzers\TypeSyntaxSimplifierWalker.cs (1)
34nameof(Single),
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (4)
LexicalAndXml\LexicalTests.cs (4)
2019var value = 123f; 2035var value = 123F; 2051var value = 123.456f; 2067var value = 123.456e10f;
Microsoft.CodeAnalysis.UnitTests (1)
CorLibTypesTests.cs (1)
110Assert.Throws<InvalidOperationException>(() => { var c = cvNull.SingleValue; });
Microsoft.CodeAnalysis.Workspaces.UnitTests (6)
ObjectSerializationTests.cs (6)
290TestRoundTripValue(Single.MaxValue); 425writer.WriteSingle(Single.MaxValue); 449Assert.Equal(Single.MaxValue, reader.ReadSingle()); 479writer.WriteScalarValue(Single.MaxValue); 517Assert.Equal(Single.MaxValue, (Single)reader.ReadScalarValue());
Microsoft.Data.Analysis (95)
DataFrameColumnCollection.cs (1)
376throw new ArgumentException(string.Format(Strings.BadColumnCast, column.DataType, typeof(Single)));
IDataView.Extension.cs (1)
169return new VBufferDataFrameColumn<Single>(name);
PrimitiveDataFrameColumn.BinaryOperationAPIs.ExplodedColumns.cs (80)
4535var convertedValue = (float)value; 4540var convertedValue = (float)value; 4545var convertedValue = (float)value; 4550var convertedValue = (float)value; 4555var convertedValue = (float)value; 4560var convertedValue = (float)value; 4565var convertedValue = (float)value; 4570var convertedValue = (float)value; 4575var convertedValue = (float)value; 4580var convertedValue = (float)value; 4675var convertedValue = (float)value; 4680var convertedValue = (float)value; 4685var convertedValue = (float)value; 4690var convertedValue = (float)value; 4695var convertedValue = (float)value; 4700var convertedValue = (float)value; 4705var convertedValue = (float)value; 4710var convertedValue = (float)value; 4715var convertedValue = (float)value; 4720var convertedValue = (float)value; 4725var convertedValue = (float)value; 4730var convertedValue = (float)value; 4735var convertedValue = (float)value; 4740var convertedValue = (float)value; 4745var convertedValue = (float)value; 4750var convertedValue = (float)value; 4755var convertedValue = (float)value; 4760var convertedValue = (float)value; 4765var convertedValue = (float)value; 4770var convertedValue = (float)value; 4775var convertedValue = (float)value; 4780var convertedValue = (float)value; 4785var convertedValue = (float)value; 4790var convertedValue = (float)value; 4795var convertedValue = (float)value; 4800var convertedValue = (float)value; 4805var convertedValue = (float)value; 4810var convertedValue = (float)value; 4815var convertedValue = (float)value; 4820var convertedValue = (float)value; 4825var convertedValue = (float)value; 4830var convertedValue = (float)value; 4835var convertedValue = (float)value; 4840var convertedValue = (float)value; 4845var convertedValue = (float)value; 4850var convertedValue = (float)value; 4855var convertedValue = (float)value; 4860var convertedValue = (float)value; 4865var convertedValue = (float)value; 4870var convertedValue = (float)value; 4875var convertedValue = (float)value; 4880var convertedValue = (float)value; 4885var convertedValue = (float)value; 4890var convertedValue = (float)value; 4895var convertedValue = (float)value; 4900var convertedValue = (float)value; 4905var convertedValue = (float)value; 4910var convertedValue = (float)value; 4915var convertedValue = (float)value; 4920var convertedValue = (float)value; 4925var convertedValue = (float)value; 4930var convertedValue = (float)value; 4935var convertedValue = (float)value; 4940var convertedValue = (float)value; 4945var convertedValue = (float)value; 4950var convertedValue = (float)value; 4955var convertedValue = (float)value; 4960var convertedValue = (float)value; 4965var convertedValue = (float)value; 4970var convertedValue = (float)value; 4975var convertedValue = (float)value; 4980var convertedValue = (float)value; 4985var convertedValue = (float)value; 4990var convertedValue = (float)value; 4995var convertedValue = (float)value; 5000var convertedValue = (float)value; 5005var convertedValue = (float)value; 5010var convertedValue = (float)value; 5015var convertedValue = (float)value; 5020var convertedValue = (float)value;
PrimitiveDataFrameColumnComputations.cs (13)
2221var ret = column.Buffers[0].ReadOnlySpan[0]; 2244var ret = float.MinValue; 2285var ret = column.Buffers[0].ReadOnlySpan[0]; 2308var ret = float.MaxValue; 2349var ret = (float)1; 2372var ret = default(float); 2413var ret = (float)0; 2436var ret = default(float); 2477var value = float.MinValue; 2500var value = float.MinValue; 2525var value = float.MaxValue; 2548var value = float.MaxValue; 2617var value = (float)0;
Microsoft.DotNet.XUnitAssert.Tests (1)
Sdk\ArgumentFormatterTests.cs (1)
134 var floatPI = (float)Math.PI;
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (8)
Linux\LinuxUtilizationParserCgroupV1Tests.cs (3)
47var hostCpuCount = parser.GetHostCpuCount(); 48var cgroupCpuCount = parser.GetCgroupLimitedCpus(); 208var cpus = p.GetCgroupLimitedCpus();
Linux\LinuxUtilizationParserCgroupV2Tests.cs (5)
50var hostCpuCount = parser.GetHostCpuCount(); 51var cgroupCpuCount = parser.GetCgroupLimitedCpus(); 280var cpus = p.GetCgroupLimitedCpus(); 298var cpus = p.GetCgroupLimitV2(); 330var cpus = p.GetCgroupLimitedCpus();
Microsoft.Extensions.Diagnostics.Testing.Tests (1)
Metrics\MeasurementExtensionsTests.cs (1)
204var total = fullSnap.EvaluateAsCounter();
Microsoft.Maui (13)
Animations\AnimationLerpingExtensions.cs (4)
13 var r = Lerp(color.Red, endColor.Red, progress); 14 var b = Lerp(color.Blue, endColor.Blue, progress); 15 var g = Lerp(color.Green, endColor.Green, progress); 16 var a = Lerp(color.Alpha, endColor.Alpha, progress);
Animations\Lerp.cs (2)
42 var start = (float)(s ?? 0f); 43 var end = (float)(e ?? 0f);
Graphics\ShapeDrawable.cs (2)
103 var strokeDashOffset = ShapeView.StrokeDashOffset; 107 var strokeMiterLimit = ShapeView.StrokeMiterLimit;
Platform\SwipeViewExtensions.cs (1)
17 var luminosity = 0.2126f * backgroundColor.Red + 0.7152f * backgroundColor.Green + 0.0722f * backgroundColor.Blue;
VisualDiagnostics\RectangleGridAdorner.cs (4)
29 var y = (float)DrawnRectangle.Y; 30 var x = (float)DrawnRectangle.X; 31 var width = (float)DrawnRectangle.Width; 32 var height = (float)DrawnRectangle.Height;
Microsoft.Maui.Controls (23)
Brush\BrushTypeConverter.cs (8)
267 foreach (var offset in offsets) 302 if (TryParseNumber(part, "deg", out var degrees)) 308 if (TryParseNumber(part, "turn", out var turn)) 337 var hasPositionX = TryParseOffset(directionX, out var positionX); 338 var hasPositionY = TryParseOffset(directionY, out var positionY); 380 if (float.TryParse(number, NumberStyles.Any, CultureInfo.InvariantCulture, out var value)) 396 if (TryParseNumber(part, "%", out var value)) 419 if (TryParseOffset(part, out var offset))
ShadowTypeConverter.cs (9)
85 var offsetX = float.Parse(matches[1].Value, CultureInfo.InvariantCulture); 86 var offsetY = float.Parse(matches[2].Value, CultureInfo.InvariantCulture); 96 var offsetX = float.Parse(matches[0].Value, CultureInfo.InvariantCulture); 97 var offsetY = float.Parse(matches[1].Value, CultureInfo.InvariantCulture); 98 var radius = float.Parse(matches[2].Value, CultureInfo.InvariantCulture); 110 var offsetX = float.Parse(matches[0].Value, CultureInfo.InvariantCulture); 111 var offsetY = float.Parse(matches[1].Value, CultureInfo.InvariantCulture); 112 var radius = float.Parse(matches[2].Value, CultureInfo.InvariantCulture); 114 var opacity = float.Parse(matches[4].Value, CultureInfo.InvariantCulture);
Shapes\EllipseGeometry.cs (4)
59 var centerX = (float)Center.X; 60 var centerY = (float)Center.Y; 62 var radiusX = (float)RadiusX; 63 var radiusY = (float)RadiusY;
Xaml\TypeConversionExtensions.cs (2)
190 if (toType == typeof(Single)) 191 return Single.Parse(str, CultureInfo.InvariantCulture);
Microsoft.Maui.Controls.Build.Tasks (1)
NodeILExtensions.cs (1)
253 yield return Instruction.Create(OpCodes.Ldc_R4, TryFormat(s => Single.Parse(str, CultureInfo.InvariantCulture), node, str));
Microsoft.Maui.Controls.Xaml (2)
CreateValuesVisitor.cs (2)
365 if (nodeType == typeof(Single) && float.TryParse(valuestring, NumberStyles.Number, CultureInfo.InvariantCulture, out var singleval))
Microsoft.Maui.Essentials (1)
Compass\LowPassFilter.shared.cs (1)
24 var old = history.Dequeue();
Microsoft.Maui.Graphics (155)
AbstractCanvas.cs (8)
82 var size = value; 86 var scale = _currentState.Scale; 87 var scaledStrokeSize = scale * value; 119 var dashOffset = value; 160 var halfHeight = Math.Abs(height / 2); 164 var halfWidth = Math.Abs(width / 2); 270 var radians = GeometryUtil.DegreesToRadians(degrees); 283 var radians = GeometryUtil.DegreesToRadians(degrees);
ArcFlattener.cs (5)
46 var angle = _startAngle + (_sweep * percentage); 53 var radians = (float)GeometryUtil.DegreesToRadians(angle); 74 var x = (point1.X + point2.X) / 2; 75 var y = (point1.Y + point2.Y) / 2; 87 var candidate = 1f / (float)n;
CanvasExtensions.cs (12)
182 var x = centerX - radius; 183 var y = centerY - radius; 184 var size = radius * 2; 200 var x = center.X - radius; 201 var y = center.Y - radius; 202 var size = radius * 2; 209 var x = centerX - radius; 210 var y = centerY - radius; 211 var size = radius * 2; 227 var x = center.X - radius; 228 var y = center.Y - radius; 229 var size = radius * 2;
Color.cs (26)
204 var l = (m + v) / 2.0f; 212 ToHsl(out var h, out var s, out var l); 220 ToHsl(out var h, out var s, out var l); 226 ToHsl(out var h, out var s, out var l); 232 ToHsl(out var h, out var s, out var l); 238 ToHsl(out var h, out var s, out var l); 244 ToHsl(out var h, out var s, out var l); 250 ToHsl(out var h, out var s, out var l); 268 var p = v * (1 - s); 522 var r = Red; 523 var g = Green; 524 var b = Blue;
GeometryUtil.cs (30)
11 var a = x2 - x1; 12 var b = y2 - y1; 19 var dx = x1 - x2; 20 var dy = y1 - y2; 22 var radians = MathF.Atan2(dy, dx); 23 var degrees = radians * 180.0f / MathF.PI; 50 var radians = DegreesToRadians(angle); 52 var x = MathF.Cos(radians) * point.X - MathF.Sin(radians) * point.Y; 53 var y = MathF.Sin(radians) * point.X + MathF.Cos(radians) * point.Y; 60 var radians = DegreesToRadians(angle); 61 var x = center.X + MathF.Cos(radians) * (point.X - center.X) - MathF.Sin(radians) * (point.Y - center.Y); 62 var y = center.Y + MathF.Sin(radians) * (point.X - center.X) + MathF.Cos(radians) * (point.Y - center.Y); 94 var sin = MathF.Sin(angleInRadians); 95 var cos = MathF.Cos(angleInRadians); 111 var radians = DegreesToRadians(angleInDegrees); 113 var cx = x + width / 2; 114 var cy = y + height / 2; 125 var dx = oppositePoint.X - pivot.X; 126 var dy = oppositePoint.Y - pivot.Y; 155 var dx = x1 - x0; 156 var dy = y1 - y0; 157 var dx1 = px0 - x0; 158 var dy1 = py0 - y0; 159 var dx2 = px1 - x1; 160 var dy2 = py1 - y1; 163 var c1 = dx * dy1 - dy * dx1; 164 var c2 = dx * dy2 - dy * dx2; 211 var vAdjustedValue = aValue - aMin; 212 var vRange = aMax - aMin; 224 var d = aMax - aMin;
GradientPaint.cs (10)
187 var before = float.MaxValue; 189 var after = float.MaxValue; 194 var currentOffset = stops[i].Offset; 203 var dx = offset - currentOffset; 212 var dx = currentOffset - offset; 231 var f = GeometryUtil.GetFactor(before, after, offset); 250 var r = GeometryUtil.GetLinearValue(startColor.Red, endColor.Red, factor); 251 var g = GeometryUtil.GetLinearValue(startColor.Green, endColor.Green, factor); 252 var b = GeometryUtil.GetLinearValue(startColor.Blue, endColor.Blue, factor); 253 var a = GeometryUtil.GetLinearValue(startColor.Alpha, endColor.Alpha, factor);
Matrix3x2Extensions.cs (7)
53 var sx = matrix.M12 == 0 ? Math.Abs(matrix.M11) : new Vector2(matrix.M11, matrix.M12).Length(); 54 var sy = matrix.M21 == 0 ? Math.Abs(matrix.M22) : new Vector2(matrix.M21, matrix.M22).Length(); 72 var sx = matrix.M12 == 0 ? Math.Abs(matrix.M11) : new Vector2(matrix.M11, matrix.M12).Length(); 73 var sy = matrix.M21 == 0 ? Math.Abs(matrix.M22) : new Vector2(matrix.M21, matrix.M22).Length(); 143 var determinant = matrix.GetDeterminant(); 144 var areaScale = MathF.Abs(determinant); 165 var det = value.GetDeterminant();
PathBuilder.cs (8)
62 if (float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out var number)) 484 var xOffset = NextValue; 485 var yOffset = NextValue; 551 var dx = lastPoint.X - lastCurveControlPoint.X; 552 var dy = lastPoint.Y - lastCurveControlPoint.Y; 587 var rx = NextValue; 588 var ry = NextValue; 590 var r = NextValue;
PathF.cs (44)
910 var startAngle = _arcAngles[arcIndex++]; 911 var endAngle = _arcAngles[arcIndex++]; 1038 var minX = x; 1039 var minY = y; 1040 var maxX = minX + w; 1041 var maxY = minY + h; 1042 var midX = minX + w / 2; 1043 var midY = minY + h / 2; 1044 var offsetY = h / 2 * K_RATIO; 1045 var offsetX = w / 2 * K_RATIO; 1062 var minX = cx - r; 1063 var minY = cy - r; 1064 var maxX = cx + r; 1065 var maxY = cy + r; 1066 var midX = cx; 1067 var midY = cy; 1068 var offsetY = r * K_RATIO; 1069 var offsetX = r * K_RATIO; 1086 var minX = x; 1087 var minY = y; 1088 var maxX = minX + w; 1089 var maxY = minY + h; 1113 var minX = x; 1114 var minY = y; 1115 var maxX = minX + w; 1116 var maxY = minY + h; 1118 var handleOffset = cornerRadius * K_RATIO; 1119 var cornerOffset = cornerRadius - handleOffset; 1153 var xHandleOffset = xCornerRadius * K_RATIO; 1154 var xCornerOffset = xCornerRadius - xHandleOffset; 1156 var yHandleOffset = yCornerRadius * K_RATIO; 1157 var yCornerOffset = yCornerRadius - yHandleOffset; 1197 var minX = x; 1198 var minY = y; 1199 var maxX = minX + w; 1200 var maxY = minY + h; 1202 var topLeftCornerOffset = topLeftCornerRadius - (topLeftCornerRadius * K_RATIO); 1203 var topRightCornerOffset = topRightCornerRadius - (topRightCornerRadius * K_RATIO); 1204 var bottomLeftCornerOffset = bottomLeftCornerRadius - (bottomLeftCornerRadius * K_RATIO); 1205 var bottomRightCornerOffset = bottomRightCornerRadius - (bottomRightCornerRadius * K_RATIO); 1315 var arcAngle = _arcAngles[i]; 1372 var arcAngle = _arcAngles[i]; 1569 var d = 1.0f / numberOfPoints; 1593 var s = 1.0f - t;
PointF.cs (2)
135 if (xy.Length == 2 && float.TryParse(xy[0], NumberStyles.Number, CultureInfo.InvariantCulture, out var x) 136 && float.TryParse(xy[1], NumberStyles.Number, CultureInfo.InvariantCulture, out var y))
ScalingCanvas.cs (2)
227 transform.DeconstructScales(out _, out var sx, out var sy);
Text\TextAttributesExtensions.cs (1)
79 if (float.TryParse(value, out var floatValue))
Microsoft.Maui.Graphics.Skia (67)
SKGraphicsExtensions.cs (11)
116 var ppux = ppu * fx; 117 var ppuy = ppu * fy; 154 var startAngle = path.GetArcAngle(arcAngleIndex++); 155 var endAngle = path.GetArcAngle(arcAngleIndex++); 169 var sweep = GeometryUtil.GetSweep(startAngle, endAngle, clockwise); 234 var startAngle = target.GetArcAngle(arcAngleIndex++); 235 var endAngle = target.GetArcAngle(arcAngleIndex); 249 var sweep = GeometryUtil.GetSweep(startAngle, endAngle, clockwise); 310 var startAngle = target.GetArcAngle(arcAngleIndex++); 311 var endAngle = target.GetArcAngle(arcAngleIndex++); 325 var sweep = GeometryUtil.GetSweep(startAngle, endAngle, clockwise);
SkiaCanvas.cs (39)
411 var rectX = x; 412 var rectY = y; 413 var rectWidth = width; 414 var rectHeight = height; 416 var sweep = GeometryUtil.GetSweep(startAngle, endAngle, clockwise); 460 var sweep = GeometryUtil.GetSweep(startAngle, endAngle, clockwise); 485 var strokeSize = CurrentState.ScaledStrokeSize; 503 var rectX = x; 504 var rectY = y; 505 var rectWidth = width; 506 var rectHeight = height; 519 var strokeSize = CurrentState.ScaledStrokeSize; 521 var rectX = x; 522 var rectY = y; 523 var rectWidth = width; 524 var rectHeight = height; 525 var radius = aCornerRadius; 537 var rectX = x; 538 var rectY = y; 539 var rectWidth = width; 540 var rectHeight = height; 541 var radius = aCornerRadius; 554 var strokeSize = CurrentState.ScaledStrokeSize; 556 var rectX = x; 557 var rectY = y; 558 var rectWidth = width; 559 var rectHeight = height; 572 var rectX = x; 573 var rectY = y; 574 var rectWidth = width; 575 var rectHeight = height; 632 var width = font.MeasureText(value); 639 var width = font.MeasureText(value); 728 var sx = actualOffset.Width; 729 var sy = actualOffset.Height; 823 var rx1 = Math.Min(x, x + width); 824 var ry1 = Math.Min(y, y + height); 825 var rx2 = Math.Max(x, x + width); 826 var ry2 = Math.Max(y, y + height);
SkiaImage.cs (6)
47 var fx = width / Width; 48 var fy = height / Height; 50 var w = Width; 51 var h = Height; 53 var x = 0f; 54 var y = 0f;
SkiaStringSizeService.cs (2)
17 var width = skiaFont.MeasureText(value); 31 var width = skiaFont.MeasureText(value);
SkiaTextLayout.cs (9)
72 var x = _rect.X; 73 var y = _rect.Y; 74 var width = _rect.Width; 75 var height = _rect.Height; 82 var top = y; 83 var bottom = y + height; 116 var y = top + height / 2; 160 var y = bottom - _descent; 226 var count = _font.BreakText(_value.AsSpan(index), width, out var textWidth);
Microsoft.Maui.Graphics.Win2D.WinUI.Desktop (20)
src\Graphics\src\Graphics\Platforms\Windows\GraphicsExtensions.cs (16)
188 var startAngle = path.GetArcAngle(arcAngleIndex++); 189 var endAngle = path.GetArcAngle(arcAngleIndex++); 202 var rotation = GeometryUtil.GetSweep(startAngle, endAngle, clockwise); 203 var absRotation = MathF.Abs(rotation); 205 var rectX = ox + topLeft.X * fx; 206 var rectY = oy + topLeft.Y * fy; 207 var rectWidth = (ox + bottomRight.X * fx) - rectX; 208 var rectHeight = (oy + bottomRight.Y * fy) - rectY; 316 var startAngle = path.GetArcAngle(arcAngleIndex++); 317 var endAngle = path.GetArcAngle(arcAngleIndex); 330 var rotation = GeometryUtil.GetSweep(startAngle, endAngle, clockwise); 331 var absRotation = MathF.Abs(rotation); 333 var rectX = topLeft.X * scale; 334 var rectY = topLeft.Y * scale; 335 var rectWidth = (bottomRight.X * scale) - rectX; 336 var rectHeight = (bottomRight.Y * scale) - rectY;
src\Graphics\src\Graphics\Platforms\Windows\PlatformCanvas.cs (4)
177 var rotation = GeometryUtil.GetSweep(startAngle, endAngle, clockwise); 178 var absRotation = Math.Abs(rotation); 565 var rotation = GeometryUtil.GetSweep(startAngle, endAngle, clockwise); 566 var absRotation = Math.Abs(rotation);
Microsoft.Maui.Resizetizer (12)
GenerateSplashAndroidResources.cs (2)
170 var width = PreferredImageSize; 171 var height = PreferredImageSize;
ResizeImageInfo.cs (1)
114 if (float.TryParse(image.GetMetadata("ForegroundScale"), NumberStyles.Number, CultureInfo.InvariantCulture, out var fsc))
SkiaSharpAppIconTools.cs (4)
134 var userFgScale = (float)Info.ForegroundScale; 140 var fgCenterX = foregroundOriginalSize.Width / 2; 141 var fgCenterY = foregroundOriginalSize.Height / 2; 156 var radius = Math.Min(canvasSize.Width, canvasSize.Height) / 2;
SkiaSharpTools.cs (5)
139 var scale = (float)dpi.Scale; 149 var scale = (float)dpi.Scale; 187 var userFgScale = (float)additionalScale; 193 var fgCenterX = originalSize.Width / 2; 194 var fgCenterY = originalSize.Height / 2;
Microsoft.ML.AutoML (30)
DatasetDimensions\DatasetDimensionsUtil.cs (6)
35var getter = cursor.GetGetter<Single>(column); 36var value = default(Single); 40if (Single.IsNaN(value)) 53var getter = cursor.GetGetter<VBuffer<Single>>(column); 54var value = default(VBuffer<Single>);
Sweepers\Parameters.cs (2)
382var floatValue = (float)value; 395var floatValue = (float)value;
Sweepers\SmacSweeper.cs (16)
11using Float = System.Single; 46public Float SplitRatio; 49public Float Epsilon; 109Single[] targets = new Single[previousRuns.Count()]; 110Single[][] features = new Single[previousRuns.Count()][]; 116targets[i] = (Float)r.MetricValue; 278Float[] neighbor = SweeperProbabilityUtils.ParameterSetAsFloatArray(_sweepParameters, parent, false); 306Float[] neigh = SweeperProbabilityUtils.ParameterSetAsFloatArray(_sweepParameters, parent, false); 310neigh[i] = (Float)newVal; 333Float[] transformedParams = SweeperProbabilityUtils.ParameterSetAsFloatArray(_sweepParameters, config, true); 334VBuffer<Float> features = new VBuffer<Float>(transformedParams.Length, transformedParams); 336var leafValue = GetLeafValue(forest, treeId, leafId); 350private static int GetLeaf(TreeEnsembleModelParameters model, int treeId, VBuffer<Float> features)
Sweepers\SweeperProbabilityUtils.cs (1)
108var floatValue = GetIfIParameterValueOfT<float>(pset) ?? float.Parse(pset.ValueText, CultureInfo.InvariantCulture);
Tuner\SmacTuner.cs (5)
122Single[] losses = new Single[history.Count()]; 123Single[][] features = new Single[history.Count()][]; 328var leafValue = forest.GetLeafValue(treeId, leafId);
Microsoft.ML.CodeGenerator (3)
Utils.cs (3)
105if (Single.IsNaN(f.GetValueOrDefault())) 110if (Single.IsPositiveInfinity(f.GetValueOrDefault())) 115if (Single.IsNegativeInfinity(f.GetValueOrDefault()))
Microsoft.ML.Core (76)
Data\DataKind.cs (3)
55/// <summary>4-byte floating-point number, type of <see cref="System.Single"/>.</summary> 270return typeof(Single); 314else if (type == typeof(Single))
EntryPoints\ModuleArgs.cs (1)
619if (type == typeof(Single) || type == typeof(Double))
Utilities\BinFinder.cs (22)
14private Single[] _valuesSng; // distinct values 28public Single[] FindBins(int cbin, IList<Single> values, int numZeroes = 0) 34return new[] { Single.PositiveInfinity }; 45_valuesSng = new Single[numValues]; 77Single[] bounds; 81bounds = new Single[CountValues]; 90bounds = new Single[CountBins]; 95bounds[bounds.Length - 1] = Single.PositiveInfinity; 214public static Single GetSplitValue(Single a, Single b) 218if (Single.IsNegativeInfinity(a)) 220if (b == Single.MinValue) 221return Single.MinValue; 222a = Single.MinValue; 224if (Single.IsPositiveInfinity(b)) 226if (a == Single.MaxValue) 227return Single.PositiveInfinity; 228b = Single.MaxValue; 231var ave = a / 2 + b / 2; 453var ideal = _meanBinSize * pos;
Utilities\DoubleParser.cs (24)
91public static bool TryParse(ReadOnlySpan<char> span, out Single value, OptionFlags flags = OptionFlags.Default) 94Contracts.Assert(res != Result.Empty || ((flags & OptionFlags.EmptyAsNaN) == 0 && value == 0) || Single.IsNaN(value)); 108public static Result Parse(ReadOnlySpan<char> span, out Single value, OptionFlags flags = OptionFlags.Default) 118value = Single.NaN; 137value = Single.NaN; 145value = default(Single); 212public static bool TryParse(ReadOnlySpan<char> span, out Single value, out int ichEnd, OptionFlags flags = OptionFlags.Default) 237value = Single.PositiveInfinity; 266value = (Single)res; 486Single tmp; 492private static bool TryParseSpecial(ReadOnlySpan<char> span, ref int ich, out Single value) 500value = Single.NaN; 507value = Single.NaN; 516value = Single.PositiveInfinity; 525value = Single.NegativeInfinity; 532value = Single.NegativeInfinity; 539value = Single.PositiveInfinity; 545value = default(Single); 957Contracts.Assert((Single)_mpe10Dbl[_mpe10Dbl.Length - 1] == Single.PositiveInfinity); 958Contracts.Assert((Single)_mpe10Dbl[_mpe10Dbl.Length - 2] < Single.PositiveInfinity); 975Contracts.Assert((Single)(_mpne10Dbl[_mpne10Dbl.Length - 1] * two64) == 0); 976Contracts.Assert((Single)(_mpne10Dbl[_mpne10Dbl.Length - 2] * two64) > 0);
Utilities\FloatUtils.cs (1)
462var v = values[i];
Utilities\MathUtils.cs (5)
19return (Single)dbl; 24public static void ToFloat(this Single dbl) 114foreach (var x in a) 128foreach (var x in a) 514var ex = ExpSlow(x);
Utilities\Random.cs (1)
26var res = (float)random.NextDouble();
Utilities\Stream.cs (2)
189foreach (var val in values) 374foreach (var v in e)
Utilities\SupervisedBinFinder.cs (12)
62public Single[] FindBins(int maxBins, int minBinSize, int nLabels, IList<Single> values, IList<int> labels) 71var seenValues = new HashSet<Single>(); 72var valuePairs = new ValuePair<Single>[_valueCount]; 75valuePairs[i] = new ValuePair<Single>(values[i], labels[i]); 83var distinctValues = new Single[_distinctValueCount]; 84Single curValue = Single.NegativeInfinity; 113Single[] result = new Single[numUpperBounds]; 125result[numUpperBounds - 1] = Single.PositiveInfinity; 210private void AssertStrictlyIncreasing(Single[] result)
Utilities\Utils.cs (2)
604var previousValue = values[0]; 608var currentValue = values[i];
Utilities\VBufferUtils.cs (3)
23public static bool HasNaNs(in VBuffer<Single> buffer) 28if (Single.IsNaN(values[i])) 45public static bool HasNonFinite(in VBuffer<Single> buffer)
Microsoft.ML.Core.Tests (104)
UnitTests\CoreBaseTestClass.cs (2)
111return GetComparerVec<Single>(r1, r2, col, size, (x, y) => FloatUtils.GetBits(x) == FloatUtils.GetBits(y)); 154return GetComparerOne<Single>(r1, r2, col, (x, y) => FloatUtils.GetBits(x) == FloatUtils.GetBits(y));
UnitTests\TestEntryPoints.cs (92)
428L1Regularization = (Single)0.1 * i, 429L2Regularization = (Single)0.01 * (1 + i), 474var avgScoreGetter = curs1.GetGetter<Single>(scoreColumn.Value); 478var medScoreGetter = curs2.GetGetter<Single>(scoreColumn.Value); 482var regScoreGetter = curs3.GetGetter<Single>(scoreColumn.Value); 484var individualScoreGetters = new ValueGetter<Single>[nModels]; 488individualScoreGetters[i] = curs4.GetGetter<Single>(scoreColumn.Value); 491var scoreBuffer = new Single[nModels]; 501Single score = 0; 505Single avgScore = 0; 510Single medScore = 0; 1562L1Regularization = (Single)0.1 * i, 1563L2Regularization = (Single)0.01 * (1 + i), 1686var getter0 = curs0.GetGetter<Single>(scoreColumn.Value); 1689var getter1 = curs1.GetGetter<Single>(scoreColumn.Value); 1692var getter2 = curs2.GetGetter<Single>(scoreColumn.Value); 1695var getter3 = curs3.GetGetter<Single>(scoreColumn.Value); 1698var getter4 = curs4.GetGetter<Single>(scoreColumn.Value); 1701var getterReg = cursReg.GetGetter<Single>(scoreColumn.Value); 1704var getterBin = cursBin.GetGetter<Single>(scoreColumn.Value); 1707var getterBinCali = cursBinCali.GetGetter<Single>(scoreColumn.Value); 1710var getterSaved = cursSaved.GetGetter<Single>(scoreColumn.Value); 1713var getterAnom = cursAnom.GetGetter<Single>(scoreColumn.Value); 1718Single score = 0; 1729Single[] score0 = new Single[5]; 1735Single scoreBin = 0; 1736Single scoreBinCali = 0; 1737Single scoreSaved = 0; 1738Single scoreAnom = 0; 1743Assert.True(Single.IsNaN(scoreBin) && Single.IsNaN(score) || scoreBin == score); 1744Assert.True(Single.IsNaN(scoreBinCali) && Single.IsNaN(score) || scoreBinCali == score); 1745Assert.True(Single.IsNaN(scoreSaved) && Single.IsNaN(score) || CompareNumbersWithTolerance(scoreSaved, score, null, 5)); 1746Assert.True(Single.IsNaN(scoreAnom) && Single.IsNaN(score) || scoreAnom == score); 1748Single avg = 0; 1750Assert.True(Single.IsNaN(avg) && Single.IsNaN(score) || avg == score); 1828L1Regularization = (Single)0.1 * i, 1829L2Regularization = (Single)0.01 * (1 + i), 1912var getter0 = curs0.GetGetter<Single>(scoreColumn.Value); 1915var getter1 = curs1.GetGetter<Single>(scoreColumn.Value); 1918var getter2 = curs2.GetGetter<Single>(scoreColumn.Value); 1921var getter3 = curs3.GetGetter<Single>(scoreColumn.Value); 1924var getter4 = curs4.GetGetter<Single>(scoreColumn.Value); 1927var getterReg = cursReg.GetGetter<Single>(scoreColumn.Value); 1930var getterBin = cursBin.GetGetter<Single>(scoreColumn.Value); 1933var getterBinCali = cursBinCali.GetGetter<Single>(scoreColumn.Value); 1936var getterSaved = cursSaved.GetGetter<Single>(scoreColumn.Value); 1941Single score = 0; 1951Single[] score0 = new Single[5]; 1957Single scoreBin = 0; 1958Single scoreBinCali = 0; 1959Single scoreSaved = 0; 1963Assert.True(Single.IsNaN(scoreBin) && Single.IsNaN(score) || scoreBin == score); 1964Assert.True(Single.IsNaN(scoreBinCali) && Single.IsNaN(score) || scoreBinCali == score); 1965Assert.True(Single.IsNaN(scoreSaved) && Single.IsNaN(score) || scoreSaved == score); 1967Single avg = 0; 1969Assert.True(Single.IsNaN(avg) && Single.IsNaN(score) || avg == score); 2070var getter0 = curs0.GetGetter<VBuffer<Single>>(scoreColumn.Value); 2073var getter1 = curs1.GetGetter<VBuffer<Single>>(scoreColumn.Value); 2076var getter2 = curs2.GetGetter<VBuffer<Single>>(scoreColumn.Value); 2079var getter3 = curs3.GetGetter<VBuffer<Single>>(scoreColumn.Value); 2082var getter4 = curs4.GetGetter<VBuffer<Single>>(scoreColumn.Value); 2085var getter = curs.GetGetter<VBuffer<Single>>(scoreColumn.Value); 2088var getterSaved = cursSaved.GetGetter<VBuffer<Single>>(scoreColumn.Value); 2091VBuffer<Single> score = default(VBuffer<Single>); 2092VBuffer<Single>[] score0 = new VBuffer<Single>[5]; 2093VBuffer<Single> scoreSaved = default(VBuffer<Single>); 2094VBuffer<Single> avg = default(VBuffer<Single>); 2095VBuffer<Single> dense1 = default(VBuffer<Single>); 2096VBuffer<Single> dense2 = default(VBuffer<Single>); 2264private static bool CompareVBuffers(in VBuffer<Single> v1, in VBuffer<Single> v2, ref VBuffer<Single> dense1, ref VBuffer<Single> dense2) 2274if (!Single.IsNaN(dense1Values[i]) && !Single.IsNaN(dense2Values[i]) && dense1Values[i] != dense2Values[i])
UnitTests\TestUtilities.cs (6)
58var x1Temp = x[1]; 59var x7Temp = x[7]; 73var x0Temp = x[0]; 241var x1Temp = x[1]; 247var x0Temp = x[0]; 253var xLengthTemp = x[x.Length - 1];
UnitTests\TestVBuffer.cs (4)
449var actualAccum = accum; 830var l1Dist = a.Items(all: true).Zip(b.Items(all: true), (av, bv) => Math.Abs(av.Value - bv.Value)).Sum(); 832var l2Dist = MathUtils.Sqrt(l2Dist2); 833var dot = a.Items(all: true).Zip(b.Items(all: true), (av, bv) => av.Value * bv.Value).Sum();
Microsoft.ML.CpuMath (1)
CpuMathUtils.netcoreapp.cs (1)
443var value = TensorPrimitives.Distance(left.Slice(0, count), right.Slice(0, count));
Microsoft.ML.CpuMath.UnitTests (10)
UnitTests.cs (10)
643var actual = CpuMathUtils.Sum(src); 666var actual = CpuMathUtils.SumSq(src); 684var actual = CpuMathUtils.SumSq(defaultScale, src); 714var actual = CpuMathUtils.SumAbs(src); 732var actual = CpuMathUtils.SumAbs(defaultScale, src); 756var actual = CpuMathUtils.MaxAbs(src); 785var actual = CpuMathUtils.MaxAbsDiff(defaultScale, src); 825var actual = CpuMathUtils.DotProductDense(src, dst, dst.Length); 859var actual = CpuMathUtils.DotProductSparse(src, dst, idx, limit); 891var actual = CpuMathUtils.L2DistSquared(src, dst, dst.Length);
Microsoft.ML.Data (654)
Data\Combiner.cs (4)
68internal sealed class R4Adder : Combiner<Single> 85public override bool IsDefault(Single value) { return value == 0; } 86public override void Combine(ref Single dst, Single src) { dst += src; }
Data\Conversion.cs (65)
24using R4 = Single; 122AddStd<I1, R4>(Convert); 132AddStd<I2, R4>(Convert); 142AddStd<I4, R4>(Convert); 152AddStd<I8, R4>(Convert); 163AddStd<U1, R4>(Convert); 174AddStd<U2, R4>(Convert); 185AddStd<U4, R4>(Convert); 196AddStd<U8, R4>(Convert); 210AddStd<R4, R4>(Convert); 211AddStd<R4, BL>(Convert); 212AddStd<R4, R8>(Convert); 213AddAux<R4, SB>(Convert); 214AddStd<R4, TX>(Convert); 216AddStd<R8, R4>(Convert); 231AddStd<TX, R4>(Convert); 244AddStd<BL, R4>(Convert); 251AddStd<TS, R4>(Convert); 257AddStd<DT, R4>(Convert); 264AddStd<DZ, R4>(Convert); 269AddIsNA<R4>(IsNA); 272AddGetNA<R4>(GetNA); 275AddHasNA<R4>(HasNA); 282AddIsDef<R4>(IsDefault); 309AddTryParse<R4>(TryParse); 766private bool IsNA(in R4 src) => R4.IsNaN(src); 771private bool HasNA(in VBuffer<R4> src) { var srcValues = src.GetValues(); for (int i = 0; i < srcValues.Length; i++) { if (R4.IsNaN(srcValues[i])) return true; } return false; } 780private bool IsDefault(in R4 src) => src == 0; 802private void GetNA(ref R4 value) => value = R4.NaN; 879public void Convert(in I1 src, ref R4 dst) => dst = (R4)src; 880public void Convert(in I2 src, ref R4 dst) => dst = (R4)src; 881public void Convert(in I4 src, ref R4 dst) => dst = (R4)src; 882public void Convert(in I8 src, ref R4 dst) => dst = (R4)src; 883public void Convert(in U1 src, ref R4 dst) => dst = src; 884public void Convert(in U2 src, ref R4 dst) => dst = src; 885public void Convert(in U4 src, ref R4 dst) => dst = src; 889public void Convert(in U8 src, ref R4 dst) => dst = src; 891public void Convert(in TS src, ref R4 dst) => dst = (R4)src.Ticks; 892public void Convert(in DT src, ref R4 dst) => dst = (R4)src.Ticks; 893public void Convert(in DZ src, ref R4 dst) => dst = (R4)src.UtcDateTime.Ticks; 924public void Convert(in R4 src, ref SB dst) { ClearDst(ref dst); if (R4.IsNaN(src)) dst.AppendFormat(CultureInfo.InvariantCulture, "{0}", "?"); else dst.AppendFormat(CultureInfo.InvariantCulture, "{0:R}", src); } 949public void Convert(in R4 src, ref TX dst) => dst = src.ToString("G7", CultureInfo.InvariantCulture).AsMemory(); 959public void Convert(in R4 src, ref BL dst) => dst = System.Convert.ToBoolean(src); 971public void Convert(in R4 src, ref R4 dst) => dst = src; 972public void Convert(in R4 src, ref R8 dst) => dst = src; 976public void Convert(in R8 src, ref R4 dst) => dst = (R4)src; 1375public bool TryParse(in TX src, out R4 dst) 1380dst = R4.NaN; 1682public void Convert(in TX src, ref R4 value) 1688value = R4.NaN; 1726public void Convert(in BL src, ref R4 dst) => dst = System.Convert.ToSingle(src);
Data\DataViewTypeManager.cs (1)
30typeof(Int64), typeof(UInt64), typeof(Single), typeof(Double),
Data\RowCursorUtils.cs (12)
352public static ValueGetter<Single> GetLabelGetter(DataViewRow cursor, int labelIndex) 357return cursor.GetGetter<Single>(cursor.Schema[labelIndex]); 363(ref Single dst) => 374private static ValueGetter<Single> GetLabelGetterNotFloat(DataViewRow cursor, int labelIndex) 385(ref Single dst) => 402(ref Single dst) => 409dst = Single.NaN; 414internal static ValueGetter<VBuffer<Single>> GetLabelGetter(SlotCursor cursor) 418return cursor.GetGetter<Single>(); 420return GetVecGetterAs<Single>(NumberDataViewType.Single, cursor); 432(ref VBuffer<Single> dst) => 443editor.Values[kv.Key] = Single.NaN;
DataLoadSave\Binary\UnsafeTypeOps.cs (7)
41_type2ops[typeof(Single)] = new SingleUnsafeTypeOps(); 148private sealed class SingleUnsafeTypeOps : UnsafeTypeOps<Single> 150public override int Size { get { return sizeof(Single); } } 151public override unsafe void Apply(ReadOnlySpan<Single> array, Action<IntPtr> func) 153fixed (Single* pArray = &MemoryMarshal.GetReference(array)) 156public override void Write(Single a, BinaryWriter writer) { writer.Write(a); } 157public override Single Read(BinaryReader reader) { return reader.ReadSingle(); }
DataLoadSave\Text\TextLoaderParser.cs (2)
266IsReal = typeof(TResult) == typeof(Single) || typeof(TResult) == typeof(Double); 451IsReal = typeof(TItem) == typeof(Single) || typeof(TItem) == typeof(Double);
Deprecated\Vector\VectorUtils.cs (11)
86var value = aValues[i]; 138var value = aEditor.Values[i]; 139var absValue = Math.Abs(value); 146var ratio = 1 / absMax; 207var d = valuesA[ia]; 214var d = valuesB[ib]; 224var normA = CpuMathUtils.SumSq(valuesA); 227var normB = CpuMathUtils.SumSq(valuesB); 228var dotP = CpuMathUtils.DotProductSparse(valuesA, valuesB, indicesB, valuesB.Length); 229var res = normA + normB - 2 * dotP; 548var diff = a[i] - b[i];
EntryPoints\EntryPointNode.cs (1)
913var cost = node[FieldNames.Cost] == null ? float.NaN : node[FieldNames.Cost].Value<float>();
Evaluators\AnomalyDetectionEvaluator.cs (41)
137var thresholdAtK = new List<Single>(); 138var thresholdAtP = new List<Single>(); 139var thresholdAtNumAnomalies = new List<Single>(); 142var scores = new List<Single>(); 143var labels = new List<Single>(); 218public readonly Single Label; 219public readonly Single Score; 221public Info(Single label, Single score) 242public void Update(Single label, Single score) 244Contracts.Assert(!Single.IsNaN(label)); 248protected abstract void UpdateCore(Single label, Single score); 252out Single thresholdAtK, out Single thresholdAtP, out Single thresholdAtNumPos) 256thresholdAtK = thresholdAtP = thresholdAtNumPos = Single.NaN; 269protected Double DetectionRate(IEnumerable<Info> sortedExamples, int maxFalsePositives, out Single threshold) 273threshold = Single.PositiveInfinity; 287public void UpdateCounts(Single label) 377protected override void UpdateCore(Single label, Single score) 418public Single Score; 419public Single Label; 436public Single ThresholdAtK; 437public Single ThresholdAtP; 438public Single ThresholdAtNumAnomalies; 440private ValueGetter<Single> _labelGetter; 441private ValueGetter<Single> _scoreGetter; 445public readonly Single[] Scores; 446public readonly Single[] Labels; 469Scores = new Single[_topK]; 470Labels = new Single[_topK]; 529Single label = 0; 531if (Single.IsNaN(label)) 538Single score = 0; 680var scoreGetter = cursor.GetGetter<Single>(column.Value); 685var labelGetter = cursor.GetGetter<Single>(column.Value); 699Single score = 0; 700Single label = 0;
Evaluators\AucAggregator.cs (34)
17protected Single Score; 18protected Single Label; 20public void ProcessRow(Single label, Single score, Single weight = 1) 27protected abstract void ProcessRowCore(Single weight); 64protected override void ProcessRowCore(Single weight) 123internal sealed class UnweightedAucAggregator : AucAggregatorBase<Single> 148var negScore = negSorted.Current; 204protected override ValueGetter<Single> GetSampleGetter() 206return (ref Single dst) => dst = Score; 209protected override void AddExample(List<Single> examples) 220public Single Score; 221public Single Weight; 224private Single _weight; 253var negScore = negSorted.Current.Score; 256var weight = posSorted.Current.Weight; 263var weight = negSorted.Current.Weight; 279var posWeight = posSorted.Current.Weight; 289var negWeight = negSorted.Current.Weight; 309var weight = posSorted.Current.Weight; 316var weight = negSorted.Current.Weight; 338protected override void ProcessRowCore(Single weight) 353protected Single Score; 354protected Single Label; 355protected Single Weight; 357public void ProcessRow(Single label, Single score, Single weight = 1) 403public Single Score; 404public Single Label; 476public Single Score; 477public Single Label; 478public Single Weight;
Evaluators\BinaryClassifierEvaluator.cs (54)
36public Single Threshold; 104private readonly Single _threshold; 240var scores = new List<Single>(); 402private readonly Single _threshold; 494public Counters(bool useRaw, Single threshold) 500public void Update(Single score, Single prob, Single label, Double logloss, Single weight) 519if (!Single.IsNaN(prob)) 533public Single Score; 534public Single Label; 535public Single Weight; 539public readonly List<Single> Scores; 560private ValueGetter<Single> _labelGetter; 561private ValueGetter<Single> _scoreGetter; 562private ValueGetter<Single> _weightGetter; 563private ValueGetter<Single> _probGetter; 564private Single _score; 565private Single _label; 566private Single _weight; 571int auPrcReservoirSize, Single threshold, bool useRaw, int prCount, string stratName) 610Scores = new List<Single>(); 628_scoreGetter = row.GetGetter<Single>(score); 636_probGetter = row.GetGetter<Single>(prob[0]); 638_probGetter = (ref Single value) => value = Single.NaN; 642_weightGetter = row.GetGetter<Single>(schema.Weight.Value); 654if (Single.IsNaN(_label)) 660Single prob = 0; 664if (!Single.IsNaN(prob)) 746Single scoreCur = Single.PositiveInfinity; 748.Concat(new[] { new RocInfo() { Score = Single.NegativeInfinity } })) 768if (Single.IsNegativeInfinity(point.Score)) 1056private readonly Single _threshold; 1060public BinaryPerInstanceEvaluator(IHostEnvironment env, DataViewSchema schema, string scoreCol, string probCol, string labelCol, Single threshold, bool useRaw) 1157Single label = 0; 1158Single prob = 0; 1159Single score = 0; 1161ValueGetter<Single> nanGetter = (ref Single value) => value = Single.NaN; 1164ValueGetter<Single> probGetter; 1166probGetter = input.GetGetter<Single>(input.Schema[_probIndex]); 1169ValueGetter<Single> scoreGetter; 1171scoreGetter = input.GetGetter<Single>(input.Schema[ScoreIndex]); 1231private Double GetLogLoss(Single prob, Single label) 1233if (Single.IsNaN(prob) || Single.IsNaN(label)) 1240private bool GetPredictedLabel(Single val) 1243return Single.IsNaN(val) ? false : val > _threshold; 1293public Single Threshold;
Evaluators\ClusteringEvaluator.cs (34)
238private readonly VBuffer<Single>[] _clusterCentroids; 307Single denom = VectorUtils.Distance(in centroidI, in centroidJ); 330_clusterCentroids = new VBuffer<Single>[_numClusters]; 332_clusterCentroids[i] = VBufferUtils.CreateEmpty<Single>(features.Value.Type.GetVectorSize()); 337public void UpdateFirstPass(int intLabel, Single[] scores, Single weight, int[] indices) 359public void InitializeSecondPass(VBuffer<Single>[] clusterCentroids) 364VectorUtils.ScaleBy(ref _clusterCentroids[i], (Single)(1.0 / _numInstancesOfClstr[i])); 368public void UpdateSecondPass(in VBuffer<Single> features, int[] indices) 372var distance = VectorUtils.Distance(in _clusterCentroids[assigned], in features); 378private ValueGetter<Single> _labelGetter; 379private ValueGetter<VBuffer<Single>> _scoreGetter; 380private ValueGetter<Single> _weightGetter; 381private ValueGetter<VBuffer<Single>> _featGetter; 384private VBuffer<Single> _scores; 385private readonly Single[] _scoresArr; 387private VBuffer<Single> _features; 390private readonly VBuffer<Single>[] _clusterCentroids; 411_clusterCentroids = new VBuffer<Single>[scoreVectorSize]; 413_clusterCentroids[i] = VBufferUtils.CreateEmpty<Single>(features.Value.Type.GetVectorSize()); 421Single label = 0; 423if (Single.IsNaN(label)) 441Single weight = 1; 497_featGetter = row.GetGetter<VBuffer<Single>>(schema.Feature.Value); 501_scoreGetter = row.GetGetter<VBuffer<Single>>(score); 508_labelGetter = (ref Single value) => value = Single.NaN; 510_weightGetter = row.GetGetter<Single>(schema.Weight.Value); 659VBuffer<Single> scores = default(VBuffer<Single>); 660var scoresArr = new Single[_numClusters]; 663var scoreGetter = input.GetGetter<VBuffer<Single>>(input.Schema[ScoreIndex]); 691ValueGetter<VBuffer<Single>> topKScoresFn = 692(ref VBuffer<Single> dst) =>
Evaluators\MulticlassClassificationEvaluator.cs (1)
486var correctProba = !wasKnownLabel ? 0 : _scoresArr[intLabel];
Evaluators\QuantileRegressionEvaluator.cs (1)
392ValueGetter<float> nanGetter = (ref float value) => value = Single.NaN;
Evaluators\RankingEvaluator.cs (27)
296private readonly List<Single> _queryOutputs; 375_queryOutputs = new List<Single>(); 379public void Update(short label, Single output) 385public void UpdateGroup(Single weight) 421private Single _currentQueryWeight; 423private ValueGetter<Single> _labelGetter; 424private ValueGetter<Single> _scoreGetter; 425private ValueGetter<Single> _weightGetter; 446_currentQueryWeight = Single.NaN; 461_scoreGetter = row.GetGetter<Single>(score); 464_weightGetter = row.GetGetter<Single>(schema.Weight.Value); 487Single label = 0; 488Single score = 0; 492if (Single.IsNaN(score)) 502Single weight = 1; 506if (Single.IsNaN(_currentQueryWeight)) 520_currentQueryWeight = Single.NaN; 628private sealed class Transform : PerGroupTransformBase<short, Single, Transform.RowCursorState> 791Single label = 0; 797protected override ValueGetter<Single> GetScoreGetter(DataViewRow row) 799return row.GetGetter<Single>(row.Schema[_bindings.ScoreIndex]); 807protected override void ProcessExample(RowCursorState state, short label, Single score) 831public readonly List<Single> QueryOutputs; 842QueryOutputs = new List<Single>(); 997List<short> queryLabels, List<Single> queryOutputs, Double[] groupMaxDcgCur) 1036List<short> queryLabels, List<Single> queryOutputs, Double[] groupDcgCur) 1056private static Comparison<int> GetCompareItems(List<short> queryLabels, List<Single> queryOutputs)
Evaluators\RegressionEvaluator.cs (1)
280ValueGetter<float> nan = (ref float value) => value = Single.NaN;
Prediction\Calibrator.cs (17)
716var scoreGetter = RowCursorUtils.GetGetterAs<Single>(NumberDataViewType.Single, input, _scoreCol); 717ValueGetter<Single> probGetter = 718(ref Single dst) => 720Single score = 0; 969var scoreGetter = RowCursorUtils.GetGetterAs<Single>(NumberDataViewType.Single, cursor, scoreCol.Index); 970ValueGetter<Single> weightGetter = !weightCol.HasValue ? (ref float dst) => dst = 1 : 971RowCursorUtils.GetGetterAs<Single>(NumberDataViewType.Single, cursor, weightCol.Value.Index); 976Single label = 0; 980Single score = 0; 984Single weight = 0; 1494var weight = di.Weight; 1540var weight = d_i.Weight; 1541var x = d_i.Score; 1543var p = pp[i]; 1582var y = d_i.Target ? d_i.Score : -d_i.Score; 1583var p = PlattCalibrator.PredictProbability(d_i.Score, slope, offset); 1585var weight = d_i.Weight;
Scorers\FeatureContributionCalculation.cs (1)
246var val = values[i];
Transforms\ConversionsExtensionsCatalog.cs (2)
182/// The data type is a vector of <see cref="System.Single"/> representing the input value.</param> 203/// The new column's data type is a vector of <see cref="System.Single"/> representing the original value.</param>
Transforms\Hashing.cs (1)
555foreach (var value in values.DenseValues())
Transforms\KeyToVector.cs (1)
740/// into a known-sized vector of <see cref="System.Single"/>.
Transforms\LabelIndicatorTransform.cs (1)
205var src = default(float);
Transforms\NAFilter.cs (1)
134Host.CheckDecode(cbFloat == sizeof(Single) || cbFloat == sizeof(Double));
Transforms\NormalizeColumn.cs (9)
986return Sng.MinMaxOneColumnFunctionBuilder.Create(column, host, srcType, cursor.GetGetter<Single>(srcColumn)); 993return Sng.MinMaxVecColumnFunctionBuilder.Create(column, host, vectorType, cursor.GetGetter<VBuffer<Single>>(srcColumn)); 1025return Sng.MeanVarOneColumnFunctionBuilder.Create(column, host, srcType, cursor.GetGetter<Single>(srcColumn)); 1032return Sng.MeanVarVecColumnFunctionBuilder.Create(column, host, vectorType, cursor.GetGetter<VBuffer<Single>>(srcColumn)); 1066return Sng.MeanVarOneColumnFunctionBuilder.Create(column, host, srcType, cursor.GetGetter<Single>(srcColumn)); 1073return Sng.MeanVarVecColumnFunctionBuilder.Create(column, host, vectorType, cursor.GetGetter<VBuffer<Single>>(srcColumn)); 1106return Sng.BinOneColumnFunctionBuilder.Create(column, host, srcType, cursor.GetGetter<Single>(srcColumn)); 1113return Sng.BinVecColumnFunctionBuilder.Create(column, host, vectorType, cursor.GetGetter<VBuffer<Single>>(srcColumn)); 1217return Sng.RobustScalerOneColumnFunctionBuilder.Create(column, host, srcType, column.CenterData, column.QuantileMin, column.QuantileMax, cursor.GetGetter<Single>(srcColumn));
Transforms\NormalizeColumnSng.cs (314)
23using TFloat = Single; 28int numFeatures, int[] indices, TFloat[] scales, TFloat[] offsets, bool saveText = false) 48ctx.Writer.Write(sizeof(TFloat)); 89out int numFeatures, out TFloat[] scales, out TFloat[] offsets, 90out int[] indicesMorph, out TFloat[] scalesSparse, out TFloat[] offsetsSparse) 106Contracts.CheckDecode(cbFloat == sizeof(TFloat)); 133TFloat scale = scales[iv]; 134Contracts.CheckDecode(!TFloat.IsNaN(scale)); 142TFloat offset = offsets[iv]; 143Contracts.CheckDecode(!TFloat.IsNaN(offset)); 155scalesSparse = ctx.Reader.ReadSingleArray(scaleCount) ?? new TFloat[0]; 161scales = Utils.CreateArray<TFloat>(numFeatures, 1); 162offsets = offsetsSparse != null ? new TFloat[numFeatures] : null; 169TFloat scale = scales[iv] = scalesSparse[iiv]; 170Contracts.CheckDecode(!TFloat.IsNaN(scale)); 178TFloat offset = offsets[iv] = offsetsSparse[iiv]; 179Contracts.CheckDecode(!TFloat.IsNaN(offset)); 195public static void SaveModel(ModelSaveContext ctx, TFloat[][] binUpperBounds, bool saveText = false) 207ctx.Writer.Write(sizeof(TFloat)); 234public static void LoadModel(ModelLoadContext ctx, out TFloat[][] binUpperBounds) 246Contracts.CheckDecode(cbFloat == sizeof(TFloat)); 251binUpperBounds = new TFloat[numFeatures][]; 254TFloat[] curUpperBounds = ctx.Reader.ReadSingleArray(); 259Contracts.CheckDecode(curUpperBounds[curUpperBounds.Length - 1] == TFloat.PositiveInfinity); 266public static void SaveModel(ModelSaveContext ctx, bool useLog, TFloat[] mean, TFloat[] stddev) 274ctx.Writer.Write(sizeof(TFloat)); 290public static void LoadModel(ModelLoadContext ctx, int cv, out bool useLog, out TFloat[] mean, out TFloat[] stddev) 300Contracts.CheckDecode(cbFloat == sizeof(TFloat)); 318internal sealed class MinMaxSngAggregator : IColumnAggregator<VBuffer<TFloat>> 320private readonly TFloat[] _min; 321private readonly TFloat[] _max; 328_min = new TFloat[size]; 329_max = new TFloat[size]; 333_min[i] = TFloat.PositiveInfinity; 334_max[i] = TFloat.NegativeInfinity; 338public TFloat[] Min 343public TFloat[] Max 353public void ProcessValue(in VBuffer<TFloat> value) 368var val = values[j]; 378var val = values[k]; 397private void Update(int j, TFloat val) 466public void ProcessValue(in VBuffer<TFloat> value) 480var origVal = values[j]; 489var origVal = values[k]; 509private void Update(int j, TFloat origVal) 513var val = _useLog ? (TFloat)Math.Log(origVal) : origVal; 769internal sealed class MedianSngAggregator : IColumnAggregator<TFloat> 778_belowMedianHeap = new MedianAggregatorUtils.MaxHeap<TFloat>(contatinerStartingSize); 779_aboveMedianHeap = new MedianAggregatorUtils.MinHeap<TFloat>(contatinerStartingSize); 783public TFloat Median 788public void ProcessValue(in TFloat value) 803public static IColumnFunction Create(IHost host, TFloat scale, TFloat offset) 808public static IColumnFunction Create(IHost host, TFloat[] scale, TFloat[] offset, int[] indicesNonZeroOffset) 816public sealed class ImplOne : ImplOne<TFloat> 818public ImplOne(IHost host, TFloat scale, TFloat offset) 825host.Check(typeSrc.RawType == typeof(TFloat), "The column type must be Single."); 828TFloat[] scales; 829TFloat[] offsets; 831TFloat[] scalesSparse; 832TFloat[] offsetsSparse; 845private void GetResult(ref TFloat input, ref TFloat value) 867var getSrc = input.GetGetter<TFloat>(input.Schema[icol]); 868ValueGetter<TFloat> del = 869(ref TFloat dst) => 879public sealed class ImplVec : ImplVec<TFloat> 881public ImplVec(IHost host, TFloat[] scale, TFloat[] offset, int[] indicesNonZeroOffset) 888host.Check(typeSrc.ItemType.RawType == typeof(TFloat), "The column type must be vector of Single."); 892TFloat[] scales; 893TFloat[] offsets; 895TFloat[] scalesSparse; 896TFloat[] offsetsSparse; 934node.AddAttribute("offset", Enumerable.Repeat<TFloat>(0, featureCount)); 942var getSrc = input.GetGetter<VBuffer<TFloat>>(input.Schema[icol]); 943var bldr = new BufferBuilder<TFloat>(R4Adder.Instance); 944ValueGetter<VBuffer<TFloat>> del; 947del = (ref VBuffer<TFloat> dst) => 957del = (ref VBuffer<TFloat> dst) => 967del = (ref VBuffer<TFloat> dst) => 980private static void FillValues(in VBuffer<TFloat> input, BufferBuilder<TFloat> bldr, TFloat[] scale) 1010private static void FillValues(in VBuffer<TFloat> input, BufferBuilder<TFloat> bldr, TFloat[] scale, 1011TFloat[] offset) 1055private static void FillValues(in VBuffer<TFloat> input, BufferBuilder<TFloat> bldr, TFloat[] scale, 1056TFloat[] offset, int[] nz) 1131public static IColumnFunction Create(IHost host, TFloat mean, TFloat stddev, bool useLog) 1136public static IColumnFunction Create(IHost host, TFloat[] mean, TFloat[] stddev, bool useLog) 1143public sealed class ImplOne : ImplOne<TFloat> 1145public ImplOne(IHost host, TFloat mean, TFloat stddev, bool useLog) 1152host.Check(typeSrc.RawType == typeof(TFloat), "The column type must be Single."); 1157TFloat[] mean; 1158TFloat[] stddev; 1164private void GetResult(ref TFloat input, ref TFloat value) 1166var val = UseLog ? (TFloat)Math.Log(input) : input; 1187if (Stddev <= TFloat.Epsilon) 1189ValueGetter<TFloat> trivial = 1190(ref TFloat dst) => 1197var getSrc = input.GetGetter<TFloat>(input.Schema[icol]); 1198ValueGetter<TFloat> del = 1199(ref TFloat dst) => 1208public sealed class ImplVec : ImplVec<TFloat> 1210public ImplVec(IHost host, TFloat[] mean, TFloat[] stddev, bool useLog) 1217host.Check(typeSrc.ItemType.RawType == typeof(TFloat), "The column type must be vector of Single."); 1224TFloat[] mean; 1225TFloat[] stddev; 1242var getSrc = input.GetGetter<VBuffer<TFloat>>(input.Schema[icol]); 1243var bldr = new BufferBuilder<TFloat>(R4Adder.Instance); 1244ValueGetter<VBuffer<TFloat>> del; 1245del = (ref VBuffer<TFloat> dst) => 1256private static void FillValues(in VBuffer<TFloat> input, BufferBuilder<TFloat> bldr, TFloat[] mean, 1257TFloat[] stddev, bool useLog) 1275var sigma = stddev[i]; 1276if (sigma > TFloat.Epsilon) 1278var val = useLog ? (TFloat)Math.Log(values[i]) : values[i]; 1291var sigma = stddev[ivDst]; 1292if (sigma > TFloat.Epsilon) 1294var val = useLog ? (TFloat)Math.Log(values[ii]) : values[ii]; 1306public static IColumnFunction Create(IHost host, TFloat[] binUpperBounds, bool fixZero) 1311public static IColumnFunction Create(IHost host, TFloat[][] binUpperBounds, bool fixZero) 1320private readonly TFloat[] _binUpperBounds; 1321private readonly TFloat _den; 1322private readonly TFloat _offset; 1324public ImplOne(IHost host, TFloat[] binUpperBounds, bool fixZero) 1336host.Check(typeSrc.RawType == typeof(TFloat), "The column type must be Single."); 1344TFloat[][] binUpperBounds = null; 1372var getSrc = input.GetGetter<TFloat>(input.Schema[icol]); 1373ValueGetter<TFloat> del = 1374(ref TFloat dst) => 1382private void GetResult(TFloat input, ref TFloat value) 1388=> new NormalizingTransformer.BinNormalizerModelParameters<TFloat>(ImmutableArray.Create(_binUpperBounds), _den, _offset); 1393private readonly TFloat[][] _binUpperBounds; 1394private readonly TFloat[] _den; 1395private readonly TFloat[] _offset; 1397public ImplVec(IHost host, TFloat[][] binUpperBounds, bool fixZero) 1401_den = new TFloat[_binUpperBounds.Length]; 1406_offset = new TFloat[_binUpperBounds.Length]; 1421host.Check(typeSrc.ItemType.RawType == typeof(TFloat), "The column type must be vector of Single."); 1430TFloat[][] binUpperBounds = null; 1457var getSrc = input.GetGetter<VBuffer<TFloat>>(input.Schema[icol]); 1458var bldr = new BufferBuilder<TFloat>(R4Adder.Instance); 1459ValueGetter<VBuffer<TFloat>> del = 1460(ref VBuffer<TFloat> dst) => 1469private void GetResult(in VBuffer<TFloat> input, ref VBuffer<TFloat> value, BufferBuilder<TFloat> bldr) 1508TFloat zero = 0; 1539=> new NormalizingTransformer.BinNormalizerModelParameters<ImmutableArray<TFloat>>( 1549public static void ComputeScaleAndOffset(bool fixZero, TFloat max, TFloat min, out TFloat scale, out TFloat offset) 1557private static void ComputeScaleAndOffset(TFloat max, TFloat min, out TFloat scale, out TFloat offset) 1559Contracts.Assert(!TFloat.IsNaN(min)); 1560Contracts.Assert(!TFloat.IsNaN(max)); 1564Contracts.Assert(min <= max || (TFloat.IsPositiveInfinity(min) && TFloat.IsNegativeInfinity(max))); 1579Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1582private static void ComputeScaleAndOffsetFixZero(TFloat max, TFloat min, out TFloat scale, out TFloat offset) 1584Contracts.Assert(!TFloat.IsNaN(min)); 1585Contracts.Assert(!TFloat.IsNaN(max)); 1589Contracts.Assert(min <= max || (TFloat.IsPositiveInfinity(min) && TFloat.IsNegativeInfinity(max))); 1600Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1606public static void ComputeScaleAndOffset(Double mean, Double stddev, out TFloat scale, out TFloat offset) 1616else if ((scale = 1 / (TFloat)stddev) == 0) 1619offset = (TFloat)mean; 1620Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1623public static void ComputeScaleAndOffsetFixZero(Double mean, Double meanSquaredError, out TFloat scale, out TFloat offset) 1635scale = 1 / (TFloat)Math.Sqrt(meanSquaredError + mean * mean); 1636Contracts.Assert(0 <= scale && scale < TFloat.PositiveInfinity); 1642public static TFloat Cdf(TFloat input, TFloat mean, TFloat stddev) 1648var x = (input - mean) / stddev; 1649var x2 = x * x / 2; 1650const TFloat a = (TFloat)0.147; 1651var ax2 = a * x2; 1652return (TFloat)(0.5 + 0.5 * Math.Sign(x) * Math.Sqrt(1 - Math.Exp(-x2 * (4 / Math.PI + ax2) / (1 + ax2)))); 1658public static TFloat GetValue(TFloat input, TFloat[] binUpperBounds, TFloat den, TFloat offset) 1660if (TFloat.IsNaN(input)) 1664var value = binIdx / den - offset; 1669public static TFloat GetValue(TFloat input, TFloat[] binUpperBounds, TFloat den) 1671if (TFloat.IsNaN(input)) 1675var value = binIdx / den; 1683public abstract class MinMaxOneColumnFunctionBuilderBase : OneColumnFunctionBuilderBase<TFloat> 1687private VBuffer<TFloat> _buffer; 1689protected MinMaxOneColumnFunctionBuilderBase(IHost host, long lim, bool fix, ValueGetter<TFloat> getSrc) 1694_buffer = new VBuffer<TFloat>(1, new TFloat[1]); 1697protected override bool ProcessValue(in TFloat val) 1709private MinMaxOneColumnFunctionBuilder(IHost host, long lim, bool fix, ValueGetter<TFloat> getSrc) 1715ValueGetter<TFloat> getter) 1724TFloat scale; 1725TFloat offset; 1732public abstract class MinMaxVecColumnFunctionBuilderBase : VecColumnFunctionBuilderBase<TFloat> 1737protected MinMaxVecColumnFunctionBuilderBase(IHost host, int cv, long lim, bool fix, ValueGetter<VBuffer<TFloat>> getSrc) 1744protected override bool ProcessValue(in VBuffer<TFloat> buffer) 1759ValueGetter<VBuffer<TFloat>> getSrc) 1765ValueGetter<VBuffer<TFloat>> getter) 1808public sealed class MeanVarOneColumnFunctionBuilder : OneColumnFunctionBuilderBase<TFloat> 1815private VBuffer<TFloat> _buffer; 1817private MeanVarOneColumnFunctionBuilder(IHost host, long lim, bool fix, ValueGetter<TFloat> getSrc, bool useLog, bool useCdf, bool useSampleVariance) 1825_buffer = new VBuffer<TFloat>(1, new TFloat[1]); 1829ValueGetter<TFloat> getter) 1836ValueGetter<TFloat> getter) 1843protected override bool ProcessValue(in TFloat origVal) 1864return AffineColumnFunction.Create(Host, (TFloat)0, (TFloat)0); 1865TFloat scale; 1866TFloat offset; 1882return CdfColumnFunction.Create(Host, (TFloat)0, (TFloat)0, _useLog); 1886return CdfColumnFunction.Create(Host, (TFloat)_aggregator.Mean[0], (TFloat)stdDev, _useLog); 1890public sealed class MeanVarVecColumnFunctionBuilder : VecColumnFunctionBuilderBase<TFloat> 1899ValueGetter<VBuffer<TFloat>> getSrc, bool useLog, bool useCdf, bool useSampleVariance) 1910ValueGetter<VBuffer<TFloat>> getter) 1918ValueGetter<VBuffer<TFloat>> getter) 1926protected override bool ProcessValue(in VBuffer<TFloat> buffer) 1950var scale = new TFloat[cv]; 1951var offset = new TFloat[cv]; 1996var mean = new TFloat[cv]; 1997var stddev = new TFloat[cv]; 2007mean[i] = (TFloat)_aggregator.Mean[i]; 2008stddev[i] = (TFloat)(_useSampleVariance ? _aggregator.StdDevSample[i] : _aggregator.StdDevPopulation[i]); 2016public sealed class BinOneColumnFunctionBuilder : OneColumnFunctionBuilderBase<TFloat> 2020private readonly List<TFloat> _values; 2022private BinOneColumnFunctionBuilder(IHost host, long lim, bool fix, int numBins, ValueGetter<TFloat> getSrc) 2027_values = new List<TFloat>(); 2031ValueGetter<TFloat> getter) 2041protected override bool ProcessValue(in TFloat val) 2054_values.RemoveAll(TFloat.IsNaN); 2060public sealed class BinVecColumnFunctionBuilder : VecColumnFunctionBuilderBase<TFloat> 2064private readonly List<TFloat>[] _values; 2067ValueGetter<VBuffer<TFloat>> getSrc) 2072_values = new List<TFloat>[cv]; 2075_values[i] = new List<TFloat>(); 2080ValueGetter<VBuffer<TFloat>> getter) 2091protected override bool ProcessValue(in VBuffer<TFloat> buffer) 2115var val = values[k]; 2127var binUpperBounds = new TFloat[count][]; 2131_values[i].RemoveAll(TFloat.IsNaN); 2138public sealed class SupervisedBinOneColumnFunctionBuilder : OneColumnSupervisedBinFunctionBuilderBase<TFloat> 2152protected override bool AcceptColumnValue(in TFloat colValue) 2154return !TFloat.IsNaN(colValue); 2176public sealed class SupervisedBinVecColumnFunctionBuilder : VecColumnSupervisedBinFunctionBuilderBase<TFloat> 2190protected override bool AcceptColumnValue(in VBuffer<TFloat> colValuesBuffer) 2198TFloat[][] binUpperBounds = new TFloat[ColumnSlotCount][]; 2216public sealed class RobustScalerOneColumnFunctionBuilder : OneColumnFunctionBuilderBase<TFloat> 2223private VBuffer<TFloat> _buffer; 2225private RobustScalerOneColumnFunctionBuilder(IHost host, long lim, bool centerData, uint quantileMin, uint quantileMax, ValueGetter<TFloat> getSrc) 2232_buffer = new VBuffer<TFloat>(1, new TFloat[1]); 2238protected override bool ProcessValue(in TFloat val) 2249bool centerData, uint quantileMin, uint quantileMax, ValueGetter<TFloat> getter) 2260TFloat median = _medianAggregator.Median; 2261TFloat range = _minMaxAggregator.Max[0] - _minMaxAggregator.Min[0]; 2263TFloat quantileRange = (_quantileMax - _quantileMin) / 100f; 2264TFloat scale = 1 / (range * quantileRange); 2273public sealed class RobustScalerVecFunctionBuilder : OneColumnFunctionBuilderBase<VBuffer<TFloat>> 2281private RobustScalerVecFunctionBuilder(IHost host, long lim, int vectorSize, bool centerData, uint quantileMin, uint quantileMax, ValueGetter<VBuffer<TFloat>> getSrc) 2299protected override bool ProcessValue(in VBuffer<TFloat> val) 2316bool centerData, uint quantileMin, uint quantileMax, ValueGetter<VBuffer<TFloat>> getter) 2327TFloat[] scale = new TFloat[_medianAggregators.Length]; 2328TFloat[] median = new TFloat[_medianAggregators.Length]; 2336TFloat range = _minMaxAggregator.Max[i] - _minMaxAggregator.Min[i]; 2339TFloat quantileRange = (_quantileMax - _quantileMin) / 100f;
Transforms\RangeFilter.cs (5)
350private readonly ValueGetter<Single> _srcGetter; 351private readonly ValueGetter<Single> _getter; 352private Single _value; 358_srcGetter = Input.GetGetter<Single>(Input.Schema[Parent._index]); 360(ref Single value) =>
Utils\ApiUtils.cs (1)
48if (t == typeof(Single))
Utils\LossFunctions.cs (5)
260var tmp = (_margin - output * truth) * invariant + alpha * truth; 261var fullUpdate = truth * Math.Max(0, Math.Min(1, tmp)) - alpha; 384var tmp = (1 - output * truth - _smoothConst * alpha * truth) * invariant + alpha * truth; 385var fullUpdate = truth * Math.Max(0, Math.Min(1, tmp)) - alpha; 508var fullUpdate = (label - output - (float)0.5 * dual) * invariant;
Microsoft.ML.Ensemble (223)
EnsembleUtils.cs (2)
37(in VBuffer<Single> src, ref VBuffer<Single> dst) => SelectFeatures(in src, features, card, ref dst));
EntryPoints\CreateEnsemble.cs (1)
257IOutputCombiner<VBuffer<Single>> combiner;
OutputCombiners\Average.cs (4)
56public override Combiner<Single> GetCombiner() 59return (ref Single dst, Single[] src, Single[] weights) =>
OutputCombiners\BaseAverager.cs (10)
30Host.CheckDecode(cbFloat == sizeof(Single)); 44ctx.Writer.Write(sizeof(Single)); 47public abstract Combiner<Single> GetCombiner(); 49protected void CombineCore(ref Single dst, Single[] src, Single[] weights = null) 51Single sum = 0; 52Single weightTotal = 0; 57if (!Single.IsNaN(src[i])) 68if (!Single.IsNaN(src[i]))
OutputCombiners\BaseMultiAverager.cs (5)
25protected void CombineCore(ref VBuffer<Single> dst, VBuffer<Single>[] src, Single[] weights = null) 44Single weightTotal; 56var w = weights[i];
OutputCombiners\BaseMultiCombiner.cs (8)
48Host.CheckDecode(cbFloat == sizeof(Single)); 64ctx.Writer.Write(sizeof(Single)); 68public abstract Combiner<VBuffer<Single>> GetCombiner(); 70protected int GetClassCount(VBuffer<Single>[] values) 81protected bool TryNormalize(VBuffer<Single>[] values) 89var sum = VectorUtils.L1Norm(in values[i]); 98protected void GetNaNOutput(ref VBuffer<Single> dst, int len) 103editor.Values[i] = Single.NaN;
OutputCombiners\BaseScalarStacking.cs (3)
12internal abstract class BaseScalarStacking : BaseStacking<Single> 24protected override void FillFeatureBuffer(Single[] src, ref VBuffer<Single> dst)
OutputCombiners\BaseStacking.cs (14)
23public Single ValidationDatasetProportion = 0.3f; 32public Single ValidationDatasetProportion { get; } 60env.CheckDecode(cbFloat == sizeof(Single)); 83ctx.Writer.Write(sizeof(Single)); 97var map = mapper.GetMapper<VBuffer<Single>, TOutput>(); 99var feat = default(VBuffer<Single>); 101(ref TOutput dst, TOutput[] src, Single[] weights) => 109protected abstract void FillFeatureBuffer(TOutput[] src, ref VBuffer<Single> dst); 135var maps = new ValueMapper<VBuffer<Single>, TOutput>[models.Count]; 140maps[i] = m.GetMapper<VBuffer<Single>, TOutput>(); 152private IDataView CreateDataView(IHostEnvironment env, IChannel ch, RoleMappedData data, ValueMapper<VBuffer<Single>, 169private IDataView CreateDataView<T>(IHostEnvironment env, IChannel ch, RoleMappedData data, ValueMapper<VBuffer<Single>, TOutput>[] maps, 174var features = new VBuffer<Single>[100]; 180var vBuffers = new VBuffer<Single>[maps.Length];
OutputCombiners\IOutputCombiner.cs (5)
18internal delegate void Combiner<TOutput>(ref TOutput dst, TOutput[] src, Single[] weights); 35Single ValidationDatasetProportion { get; } 38internal interface IRegressionOutputCombiner : IOutputCombiner<Single> 42internal interface IBinaryOutputCombiner : IOutputCombiner<Single> 46internal interface IMulticlassOutputCombiner : IOutputCombiner<VBuffer<Single>>
OutputCombiners\Median.cs (6)
51_host.CheckDecode(cbFloat == sizeof(Single)); 70ctx.Writer.Write(sizeof(Single)); 73public Combiner<Single> GetCombiner() 78private void CombineCore(ref Single dst, Single[] src, Single[] weights)
OutputCombiners\MultiAverage.cs (4)
65public override Combiner<VBuffer<Single>> GetCombiner() 69(ref VBuffer<Single> dst, VBuffer<Single>[] src, Single[] weights) =>
OutputCombiners\MultiMedian.cs (6)
68public override Combiner<VBuffer<Single>> GetCombiner() 70Single[] raw = null; 72(ref VBuffer<Single> dst, VBuffer<Single>[] src, Single[] weights) => 88raw = new Single[count];
OutputCombiners\MultiStacking.cs (3)
24internal sealed class MultiStacking : BaseStacking<VBuffer<Single>>, IMulticlassOutputCombiner 80protected override void FillFeatureBuffer(VBuffer<Single>[] src, ref VBuffer<Single> dst)
OutputCombiners\MultiVoting.cs (4)
67public override Combiner<VBuffer<Single>> GetCombiner() 72private void CombineCore(ref VBuffer<Single> dst, VBuffer<Single>[] src, Single[] weights = null)
OutputCombiners\MultiWeightedAverage.cs (1)
91public override Combiner<VBuffer<Single>> GetCombiner()
OutputCombiners\Voting.cs (8)
49_host.CheckDecode(cbFloat == sizeof(Single)); 68ctx.Writer.Write(sizeof(Single)); 71public Combiner<Single> GetCombiner() 76private void CombineCore(ref Single dst, Single[] src, Single[] weights) 86var v = src[i]; 92dst = (Single)(pos - neg) / (pos + neg);
OutputCombiners\WeightedAverage.cs (1)
89public override Combiner<Single> GetCombiner()
PipelineEnsemble.cs (10)
162public ValueGetter<Single> GetLabelGetter(DataViewRow input, int i, out Action disposer) 174public ValueGetter<Single> GetWeightGetter(DataViewRow input, int i, out Action disposer) 180ValueGetter<Single> weight = (ref float dst) => dst = 1; 232private sealed class ImplOne : SchemaBindablePipelineEnsemble<Single> 260private sealed class ImplVec : SchemaBindablePipelineEnsemble<VBuffer<Single>> 292private sealed class ImplOneWithCalibrator : SchemaBindablePipelineEnsemble<Single>, ISelfCalibratingPredictor 333var scoreGetter = (ValueGetter<Single>)bound.CreateScoreGetter(curs, out Action disposer); 346Single label = 0; 350Single score = 0; 354Single weight = 0;
Selector\DiversityMeasure\BaseDisagreementDiversityMeasure.cs (2)
26Single differencesCount = 0; 44protected abstract Single GetDifference(in TOutput tOutput1, in TOutput tOutput2);
Selector\DiversityMeasure\DisagreementDiversityMeasure.cs (4)
14internal sealed class DisagreementDiversityMeasure : BaseDisagreementDiversityMeasure<Single>, IBinaryDiversityMeasure 19protected override Single GetDifference(in Single valueX, in Single valueY)
Selector\DiversityMeasure\ModelDiversityMetric.cs (1)
13public Single DiversityNumber { get; set; }
Selector\DiversityMeasure\MultiDisagreementDiversityMeasure.cs (4)
16internal sealed class MultiDisagreementDiversityMeasure : BaseDisagreementDiversityMeasure<VBuffer<Single>>, IMulticlassDiversityMeasure 20protected override Single GetDifference(in VBuffer<Single> valueX, in VBuffer<Single> valueY)
Selector\DiversityMeasure\RegressionDisagreementDiversityMeasure.cs (4)
14internal sealed class RegressionDisagreementDiversityMeasure : BaseDisagreementDiversityMeasure<Single>, IRegressionDiversityMeasure 18protected override Single GetDifference(in Single valueX, in Single valueY)
Selector\FeatureSelector\RandomFeatureSelector.cs (1)
28public Single FeaturesSelectionProportion = 0.8f;
Selector\IDiversityMeasure.cs (3)
22internal interface IBinaryDiversityMeasure : IDiversityMeasure<Single> 24internal interface IRegressionDiversityMeasure : IDiversityMeasure<Single> 26internal interface IMulticlassDiversityMeasure : IDiversityMeasure<VBuffer<Single>>
Selector\ISubModelSelector.cs (4)
20Single ValidationDatasetProportion { get; } 23internal interface IRegressionSubModelSelector : ISubModelSelector<Single> 27internal interface IBinarySubModelSelector : ISubModelSelector<Single> 31internal interface IMulticlassSubModelSelector : ISubModelSelector<VBuffer<Single>>
Selector\ISubsetSelector.cs (1)
15void Initialize(RoleMappedData data, int size, int batchSize, Single validationDatasetProportion);
Selector\SubModelSelector\AllSelector.cs (2)
14internal sealed class AllSelector : BaseSubModelSelector<Single>, IBinarySubModelSelector, IRegressionSubModelSelector 19public override Single ValidationDatasetProportion => 0;
Selector\SubModelSelector\AllSelectorMulticlass.cs (2)
16internal sealed class AllSelectorMulticlass : BaseSubModelSelector<VBuffer<Single>>, IMulticlassSubModelSelector 21public override Single ValidationDatasetProportion => 0;
Selector\SubModelSelector\BaseDiverseSelector.cs (1)
44var map = vm.GetMapper<VBuffer<Single>, TOutput>();
Selector\SubModelSelector\BaseSubModelSelector.cs (1)
17public abstract Single ValidationDatasetProportion { get; }
Selector\SubModelSelector\BestDiverseSelectorBinary.cs (3)
20internal sealed class BestDiverseSelectorBinary : BaseDiverseSelector<Single, DisagreementDiversityMeasure>, IBinarySubModelSelector 41public override List<ModelDiversityMetric<Single>> CalculateDiversityMeasure(IList<FeatureSubsetModel<float>> models, 42ConcurrentDictionary<FeatureSubsetModel<float>, Single[]> predictions)
Selector\SubModelSelector\BestDiverseSelectorMulticlass.cs (4)
21internal sealed class BestDiverseSelectorMulticlass : BaseDiverseSelector<VBuffer<Single>, IDiversityMeasure<VBuffer<Single>>>, IMulticlassSubModelSelector 42public override List<ModelDiversityMetric<VBuffer<Single>>> CalculateDiversityMeasure(IList<FeatureSubsetModel<VBuffer<float>>> models, 43ConcurrentDictionary<FeatureSubsetModel<VBuffer<float>>, VBuffer<Single>[]> predictions)
Selector\SubModelSelector\BestDiverseSelectorRegression.cs (3)
20internal sealed class BestDiverseSelectorRegression : BaseDiverseSelector<Single, RegressionDisagreementDiversityMeasure>, IRegressionSubModelSelector 39public override List<ModelDiversityMetric<Single>> CalculateDiversityMeasure(IList<FeatureSubsetModel<float>> models, 40ConcurrentDictionary<FeatureSubsetModel<float>, Single[]> predictions)
Selector\SubModelSelector\BestPerformanceRegressionSelector.cs (1)
19internal sealed class BestPerformanceRegressionSelector : BaseBestPerformanceSelector<Single>, IRegressionSubModelSelector
Selector\SubModelSelector\BestPerformanceSelector.cs (1)
19internal sealed class BestPerformanceSelector : BaseBestPerformanceSelector<Single>, IBinarySubModelSelector
Selector\SubModelSelector\BestPerformanceSelectorMulticlass.cs (1)
19internal sealed class BestPerformanceSelectorMulticlass : BaseBestPerformanceSelector<VBuffer<Single>>, IMulticlassSubModelSelector
Selector\SubModelSelector\SubModelDataSelector.cs (4)
19public Single LearnersSelectionProportion = 0.5f; 24public Single ValidationDatasetProportion = 0.3f; 27public Single LearnersSelectionProportion { get; } 29public override Single ValidationDatasetProportion { get; }
Selector\SubsetSelector\BaseSubsetSelector.cs (2)
30protected Single ValidationDatasetProportion; 43public void Initialize(RoleMappedData data, int size, int batchSize, Single validationDatasetProportion)
Trainer\Binary\EnsembleTrainer.cs (4)
24using TDistPredictor = IDistPredictorProducing<Single, Single>; 25using TScalarPredictor = IPredictorProducing<Single>; 31internal sealed class EnsembleTrainer : EnsembleTrainerBase<Single,
Trainer\EnsembleDistributionModelParameters.cs (38)
21using TDistPredictor = IDistPredictorProducing<Single, Single>; 23internal sealed class EnsembleDistributionModelParameters : EnsembleModelParametersBase<Single>, 43private readonly Single[] _averagedWeights; 64FeatureSubsetModel<float>[] models, IOutputCombiner<Single> combiner, Single[] weights = null) 142Host.Check(typeof(TIn) == typeof(VBuffer<Single>)); 143Host.Check(typeof(TOut) == typeof(Single)); 147var predictions = new Single[_mappers.Length]; 148var probabilities = new Single[_mappers.Length]; 149var vBuffers = new VBuffer<Single>[_mappers.Length]; 150ValueMapper<VBuffer<Single>, Single> del = 151(in VBuffer<Single> src, ref Single dst) => 178Host.Check(typeof(TIn) == typeof(VBuffer<Single>)); 179Host.Check(typeof(TOut) == typeof(Single)); 180Host.Check(typeof(TDist) == typeof(Single)); 185var predictions = new Single[_mappers.Length]; 186var probabilities = new Single[_mappers.Length]; 187var vBuffers = new VBuffer<Single>[_mappers.Length]; 188ValueMapper<VBuffer<Single>, Single, Single> del = 189(in VBuffer<Single> src, ref Single score, ref Single prob) => 214private ValueMapper<VBuffer<Single>, Single, Single>[] GetMaps() 218var maps = new ValueMapper<VBuffer<Single>, Single, Single>[_mappers.Length]; 220maps[i] = _mappers[i].GetMapper<VBuffer<Single>, Single, Single>(); 224private void ComputeAveragedWeights(out Single[] averagedWeights) 241averagedWeights = Models.SelectMany(model => model.Metrics).Where(m => m.Key == metric.Key).Select(m => (Single)m.Value).ToArray();
Trainer\EnsembleModelParameters.cs (15)
23internal sealed class EnsembleModelParameters : EnsembleModelParametersBase<Single>, IValueMapper 58FeatureSubsetModel<float>[] models, IOutputCombiner<Single> combiner, Single[] weights = null) 132Host.Check(typeof(TIn) == typeof(VBuffer<Single>)); 133Host.Check(typeof(TOut) == typeof(Single)); 136var predictions = new Single[_mappers.Length]; 137var buffers = new VBuffer<Single>[_mappers.Length]; 138var maps = new ValueMapper<VBuffer<Single>, Single>[_mappers.Length]; 140maps[i] = _mappers[i].GetMapper<VBuffer<Single>, Single>(); 142ValueMapper<VBuffer<Single>, Single> del = 143(in VBuffer<Single> src, ref Single dst) =>
Trainer\EnsembleModelParametersBase.cs (3)
23private protected readonly Single[] Weights; 28IOutputCombiner<TOutput> combiner, Single[] weights) 120ctx.Writer.Write((Single)metric.Value);
Trainer\EnsembleTrainerBase.cs (1)
132var validationDataSetProportion = SubModelSelector.ValidationDatasetProportion;
Trainer\Multiclass\EnsembleMulticlassModelParameters.cs (14)
17internal sealed class EnsembleMulticlassModelParameters : EnsembleModelParametersBase<VBuffer<Single>>, IValueMapper 51IMulticlassOutputCombiner combiner, Single[] weights = null) 112Host.Check(typeof(TIn) == typeof(VBuffer<Single>)); 113Host.Check(typeof(TOut) == typeof(VBuffer<Single>)); 116var features = new VBuffer<Single>[_mappers.Length]; 117var predictions = new VBuffer<Single>[_mappers.Length]; 118var maps = new ValueMapper<VBuffer<Single>, VBuffer<Single>>[_mappers.Length]; 124maps[i] = _mappers[i].GetMapper<VBuffer<Single>, VBuffer<Single>>(); 127ValueMapper<VBuffer<Single>, VBuffer<Single>> del = 128(in VBuffer<Single> src, ref VBuffer<Single> dst) =>
Trainer\Multiclass\MulticlassDataPartitionEnsembleTrainer.cs (2)
26using TVectorPredictor = IPredictorProducing<VBuffer<Single>>; 33EnsembleTrainerBase<VBuffer<Single>,
Trainer\Regression\RegressionEnsembleTrainer.cs (2)
25using TScalarPredictor = IPredictorProducing<Single>; 28internal sealed class RegressionEnsembleTrainer : EnsembleTrainerBase<Single,
Microsoft.ML.Fairlearn (10)
Reductions\GridSearchTrialRunner.cs (1)
64var value = lambdas[x].AsType<float>();
Reductions\UtilityParity.cs (9)
33public UtilityParity(float differenceBound = Single.NaN, float ratioBond = Single.NaN, float ratioBoundSlack = 0.0f) 35if (Single.NaN.Equals(differenceBound) && Single.NaN.Equals(ratioBond)) 40else if (!Single.NaN.Equals(differenceBound) && Single.NaN.Equals(ratioBond)) 45else if (Single.NaN.Equals(differenceBound) && !Single.NaN.Equals(ratioBond)) 143var lambdaEvent = (float)(gPos["value"] - _ratio * gNeg["value"]).Sum() / ProbEvent;
Microsoft.ML.FastTree (35)
FastTree.cs (1)
1594var label = tempValues[i];
GamModelParameters.cs (1)
424foreach (var featureValue in features.DenseValues())
RandomForestRegression.cs (2)
118var h = (_weights == null) ? (weightedLength + oneThird) * p + oneThird : weightedLength * p; 553var lab = _labels[i];
TreeEnsemble\InternalRegressionTree.cs (5)
228foreach (var val in DefaultValueForMissing) 319foreach (var val in DefaultValueForMissing) 1572var diff = (float)(trueOutput - ghostOutput); 1588var diff = (float)(trueOutput - ghostOutput); 1601var val = src.GetItemOrDefault(ifeat);
TreeEnsembleFeaturizationEstimator.cs (3)
30/// The column type must be a vector of <see cref="System.Single"/>. The column called <see cref="InputColumnName"/> would be mapped 38/// The name of the column that stores the prediction values of all trees. Its type is a vector of <see cref="System.Single"/> 45/// The 0-1 encoding of all leaf nodes' IDs. Its type is a vector of <see cref="System.Single"/>. If the given feature
TreeEnsembleFeaturizationTransformer.cs (1)
140/// The three columns are all <see cref="System.Single"/> vectors. The fist column stores the prediction values of all trees and
TreeEnsembleFeaturizer.cs (9)
83/// The name of the column that stores the prediction values of all trees. Its type is a vector of <see cref="System.Single"/> 90/// The 0-1 encoding of all leaf nodes' IDs. Its type is a vector of <see cref="System.Single"/>. If the given feature 749ValueMapper<TInput, Single> mapper; 753(in TInput src, ref Single dst) => 761dst = Single.NaN; 765dst = (Single)temp - 1; 773(in TInput src, ref Single dst) => 781dst = Single.NaN; 785dst = (Single)permutation[(int)(temp - 1)];
TreeTrainersCatalog.cs (13)
22/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param> 23/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 77/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 130/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/> or <see cref="KeyDataViewType"/>.</param> 131/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 187/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 236/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param> 237/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 286/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param> 287/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 340/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/></param> 341/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/></param> 393/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
Microsoft.ML.GenAI.LLaMA (6)
LlamaCausalLMAgent.cs (2)
49var temperature = options?.Temperature ?? 0.7f; 76var temperature = options?.Temperature ?? 0.7f;
LlamaTextCompletionService.cs (4)
44var temperature = executionSettings?.ExtensionData?["temperature"] as float? ?? 0.7f; 47var topP = executionSettings?.ExtensionData?["top_p"] as float? ?? 0.9f; 63var temperature = executionSettings?.ExtensionData?["temperature"] as float? ?? 0.7f; 66var topP = executionSettings?.ExtensionData?["top_p"] as float? ?? 0.9f;
Microsoft.ML.GenAI.Mistral (2)
MistralCausalLMAgent.cs (2)
53var temperature = options?.Temperature ?? 0.7f; 86var temperature = options?.Temperature ?? 0.7f;
Microsoft.ML.GenAI.Phi (6)
Phi3\Phi3CausalLMAgent.cs (2)
48var temperature = options?.Temperature ?? 0.7f; 76var temperature = options?.Temperature ?? 0.7f;
Phi3\Phi3CausalLMTextGenerationService.cs (4)
33var temperature = executionSettings?.ExtensionData?["temperature"] as float? ?? 0.7f; 36var topP = executionSettings?.ExtensionData?["top_p"] as float? ?? 0.9f; 58var temperature = executionSettings?.ExtensionData?["temperature"] as float? ?? 0.7f; 61var topP = executionSettings?.ExtensionData?["top_p"] as float? ?? 0.9f;
Microsoft.ML.GenAI.Samples (1)
Mistral\Mistral_7B_Instruct.cs (1)
103var score = 0f;
Microsoft.ML.ImageAnalytics (11)
ExtensionsCatalog.cs (2)
99/// This column's data type will be a known-sized vector of <see cref="System.Single"/> or <see cref="System.Byte"/> depending on <paramref name="outputAsFloatArray"/>.</param> 207/// This estimator operates over known-sized vector of <see cref="System.Single"/>, <see cref="System.Double"/> and <see cref="System.Byte"/>.</param>
ImagePixelExtractor.cs (5)
62public Single? Offset; 65public Single? Scale; 117public Single? Offset; 120public Single? Scale; 300return GetGetterCore<Single>(input, iinfo, out disposer);
VectorToImageTransform.cs (4)
64public Single? Offset; 67public Single? Scale; 134public Single Offset = VectorToImageConvertingEstimator.Defaults.Offset; 137public Single Scale = VectorToImageConvertingEstimator.Defaults.Scale;
Microsoft.ML.IntegrationTests (5)
DataTransformation.cs (3)
70var cosineDistance = angiospermCosine(row.PetalLength, row.PetalWidth, row.SepalLength, row.SepalWidth); 116var randomNumber1 = GetRandomNumber(1 + row.Label + row.PetalLength + row.PetalWidth + row.SepalLength + row.SepalWidth); 117var randomNumber2 = GetRandomNumber(2 + row.Label + row.PetalLength + row.PetalWidth + row.SepalLength + row.SepalWidth);
Debugging.cs (1)
150var rowSum = row.MedianHomeValue;
IntrospectiveTraining.cs (1)
240var bias = linearModel.Bias;
Microsoft.ML.LightGbm (11)
LightGbmCatalog.cs (10)
23/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param> 24/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 76/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 92/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 144/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 159/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/> or <see cref="KeyDataViewType"/>.</param> 160/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 215/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 231/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 283/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
LightGbmMulticlassTrainer.cs (1)
279foreach (var labelColumn in labels)
Microsoft.ML.Mkl.Components (15)
ComputeLRTrainingStdThroughHal.cs (2)
76var entry = (float)invHessian[ioffset++]; 77var adjustment = l2Weight * entry * entry;
MklComponentsCatalog.cs (3)
23/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param> 24/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 80/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
OlsLinearRegression.cs (6)
312var yi = cursor.Label; 447var bias = (float)beta[0]; 499standardErrors[i] = (Single)xtx[i * (i + 1) / 2 + i]; 511var entry = (Single)xtx[ioffset]; 512var adjustment = -reg * entry * entry;
SymSgdClassificationTrainer.cs (4)
710var positiveInstanceWeight = _options.PositiveInstanceWeight; 726var lr = _options.LearningRate ?? 1.0f; 731var l2Const = _options.L2Regularization; 732var piw = _options.PositiveInstanceWeight;
Microsoft.ML.OnnxTransformer (5)
DnnImageFeaturizerTransform.cs (2)
96/// <param name="outputColumnName">Name of the column resulting from the transformation of <paramref name="inputColumnName"/>. The column data is a known-sized vector of <see cref="System.Single"/>.</param> 97/// <param name="inputColumnName">Name of column to transform. If set to <see langword="null"/>, the value of the <paramref name="outputColumnName"/> will be used as source. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
OnnxTypeParser.cs (1)
63scalarType = typeof(System.Single);
OnnxUtils.cs (2)
498typeof(Single), 513{ typeof(Single) , InternalDataKind.R4},
Microsoft.ML.OnnxTransformerTest (3)
DnnImageFeaturizerTest.cs (1)
173foreach (var val in values)
OnnxTransformTests.cs (2)
218foreach (var val in values) 655foreach (var score in dataPoint.Scores)
Microsoft.ML.Parquet (3)
ParquetLoader.cs (3)
523return CreateGetterDelegateCore<float?, Single>(col, _parquetConversions.Conv); 705public void Conv(in float? src, ref Single dst) => dst = src ?? Single.NaN;
Microsoft.ML.PCA (4)
PCACatalog.cs (2)
50/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 52/// must be of type <see cref="System.Single"/>.</param>
PcaTrainer.cs (1)
573foreach (var value in _meanProjected)
PcaTransformer.cs (1)
460var invn = (float)(1 / totalColWeight[iinfo]);
Microsoft.ML.Recommender (2)
MatrixFactorizationTrainer.cs (1)
145/// The column data must be <see cref="System.Single"/>.
RecommenderCatalog.cs (1)
54/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param>
Microsoft.ML.Samples (28)
Dynamic\TensorFlow\ImageClassification.cs (1)
60foreach (var classScore in prediction.output.Take(3))
Dynamic\TextTransform.cs (1)
85foreach (var value in featureRow.GetValues())
Dynamic\Trainers\BinaryClassification\FieldAwareFactorizationMachine.cs (3)
166var value0 = (float)rnd.NextDouble(); 172var value1 = (float)rnd.NextDouble(); 178var value2 = (float)rnd.NextDouble();
Dynamic\Trainers\BinaryClassification\FieldAwareFactorizationMachineWithOptions.cs (3)
177var value0 = (float)rnd.NextDouble(); 183var value1 = (float)rnd.NextDouble(); 189var value2 = (float)rnd.NextDouble();
Dynamic\Trainers\BinaryClassification\PermutationFeatureImportance.cs (1)
110var value = (float)(bias + weight1 * data.Feature1 + weight2 *
Dynamic\Trainers\BinaryClassification\PermutationFeatureImportanceLoadFromDisk.cs (1)
96var value = (float)(bias + weight1 * data.Feature1 + weight2 *
Dynamic\Trainers\MulticlassClassification\PermutationFeatureImportance.cs (1)
115var value = (float)
Dynamic\Trainers\MulticlassClassification\PermutationFeatureImportanceLoadFromDisk.cs (1)
124var value = (float)
Dynamic\Trainers\Ranking\PermutationFeatureImportance.cs (1)
126var value = (float)(bias + weight1 * data.Feature1 + weight2 *
Dynamic\Trainers\Ranking\PermutationFeatureImportanceLoadFromDisk.cs (1)
133var value = (float)(bias + weight1 * data.Feature1 + weight2 *
Dynamic\Transforms\ApplyOnnxModel.cs (1)
39foreach (var classScore in prediction.softmaxout_1.Take(3))
Dynamic\Transforms\ApplyONNXModelWithInMemoryImages.cs (2)
65var firstClassProb = dataPoint.Scores.First(); 66var lastClassProb = dataPoint.Scores.Last();
Dynamic\Transforms\Conversion\MapKeyToValueMultiColumn.cs (1)
100var value = (float)rnd.NextDouble() + res * 0.2f;
Dynamic\Transforms\NormalizeBinning.cs (2)
78var density = transformParams.Density[0]; 79var offset = (transformParams.Offset.Length == 0 ? 0 : transformParams
Dynamic\Transforms\NormalizeLogMeanVariance.cs (2)
87var offset = noCdfParams.Offset.Length == 0 ? 0 : noCdfParams.Offset[1]; 88var scale = noCdfParams.Scale[1];
Dynamic\Transforms\NormalizeLogMeanVarianceFixZero.cs (2)
69var offset = noCdfParams.Offset.Length == 0 ? 0 : noCdfParams.Offset[1]; 70var scale = noCdfParams.Scale[1];
Dynamic\Transforms\NormalizeMeanVariance.cs (2)
89var offset = noCdfParams.Offset.Length == 0 ? 0 : noCdfParams.Offset[1]; 90var scale = noCdfParams.Scale[1];
Dynamic\Transforms\Text\ApplyCustomWordEmbedding.cs (1)
74foreach (var f in prediction.Features)
Dynamic\Transforms\Text\ApplyWordEmbedding.cs (1)
64foreach (var f in prediction.Features)
Microsoft.ML.Samples.GPU (1)
docs\samples\Microsoft.ML.Samples\Dynamic\TensorFlow\ImageClassification.cs (1)
60foreach (var classScore in prediction.output.Take(3))
Microsoft.ML.SamplesUtils (2)
SamplesDatasetUtils.cs (2)
261var value = (float)rnd.NextDouble(); 373var value = (float)rnd.NextDouble() + res * 0.2f;
Microsoft.ML.SearchSpace (4)
Converter\NumericOptionConverter.cs (1)
73Default = singleOption.SampleFromFeatureSpace(singleOption.Default).AsType<Single>(),
Option\ChoiceOption.cs (1)
84var value = param.AsType<float>();
Option\UniformNumericOption.cs (2)
141var singleValue = param.AsType<float>(); 150var singleValue = Convert.ToSingle(doubleValue);
Microsoft.ML.StandardTrainers (79)
FactorizationMachine\FactorizationMachineCatalog.cs (2)
25/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 48/// <param name="featureColumnNames">The names of the feature columns. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
FactorizationMachine\FactorizationMachineTrainer.cs (1)
522var slope = CalculateLossSlope(label, modelResponse);
LdSvm\LdSvmTrainer.cs (3)
274var gamma = 0.01f; 324var tanhDist = (float)Math.Tanh(gamma * (VectorUtils.DotProduct(in features, in theta[i]) + biasTheta[i])); 642var label = default(float);
Optimizer\Optimizer.cs (1)
367var temp = LastValue;
Standard\LinearPredictorUtils.cs (6)
207public static IEnumerable<KeyValuePair<string, Single>> GetSortedLinearModelFeatureNamesAndWeights(Single bias, 208in VBuffer<Single> weights, in VBuffer<ReadOnlyMemory<char>> names) 214var list = new List<KeyValuePair<string, Single>>() { new KeyValuePair<string, Single>("(Bias)", bias) }; 219list.Add(new KeyValuePair<string, Single>(name.IsEmpty ? $"f{index}" : name.ToString(), weight.Value));
Standard\LogisticRegression\LbfgsPredictorBase.cs (3)
779var xx = values[i]; 898foreach (var bias in biases) 906foreach (var weight in weights)
Standard\LogisticRegression\LogisticRegression.cs (3)
342var bias = currentWeightsValues[0]; 347var label = cursor.Label; 348var weight = cursor.Weight;
Standard\LogisticRegression\MulticlassLogisticRegression.cs (1)
853var value = weight.Value;
Standard\ModelStatistics.cs (7)
343var stdError = _coeffStdError.GetValues()[0]; 345var zScore = bias / stdError; 378var weight = estimateEditor.Values[i - 1] = _weights.GetItemOrDefault(wi); 379var stdError = stdErrorEditor.Values[wi] = coeffStdErrorValues[i]; 421var weight = _weights.GetItemOrDefault(wi); 422var stdError = stdErrorValues[i]; 423var zScore = zScores[i - 1] = weight / stdError;
Standard\MulticlassClassification\OneVersusAllTrainer.cs (1)
754var value = output[i];
Standard\SdcaBinary.cs (20)
465var l1Threshold = SdcaTrainerOptions.L1Regularization.Value; 495var l2Const = SdcaTrainerOptions.L2Regularization.Value; 583var normSquared = VectorUtils.NormSquared(features); 800var l1Threshold = SdcaTrainerOptions.L1Regularization.Value; 802var lr = SdcaTrainerOptions.BiasLearningRate * SdcaTrainerOptions.L2Regularization.Value; 824var featuresNormSquared = VectorUtils.NormSquared(features); 838var dual = duals[idx]; 839var output = WDot(in features, in weights[0], biasReg[0] + biasUnreg[0]); 840var dualUpdate = Loss.DualUpdate(output, label, dual, invariant, numThreads); 844var adjustment = l1ThresholdZero ? lr * biasReg[0] : lr * l1IntermediateBias[0]; 855var instanceWeight = GetInstanceWeight(cursor); 856var primalUpdate = dualUpdate * lambdaNInv * instanceWeight; 968var biasTotal = biasReg[0] + biasUnreg[0]; 979var instanceWeight = GetInstanceWeight(cursor); 981var output = WDot(in features, in weights[0], biasTotal); 1674/// <seealso cref="Microsoft.ML.StandardTrainersCatalog.SdcaNonCalibrated(Microsoft.ML.BinaryClassificationCatalog.BinaryClassificationTrainers,System.String,System.String,System.String,Microsoft.ML.Trainers.ISupportSdcaClassificationLoss,System.Nullable{System.Single},System.Nullable{System.Single},System.Nullable{System.Int32})"/> 2047var l2Weight = _options.L2Regularization; 2050var positiveInstanceWeight = _options.PositiveInstanceWeight; 2083var instanceWeight = cursor.Weight;
Standard\SdcaMulticlass.cs (13)
188var l1Threshold = SdcaTrainerOptions.L1Regularization.Value; 190var lr = SdcaTrainerOptions.BiasLearningRate * SdcaTrainerOptions.L2Regularization.Value; 226var labelOutput = WDot(in features, in weights[label], biasReg[label] + biasUnreg[label]); 227var instanceWeight = GetInstanceWeight(cursor); 256var dual = duals[dualIndex]; 258var dualUpdate = _loss.DualUpdate(output, 1, dual, invariant, numThreads); 262var adjustment = l1ThresholdZero ? lr * biasReg[iClass] : lr * l1IntermediateBias[iClass]; 271var primalUpdate = dualUpdate * lambdaNInv * instanceWeight; 320var intermediateBias = l1IntermediateBias[label]; 380var instanceWeight = GetInstanceWeight(cursor); 383var labelOutput = WDot(in features, in weights[label], biasReg[label] + biasUnreg[label]); 396var currentClassOutput = WDot(in features, in weights[iClass], biasReg[iClass] + biasUnreg[iClass]); 399var dual = duals[dualIndex++];
StandardTrainersCatalog.cs (18)
29/// <param name="featureColumnName">The features, or independent variables. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 84/// <param name="featureColumnName">The features, or independent variables. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 139/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/></param> 140/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/></param> 191/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param> 192/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 244/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 298/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 348/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 400/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 473/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param> 474/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 529/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 583/// <param name="labelColumnName">The name of the label column. The column data must be <see cref="System.Single"/>.</param> 584/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 637/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 814/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param> 897/// <param name="featureColumnName">The name of the feature column. The column data must be a known-sized vector of <see cref="System.Single"/>.</param>
Microsoft.ML.Sweeper (7)
Algorithms\NelderMead.cs (1)
328var dist = VectorUtils.Distance(x, y);
Algorithms\SmacSweeper.cs (4)
114Single[] targets = new Single[previousRuns.Count()]; 115Single[][] features = new Single[previousRuns.Count()][];
Parameters.cs (2)
396var floatValue = (float)value; 409var floatValue = (float)value;
Microsoft.ML.Sweeper.Tests (6)
TestSweeper.cs (6)
70var normalizedValue = (float)random.NextDouble(); 72var originalNormalizedValue = paramSweep.NormalizeValue(value); 412var val = float.Parse(parameterValue.ValueText, CultureInfo.InvariantCulture); 572var val = float.Parse(parameterValue.ValueText, CultureInfo.InvariantCulture); 620var val = float.Parse(parameterValue.ValueText, CultureInfo.InvariantCulture); 671var val = float.Parse(parameterValue.ValueText, CultureInfo.InvariantCulture);
Microsoft.ML.TensorFlow (2)
TensorFlowModel.cs (2)
61/// <param name="inputColumnName"> The name of the model input. The data type is a vector of <see cref="System.Single"/>.</param> 62/// <param name="outputColumnName">The name of the requested model output. The data type is a vector of <see cref="System.Single"/></param>
Microsoft.ML.TestFramework (8)
DataPipe\TestDataPipe.cs (8)
23private static float[] _dataFloat = new float[] { -0.0f, 0, 1, -1, 2, -2, Single.NaN, Single.MinValue, 24Single.MaxValue, Single.Epsilon, Single.NegativeInfinity, Single.PositiveInfinity }; 27private static VBuffer<Single> _dataFloatSparse = new VBuffer<Single>(5, 3, new float[] { -0.0f, 0, 1 }, new[] { 0, 3, 4 });
Microsoft.ML.Tests (76)
ExpressionLanguageTests\ExpressionLanguageTests.cs (25)
38using R4 = Single; 376var v = (Single)src; 453FunctionProviderUtils.Fn<R4, R4>(A)); 466FunctionProviderUtils.Fn<I4, BL, R4[], R4>(Var)); 480FunctionProviderUtils.Fn<R4, R4>(X)); 490FunctionProviderUtils.Fn<R4, R4>(Dump), 496FunctionProviderUtils.Fn<TX, R4, R4>(Dump), 526public static R4 A(R4 a) 535public static R4 Var(I4 a, BL b, R4[] c) 538return R4.NaN; 539R4 res = c[a]; 580internal static R4 X(R4 a) 651FunctionProviderUtils.Fn<R4, R4>(A)); 678public static R4 A(R4 a)
FeatureContributionTests.cs (3)
288foreach (var vbValue in vb.DenseValues()) 341var min = MathUtils.Min(rawScores); 342var max = MathUtils.Max(rawScores);
OnnxConversionTest.cs (1)
1748Assert.Equal((Single)140.66, loadedData.ColumnView[1].Values[0]);
PermutationFeatureImportanceTests.cs (3)
912foreach (var vbValue in vb.DenseValues()) 984var min = MathUtils.Min(rawScores); 985var max = MathUtils.Max(rawScores);
TextLoaderTests.cs (35)
780foreach (var val in featureValue.GetValues()) 1013VBuffer<Single> featuresPeriod = default; 1014ValueGetter<VBuffer<Single>> featuresDelegatePeriod = cursor.GetGetter<VBuffer<Single>>(columns[1]); 1021Assert.Equal(Single.NaN, feature); 1075VBuffer<Single> featuresPeriod = default; 1076VBuffer<Single> featuresComma = default; 1082var delegatePeriod = cursorPeriod.GetGetter<VBuffer<Single>>(dataViewPeriod.Schema["Features"]); 1083var delegateComma = cursorComma.GetGetter<VBuffer<Single>>(dataViewPeriod.Schema["Features"]); 1100Assert.NotEqual(Single.NaN, featuresPeriodArray[i]); 1107Assert.Equal(Single.NaN, featuresPeriodArray[i]); 1112Assert.Equal(Single.NaN, featuresPeriodArray[i]); 1113Assert.NotEqual(Single.NaN, featuresCommaArray[i]); 1118Assert.NotEqual(Single.NaN, featuresPeriodArray[i]); 1119Assert.Equal(Single.NaN, featuresCommaArray[i]); 1471Single baselineSing1 = default; 1472Single baselineSing2 = default; 1473Single baselineSing3 = default; 1474Single baselineSing4 = default; 1483Single testSing1 = default; 1484Single testSing2 = default; 1485Single testSing3 = default; 1486Single testSing4 = default; 1487VBuffer<Single> testSingFt1 = default; 1488VBuffer<Single> testSingFt2 = default; 1502var delegateBaselineSing1 = cursorBaseline.GetGetter<Single>(baselineDV.Schema["sing1"]); 1503var delegateBaselineSing2 = cursorBaseline.GetGetter<Single>(baselineDV.Schema["sing2"]); 1504var delegateBaselineSing3 = cursorBaseline.GetGetter<Single>(baselineDV.Schema["sing3"]); 1505var delegateBaselineSing4 = cursorBaseline.GetGetter<Single>(baselineDV.Schema["sing4"]); 1514var delegateTestSing1 = cursorTest.GetGetter<Single>(testDV.Schema["sing1"]); 1515var delegateTestSing2 = cursorTest.GetGetter<Single>(testDV.Schema["sing2"]); 1516var delegateTestSing3 = cursorTest.GetGetter<Single>(testDV.Schema["sing3"]); 1517var delegateTestSing4 = cursorTest.GetGetter<Single>(testDV.Schema["sing4"]); 1518var delegateTestSingFt1 = cursorTest.GetGetter<VBuffer<Single>>(testDV.Schema["singFt1"]); 1519var delegateTestSingFt2 = cursorTest.GetGetter<VBuffer<Single>>(testDV.Schema["singFt2"]);
TrainerEstimators\FAFMEstimator.cs (3)
139var value0 = (float)rnd.NextDouble(); 145var value1 = (float)rnd.NextDouble(); 151var value2 = (float)rnd.NextDouble();
TrainerEstimators\TreeEnsembleFeaturizerTest.cs (3)
167var leafValue = model.Model.SubModel.GetLeafValue(0, leafId); 218var leafValue = model.Model.GetLeafValue(0, leafId); 282var leafValue = model.Model.SubModel.GetLeafValue(0, leafId);
Transformers\NormalizerTests.cs (1)
1100foreach (var num in numbers)
Transformers\TextFeaturizerTests.cs (2)
223var exp1 = 0.333333343f; 224var exp2 = 0.577350259f;
Microsoft.ML.TimeSeries (315)
AdaptiveSingularSpectrumSequenceModeler.cs (110)
51internal sealed class AdaptiveSingularSpectrumSequenceModelerInternal : SequenceModelerBase<Single, Single> 55internal sealed class SsaForecastResult : ForecastResultBase<Single> 57public VBuffer<Single> ForecastStandardDeviation; 58public VBuffer<Single> UpperBound; 59public VBuffer<Single> LowerBound; 60public Single ConfidenceLevel; 63internal Single BoundOffset; 73public Single[] Spectrum; 98public Single[] AutoRegressiveCoefficients; 147private Single[] _alpha; 148private Single[] _state; 149private readonly FixedSizeQueue<Single> _buffer; 155private readonly Single _discountFactor; 165private Single _observationNoiseVariance; 166private Single _observationNoiseMean; 167private Single _autoregressionNoiseVariance; 168private Single _autoregressionNoiseMean; 172private Single _nextPrediction; 187public Single LastSmoothedValue { get { return _state[_windowSize - 2]; } } 192public Single LastValue { get { return _buffer.Count > 0 ? _buffer[_buffer.Count - 1] : Single.NaN; } } 228public AdaptiveSingularSpectrumSequenceModelerInternal(IHostEnvironment env, int trainSize, int seriesLength, int windowSize, Single discountFactor = 1, 268_buffer = new FixedSizeQueue<Single>(seriesLength); 270_alpha = new Single[windowSize - 1]; 271_state = new Single[windowSize - 1]; 322_alpha = new Single[_windowSize - 1]; 324_state = new Single[_windowSize - 1]; 396_state = new Single[_windowSize - 1]; 419_info.AutoRegressiveCoefficients = new Single[_windowSize - 1]; 510var tempArray = new Single[_rank * _windowSize]; 523private static void ReconstructSignal(TrajectoryMatrix tMat, Single[] singularVectors, int rank, Single[] output) 533var v = new Single[k]; 547private static void ReconstructSignalTailFast(Single[] series, TrajectoryMatrix tMat, Single[] singularVectors, int rank, Single[] output) 556Single v; 561Single temp; 594private static void ComputeNoiseMoments(Single[] series, Single[] signal, Single[] alpha, out Single observationNoiseVariance, out Single autoregressionNoiseVariance, 595out Single observationNoiseMean, out Single autoregressionNoiseMean, int startIndex = 0) 606var y = new Single[k]; 642private static int DetermineSignalRank(Single[] series, TrajectoryMatrix tMat, Single[] singularVectors, Single[] singularValues, 643Single[] outputSignal, int maxRank) 656var x = new Single[inputSeriesLength]; 657var y = new Single[k]; 658var alpha = new Single[tMat.WindowSize - 1]; 659var v = new Single[k]; 661Single nu = 0; 671Single temp; 674Single lambda; 675Single observationNoiseMean; 677FixedSizeQueue<Single> window = new FixedSizeQueue<float>(tMat.WindowSize - 1); 738private static int DetermineSignalRankFast(Single[] series, TrajectoryMatrix tMat, Single[] singularVectors, Single[] singularValues, int maxRank) 750var x = new Single[tMat.WindowSize - 1]; 751var alpha = new Single[tMat.WindowSize - 1]; 752Single v; 754Single nu = 0; 763Single temp; 765Single lambda; 766Single observationNoiseMean; 768FixedSizeQueue<Single> window = new FixedSizeQueue<float>(tMat.WindowSize - 1); 1084_alpha[i] = (Single)(-coeff[i]); 1103internal override void Consume(ref Single input, bool updateModel = false) 1105if (Single.IsNaN(input)) 1114Single[] vecs = new Single[_rank * _windowSize]; 1166internal override void Train(FixedSizeQueue<Single> data) 1171Single[] dataArray = new Single[_trainSize]; 1176if (!Single.IsNaN(data[i])) 1215Single[] dataArray = new Single[_trainSize]; 1220var getVal = cursor.GetGetter<Single>(featureCol); 1221Single val = default; 1225if (!Single.IsNaN(val)) 1251private void TrainCore(Single[] dataArray, int originalSeriesLength) 1254Single[] singularVals; 1255Single[] leftSingularVecs; 1259var signal = new Single[signalLength]; 1272if (Single.IsNaN(leftSingularVecs[i])) 1285var v = leftSingularVecs[(i + 1) * _windowSize - 1]; 1292_alpha = new Single[_windowSize - 1]; 1293_state = new Single[_windowSize - 1]; 1318var temp = (Single)(1f / Math.Sqrt(_windowSize)); 1340Single nu = 0; 1405_info.AutoRegressiveCoefficients = new Single[_windowSize - 1]; 1418internal override void Forecast(ref ForecastResultBase<Single> result, int horizon = 1) 1452var lastCol = new FixedSizeQueue<Single>(_windowSize - 1); 1462Single temp = 0; 1485internal override void PredictNext(ref Single output) 1490internal override SequenceModelerBase<Single, Single> Clone() 1500internal static void ComputeForecastIntervals(ref SsaForecastResult forecast, Single confidenceLevel = 0.95f) 1524upper.Values[i] = (Single)(meanForecast[i] + forecast.BoundOffset + temp); 1525lower.Values[i] = (Single)(meanForecast[i] + forecast.BoundOffset - temp); 1564var getVal = cursor.GetGetter<Single>(col); 1565Single val = default(Single); 1569if (!Single.IsNaN(val))
EigenUtils.cs (7)
511public static bool MklSymmetricEigenDecomposition(Single[] input, int size, out Single[] eigenValues, out Single[] eigenVectors) 545eigenValues = new Single[size]; 547eigenValues[i] = (Single)d[i]; 549eigenVectors = new Single[n2]; 551eigenVectors[i] = (Single)a[i];
ExponentialAverageTransform.cs (16)
23internal sealed class ExponentialAverageTransform : SequentialTransformBase<Single, Single, ExponentialAverageTransform.State> 43public Single Decay = 0.9f; 58private readonly Single _decay; 96public static Single ComputeExponentialAverage(Single input, Single decay, Single previousAverage) 103private Single _previousAverage; 105private Single _decay; 112private protected override void SetNaOutput(ref Single output) 114output = Single.NaN; 117private protected override void TransformCore(ref Single input, FixedSizeQueue<Single> windowedBuffer, long iteration, ref Single output) 136private protected override void LearnStateFromDataCore(FixedSizeQueue<Single> data)
ExtensionsCatalog.cs (9)
24/// <param name="inputColumnName">Name of column to transform. The column data must be <see cref="System.Single"/>. If set to <see langword="null"/>, the value of the <paramref name="outputColumnName"/> will be used as source.</param> 49/// <param name="inputColumnName">Name of column to transform. The column data must be <see cref="System.Single"/>. If set to <see langword="null"/>, the value of the <paramref name="outputColumnName"/> will be used as source.</param> 73/// <param name="inputColumnName">Name of column to transform. The column data must be <see cref="System.Single"/>. 98/// <param name="inputColumnName">Name of column to transform. The column data must be <see cref="System.Single"/>. 121/// <param name="inputColumnName">Name of column to transform. The column data must be <see cref="System.Single"/>. 150/// <param name="inputColumnName">Name of column to transform. The column data must be <see cref="System.Single"/>. 189/// <param name="inputColumnName">Name of column to transform. The column data must be <see cref="System.Single"/>. 216/// <param name="inputColumnName">Name of column to transform. The column data must be <see cref="System.Single"/>. 241/// <param name="inputColumnName">Name of column to transform. The column data must be <see cref="System.Single"/>.</param>
IidAnomalyDetectionBase.cs (4)
97internal class IidAnomalyDetectionBase : SequentialAnomalyDetectionTransformBase<Single, IidAnomalyDetectionBase.State> 178private protected override void LearnStateFromDataCore(FixedSizeQueue<Single> data) 188private protected override double ComputeRawAnomalyScore(ref Single input, FixedSizeQueue<Single> windowedBuffer, long iteration)
MovingAverageTransform.cs (45)
25internal sealed class MovingAverageTransform : SequentialTransformBase<Single, Single, MovingAverageTransform.State> 66private readonly Single[] _weights; 115private static Single ComputeMovingAverageUniformInitialisation(FixedSizeQueue<Single> others, Single input, int lag, 116Single lastDropped, ref Single currentSum, 119Single sumValues = 0; 124if (Single.IsNaN(input)) 135if (Single.IsNaN(others[i])) 142return nb == 0 ? Single.NaN : sumValues / nb; 145internal static Single ComputeMovingAverageNonUniform(FixedSizeQueue<Single> others, Single input, Single[] weights, int lag) 147Single sumWeights = 0; 148Single sumValues = 0; 152if (!Single.IsNaN(input)) 164if (!Single.IsNaN(others[i])) 170return sumWeights != 0 ? sumValues / sumWeights : Single.NaN; 180internal static Single ComputeMovingAverageUniform(FixedSizeQueue<Single> others, Single input, int lag, 181Single lastDropped, ref Single currentSum, 193if (Single.IsNaN(lastDropped)) 204Contracts.Assert(FloatUtils.IsFinite(lastDropped) || Single.IsNaN(lastDropped)); 207if (!Single.IsNaN(newValue) && !FloatUtils.IsFinite(newValue)) 214Contracts.Assert(FloatUtils.IsFinite(newValue) || Single.IsNaN(newValue)); 216if (!Single.IsNaN(currentSum) && !FloatUtils.IsFinite(currentSum)) 218if (Single.IsNaN(newValue)) 228Contracts.Assert(FloatUtils.IsFinite(currentSum) || Single.IsNaN(currentSum)); 230if (Single.IsNaN(newValue)) 234return nb == 0 ? Single.NaN : currentSum / nb; 240return nb == 0 ? Single.NaN : currentSum / nb; 247private Single[] _weights; 253private Single _lastDroppedValue; 254private Single _currentSum; 264private protected override void SetNaOutput(ref Single output) 266output = Single.NaN; 276private protected override void TransformCore(ref Single input, FixedSizeQueue<Single> windowedBuffer, long iteration, ref Single output) 292private protected override void LearnStateFromDataCore(FixedSizeQueue<Single> data)
PercentileThresholdTransform.cs (7)
24internal sealed class PercentileThresholdTransform : SequentialTransformBase<Single, bool, PercentileThresholdTransform.State> 103internal static void CountGreaterOrEqualValues(FixedSizeQueue<Single> others, Single theValue, out int greaterVals, out int equalVals, out int totalVals) 116if (!Single.IsNaN(others[i])) 137private protected override void TransformCore(ref Single input, FixedSizeQueue<Single> windowedBuffer, long iteration, ref bool dst) 152private protected override void LearnStateFromDataCore(FixedSizeQueue<Single> data)
PValueTransform.cs (9)
24internal sealed class PValueTransform : SequentialTransformBase<Single, Single, PValueTransform.State> 115private protected override void SetNaOutput(ref Single dst) 117dst = Single.NaN; 120private protected override void TransformCore(ref Single input, FixedSizeQueue<Single> windowedBuffer, long iteration, ref Single dst) 129dst = (Single)((count + _randomGen.NextDouble() * equalCount) / (totalCount + 1)); 139private protected override void LearnStateFromDataCore(FixedSizeQueue<Single> data)
SequentialAnomalyDetectionTransformBase.cs (1)
432private FixedSizeQueue<Single> RawScoreBuffer { get; set; }
SlidingWindowTransform.cs (1)
21internal sealed class SlidingWindowTransform : SlidingWindowTransformBase<Single>
SrCnnAnomalyDetectionBase.cs (34)
89internal sealed class SrCnnAnomalyDetectionBaseCore : SrCnnTransformBase<Single, SrCnnAnomalyDetectionBaseCore.State> 172private protected sealed override void SpectralResidual(Single input, FixedSizeQueue<Single> data, ref VBufferEditor<double> result) 175List<Single> backAddList = BackAdd(data); 184List<Single> magList = new List<Single>(); 191List<Single> magLogList = magList.Select(x => x != 0 ? MathUtils.Log(x) : 0).ToList(); 192List<Single> filteredLogList = AverageFilter(magLogList, Parent.AvergingWindowSize); 193List<Single> spectralList = new List<Single>(); 221List<Single> ifftMagList = new List<Single>(); 226List<Single> filteredIfftMagList = AverageFilter(ifftMagList, Parent.JudgementWindowSize); 229var score = CalculateScore(ifftMagList[data.Count - 1], filteredIfftMagList[data.Count - 1]); 238var mag = ifftMagList[data.Count - 1]; 242private List<Single> BackAdd(FixedSizeQueue<Single> data) 244List<Single> predictArray = new List<Single>(); 249var predictedValue = PredictNext(predictArray); 250List<Single> backAddArray = new List<Single>(); 259private Single PredictNext(List<Single> data) 262Single slopeSum = 0.0f; 270private List<Single> AverageFilter(List<Single> data, int n) 272Single cumsum = 0.0f; 273List<Single> cumSumList = data.Select(x => cumsum += x).ToList(); 274List<Single> cumSumShift = new List<Single>(cumSumList); 286private Single CalculateScore(Single mag, Single avgMag)
SRCNNAnomalyDetector.cs (1)
239/// <param name="inputColumnName">Name of column to transform. The column data must be <see cref="System.Single"/>.</param>
SsaAnomalyDetectionBase.cs (13)
156public Single DiscountFactor = 1; 185internal readonly Single DiscountFactor; 189internal SequenceModelerBase<Single, Single> Model; 240ctx.LoadModel<SequenceModelerBase<Single, Single>, SignatureLoadModel>(env, out Model, "SSA"); 296private SequenceModelerBase<Single, Single> _model; 330private protected override void LearnStateFromDataCore(FixedSizeQueue<Single> data) 341private protected override double ComputeRawAnomalyScore(ref Single input, FixedSizeQueue<Single> windowedBuffer, long iteration) 344Single expectedValue = 0; 355public override void Consume(Single input) => _model.Consume(ref input, _parentAnomalyDetector.IsAdaptive);
SSaForecasting.cs (2)
231/// <seealso cref="Microsoft.ML.TimeSeriesCatalog.ForecastBySsa(Microsoft.ML.ForecastingCatalog,System.String,System.String,System.Int32,System.Int32,System.Int32,System.Int32,System.Boolean,System.Single,Microsoft.ML.Transforms.TimeSeries.RankSelectionMethod,System.Int32?,System.Int32?,System.Boolean,System.Boolean,Microsoft.ML.Transforms.TimeSeries.GrowthRatio?,System.String,System.String,System.Single,System.Boolean)" />
SsaForecastingBase.cs (9)
86public Single DiscountFactor = 1; 127internal SequenceModelerBase<Single, Single> Model; 164ctx.LoadModel<SequenceModelerBase<Single, Single>, SignatureLoadModel>(env, out Model, "SSA"); 214private SequenceModelerBase<Single, Single> _model; 248private protected override void LearnStateFromDataCore(FixedSizeQueue<Single> data) 310public override void Consume(Single input) => _model.Consume(ref input, _parentForecaster.IsAdaptive);
TimeSeriesUtils.cs (3)
14internal static void SerializeFixedSizeQueue(FixedSizeQueue<Single> queue, BinaryWriter writer) 26internal static FixedSizeQueue<Single> DeserializeFixedSizeQueueSingle(BinaryReader reader, IHost host) 32var q = new FixedSizeQueue<Single>(capacity);
TrajectoryMatrix.cs (44)
36private Single[] _data; 113public TrajectoryMatrix(IExceptionContext ectx, Single[] data, int windowSize, int seriesLength) 135public void SetSeries(Single[] data) 154private static Single RoundUpToReal(Double re, Double im, Double coeff = 1) 156return (Single)(coeff * Math.Sign(re) * Math.Sqrt(re * re + im * im)); 190public void ComputeUnnormalizedTrajectoryCovarianceMat(Single[] cov) 198var temp = new Single[_k]; 223public bool ComputeSvd(out Single[] singularValues, out Single[] leftSingularvectors) 225Single[] covariance = new Single[_windowSize * _windowSize]; 226Single[] sVal; 227Single[] sVec; 228singularValues = new Single[_windowSize]; 229leftSingularvectors = new Single[_windowSize * _windowSize]; 262private void NaiveMultiply(Single[] vector, Single[] result, bool add = false, int srcIndex = 0, int dstIndex = 0) 292private void FftMultiply(Single[] vector, Single[] result, bool add = false, int srcIndex = 0, int dstIndex = 0) 350public void Multiply(Single[] vector, Single[] result, bool add = false, int srcIndex = 0, int dstIndex = 0) 366private void NaiveMultiplyTranspose(Single[] vector, Single[] result, bool add = false, int srcIndex = 0, int dstIndex = 0) 396private void FftMultiplyTranspose(Single[] vector, Single[] result, bool add = false, int srcIndex = 0, int dstIndex = 0) 454public void MultiplyTranspose(Single[] vector, Single[] result, bool add = false, int srcIndex = 0, int dstIndex = 0) 475private void NaiveRankOneHankelization(Single[] u, Single[] v, Single sigma, Single[] result, bool add = false, 504_ectx.Assert(!Single.IsNaN(sigma)); 505_ectx.Assert(!Single.IsInfinity(sigma)); 512Single temp; 547private void FftRankOneHankelization(Single[] u, Single[] v, Single sigma, Single[] result, bool add = false, 575_ectx.Assert(!Single.IsNaN(sigma)); 576_ectx.Assert(!Single.IsInfinity(sigma)); 658public void RankOneHankelization(Single[] u, Single[] v, Single sigma, Single[] result, bool add = false,
Microsoft.ML.TorchSharp (8)
AutoFormerV2\ObjectDetectionTrainer.cs (3)
488if (boundingBoxCol.Kind != SchemaShape.Column.VectorKind.VariableVector || boundingBoxCol.ItemType.RawType != typeof(Single)) 939public Single[] ScoresBuffer; 940public Single[] BoxBuffer;
NasBert\SentenceSimilarityTrainer.cs (1)
152foreach (var label in labelCol)
Roberta\QATrainer.cs (2)
887public Single[] ScoresBuffer; 926var score = topKSpan.score;
Utils\ImageUtils.cs (2)
18public static void Postprocess(Tensor imgBatch, Tensor classification, Tensor regression, Tensor anchors, out UInt32[] predictedLabels, out Single[] score, out Single[] boxes, double scoreThreshold = 0.05, double overlapThreshold = 0.5)
Microsoft.ML.Transforms (356)
CategoricalCatalog.cs (4)
24/// This column's data type will be a vector of <see cref="System.Single"/> if <paramref name="outputKind"/> is 60/// <param name="columns">The pairs of input and output columns. The output columns' data type will be a vector of <see cref="System.Single"/> if <paramref name="outputKind"/> is 119/// This column's data type will be a vector of <see cref="System.Single"/> if <paramref name="outputKind"/> is 158/// <param name="columns">The pairs of input and output columns. The output columns' data type will be a vector of <see cref="System.Single"/> if <paramref name="outputKind"/> is
ConversionsCatalog.cs (1)
37/// The data type is a known-size vector of <see cref="System.Single"/> representing the input value.</param>
Dracula\CMCountTable.cs (1)
156if (!table[idepth].TryGetValue(iwidth, out var count))
Dracula\CountTable.cs (1)
66var priorSum = priorCounts.Sum();
Dracula\DictCountTable.cs (1)
121if (!Tables[ilabel].TryGetValue(key, out var count))
Dracula\Featurizer.cs (2)
149foreach (var feat in countsBuffer) 155foreach (var count in countTable.GarbageCounts)
Expression\BuiltinFunctions.cs (184)
24using R4 = Single; 38if (type == typeof(R4)) 39return R4.IsNaN((R4)v); 52if (type == typeof(R4)) 53return R4.NaN; 150FunctionProviderUtils.Fn<R4, R4>(NA), 156FunctionProviderUtils.Fn<R4, R4>(Default), 165FunctionProviderUtils.Fn<R4, R4>(Math.Abs), 171FunctionProviderUtils.Fn<R4, R4>(Sign), 175FunctionProviderUtils.Fn<R4, R4>(Exp), 179FunctionProviderUtils.Fn<R4, R4>(Log), 183FunctionProviderUtils.Fn<R4, R4>(Log), 185FunctionProviderUtils.Fn<R4, R4, R4>(Log), 191FunctionProviderUtils.Fn<R4, R4>(Deg), 196FunctionProviderUtils.Fn<R4, R4>(Rad), 201FunctionProviderUtils.Fn<R4, R4>(Sin), 205FunctionProviderUtils.Fn<R4, R4>(SinD), 209FunctionProviderUtils.Fn<R4, R4>(Cos), 213FunctionProviderUtils.Fn<R4, R4>(CosD), 217FunctionProviderUtils.Fn<R4, R4>(Tan), 221FunctionProviderUtils.Fn<R4, R4>(TanD), 226FunctionProviderUtils.Fn<R4, R4>(Asin), 230FunctionProviderUtils.Fn<R4, R4>(Acos), 234FunctionProviderUtils.Fn<R4, R4>(Atan), 239FunctionProviderUtils.Fn<R4, R4, R4>(Atan2), 244FunctionProviderUtils.Fn<R4, R4>(Sinh), 248FunctionProviderUtils.Fn<R4, R4>(Cosh), 252FunctionProviderUtils.Fn<R4, R4>(Tanh), 257FunctionProviderUtils.Fn<R4, R4>(Sqrt), 263FunctionProviderUtils.Fn<R4, R4>(Truncate), 267FunctionProviderUtils.Fn<R4, R4>(Floor), 272FunctionProviderUtils.Fn<R4, R4>(Ceiling), 276FunctionProviderUtils.Fn<R4, R4>(Round), 283FunctionProviderUtils.Fn<R4, R4, R4>(Math.Min), 289FunctionProviderUtils.Fn<R4, R4, R4>(Math.Max), 315FunctionProviderUtils.Fn<R4, BL>(IsNA), 325FunctionProviderUtils.Fn<R4, I4>(Convert.ToInt32), 333FunctionProviderUtils.Fn<R4, I8>(Convert.ToInt64), 341FunctionProviderUtils.Fn<I4, R4>(Convert.ToSingle), 342FunctionProviderUtils.Fn<I8, R4>(Convert.ToSingle), 343FunctionProviderUtils.Fn<R4, R4>(ToR4), 344FunctionProviderUtils.Fn<R8, R4>(ToR4), 345FunctionProviderUtils.Fn<BL, R4>(Convert.ToSingle), 346FunctionProviderUtils.Fn<TX, R4>(ToR4)); 351FunctionProviderUtils.Fn<R4, R8>(ToR8), 359FunctionProviderUtils.Fn<R4, TX>(ToTX), 382if (type == typeof(R4)) 383return R4.NaN; 397if (type == typeof(R4)) 398return default(R4); 431public static R4 NA(R4 a) 433return R4.NaN; 455public static R4 Default(R4 a) 457return default(R4); 479public static R4 Sign(R4 a) 507public static R4 Pow(R4 a, R4 b) 509return (R4)Math.Pow(a, b); 513public static R4 Exp(R4 a) 515return (R4)Math.Exp(a); 519public static R4 Log(R4 a) 521return (R4)Math.Log(a); 525public static R4 Log(R4 a, R4 b) 527return (R4)Math.Log(a, b); 531public static R4 Deg(R4 a) 533return (R4)(a * (180 / Math.PI)); 543public static R4 Rad(R4 a) 545return (R4)(a * (Math.PI / 180)); 555public static R4 Sin(R4 a) 557return (R4)Math.Sin(a); 567public static R4 SinD(R4 a) 569return (R4)Math.Sin(a * (Math.PI / 180)); 579public static R4 Cos(R4 a) 581return (R4)Math.Cos(a); 591public static R4 CosD(R4 a) 593return (R4)Math.Cos(a * (Math.PI / 180)); 603public static R4 Tan(R4 a) 605return (R4)Math.Tan(a); 609public static R4 TanD(R4 a) 611return (R4)Math.Tan(a * (Math.PI / 180)); 621public static R4 Asin(R4 a) 623return (R4)Math.Asin(a); 627public static R4 Acos(R4 a) 629return (R4)Math.Acos(a); 633public static R4 Atan(R4 a) 635return (R4)Math.Atan(a); 639public static R4 Atan2(R4 a, R4 b) 643if (R4.IsInfinity(a) && R4.IsInfinity(b)) 644return R4.NaN; 645return (R4)Math.Atan2(a, b); 659public static R4 Sinh(R4 a) 661return (R4)Math.Sinh(a); 665public static R4 Cosh(R4 a) 667return (R4)Math.Cosh(a); 671public static R4 Tanh(R4 a) 673return (R4)Math.Tanh(a); 677public static R4 Sqrt(R4 a) 679return (R4)Math.Sqrt(a); 683public static R4 Truncate(R4 a) 685return (R4)Math.Truncate(a); 689public static R4 Floor(R4 a) 691return (R4)Math.Floor(a); 695public static R4 Ceiling(R4 a) 697return (R4)Math.Ceiling(a); 701public static R4 Round(R4 a) 703return (R4)Math.Round(a); 833public static BL IsNA(R4 a) 835return R4.IsNaN(a); 866public static R4 ToR4(R4 a) 871return (R4)a; 875public static R4 ToR4(R8 a) 877return (R4)a; 880public static R4 ToR4(TX a) 882R4 res = default(R4); 888public static R8 ToR8(R4 a) 911public static TX ToTX(R4 src) => src.ToString("R", CultureInfo.InvariantCulture).AsMemory();
Expression\CodeGen.cs (9)
17using R4 = Single; 247Contracts.Assert(value is R4); 248_gen.Ldc_R4((R4)value); 308Contracts.Assert(value is R4); 309_gen.Ldc_R4((R4)value); 629CallBin<R4>(BuiltinFunctions.Pow); 853typeLoc = typeof(R4); 991var x = (R4)val;
Expression\LambdaBinder.cs (52)
18using R4 = Single; 275node.SetValue(-(R4?)arg.ExprValue); 473R4? v1; 474R4? v2; 584private void ReduceBinOp(BinaryOpNode node, R4? a, R4? b) 591var v = a.Value; 595if (!R4.IsNaN(v)) 601if (R4.IsNaN(v)) 607if (R4.IsNaN(v)) 615if (R4.IsNaN(v)) 623var v = b.Value; 627if (R4.IsNaN(v)) 631if (R4.IsNaN(v)) 637if (R4.IsNaN(v)) 645if (R4.IsNaN(v)) 768private R4 BinOp(BinaryOpNode node, R4 v1, R4 v2) 773return !R4.IsNaN(v1) ? v1 : v2; 788return R4.NaN; 906R4? v1; 907R4? v2; 1518R4? val; 1783(a,b) => { var x = Cast<R4>(a); var y = Cast<R4>(b); if (x == y) return true; if (!R4.IsNaN(x) && !R4.IsNaN(y)) return false; return null; }, 1797(a,b) => { var x = Cast<R4>(a); var y = Cast<R4>(b); if (x == y) return false; if (!R4.IsNaN(x) && !R4.IsNaN(y)) return true; return null; }, 1811(a,b) => { var x = Cast<R4>(a); var y = Cast<R4>(b); if (x < y) return true; if (x >= y) return false; return null; }, 1825(a,b) => { var x = Cast<R4>(a); var y = Cast<R4>(b); if (x <= y) return true; if (x > y) return false; return null; }, 1839(a,b) => { var x = Cast<R4>(a); var y = Cast<R4>(b); if (x > y) return true; if (x <= y) return false; return null; }, 1853(a,b) => { var x = Cast<R4>(a); var y = Cast<R4>(b); if (x >= y) return true; if (x < y) return false; return null; },
Expression\Node.cs (10)
17using R4 = Single; 355return typeof(R4); 373if (type == typeof(R4)) 426public void SetValue(R4 value) 432public void SetValue(R4? value) 485ExprValue = (R4)(I4)ExprValue; 505Contracts.Assert(ExprValue is R4); 506ExprValue = (R8)(R4)ExprValue; 554public bool TryGet(out R4? value) 566value = (R4?)ExprValue;
Expression\Printer.cs (4)
15using R4 = Single; 227Show((R4)value); 254private void Show(R4 x) 256if (R4.IsNaN(x))
ExtensionsCatalog.cs (3)
27/// This estimator operates over scalar or vector of <see cref="System.Single"/> or <see cref="System.Double"/>.</param> 45/// <param name="columns">The pairs of input and output columns. This estimator operates over data which is either scalar or vector of <see cref="System.Single"/> or <see cref="System.Double"/>.</param> 67/// This estimator operates over scalar or vector of <see cref="System.Single"/> or <see cref="System.Double"/>.</param>
GcnTransform.cs (12)
385var mean = Mean(srcValues, src.Length); 386var divisor = StdDev(srcValues, src.Length, mean); 396var mean = Mean(srcValues, src.Length); 397var divisor = L2Norm(srcValues, mean); 407var mean = Mean(srcValues, src.Length); 408var divisor = L1Norm(srcValues, mean); 418var mean = Mean(srcValues, src.Length); 419var divisor = LInfNorm(srcValues, mean); 436var divisor = StdDev(src.GetValues(), src.Length); 445var divisor = L2Norm(src.GetValues()); 454var divisor = L1Norm(src.GetValues()); 463var divisor = LInfNorm(src.GetValues());
KernelCatalog.cs (2)
22/// The data type on this column will be a known-sized vector of <see cref="System.Single"/>.</param> 25/// This estimator operates on known-sized vector of <see cref="System.Single"/> data type.</param>
LearnerFeatureSelection.cs (10)
33public Single? Threshold; 41public IComponentFactory<ITrainer<IPredictorWithFeatureWeights<Single>>> Filter = 44ComponentCatalog.CreateInstance<ITrainer<IPredictorWithFeatureWeights<Single>>>(env, typeof(SignatureFeatureScorerTrainer), "SDCA", options: null)); 95var scores = default(VBuffer<Single>); 115private static SlotsDroppingTransformer.ColumnOptions CreateDropSlotsColumn(Options options, in VBuffer<Single> scores, out int selectedCount) 147var score = Math.Abs(scoresValues[i]); 238var score = Math.Abs(scores[i]); 266private static void TrainCore(IHost host, IDataView input, Options options, ref VBuffer<Single> scores) 297var rfs = predictor as IPredictorWithFeatureWeights<Single>; 306public static void Train(IHostEnvironment env, IDataView input, Options options, ref VBuffer<Single> scores)
MissingValueIndicatorTransform.cs (3)
261var src = default(float); 309var val = values[ivSrc]; 334var val = values[iivSrc];
MissingValueReplacing.cs (1)
887node.AddAttribute("replaced_value_float", Single.NaN);
MutualInformationFeatureSelection.cs (14)
190var threshold = ComputeThreshold(scores, _slotsInOutput, out int tiedScoresToKeep); 291var score = scores[i][j]; 340var sc = score[j]; 530var tmp = default(VBuffer<Single>); 592private Single[] ComputeMutualInformation(Transposer trans, int col) 608(ref VBuffer<Single> src, ref VBuffer<int> dst, out int min, out int lim) => 636return (Single[])cmiMethodInfo.Invoke(this, new object[] { trans, col, mapper }); 806dst = offset + 1 + bounds.FindIndexSorted((Single)src); 814private void BinSingles(in VBuffer<Single> input, ref VBuffer<int> output, 821var val = inputValues[i]; 822if (!Single.IsNaN(val)) 830ValueMapper<Single, int> mapper = 831(in Single src, ref int dst) => 832dst = Single.IsNaN(src) ? offset : offset + 1 + bounds.FindIndexSorted(src);
NormalizerCatalog.cs (16)
41/// The data type on this column should be <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types.</param> 65/// The input columns must be of data type <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types. 90/// The data type on this column should be <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types.</param> 116/// The input columns must be of data type <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types. 136/// The data type on this column should be <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types.</param> 160/// The input columns must be of data type <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types. 179/// The data type on this column should be <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types.</param> 205/// The input columns must be of data type <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types. 225/// The data type on this column should be <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types.</param> 251/// The input columns must be of data type <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types. 278/// The data type on this column should be <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types.</param> 308/// The input columns must be of data type <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types. 334/// The data type on this column should be <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types.</param> 363/// The input columns must be of data type <see cref="System.Single"/>, <see cref="System.Double"/> or a known-sized vector of those types. 405/// This estimator operates over known-sized vectors of <see cref="System.Single"/>.</param> 437/// This estimator operates over known-sized vectors of <see cref="System.Single"/>.</param>
PermutationFeatureImportance.cs (1)
70var predictorWithWeights = model.Model as IPredictorWithFeatureWeights<Single>;
PermutationFeatureImportanceExtensions.cs (4)
59/// <param name="labelColumnName">Label column name. The column data must be <see cref="System.Single"/>.</param> 122/// <param name="labelColumnName">Label column name. The column data must be <see cref="System.Single"/>.</param> 522/// <param name="labelColumnName">Label column name. The column data must be <see cref="System.Single"/> or <see cref="KeyDataViewType"/>.</param> 587/// <param name="labelColumnName">Label column name. The column data must be <see cref="System.Single"/> or <see cref="KeyDataViewType"/>.</param>
RandomFourierFeaturizing.cs (1)
532var src = default(float);
Text\TextCatalog.cs (18)
21/// Create a <see cref="TextFeaturizingEstimator"/>, which transforms a text column into a featurized vector of <see cref="System.Single"/> that represents normalized counts of n-grams and char-grams. 25/// This column's data type will be a vector of <see cref="System.Single"/>. </param> 43/// Create a <see cref="TextFeaturizingEstimator"/>, which transforms a text column into featurized vector of <see cref="System.Single"/> that represents normalized counts of n-grams and char-grams. 48/// This column's data type will be a vector of <see cref="System.Single"/>. 52/// This estimator operates over text data, and it can transform several columns at once, yielding one vector of <see cref="System.Single"/> 150/// This column's data type will be a vector of <see cref="System.Single"/>.</param> 175/// This column's data type will be a vector of <see cref="System.Single"/>.</param> 251/// This column's data type will be a vector of <see cref="System.Single"/>.</param> 346/// This column's data type will be known-size vector of <see cref="System.Single"/>.</param> 375/// This column's data type will be known-size vector of <see cref="System.Single"/>.</param> 400/// This column's data type will be known-size vector of <see cref="System.Single"/>.</param> 429/// This column's data type will be known-size vector of <see cref="System.Single"/>.</param> 467/// This column's data type will be known-size vector of <see cref="System.Single"/>.</param> 505/// This column's data type will be vector of <see cref="System.Single"/>.</param> 544/// This column's data type will be vector of known size of <see cref="System.Single"/>.</param> 596/// into a vector of <see cref="System.Single"/> indicating the similarity of the text with each topic identified. 600/// This estimator outputs a vector of <see cref="System.Single"/>.</param> 602/// This estimator operates over a vector of <see cref="System.Single"/>.
Text\WordEmbeddingsExtractor.cs (2)
715float[] firstValue = wordsInFirstLine.Skip(1).Select(x => float.TryParse(x, out temp) ? temp : Single.NaN).ToArray(); 716if (!firstValue.Contains(Single.NaN))
Microsoft.ML.Vision (1)
ImageClassificationTrainer.cs (1)
263_bestMetricValue = Single.MaxValue;
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
1081[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Single))]
netstandard (1)
netstandard.cs (1)
2014[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Single))]
PresentationBuildTasks (2)
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\KnownTypes.cs (1)
5498case KnownElements.Single: t = typeof(Single); break;
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\TypeConverterHelper.cs (1)
188else if (typeof(Single).IsAssignableFrom(type))
PresentationCore (111)
MS\Internal\AnimatedTypeHelpers.cs (20)
26return from + ((to - from) * (Single)progress); 135internal static Single InterpolateSingle(Single from, Single to, Double progress) 137return from + (Single)((to - from) * progress); 214internal static Single AddSingle(Single value1, Single value2) 318internal static Single SubtractSingle(Single value1, Single value2) 473internal static Double GetSegmentLengthSingle(Single from, Single to) 516return value * (Single)factor; 584internal static Single ScaleSingle(Single value, Double factor) 586return (Single)((Double)value * factor); 711internal static bool IsValidAnimationValueSingle(Single value) 810internal static Single GetZeroValueSingle(Single baseValue)
MS\Internal\Ink\InkSerializedFormat\SerializationHelper.cs (2)
274else if (typeof(Single) == type) 278else if (typeof(Single[]) == type)
System\Windows\Input\Stylus\Common\StylusPoint.cs (1)
82(pressureFactor == Single.NaN || pressureFactor < 0.0f || pressureFactor > 1.0f))
System\Windows\Media\Animation\Generated\DiscreteKeyFrames.cs (4)
1257public DiscreteSingleKeyFrame(Single value) 1265public DiscreteSingleKeyFrame(Single value, KeyTime keyTime) 1293protected override Single InterpolateValueCore(Single baseValue, double keyFrameProgress)
System\Windows\Media\Animation\Generated\EasingKeyFrames.cs (5)
1542public EasingSingleKeyFrame(Single value) 1551public EasingSingleKeyFrame(Single value, KeyTime keyTime) 1561public EasingSingleKeyFrame(Single value, KeyTime keyTime, IEasingFunction easingFunction) 1590protected override Single InterpolateValueCore(Single baseValue, double keyFrameProgress)
System\Windows\Media\Animation\Generated\KeyFrames.cs (10)
2293protected SingleKeyFrame(Single value) 2302protected SingleKeyFrame(Single value, KeyTime keyTime) 2345typeof(Single), 2360Value = (Single)value; 2367public Single Value 2371return (Single)GetValue(ValueProperty); 2388public Single InterpolateValue( 2389Single baseValue, 2406protected abstract Single InterpolateValueCore( 2407Single baseValue,
System\Windows\Media\Animation\Generated\LinearKeyFrames.cs (4)
966public LinearSingleKeyFrame(Single value) 974public LinearSingleKeyFrame(Single value, KeyTime keyTime) 1000protected override Single InterpolateValueCore(Single baseValue, double keyFrameProgress)
System\Windows\Media\Animation\Generated\SingleAnimation.cs (32)
32private Single[] _keyValues; 47Type typeofProp = typeof(Single?); 56new PropertyMetadata((Single?)null, propCallback), 63new PropertyMetadata((Single?)null, propCallback), 70new PropertyMetadata((Single?)null, propCallback), 94public SingleAnimation(Single toValue, Duration duration) 106public SingleAnimation(Single toValue, Duration duration, FillBehavior fillBehavior) 119public SingleAnimation(Single fromValue, Single toValue, Duration duration) 132public SingleAnimation(Single fromValue, Single toValue, Duration duration, FillBehavior fillBehavior) 205protected override Single GetCurrentValueCore(Single defaultOriginValue, Single defaultDestinationValue, AnimationClock animationClock) 222Single from = new Single(); 223Single to = new Single(); 224Single accumulated = new Single(); 225Single foundation = new Single(); 339Single accumulator = AnimatedTypeHelpers.SubtractSingle(to, from); 364_keyValues = new Single[2]; 371_keyValues = new Single[2]; 378_keyValues = new Single[1]; 385_keyValues = new Single[1]; 391_keyValues = new Single[1]; 412Single? typedValue = (Single?)value; 432public Single? From 436return (Single?)GetValue(FromProperty); 452public Single? To 456return (Single?)GetValue(ToProperty); 472public Single? By 476return (Single?)GetValue(ByProperty);
System\Windows\Media\Animation\Generated\SingleAnimationBase.cs (9)
80return GetCurrentValue((Single)defaultOriginValue, (Single)defaultDestinationValue, animationClock); 92return typeof(Single); 129public Single GetCurrentValue(Single defaultOriginValue, Single defaultDestinationValue, AnimationClock animationClock) 185protected abstract Single GetCurrentValueCore(Single defaultOriginValue, Single defaultDestinationValue, AnimationClock animationClock);
System\Windows\Media\Animation\Generated\SingleAnimationUsingKeyFrames.cs (8)
312protected sealed override Single GetCurrentValueCore( 313Single defaultOriginValue, 314Single defaultDestinationValue, 340Single currentIterationValue; 376Single fromValue; 621private Single GetResolvedKeyFrameValue(Int32 resolvedKeyFrameIndex) 934Single prevKeyValue = _keyFrames[index - 1].Value; 938Single currentKeyValue = _keyFrames[index].Value;
System\Windows\Media\Animation\Generated\SplineKeyFrames.cs (5)
1571public SplineSingleKeyFrame(Single value) 1580public SplineSingleKeyFrame(Single value, KeyTime keyTime) 1590public SplineSingleKeyFrame(Single value, KeyTime keyTime, KeySpline keySpline) 1621protected override Single InterpolateValueCore(Single baseValue, double keyFrameProgress)
System\Windows\Media\Effects\ShaderEffect.cs (1)
580data.DependencyPropertyFloatValuesSize = (uint)(4 * sizeof(Single) * _floatCount);
System\Windows\Media\MILUtilities.cs (10)
83Debug.Assert(pD3DMatrix[2] == 0.0f || Single.IsNaN(pD3DMatrix[2])); 84Debug.Assert(pD3DMatrix[3] == 0.0f || Single.IsNaN(pD3DMatrix[3])); 92Debug.Assert(pD3DMatrix[6] == 0.0f || Single.IsNaN(pD3DMatrix[6])); 93Debug.Assert(pD3DMatrix[7] == 0.0f || Single.IsNaN(pD3DMatrix[7])); 99Debug.Assert(pD3DMatrix[8] == 0.0f || Single.IsNaN(pD3DMatrix[8])); 100Debug.Assert(pD3DMatrix[9] == 0.0f || Single.IsNaN(pD3DMatrix[9])); 101Debug.Assert(pD3DMatrix[10] == 1.0f || Single.IsNaN(pD3DMatrix[10])); 102Debug.Assert(pD3DMatrix[11] == 0.0f || Single.IsNaN(pD3DMatrix[11])); 110Debug.Assert(pD3DMatrix[14] == 0.0f || Single.IsNaN(pD3DMatrix[14])); 111Debug.Assert(pD3DMatrix[15] == 1.0f || Single.IsNaN(pD3DMatrix[15]));
PresentationFramework (5)
MS\Internal\Data\DefaultValueConverter.cs (1)
526typeof(Int32), typeof(Int64), typeof(Single), typeof(Double),
System\Windows\FontSizeConverter.cs (1)
80if (value is System.Int32 || value is System.Single || value is System.Double)
System\Windows\Markup\Baml2006\Baml2006KnownTypes.cs (1)
652case 559: t = () => typeof(Single); break;
System\Windows\Markup\Baml2006\WpfGeneratedKnownTypes.cs (1)
9823typeof(System.Single),
System\Windows\Markup\KnownTypes.cs (1)
6106case KnownElements.Single: t = typeof(System.Single); break;
System.Linq.Expressions (3)
System\Linq\Expressions\Interpreter\CallInstruction.Generated.cs (3)
65case TypeCode.Single: return FastCreate<Single>(target, pi); 109case TypeCode.Single: return FastCreate<T0, Single>(target, pi); 151case TypeCode.Single: return new FuncCallInstruction<T0, T1, Single>(target);
System.Private.CoreLib (3)
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (1)
1969float IConvertible.ToSingle(IFormatProvider? provider) => throw InvalidCast(nameof(Single));
src\libraries\System.Private.CoreLib\src\System\Half.cs (2)
1274var tmp = (float)value; 1589var tmp = (float)value;
System.Private.DataContractSerialization (3)
System\Xml\XmlDictionaryReader.cs (3)
1764throw XmlExceptionHelper.CreateConversionException(nameof(Single), exception); 1768throw XmlExceptionHelper.CreateConversionException(nameof(Single), exception); 1772throw XmlExceptionHelper.CreateConversionException(nameof(Single), exception);
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
767[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Single))]