Skip to content

Use inline training data in generated Console Project file. - #4907

Merged
LittleLittleCloud merged 5 commits into
dotnet:masterfrom
LittleLittleCloud:u/xiaoyun/InlineDataInCodeGen
Mar 3, 2020
Merged

Use inline training data in generated Console Project file.#4907
LittleLittleCloud merged 5 commits into
dotnet:masterfrom
LittleLittleCloud:u/xiaoyun/InlineDataInCodeGen

Conversation

@LittleLittleCloud

@LittleLittleCloud LittleLittleCloud commented Mar 3, 2020

Copy link
Copy Markdown
Member

Code Sample

// This file was auto-generated by ML.NET Model Builder. 

using System;
using SampleRecommendation.Model;

namespace SampleRecommendation.ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create single instance of sample data from first line of dataset for model input
            ModelInput sampleData = new ModelInput()
            {
                UserId = 1,
                MovieId = 1,
                Timestamp = 9.649827E+08F,
            };

            // Make a single prediction on the sample data and print results
            var predictionResult = ConsumeModel.Predict(sampleData);

            Console.WriteLine("Using model to make single prediction -- Comparing actual Rating with predicted Rating from sample data...\n\n");
            Console.WriteLine($"userId: {sampleData.UserId}");
            Console.WriteLine($"movieId: {sampleData.MovieId}");
            Console.WriteLine($"timestamp: {sampleData.Timestamp}");
            Console.WriteLine($"\n\nActual Rating: {sampleData.Rating} \nPredicted Rating: {predictionResult.Score}\n\n");
            Console.WriteLine("=============== End of process, hit any key to finish ===============");
            Console.ReadKey();
        }
    }
}

Fix issue

@LittleLittleCloud LittleLittleCloud added the AutoML.NET Automating various steps of the machine learning process label Mar 3, 2020
@LittleLittleCloud
LittleLittleCloud requested a review from a team as a code owner March 3, 2020 00:41
options.LabelColumnName = columnInfo.LabelColumnName;
options.MatrixColumnIndexColumnName = columnInfo.UserIdColumnName;
options.MatrixRowIndexColumnName = columnInfo.ItemIdColumnName;
options.Quiet = true;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for quite the verbose output from MatrixFactorization trainer

INT = 2,
DOUBLE = 1.2,
FLOAT = 1.223E+10F,
TrickySTR = "ab\"\';@#$%^&-++==",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some others to test:

  • Single.NaN
  • Single.PositiveInfinity
  • "" (empty string)
  • 1 (as boolean)
  • "T" (as boolean)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@LittleLittleCloud
LittleLittleCloud merged commit 5db5127 into dotnet:master Mar 3, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

AutoML.NET Automating various steps of the machine learning process

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants