Temporarily removed Visual Studio solution

- WIP decision engine
- Redesigned choice dataset
- Moved data, images and models folders into notebooks directory for easier eaccess
This commit is contained in:
Tony Bark 2020-12-04 16:59:17 -05:00
parent 31024f9fc5
commit 929b96b07b
16 changed files with 114 additions and 761 deletions

View file

@ -0,0 +1,3 @@
Action,Need,Min,Max
Refrigerator,Hunger,10,30
Toy,Fun,60,70
1 Action Need Min Max
2 Refrigerator Hunger 10 30
3 Toy Fun 60 70

79
notebooks/decision.ipynb Normal file
View file

@ -0,0 +1,79 @@
{
"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
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View file

View file

@ -6,7 +6,7 @@
"source": [
"# Motive Engine\n",
"\n",
"![](../images/v3_slide0094_image039.gif)\n",
"![](images/v3_slide0094_image039.gif)\n",
"\n",
"The Motive Engine is based on opposing weights. An object signals it's presence if the Sim's need is low. The need is the motive and that drives a Sims' decision. All games in the franchise are based on this dynamic at it's core. For example, if hunger is low then the fridge's presence is high and vice versa. A Sim's mood is the sum of the current state of their motives. They will only choose the fridge if it increases it's overall mood. The ML portion comes in deciding which has the priority.\n",
"\n",
@ -18,7 +18,15 @@
"execution_count": 1,
"metadata": {},
"source": [
"using System;\n",
"#r \"nuget:Microsoft.ML\""
],
"outputs": []
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"source": [
"using System.Linq;"
],
"outputs": []
@ -76,10 +84,8 @@
" public int Environment { get; set; }\n",
" public int Social { get; set; }\n",
"\n",
" /// <summary>\n",
" /// The mood is the sum of all the motives.\n",
" /// It deteremines the best course of action.\n",
" /// </summary>\n",
" // The mood is the sum of all the motives.\n",
" // It deteremines the best course of action.\n",
" public int Mood\n",
" {\n",
" get\n",
@ -174,6 +180,7 @@
"source": [
"// Run this first\n",
"var rng = new Random();\n",
"\n",
"var motives = new Motives(hunger: rng.Next(MAX_MOTIVE), \n",
"bladder: rng.Next(MAX_MOTIVE), fun: rng.Next(MAX_MOTIVE), \n",
"energy: rng.Next(MAX_MOTIVE), environment: rng.Next(MAX_MOTIVE), \n",
@ -190,6 +197,8 @@
"source": [
"// Run this next\n",
"var newRng = new Random();\n",
"\n",
"// Minimum random number is whatever the current motive is\n",
"motives.ChangeHunger(newRng.Next(motives.Hunger, MAX_MOTIVE));\n",
"motives.ChangeFun(newRng.Next(motives.Fun, MAX_MOTIVE));\n",
"motives.ChangeSocial(newRng.Next(motives.Social, MAX_MOTIVE));\n",