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