New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify API for advanced settings (MatrixFactorizationTrainer) #2204
Modify API for advanced settings (MatrixFactorizationTrainer) #2204
Conversation
/// <remarks> | ||
/// <para>The basic idea of matrix factorization is finding two low-rank factor marcies to apporimate the training matrix.</para> | ||
/// <para>In this module, the expected training data is a list of tuples. Every tuple consists of a column index, a row index, | ||
/// and the value at the location specified by the two indexes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a reference to Options
in the doc string?
/// and the value at the location specified by the two indexes. | |
/// and the value at the location specified by the two indexes. The training configuration is encoded in <see cref="Options>. | |
``` #Resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.Append(r => (r.label, score: mlContext.Regression.Trainers.MatrixFactorization(r.label, r.matrixRowIndex, r.matrixColumnIndex, onFit: p => pred = p, | ||
advancedSettings: args => { args.NumThreads = 1; }))); | ||
.Append(r => (r.label, score: mlContext.Regression.Trainers.MatrixFactorization( | ||
r.label, r.matrixRowIndex, r.matrixColumnIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the following 2 lines got too many indents? #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i found this slightly easier to read. did a control+k+d on this file
In reply to: 250022406 [](ancestors = 250022406)
MatrixRowIndexColumnName = itemColumnName, | ||
LabelColumnName = labelColumnName, | ||
NumIterations = 3, | ||
NumThreads = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please copy my old comment. Thanks. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MatrixRowIndexColumnName = nameof(MatrixElement.MatrixRowIndex), | ||
LabelColumnName = nameof(MatrixElement.Value), | ||
NumIterations = 10, | ||
NumThreads = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Please copy my comment on NumThread. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MatrixRowIndexColumnName = nameof(MatrixElement.MatrixRowIndex), | ||
LabelColumnName = nameof(MatrixElement.Value), | ||
NumIterations = 100, | ||
NumThreads = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May we have my old comment back? :) #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LabelColumnName = nameof(MatrixElement.Value), | ||
LossFunction = MatrixFactorizationTrainer.LossFunctionType.SquareLossOneClass, | ||
NumIterations = 100, | ||
NumThreads = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing my old comment. #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor comments. Overall LGTM.
Codecov Report
@@ Coverage Diff @@
## master #2204 +/- ##
=======================================
Coverage 69.78% 69.78%
=======================================
Files 786 786
Lines 143945 143945
Branches 16648 16642 -6
=======================================
Hits 100451 100451
+ Misses 38951 38949 -2
- Partials 4543 4545 +2
|
|
||
/// <summary> | ||
/// The <see cref="TrainerInfo"/> contains general parameters for this trainer. | ||
/// </summary> | ||
public override TrainerInfo Info { get; } | ||
|
||
/// <summary> | ||
/// Legacy constructor initializing a new instance of <see cref="MatrixFactorizationTrainer"/> through the legacy | ||
/// <see cref="Arguments"/> class. | ||
/// Constructor initializing a new instance of <see cref="MatrixFactorizationTrainer"/> through the <see cref="Options"/> class. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constructor initializing [](start = 12, length = 24)
replace with "Initializes".
That seems to be standard for .net docs for ctors. #Resolved
/// <param name="args">An instance of the legacy <see cref="Arguments"/> to apply advanced parameters to the algorithm.</param> | ||
private MatrixFactorizationTrainer(IHostEnvironment env, Arguments args) : base(env, LoadNameValue) | ||
/// <param name="options">An instance of <see cref="Options"/> to apply advanced parameters to the algorithm.</param> | ||
internal MatrixFactorizationTrainer(IHostEnvironment env, Options options) : base(env, LoadNameValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
internal [](start = 8, length = 8)
think @Ivanidzo4ka asked for those marked with [BestFriend] #Resolved
/// </para> | ||
/// </remarks> | ||
/// <param name="options">Advanced arguments to the algorithm.</param> | ||
public MatrixFactorizationTrainer MatrixFactorization( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public MatrixFactorizationTrainer MatrixFactorization [](start = 9, length = 56)
please link to the Matrix factorization sample.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Towards #1798 .
This PR addresses the following algos
The following changes have been made:
public
extension methods, one for simple arguments and the other for advanced optionsinternal
. Also a few other fields have been madeinternal
Options
for API consistency.