servo/notebooks/decision.ipynb

79 lines
1.7 KiB
Text
Raw Normal View History

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"source": [
"#r \"nuget:Microsoft.ML\"\n",
"#r \"nuget:Microsoft.ML.AutoML\""
],
"outputs": []
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"source": [
"using Microsoft.ML;\n",
"using Microsoft.ML.Data;\n",
"using Microsoft.ML.AutoML;\n",
"using System.IO;"
],
"outputs": []
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"source": [
"class NeedsInput {\n",
" [LoadColumn(0)] public string Action { get; set; }\n",
" [LoadColumn(1)] public string Need { get; set; }\n",
" [LoadColumn(2,3)] public float[] Threshold { get; set; }\n",
"}\n",
"\n",
"class NeedsOutput {\n",
" public int Score { get; set; }\n",
"}"
],
"outputs": []
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"source": [
"var dataPath = Path.Combine(Environment.CurrentDirectory, \"data\", \"choice.csv\");"
],
"outputs": []
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"source": [
"var ctx = new MLContext();\n",
"var trainingData = ctx.Data.LoadFromTextFile<NeedsInput>(dataPath, hasHeader: true);\n",
"var recSettings = new RecommendationExperimentSettings();"
],
"outputs": []
}
],
"metadata": {
"kernelspec": {
"display_name": ".NET (C#)",
"language": "C#",
"name": ".net-csharp"
},
"language_info": {
"file_extension": ".cs",
"mimetype": "text/x-csharp",
"name": "C#",
"pygments_lexer": "csharp",
"version": "8.0"
}
},
"nbformat": 4,
"nbformat_minor": 4
}