@@ -24,23 +24,31 @@ public static class LightGbmExtensions
24
24
/// <param name="numBoostRound">Number of iterations.</param>
25
25
/// <param name="minDataPerLeaf">The minimal number of documents allowed in a leaf of the tree, out of the subsampled data.</param>
26
26
/// <param name="learningRate">The learning rate.</param>
27
- /// <param name="advancedSettings">A delegate to set more settings.
28
- /// The settings here will override the ones provided in the direct signature,
29
- /// if both are present and have different values.
30
- /// The columns names, however need to be provided directly, not through the <paramref name="advancedSettings"/>.</param>
31
27
public static LightGbmRegressorTrainer LightGbm ( this RegressionCatalog . RegressionTrainers catalog ,
32
28
string labelColumn = DefaultColumnNames . Label ,
33
29
string featureColumn = DefaultColumnNames . Features ,
34
30
string weights = null ,
35
31
int ? numLeaves = null ,
36
32
int ? minDataPerLeaf = null ,
37
33
double ? learningRate = null ,
38
- int numBoostRound = LightGbmArguments . Defaults . NumBoostRound ,
39
- Action < LightGbmArguments > advancedSettings = null )
34
+ int numBoostRound = Options . Defaults . NumBoostRound )
40
35
{
41
36
Contracts . CheckValue ( catalog , nameof ( catalog ) ) ;
42
37
var env = CatalogUtils . GetEnvironment ( catalog ) ;
43
- return new LightGbmRegressorTrainer ( env , labelColumn , featureColumn , weights , numLeaves , minDataPerLeaf , learningRate , numBoostRound , advancedSettings ) ;
38
+ return new LightGbmRegressorTrainer ( env , labelColumn , featureColumn , weights , numLeaves , minDataPerLeaf , learningRate , numBoostRound ) ;
39
+ }
40
+
41
+ /// <summary>
42
+ /// Predict a target using a decision tree regression model trained with the <see cref="LightGbmRegressorTrainer"/>.
43
+ /// </summary>
44
+ /// <param name="catalog">The <see cref="RegressionCatalog"/>.</param>
45
+ /// <param name="options">Advanced options to the algorithm.</param>
46
+ public static LightGbmRegressorTrainer LightGbm ( this RegressionCatalog . RegressionTrainers catalog ,
47
+ Options options )
48
+ {
49
+ Contracts . CheckValue ( catalog , nameof ( catalog ) ) ;
50
+ var env = CatalogUtils . GetEnvironment ( catalog ) ;
51
+ return new LightGbmRegressorTrainer ( env , options ) ;
44
52
}
45
53
46
54
/// <summary>
@@ -54,28 +62,35 @@ public static LightGbmRegressorTrainer LightGbm(this RegressionCatalog.Regressio
54
62
/// <param name="numBoostRound">Number of iterations.</param>
55
63
/// <param name="minDataPerLeaf">The minimal number of documents allowed in a leaf of the tree, out of the subsampled data.</param>
56
64
/// <param name="learningRate">The learning rate.</param>
57
- /// <param name="advancedSettings">A delegate to set more settings.
58
- /// The settings here will override the ones provided in the direct signature,
59
- /// if both are present and have different values.
60
- /// The columns names, however need to be provided directly, not through the <paramref name="advancedSettings"/>.</param>
61
65
public static LightGbmBinaryTrainer LightGbm ( this BinaryClassificationCatalog . BinaryClassificationTrainers catalog ,
62
66
string labelColumn = DefaultColumnNames . Label ,
63
67
string featureColumn = DefaultColumnNames . Features ,
64
68
string weights = null ,
65
69
int ? numLeaves = null ,
66
70
int ? minDataPerLeaf = null ,
67
71
double ? learningRate = null ,
68
- int numBoostRound = LightGbmArguments . Defaults . NumBoostRound ,
69
- Action < LightGbmArguments > advancedSettings = null )
72
+ int numBoostRound = Options . Defaults . NumBoostRound )
70
73
{
71
74
Contracts . CheckValue ( catalog , nameof ( catalog ) ) ;
72
75
var env = CatalogUtils . GetEnvironment ( catalog ) ;
73
- return new LightGbmBinaryTrainer ( env , labelColumn , featureColumn , weights , numLeaves , minDataPerLeaf , learningRate , numBoostRound , advancedSettings ) ;
76
+ return new LightGbmBinaryTrainer ( env , labelColumn , featureColumn , weights , numLeaves , minDataPerLeaf , learningRate , numBoostRound ) ;
77
+ }
74
78
79
+ /// <summary>
80
+ /// Predict a target using a decision tree binary classification model trained with the <see cref="LightGbmBinaryTrainer"/>.
81
+ /// </summary>
82
+ /// <param name="catalog">The <see cref="BinaryClassificationCatalog"/>.</param>
83
+ /// <param name="options">Advanced options to the algorithm.</param>
84
+ public static LightGbmBinaryTrainer LightGbm ( this BinaryClassificationCatalog . BinaryClassificationTrainers catalog ,
85
+ Options options )
86
+ {
87
+ Contracts . CheckValue ( catalog , nameof ( catalog ) ) ;
88
+ var env = CatalogUtils . GetEnvironment ( catalog ) ;
89
+ return new LightGbmBinaryTrainer ( env , options ) ;
75
90
}
76
91
77
92
/// <summary>
78
- /// Predict a target using a decision tree binary classification model trained with the <see cref="LightGbmRankingTrainer"/>.
93
+ /// Predict a target using a decision tree ranking model trained with the <see cref="LightGbmRankingTrainer"/>.
79
94
/// </summary>
80
95
/// <param name="catalog">The <see cref="RankingCatalog"/>.</param>
81
96
/// <param name="labelColumn">The labelColumn column.</param>
@@ -86,10 +101,6 @@ public static LightGbmBinaryTrainer LightGbm(this BinaryClassificationCatalog.Bi
86
101
/// <param name="numBoostRound">Number of iterations.</param>
87
102
/// <param name="minDataPerLeaf">The minimal number of documents allowed in a leaf of the tree, out of the subsampled data.</param>
88
103
/// <param name="learningRate">The learning rate.</param>
89
- /// <param name="advancedSettings">A delegate to set more settings.
90
- /// The settings here will override the ones provided in the direct signature,
91
- /// if both are present and have different values.
92
- /// The columns names, however need to be provided directly, not through the <paramref name="advancedSettings"/>.</param>
93
104
public static LightGbmRankingTrainer LightGbm ( this RankingCatalog . RankingTrainers catalog ,
94
105
string labelColumn = DefaultColumnNames . Label ,
95
106
string featureColumn = DefaultColumnNames . Features ,
@@ -98,44 +109,62 @@ public static LightGbmRankingTrainer LightGbm(this RankingCatalog.RankingTrainer
98
109
int ? numLeaves = null ,
99
110
int ? minDataPerLeaf = null ,
100
111
double ? learningRate = null ,
101
- int numBoostRound = LightGbmArguments . Defaults . NumBoostRound ,
102
- Action < LightGbmArguments > advancedSettings = null )
112
+ int numBoostRound = Options . Defaults . NumBoostRound )
103
113
{
104
114
Contracts . CheckValue ( catalog , nameof ( catalog ) ) ;
105
115
var env = CatalogUtils . GetEnvironment ( catalog ) ;
106
- return new LightGbmRankingTrainer ( env , labelColumn , featureColumn , groupIdColumn , weights , numLeaves , minDataPerLeaf , learningRate , numBoostRound , advancedSettings ) ;
107
-
116
+ return new LightGbmRankingTrainer ( env , labelColumn , featureColumn , groupIdColumn , weights , numLeaves , minDataPerLeaf , learningRate , numBoostRound ) ;
108
117
}
109
118
110
119
/// <summary>
111
- /// Predict a target using a decision tree binary classification model trained with the <see cref="LightGbmRankingTrainer"/>.
120
+ /// Predict a target using a decision tree ranking model trained with the <see cref="LightGbmRankingTrainer"/>.
112
121
/// </summary>
113
122
/// <param name="catalog">The <see cref="RankingCatalog"/>.</param>
123
+ /// <param name="options">Advanced options to the algorithm.</param>
124
+ public static LightGbmRankingTrainer LightGbm ( this RankingCatalog . RankingTrainers catalog ,
125
+ Options options )
126
+ {
127
+ Contracts . CheckValue ( catalog , nameof ( catalog ) ) ;
128
+ var env = CatalogUtils . GetEnvironment ( catalog ) ;
129
+ return new LightGbmRankingTrainer ( env , options ) ;
130
+ }
131
+
132
+ /// <summary>
133
+ /// Predict a target using a decision tree multiclass classification model trained with the <see cref="LightGbmMulticlassTrainer"/>.
134
+ /// </summary>
135
+ /// <param name="catalog">The <see cref="MulticlassClassificationCatalog"/>.</param>
114
136
/// <param name="labelColumn">The labelColumn column.</param>
115
137
/// <param name="featureColumn">The features column.</param>
116
138
/// <param name="weights">The weights column.</param>
117
139
/// <param name="numLeaves">The number of leaves to use.</param>
118
140
/// <param name="numBoostRound">Number of iterations.</param>
119
141
/// <param name="minDataPerLeaf">The minimal number of documents allowed in a leaf of the tree, out of the subsampled data.</param>
120
142
/// <param name="learningRate">The learning rate.</param>
121
- /// <param name="advancedSettings">A delegate to set more settings.
122
- /// The settings here will override the ones provided in the direct signature,
123
- /// if both are present and have different values.
124
- /// The columns names, however need to be provided directly, not through the <paramref name="advancedSettings"/>.</param>
125
143
public static LightGbmMulticlassTrainer LightGbm ( this MulticlassClassificationCatalog . MulticlassClassificationTrainers catalog ,
126
144
string labelColumn = DefaultColumnNames . Label ,
127
145
string featureColumn = DefaultColumnNames . Features ,
128
146
string weights = null ,
129
147
int ? numLeaves = null ,
130
148
int ? minDataPerLeaf = null ,
131
149
double ? learningRate = null ,
132
- int numBoostRound = LightGbmArguments . Defaults . NumBoostRound ,
133
- Action < LightGbmArguments > advancedSettings = null )
150
+ int numBoostRound = Options . Defaults . NumBoostRound )
134
151
{
135
152
Contracts . CheckValue ( catalog , nameof ( catalog ) ) ;
136
153
var env = CatalogUtils . GetEnvironment ( catalog ) ;
137
- return new LightGbmMulticlassTrainer ( env , labelColumn , featureColumn , weights , numLeaves , minDataPerLeaf , learningRate , numBoostRound , advancedSettings ) ;
154
+ return new LightGbmMulticlassTrainer ( env , labelColumn , featureColumn , weights , numLeaves , minDataPerLeaf , learningRate , numBoostRound ) ;
155
+ }
138
156
157
+ /// <summary>
158
+ /// Predict a target using a decision tree multiclass classification model trained with the <see cref="LightGbmMulticlassTrainer"/>.
159
+ /// </summary>
160
+ /// <param name="catalog">The <see cref="MulticlassClassificationCatalog"/>.</param>
161
+ /// <param name="options">Advanced options to the algorithm.</param>
162
+ public static LightGbmMulticlassTrainer LightGbm ( this MulticlassClassificationCatalog . MulticlassClassificationTrainers catalog ,
163
+ Options options )
164
+ {
165
+ Contracts . CheckValue ( catalog , nameof ( catalog ) ) ;
166
+ var env = CatalogUtils . GetEnvironment ( catalog ) ;
167
+ return new LightGbmMulticlassTrainer ( env , options ) ;
139
168
}
140
169
}
141
170
}
0 commit comments