-
Notifications
You must be signed in to change notification settings - Fork 1.9k
API reference - Finalize the template for trainer samples #3160
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
Comments
What's the desired position of in-memory data structures? Before |
I added the position to the template: For reference papers, please add a snippet so that I know what you mean. |
I think we should also add reading the model parameters. There has been asks for it. |
Are model parameters available for all trainers or just some? Do they change per ML task, or trainer family (linear, tree, etc). Could you please post a snippet here? |
Here is some reference paper of matrix factorization in ML.NET:
|
Showing model parameters will be too much for a trainer's first example. However, inspecting models is definitely important, so I'd suggest to have at least two example files per trainer. |
@wschin could you please provide snippets for the second example you want? |
Sure. I got one from a test. /// <summary>
/// Introspective Training: Linear model parameters may be inspected.
/// </summary>
[Fact]
public void InpsectLinearModelParameters()
{
// ...
// Prepare a linear model and data by reusing code in the first example.
// ...
// Train the model.
var model = pipeline.Fit(data);
// Extract the linear model from the pipeline.
var linearModel = model.Model;
// Get the model bias and weights.
var bias = linearModel.Bias;
var weights = linearModel.Weights;
// Print coefficient of each feature and show the computation of score using bias and weights.
// ...
} The key differentiator between this example and the first example is that
In this example, the need of adding papers will be even stronger, because in general, we are not able to cover every math bit in code. If papers are added, we also need to make sure the symbols in code are linked with their associated symbols in papers; for example, // This is the linear coefficient vector denoted by \boldsymbol{w} in reference [1]
var weights = linearModel.Weights; |
Our current template for trainer API reference samples is as follows:
Below are some examples:
Other samples will be added using this template. If you want to make any changes please mention them here so that we can finalize the sample.
/cc @shauheen @glebuk
The text was updated successfully, but these errors were encountered: