28 writes to
Microsoft.Data.Analysis.Tests (1)
DataFrameTests.cs (1)
229
df
[
"Int3"] = df.Columns["Int1"] * 2 + df.Columns["Int2"];
Microsoft.ML.Fairlearn (20)
Metrics\FairlearnMetricCatalog.cs (14)
100
result
[
_sensitiveFeatureColumn] = DataFrameColumn.Create(_sensitiveFeatureColumn, groupMetric.Keys.Select(x => x.ToString()));
101
result
[
"AUC"] = DataFrameColumn.Create("AUC", groupMetric.Keys.Select(k => groupMetric[k].AreaUnderRocCurve)); //coloumn name?
102
result
[
"Accuracy"] = DataFrameColumn.Create("Accuracy", groupMetric.Keys.Select(k => groupMetric[k].Accuracy));
103
result
[
"PosPrec"] = DataFrameColumn.Create("PosPrec", groupMetric.Keys.Select(k => groupMetric[k].PositivePrecision));
104
result
[
"PosRecall"] = DataFrameColumn.Create("PosRecall", groupMetric.Keys.Select(k => groupMetric[k].PositiveRecall));
105
result
[
"NegPrec"] = DataFrameColumn.Create("NegPrec", groupMetric.Keys.Select(k => groupMetric[k].NegativePrecision));
106
result
[
"NegRecall"] = DataFrameColumn.Create("NegRecall", groupMetric.Keys.Select(k => groupMetric[k].NegativeRecall));
107
result
[
"F1Score"] = DataFrameColumn.Create("F1Score", groupMetric.Keys.Select(k => groupMetric[k].F1Score));
108
result
[
"AreaUnderPrecisionRecallCurve"] = DataFrameColumn.Create("AreaUnderPrecisionRecallCurve", groupMetric.Keys.Select(k => groupMetric[k].AreaUnderPrecisionRecallCurve));
234
result
[
_sensitiveFeatureColumn] = DataFrameColumn.Create(_sensitiveFeatureColumn, groupMetric.Keys.Select(x => x.ToString()));
235
result
[
"RSquared"] = DataFrameColumn.Create("RSquared", groupMetric.Keys.Select(k => groupMetric[k].RSquared));
236
result
[
"RMS"] = DataFrameColumn.Create("RMS", groupMetric.Keys.Select(k => groupMetric[k].RootMeanSquaredError));
237
result
[
"MSE"] = DataFrameColumn.Create("MSE", groupMetric.Keys.Select(k => groupMetric[k].MeanSquaredError));
238
result
[
"MAE"] = DataFrameColumn.Create("MAE", groupMetric.Keys.Select(k => groupMetric[k].MeanAbsoluteError));
Reductions\GridSearchTrialRunner.cs (3)
73
df
[
"sign"] = DataFrameColumn.Create("sign", lambdasValue.Select(x => x.sign));
74
df
[
"group_id"] = DataFrameColumn.Create("group_id", lambdasValue.Select(x => x.e));
75
df
[
"value"] = DataFrameColumn.Create("value", lambdasValue.Select(x => x.value));
Reductions\Moment.cs (2)
50
Tags
[
"label"] = label;
51
Tags
[
"group_id"] = sensitiveFeature;
Reductions\UtilityParity.cs (1)
93
Tags
[
"pred"] = yPred;
Microsoft.ML.Fairlearn.Tests (7)
GridSearchTest.cs (7)
39
df
[
"X"] = DataFrameColumn.Create("X", new[] { 0f, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
40
df
[
"y_true"] = DataFrameColumn.Create("y_true", new[] { true, true, true, true, true, true, true, false, false, false });
41
df
[
"y_pred"] = DataFrameColumn.Create("y_pred", new[] { true, true, true, true, false, false, false, true, false, false });
42
df
[
"sensitiveFeature"] = DataFrameColumn.Create("sensitiveFeature", new[] { "a", "b", "a", "a", "b", "a", "b", "b", "a", "b" });
63
df
[
"score_feature"] = DataFrameColumn.Create("score_feature", score_feature);
64
df
[
"y"] = DataFrameColumn.Create("y", new[] {
71
df
[
"sensitiveFeature"] = DataFrameColumn.Create("sensitiveFeature", new[] { "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3", "3" });
80 references to
Microsoft.Data.Analysis (3)
DataFrame.cs (1)
389
DataFrameColumn column = this
[
columnName];
DataFrameRow.cs (2)
71
return _dataFrame
[
columnName][_rowIndex];
75
_dataFrame
[
columnName][_rowIndex] = value;
Microsoft.Data.Analysis.Tests (44)
DataFrame.IOTests.cs (6)
193
Assert.Equal(3.8f, (float)df
[
"trip_distance"][0]);
194
Assert.Equal(17.5f, (float)df
[
"fare_amount"][0]);
196
Assert.Equal(1.5f, (float)df
[
"trip_distance"][1]);
197
Assert.Equal(8f, (float)df
[
"fare_amount"][1]);
199
Assert.Equal(1.4f, (float)df
[
"trip_distance"][2]);
200
Assert.Equal(8.5f, (float)df
[
"fare_amount"][2]);
DataFrameTests.BinaryOperations.cs (2)
225
var equalsToScalarResult = df
[
"DateTime1"].ElementwiseEquals(SampleDateTime);
233
var notEqualsToScalarResult = df
[
"DateTime1"].ElementwiseNotEquals(SampleDateTime);
DataFrameTests.Computations.cs (6)
20
df
[
"Int"][0] = -10;
182
df
[
"Int"][0] = -10;
483
var col3 = dfTest
[
"col1"].And(dfTest
[
"col2"]);
500
var col3 = dfTest
[
"col1"].Or(dfTest
[
"col2"]);
DataFrameTests.cs (17)
39
var column = dataFrame
[
"Int2"] as Int32DataFrameColumn;
42
Assert.Throws<ArgumentException>(() => dataFrame
[
"Int5"]);
186
dataframe
[
"City"].SetName("Town");
187
var renamedColumn = dataframe
[
"Town"];
189
Assert.Throws<ArgumentException>(() => dataframe
[
"City"]);
206
var renamedColumn = dataframe
[
"Town"];
208
Assert.Throws<ArgumentException>(() => dataframe
[
"City"]);
1075
Assert.Equal("c", resultDataFrame
[
"ColumnA"][2]);
1076
Assert.Equal("d", resultDataFrame
[
"ColumnA"][3]);
1078
Assert.Equal(3, resultDataFrame
[
"ColumnB"][2]);
1079
Assert.Equal(4, resultDataFrame
[
"ColumnB"][3]);
1081
Assert.Equal(30, resultDataFrame
[
"ColumnC"][2]);
1082
Assert.Equal(40, resultDataFrame
[
"ColumnC"][3]);
1349
Assert.Equal(40.0 / 9.0, df
[
"Decimal"].Mean());
1357
Assert.Equal(4, df
[
"Decimal"].Median());
1366
var filteredNullDf = dfTest.Filter(dfTest
[
"col"].ElementwiseNotEquals(null));
1383
var filteredNullDf = dfTest.Filter(dfTest
[
"col"].ElementwiseEquals(null));
DataFrameTests.Merge.cs (8)
142
left
[
"Int"][8] = null;
147
right
[
"Int"][8] = null;
180
left
[
"Int"][3] = null;
181
right
[
"Int"][6] = null;
228
left
[
"Int"][3] = null;
230
right
[
"Int"][1] = 5;
231
right
[
"Int"][3] = null;
232
right
[
"Int"][4] = 6;
DataFrameTests.Sort.cs (3)
106
dataFrame
[
"Int"][3] = null;
107
dataFrame
[
"String"][3] = null;
124
Assert.Equal(dataFrame
[
columnName][3], penultimateRow[i]);
PrimitiveDataFrameColumnTests.cs (2)
495
var filteredNullDf = dfTest.Filter(dfTest
[
"col"].ElementwiseNotEquals(null));
512
var filteredNullDf = dfTest.Filter(dfTest
[
"col"].ElementwiseEquals(null));
Microsoft.ML.Fairlearn (21)
Metrics\FairlearnMetricCatalog.cs (8)
246
diffDict.Add("RSquared", Math.Abs((double)groupMetrics
[
"RSquared"].Max() - (double)groupMetrics
[
"RSquared"].Min()));
247
diffDict.Add("RMS", Math.Abs((double)groupMetrics
[
"RMS"].Max() - (double)groupMetrics
[
"RMS"].Min()));
248
diffDict.Add("MSE", Math.Abs((double)groupMetrics
[
"MSE"].Max() - (double)groupMetrics
[
"MSE"].Min()));
249
diffDict.Add("MAE", Math.Abs((double)groupMetrics
[
"MAE"].Max() - (double)groupMetrics
[
"MAE"].Min()));
Reductions\GridSearchTrialRunner.cs (1)
88
double fairnessLost = Convert.ToSingle(gamma
[
"value"].Max());
Reductions\Moment.cs (1)
31
public DataFrameColumn SensitiveFeatureColumn { get => Tags
[
"group_id"]; }
Reductions\UtilityParity.cs (11)
97
var expectEvent = Tags
[
"pred"].Mean();
117
gSigned
[
"sign"].FillNulls("+", inPlace: true);
122
dfNeg
[
"sign"].FillNulls("-", inPlace: true);
141
var gPos = lambdaVec.Filter(lambdaVec
[
"sign"].ElementwiseEquals("+")).OrderBy("group_id");
142
var gNeg = lambdaVec.Filter(lambdaVec
[
"sign"].ElementwiseEquals("-")).OrderBy("group_id");
143
var lambdaEvent = (float)(gPos
[
"value"] - _ratio * gNeg
[
"value"]).Sum() / ProbEvent;
144
var lambdaGroupEvent = (_ratio * gPos
[
"value"] - gNeg
[
"value"]) / ProbGroupEvent;
147
DataFrame lookUp = new DataFrame(gPos
[
"group_id"], adjust);
158
signedWeightsFloat[i] = Convert.ToSingle(lookUp.Filter(lookUp
[
"group_id"].ElementwiseEquals(row["group_id"]))["value"][0]);
Microsoft.ML.Fairlearn.Tests (12)
GridSearchTest.cs (2)
29
moment.LoadData(X, X
[
"y_true"], X
[
"sensitiveFeature"] as StringDataFrameColumn);
MetricTest.cs (6)
41
Assert.Equal(-2.30578, Convert.ToSingle(metricByGroup
[
"RSquared"][0]), 0.001);
42
Assert.Equal(-2039.81453, Convert.ToSingle(metricByGroup
[
"RSquared"][1]), 0.001);
43
Assert.Equal(1.00000, Convert.ToSingle(metricByGroup
[
"RMS"][0]), 0.001);
44
Assert.Equal(15.811388, Convert.ToSingle(metricByGroup
[
"RMS"][1]), 0.001);
73
Assert.Equal(0.8, Convert.ToSingle(metricByGroup
[
"Accuracy"][0]), 0.1);
74
Assert.Equal(0.6, Convert.ToSingle(metricByGroup
[
"Accuracy"][1]), 0.1);
UtilityTest.cs (4)
34
Assert.Equal(0.1, Convert.ToSingle(gSinged
[
"value"][0]), 0.1);
35
Assert.Equal(-0.1, Convert.ToSingle(gSinged
[
"value"][1]), 0.1);
36
Assert.Equal(-0.1, Convert.ToSingle(gSinged
[
"value"][2]), 0.1);
37
Assert.Equal(0.1, Convert.ToSingle(gSinged
[
"value"][3]), 0.1);