Skip to content

Commit 669f4fa

Browse files
dan-drewsIvanidzo4ka
authored andcommitted
Remove Extra Code Comments and unused InternalStreams project (#514)
* First attempt at removing extra code comments * Round #2 * Removing Microsoft.ML.InternalStreams per comment on #513 * Address notes from @Ivanidzo4ka * Remove TreeOrderedCandidatesSearch * Remove whitespace and reinstate commented out tests
1 parent ceac01f commit 669f4fa

File tree

27 files changed

+10
-19678
lines changed

27 files changed

+10
-19678
lines changed

Microsoft.ML.sln

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Tests", "test\
3636
EndProject
3737
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.TestFramework", "test\Microsoft.ML.TestFramework\Microsoft.ML.TestFramework.csproj", "{B5989C06-4FFA-46C1-9D85-9366B34AB0A2}"
3838
EndProject
39-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.InternalStreams", "src\Microsoft.ML.InternalStreams\Microsoft.ML.InternalStreams.csproj", "{C4F7938F-7109-43C8-92A5-9BE47C7FF7D9}"
40-
EndProject
4139
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Predictor.Tests", "test\Microsoft.ML.Predictor.Tests\Microsoft.ML.Predictor.Tests.csproj", "{6B047E09-39C9-4583-96F3-685D84CA4117}"
4240
EndProject
4341
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.ResultProcessor", "src\Microsoft.ML.ResultProcessor\Microsoft.ML.ResultProcessor.csproj", "{3769FCC3-9AFF-4C37-97E9-6854324681DF}"
@@ -150,10 +148,6 @@ Global
150148
{B5989C06-4FFA-46C1-9D85-9366B34AB0A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
151149
{B5989C06-4FFA-46C1-9D85-9366B34AB0A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
152150
{B5989C06-4FFA-46C1-9D85-9366B34AB0A2}.Release|Any CPU.Build.0 = Release|Any CPU
153-
{C4F7938F-7109-43C8-92A5-9BE47C7FF7D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
154-
{C4F7938F-7109-43C8-92A5-9BE47C7FF7D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
155-
{C4F7938F-7109-43C8-92A5-9BE47C7FF7D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
156-
{C4F7938F-7109-43C8-92A5-9BE47C7FF7D9}.Release|Any CPU.Build.0 = Release|Any CPU
157151
{6B047E09-39C9-4583-96F3-685D84CA4117}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
158152
{6B047E09-39C9-4583-96F3-685D84CA4117}.Debug|Any CPU.Build.0 = Debug|Any CPU
159153
{6B047E09-39C9-4583-96F3-685D84CA4117}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -218,7 +212,6 @@ Global
218212
{2F636A2C-062C-49F4-85F3-60DCADAB6A43} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
219213
{64BC22D3-1E76-41EF-94D8-C79E471FF2DD} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
220214
{B5989C06-4FFA-46C1-9D85-9366B34AB0A2} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
221-
{C4F7938F-7109-43C8-92A5-9BE47C7FF7D9} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
222215
{6B047E09-39C9-4583-96F3-685D84CA4117} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
223216
{3769FCC3-9AFF-4C37-97E9-6854324681DF} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
224217
{B7B593C5-FB8C-4ADA-A638-5B53B47D087E} = {09EADF06-BE25-4228-AB53-95AE3E15B530}

src/Microsoft.ML.Console/Microsoft.ML.Console.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
<ProjectReference Include="..\Microsoft.ML.Data\Microsoft.ML.Data.csproj" />
1616
<ProjectReference Include="..\Microsoft.ML.Ensemble\Microsoft.ML.Ensemble.csproj" />
1717
<ProjectReference Include="..\Microsoft.ML.FastTree\Microsoft.ML.FastTree.csproj" />
18-
<ProjectReference Include="..\Microsoft.ML.InternalStreams\Microsoft.ML.InternalStreams.csproj" />
1918
<ProjectReference Include="..\Microsoft.ML.KMeansClustering\Microsoft.ML.KMeansClustering.csproj" />
2019
<ProjectReference Include="..\Microsoft.ML.LightGBM\Microsoft.ML.LightGBM.csproj" />
2120
<ProjectReference Include="..\Microsoft.ML.Maml\Microsoft.ML.Maml.csproj" />

src/Microsoft.ML.Core/Utilities/DoubleParser.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,12 +433,6 @@ public static bool TryParse(out Double value, string s, int ichMin, int ichLim,
433433
if (FloatUtils.GetBits(x) != 0 || FloatUtils.GetBits(value) != TopBit || !neg)
434434
{
435435
System.Diagnostics.Debug.WriteLine("*** FloatParser disagrees with Double.TryParse on: {0} ({1} vs {2})", str, FloatUtils.GetBits(x), FloatUtils.GetBits(value));
436-
//if (!_failed)
437-
//{
438-
// // REVIEW: Double.Parse gets several things wrong, like mapping 148e-325 to 0x2 instead of 0x3.
439-
// _failed = true;
440-
// Contracts.Assert(false, string.Format("FloatParser disagrees with Double.TryParse on: {0} ({1} vs {2})", str, FloatUtils.GetBits(x), FloatUtils.GetBits(value)));
441-
//}
442436
}
443437
}
444438
#endif

src/Microsoft.ML.Core/Utilities/MathUtils.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,6 @@ public static Float SoftMax(Float[] inputs, int count)
258258
if (count == 1)
259259
return max;
260260

261-
//else if (leng == 2) {
262-
// return SoftMax(inputs[0], inputs[1]);
263-
//}
264-
265261
double intermediate = 0.0;
266262
Float cutoff = max - LogTolerance;
267263

src/Microsoft.ML.Data/DataLoadSave/Text/TextLoaderParser.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ private sealed class ParseStats
137137
private volatile int _cref;
138138

139139
// Total number of rows, number of unparsable values, number of format errors.
140-
private /*volatile*/ long _rowCount;
141-
private /*volatile*/ long _badCount;
142-
private /*volatile*/ long _fmtCount;
140+
private long _rowCount;
141+
private long _badCount;
142+
private long _fmtCount;
143143

144144
public ParseStats(IChannelProvider provider, int cref, long maxShow = MaxShow)
145145
{

src/Microsoft.ML.FastTree/Application/LogLossApplication.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,6 @@ protected override void GetGradientInOneQuery(int query, int threadIndex)
107107

108108
_gradient[d1] += delta;
109109
_gradient[d2] -= delta;
110-
/*
111-
double labelDiff = (labels[d1] - labels[d2]);
112-
double margin = labelDiff * (_scores[d1] - _scores[d2]);
113-
if (_coef - margin > 0)
114-
{
115-
_gradient[d1] += 0.01 * labelDiff;
116-
_gradient[d2] -= 0.01 * labelDiff;
117-
}
118-
*/
119110
}
120111
}
121112
}

src/Microsoft.ML.FastTree/Application/WinLossSurplusApplication.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ protected override void GetGradientInOneQuery(int query, int threadIndex)
120120

121121
double inverseMaxDCG = _inverseMaxDCGT[query];
122122

123-
//int[] permutation = (threadIndex < 0 ? new int[numDocuments] : _permutationBuffers[threadIndex]);
124123
int[] permutation = _permutationBuffers[threadIndex];
125124

126125
short[] labels = Labels;

src/Microsoft.ML.FastTree/Dataset/FeatureFlock.cs

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -698,20 +698,6 @@ public void FillSplitCandidatesCategoricalLowPopulation(LeastSquaresRegressionTr
698698
var binStats = virtualBins[i];
699699
catFeatureCount += 1 + binStats.SubFeatures.Length;
700700

701-
/*int feature = features[i];
702-
int subfeature = feature - featureMin;
703-
Contracts.Assert(0 <= subfeature && subfeature < Flock.Count);
704-
Contracts.Assert(subfeature <= feature);
705-
Contracts.Assert(learner.TrainData.FlockToFirstFeature(flock) == feature - subfeature);
706-
Contracts.Assert(featureUseCount[feature] >= 0);
707-
Contracts.Assert(Flock.BinCount(subfeature) == 2);
708-
Contracts.Assert(GetMaxBorder(subfeature) == GetMinBorder(subfeature));
709-
710-
var binStats = GetBinStats(GetMinBorder(subfeature));
711-
sumGTTargets += binStats.SumTargets;
712-
if (hasWeights)
713-
sumGTWeights += binStats.SumWeights;*/
714-
715701
sumGTTargets += binStats.SumTargets;
716702
gtCount += binStats.Count;
717703
docsInCurrentGroup += binStats.Count;
@@ -933,21 +919,7 @@ public void FillSplitCandidatesCategoricalNeighborBundling(LeastSquaresRegressio
933919
{
934920
var binStats = virtualBins[i];
935921
catFeatureCount += 1 + binStats.SubFeatures.Length;
936-
937-
/*int feature = features[i];
938-
int subfeature = feature - featureMin;
939-
Contracts.Assert(0 <= subfeature && subfeature < Flock.Count);
940-
Contracts.Assert(subfeature <= feature);
941-
Contracts.Assert(learner.TrainData.FlockToFirstFeature(flock) == feature - subfeature);
942-
Contracts.Assert(featureUseCount[feature] >= 0);
943-
Contracts.Assert(Flock.BinCount(subfeature) == 2);
944-
Contracts.Assert(GetMaxBorder(subfeature) == GetMinBorder(subfeature));
945-
946-
var binStats = GetBinStats(GetMinBorder(subfeature));
947-
sumGTTargets += binStats.SumTargets;
948-
if (hasWeights)
949-
sumGTWeights += binStats.SumWeights;*/
950-
922+
951923
sumGTTargets += binStats.SumTargets;
952924
gtCount += binStats.Count;
953925
docsInCurrentGroup += binStats.Count;

src/Microsoft.ML.FastTree/Dataset/SegmentIntArray.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,8 @@ public static void StatsOfBestEncoding(uint[] ivalues, int bitsForMaxItem, bool
168168

169169
max = 0;
170170
bits = TransitionCost;
171-
//IEnumerator<int> ienum = ivalues.GetEnumerator();
172-
//while (ienum.MoveNext())
173171
for (int i = 0; i < ivalues.Length; ++i)
174172
{
175-
//uint val = (uint)ienum.Current;
176173
uint val = (uint)ivalues[i];
177174
if (val > max)
178175
max = val;

src/Microsoft.ML.FastTree/Dataset/SparseIntArray.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,9 @@ public unsafe int this[int virtualIndex]
546546
{
547547
get
548548
{
549-
//if (virtualIndex < _index) throw new Exception("Index must move forward");
550-
551549
if (virtualIndex < _nextIndex)
552550
return 0;
553551

554-
//if (virtualIndex >= _array._length) throw new IndexOutOfRangeException();
555-
556552
if (virtualIndex == _nextIndex)
557553
return _array._values[_pos];
558554

@@ -561,7 +557,6 @@ public unsafe int this[int virtualIndex]
561557
{
562558
while (_pos < _array._values.Length)
563559
{
564-
//_index = _nextIndex;
565560
_nextIndex += pDeltas[_pos];
566561
if (virtualIndex < _nextIndex)
567562
return 0;

0 commit comments

Comments
 (0)