diff --git a/DATA-LICENSE b/DATA-LICENSE
new file mode 100644
index 0000000..e6e27e4
--- /dev/null
+++ b/DATA-LICENSE
@@ -0,0 +1,540 @@
+## ODC Open Database License (ODbL)
+
+### Preamble
+
+The Open Database License (ODbL) is a license agreement intended to
+allow users to freely share, modify, and use this Database while
+maintaining this same freedom for others. Many databases are covered by
+copyright, and therefore this document licenses these rights. Some
+jurisdictions, mainly in the European Union, have specific rights that
+cover databases, and so the ODbL addresses these rights, too. Finally,
+the ODbL is also an agreement in contract for users of this Database to
+act in certain ways in return for accessing this Database.
+
+Databases can contain a wide variety of types of content (images,
+audiovisual material, and sounds all in the same database, for example),
+and so the ODbL only governs the rights over the Database, and not the
+contents of the Database individually. Licensors should use the ODbL
+together with another license for the contents, if the contents have a
+single set of rights that uniformly covers all of the contents. If the
+contents have multiple sets of different rights, Licensors should
+describe what rights govern what contents together in the individual
+record or in some other way that clarifies what rights apply.
+
+Sometimes the contents of a database, or the database itself, can be
+covered by other rights not addressed here (such as private contracts,
+trade mark over the name, or privacy rights / data protection rights
+over information in the contents), and so you are advised that you may
+have to consult other documents or clear other rights before doing
+activities not covered by this License.
+
+------
+
+The Licensor (as defined below)
+
+and
+
+You (as defined below)
+
+agree as follows:
+
+### 1.0 Definitions of Capitalised Words
+
+"Collective Database" - Means this Database in unmodified form as part
+of a collection of independent databases in themselves that together are
+assembled into a collective whole. A work that constitutes a Collective
+Database will not be considered a Derivative Database.
+
+"Convey" - As a verb, means Using the Database, a Derivative Database,
+or the Database as part of a Collective Database in any way that enables
+a Person to make or receive copies of the Database or a Derivative
+Database. Conveying does not include interaction with a user through a
+computer network, or creating and Using a Produced Work, where no
+transfer of a copy of the Database or a Derivative Database occurs.
+"Contents" - The contents of this Database, which includes the
+information, independent works, or other material collected into the
+Database. For example, the contents of the Database could be factual
+data or works such as images, audiovisual material, text, or sounds.
+
+"Database" - A collection of material (the Contents) arranged in a
+systematic or methodical way and individually accessible by electronic
+or other means offered under the terms of this License.
+
+"Database Directive" - Means Directive 96/9/EC of the European
+Parliament and of the Council of 11 March 1996 on the legal protection
+of databases, as amended or succeeded.
+
+"Database Right" - Means rights resulting from the Chapter III ("sui
+generis") rights in the Database Directive (as amended and as transposed
+by member states), which includes the Extraction and Re-utilisation of
+the whole or a Substantial part of the Contents, as well as any similar
+rights available in the relevant jurisdiction under Section 10.4.
+
+"Derivative Database" - Means a database based upon the Database, and
+includes any translation, adaptation, arrangement, modification, or any
+other alteration of the Database or of a Substantial part of the
+Contents. This includes, but is not limited to, Extracting or
+Re-utilising the whole or a Substantial part of the Contents in a new
+Database.
+
+"Extraction" - Means the permanent or temporary transfer of all or a
+Substantial part of the Contents to another medium by any means or in
+any form.
+
+"License" - Means this license agreement and is both a license of rights
+such as copyright and Database Rights and an agreement in contract.
+
+"Licensor" - Means the Person that offers the Database under the terms
+of this License.
+
+"Person" - Means a natural or legal person or a body of persons
+corporate or incorporate.
+
+"Produced Work" - a work (such as an image, audiovisual material, text,
+or sounds) resulting from using the whole or a Substantial part of the
+Contents (via a search or other query) from this Database, a Derivative
+Database, or this Database as part of a Collective Database.
+
+"Publicly" - means to Persons other than You or under Your control by
+either more than 50% ownership or by the power to direct their
+activities (such as contracting with an independent consultant).
+
+"Re-utilisation" - means any form of making available to the public all
+or a Substantial part of the Contents by the distribution of copies, by
+renting, by online or other forms of transmission.
+
+"Substantial" - Means substantial in terms of quantity or quality or a
+combination of both. The repeated and systematic Extraction or
+Re-utilisation of insubstantial parts of the Contents may amount to the
+Extraction or Re-utilisation of a Substantial part of the Contents.
+
+"Use" - As a verb, means doing any act that is restricted by copyright
+or Database Rights whether in the original medium or any other; and
+includes without limitation distributing, copying, publicly performing,
+publicly displaying, and preparing derivative works of the Database, as
+well as modifying the Database as may be technically necessary to use it
+in a different mode or format.
+
+"You" - Means a Person exercising rights under this License who has not
+previously violated the terms of this License with respect to the
+Database, or who has received express permission from the Licensor to
+exercise rights under this License despite a previous violation.
+
+Words in the singular include the plural and vice versa.
+
+### 2.0 What this License covers
+
+2.1. Legal effect of this document. This License is:
+
+ a. A license of applicable copyright and neighbouring rights;
+
+ b. A license of the Database Right; and
+
+ c. An agreement in contract between You and the Licensor.
+
+2.2 Legal rights covered. This License covers the legal rights in the
+Database, including:
+
+ a. Copyright. Any copyright or neighbouring rights in the Database.
+ The copyright licensed includes any individual elements of the
+ Database, but does not cover the copyright over the Contents
+ independent of this Database. See Section 2.4 for details. Copyright
+ law varies between jurisdictions, but is likely to cover: the Database
+ model or schema, which is the structure, arrangement, and organisation
+ of the Database, and can also include the Database tables and table
+ indexes; the data entry and output sheets; and the Field names of
+ Contents stored in the Database;
+
+ b. Database Rights. Database Rights only extend to the Extraction and
+ Re-utilisation of the whole or a Substantial part of the Contents.
+ Database Rights can apply even when there is no copyright over the
+ Database. Database Rights can also apply when the Contents are removed
+ from the Database and are selected and arranged in a way that would
+ not infringe any applicable copyright; and
+
+ c. Contract. This is an agreement between You and the Licensor for
+ access to the Database. In return you agree to certain conditions of
+ use on this access as outlined in this License.
+
+2.3 Rights not covered.
+
+ a. This License does not apply to computer programs used in the making
+ or operation of the Database;
+
+ b. This License does not cover any patents over the Contents or the
+ Database; and
+
+ c. This License does not cover any trademarks associated with the
+ Database.
+
+2.4 Relationship to Contents in the Database. The individual items of
+the Contents contained in this Database may be covered by other rights,
+including copyright, patent, data protection, privacy, or personality
+rights, and this License does not cover any rights (other than Database
+Rights or in contract) in individual Contents contained in the Database.
+For example, if used on a Database of images (the Contents), this
+License would not apply to copyright over individual images, which could
+have their own separate licenses, or one single license covering all of
+the rights over the images.
+
+### 3.0 Rights granted
+
+3.1 Subject to the terms and conditions of this License, the Licensor
+grants to You a worldwide, royalty-free, non-exclusive, terminable (but
+only under Section 9) license to Use the Database for the duration of
+any applicable copyright and Database Rights. These rights explicitly
+include commercial use, and do not exclude any field of endeavour. To
+the extent possible in the relevant jurisdiction, these rights may be
+exercised in all media and formats whether now known or created in the
+future.
+
+The rights granted cover, for example:
+
+ a. Extraction and Re-utilisation of the whole or a Substantial part of
+ the Contents;
+
+ b. Creation of Derivative Databases;
+
+ c. Creation of Collective Databases;
+
+ d. Creation of temporary or permanent reproductions by any means and
+ in any form, in whole or in part, including of any Derivative
+ Databases or as a part of Collective Databases; and
+
+ e. Distribution, communication, display, lending, making available, or
+ performance to the public by any means and in any form, in whole or in
+ part, including of any Derivative Database or as a part of Collective
+ Databases.
+
+3.2 Compulsory license schemes. For the avoidance of doubt:
+
+ a. Non-waivable compulsory license schemes. In those jurisdictions in
+ which the right to collect royalties through any statutory or
+ compulsory licensing scheme cannot be waived, the Licensor reserves
+ the exclusive right to collect such royalties for any exercise by You
+ of the rights granted under this License;
+
+ b. Waivable compulsory license schemes. In those jurisdictions in
+ which the right to collect royalties through any statutory or
+ compulsory licensing scheme can be waived, the Licensor waives the
+ exclusive right to collect such royalties for any exercise by You of
+ the rights granted under this License; and,
+
+ c. Voluntary license schemes. The Licensor waives the right to collect
+ royalties, whether individually or, in the event that the Licensor is
+ a member of a collecting society that administers voluntary licensing
+ schemes, via that society, from any exercise by You of the rights
+ granted under this License.
+
+3.3 The right to release the Database under different terms, or to stop
+distributing or making available the Database, is reserved. Note that
+this Database may be multiple-licensed, and so You may have the choice
+of using alternative licenses for this Database. Subject to Section
+10.4, all other rights not expressly granted by Licensor are reserved.
+
+### 4.0 Conditions of Use
+
+4.1 The rights granted in Section 3 above are expressly made subject to
+Your complying with the following conditions of use. These are important
+conditions of this License, and if You fail to follow them, You will be
+in material breach of its terms.
+
+4.2 Notices. If You Publicly Convey this Database, any Derivative
+Database, or the Database as part of a Collective Database, then You
+must:
+
+ a. Do so only under the terms of this License or another license
+ permitted under Section 4.4;
+
+ b. Include a copy of this License (or, as applicable, a license
+ permitted under Section 4.4) or its Uniform Resource Identifier (URI)
+ with the Database or Derivative Database, including both in the
+ Database or Derivative Database and in any relevant documentation; and
+
+ c. Keep intact any copyright or Database Right notices and notices
+ that refer to this License.
+
+ d. If it is not possible to put the required notices in a particular
+ file due to its structure, then You must include the notices in a
+ location (such as a relevant directory) where users would be likely to
+ look for it.
+
+4.3 Notice for using output (Contents). Creating and Using a Produced
+Work does not require the notice in Section 4.2. However, if you
+Publicly Use a Produced Work, You must include a notice associated with
+the Produced Work reasonably calculated to make any Person that uses,
+views, accesses, interacts with, or is otherwise exposed to the Produced
+Work aware that Content was obtained from the Database, Derivative
+Database, or the Database as part of a Collective Database, and that it
+is available under this License.
+
+ a. Example notice. The following text will satisfy notice under
+ Section 4.3:
+
+ Contains information from DATABASE NAME, which is made available
+ here under the Open Database License (ODbL).
+
+DATABASE NAME should be replaced with the name of the Database and a
+hyperlink to the URI of the Database. "Open Database License" should
+contain a hyperlink to the URI of the text of this License. If
+hyperlinks are not possible, You should include the plain text of the
+required URI's with the above notice.
+
+4.4 Share alike.
+
+ a. Any Derivative Database that You Publicly Use must be only under
+ the terms of:
+
+ i. This License;
+
+ ii. A later version of this License similar in spirit to this
+ License; or
+
+ iii. A compatible license.
+
+ If You license the Derivative Database under one of the licenses
+ mentioned in (iii), You must comply with the terms of that license.
+
+ b. For the avoidance of doubt, Extraction or Re-utilisation of the
+ whole or a Substantial part of the Contents into a new database is a
+ Derivative Database and must comply with Section 4.4.
+
+ c. Derivative Databases and Produced Works. A Derivative Database is
+ Publicly Used and so must comply with Section 4.4. if a Produced Work
+ created from the Derivative Database is Publicly Used.
+
+ d. Share Alike and additional Contents. For the avoidance of doubt,
+ You must not add Contents to Derivative Databases under Section 4.4 a
+ that are incompatible with the rights granted under this License.
+
+ e. Compatible licenses. Licensors may authorise a proxy to determine
+ compatible licenses under Section 4.4 a iii. If they do so, the
+ authorised proxy's public statement of acceptance of a compatible
+ license grants You permission to use the compatible license.
+
+
+4.5 Limits of Share Alike. The requirements of Section 4.4 do not apply
+in the following:
+
+ a. For the avoidance of doubt, You are not required to license
+ Collective Databases under this License if You incorporate this
+ Database or a Derivative Database in the collection, but this License
+ still applies to this Database or a Derivative Database as a part of
+ the Collective Database;
+
+ b. Using this Database, a Derivative Database, or this Database as
+ part of a Collective Database to create a Produced Work does not
+ create a Derivative Database for purposes of Section 4.4; and
+
+ c. Use of a Derivative Database internally within an organisation is
+ not to the public and therefore does not fall under the requirements
+ of Section 4.4.
+
+4.6 Access to Derivative Databases. If You Publicly Use a Derivative
+Database or a Produced Work from a Derivative Database, You must also
+offer to recipients of the Derivative Database or Produced Work a copy
+in a machine readable form of:
+
+ a. The entire Derivative Database; or
+
+ b. A file containing all of the alterations made to the Database or
+ the method of making the alterations to the Database (such as an
+ algorithm), including any additional Contents, that make up all the
+ differences between the Database and the Derivative Database.
+
+The Derivative Database (under a.) or alteration file (under b.) must be
+available at no more than a reasonable production cost for physical
+distributions and free of charge if distributed over the internet.
+
+4.7 Technological measures and additional terms
+
+ a. This License does not allow You to impose (except subject to
+ Section 4.7 b.) any terms or any technological measures on the
+ Database, a Derivative Database, or the whole or a Substantial part of
+ the Contents that alter or restrict the terms of this License, or any
+ rights granted under it, or have the effect or intent of restricting
+ the ability of any person to exercise those rights.
+
+ b. Parallel distribution. You may impose terms or technological
+ measures on the Database, a Derivative Database, or the whole or a
+ Substantial part of the Contents (a "Restricted Database") in
+ contravention of Section 4.74 a. only if You also make a copy of the
+ Database or a Derivative Database available to the recipient of the
+ Restricted Database:
+
+ i. That is available without additional fee;
+
+ ii. That is available in a medium that does not alter or restrict
+ the terms of this License, or any rights granted under it, or have
+ the effect or intent of restricting the ability of any person to
+ exercise those rights (an "Unrestricted Database"); and
+
+ iii. The Unrestricted Database is at least as accessible to the
+ recipient as a practical matter as the Restricted Database.
+
+ c. For the avoidance of doubt, You may place this Database or a
+ Derivative Database in an authenticated environment, behind a
+ password, or within a similar access control scheme provided that You
+ do not alter or restrict the terms of this License or any rights
+ granted under it or have the effect or intent of restricting the
+ ability of any person to exercise those rights.
+
+4.8 Licensing of others. You may not sublicense the Database. Each time
+You communicate the Database, the whole or Substantial part of the
+Contents, or any Derivative Database to anyone else in any way, the
+Licensor offers to the recipient a license to the Database on the same
+terms and conditions as this License. You are not responsible for
+enforcing compliance by third parties with this License, but You may
+enforce any rights that You have over a Derivative Database. You are
+solely responsible for any modifications of a Derivative Database made
+by You or another Person at Your direction. You may not impose any
+further restrictions on the exercise of the rights granted or affirmed
+under this License.
+
+### 5.0 Moral rights
+
+5.1 Moral rights. This section covers moral rights, including any rights
+to be identified as the author of the Database or to object to treatment
+that would otherwise prejudice the author's honour and reputation, or
+any other derogatory treatment:
+
+ a. For jurisdictions allowing waiver of moral rights, Licensor waives
+ all moral rights that Licensor may have in the Database to the fullest
+ extent possible by the law of the relevant jurisdiction under Section
+ 10.4;
+
+ b. If waiver of moral rights under Section 5.1 a in the relevant
+ jurisdiction is not possible, Licensor agrees not to assert any moral
+ rights over the Database and waives all claims in moral rights to the
+ fullest extent possible by the law of the relevant jurisdiction under
+ Section 10.4; and
+
+ c. For jurisdictions not allowing waiver or an agreement not to assert
+ moral rights under Section 5.1 a and b, the author may retain their
+ moral rights over certain aspects of the Database.
+
+Please note that some jurisdictions do not allow for the waiver of moral
+rights, and so moral rights may still subsist over the Database in some
+jurisdictions.
+
+### 6.0 Fair dealing, Database exceptions, and other rights not affected
+
+6.1 This License does not affect any rights that You or anyone else may
+independently have under any applicable law to make any use of this
+Database, including without limitation:
+
+ a. Exceptions to the Database Right including: Extraction of Contents
+ from non-electronic Databases for private purposes, Extraction for
+ purposes of illustration for teaching or scientific research, and
+ Extraction or Re-utilisation for public security or an administrative
+ or judicial procedure.
+
+ b. Fair dealing, fair use, or any other legally recognised limitation
+ or exception to infringement of copyright or other applicable laws.
+
+6.2 This License does not affect any rights of lawful users to Extract
+and Re-utilise insubstantial parts of the Contents, evaluated
+quantitatively or qualitatively, for any purposes whatsoever, including
+creating a Derivative Database (subject to other rights over the
+Contents, see Section 2.4). The repeated and systematic Extraction or
+Re-utilisation of insubstantial parts of the Contents may however amount
+to the Extraction or Re-utilisation of a Substantial part of the
+Contents.
+
+### 7.0 Warranties and Disclaimer
+
+7.1 The Database is licensed by the Licensor "as is" and without any
+warranty of any kind, either express, implied, or arising by statute,
+custom, course of dealing, or trade usage. Licensor specifically
+disclaims any and all implied warranties or conditions of title,
+non-infringement, accuracy or completeness, the presence or absence of
+errors, fitness for a particular purpose, merchantability, or otherwise.
+Some jurisdictions do not allow the exclusion of implied warranties, so
+this exclusion may not apply to You.
+
+### 8.0 Limitation of liability
+
+8.1 Subject to any liability that may not be excluded or limited by law,
+the Licensor is not liable for, and expressly excludes, all liability
+for loss or damage however and whenever caused to anyone by any use
+under this License, whether by You or by anyone else, and whether caused
+by any fault on the part of the Licensor or not. This exclusion of
+liability includes, but is not limited to, any special, incidental,
+consequential, punitive, or exemplary damages such as loss of revenue,
+data, anticipated profits, and lost business. This exclusion applies
+even if the Licensor has been advised of the possibility of such
+damages.
+
+8.2 If liability may not be excluded by law, it is limited to actual and
+direct financial loss to the extent it is caused by proved negligence on
+the part of the Licensor.
+
+### 9.0 Termination of Your rights under this License
+
+9.1 Any breach by You of the terms and conditions of this License
+automatically terminates this License with immediate effect and without
+notice to You. For the avoidance of doubt, Persons who have received the
+Database, the whole or a Substantial part of the Contents, Derivative
+Databases, or the Database as part of a Collective Database from You
+under this License will not have their licenses terminated provided
+their use is in full compliance with this License or a license granted
+under Section 4.8 of this License. Sections 1, 2, 7, 8, 9 and 10 will
+survive any termination of this License.
+
+9.2 If You are not in breach of the terms of this License, the Licensor
+will not terminate Your rights under it.
+
+9.3 Unless terminated under Section 9.1, this License is granted to You
+for the duration of applicable rights in the Database.
+
+9.4 Reinstatement of rights. If you cease any breach of the terms and
+conditions of this License, then your full rights under this License
+will be reinstated:
+
+ a. Provisionally and subject to permanent termination until the 60th
+ day after cessation of breach;
+
+ b. Permanently on the 60th day after cessation of breach unless
+ otherwise reasonably notified by the Licensor; or
+
+ c. Permanently if reasonably notified by the Licensor of the
+ violation, this is the first time You have received notice of
+ violation of this License from the Licensor, and You cure the
+ violation prior to 30 days after your receipt of the notice.
+
+Persons subject to permanent termination of rights are not eligible to
+be a recipient and receive a license under Section 4.8.
+
+9.5 Notwithstanding the above, Licensor reserves the right to release
+the Database under different license terms or to stop distributing or
+making available the Database. Releasing the Database under different
+license terms or stopping the distribution of the Database will not
+withdraw this License (or any other license that has been, or is
+required to be, granted under the terms of this License), and this
+License will continue in full force and effect unless terminated as
+stated above.
+
+### 10.0 General
+
+10.1 If any provision of this License is held to be invalid or
+unenforceable, that must not affect the validity or enforceability of
+the remainder of the terms and conditions of this License and each
+remaining provision of this License shall be valid and enforced to the
+fullest extent permitted by law.
+
+10.2 This License is the entire agreement between the parties with
+respect to the rights granted here over the Database. It replaces any
+earlier understandings, agreements or representations with respect to
+the Database.
+
+10.3 If You are in breach of the terms of this License, You will not be
+entitled to rely on the terms of this License or to complain of any
+breach by the Licensor.
+
+10.4 Choice of law. This License takes effect in and will be governed by
+the laws of the relevant jurisdiction in which the License terms are
+sought to be enforced. If the standard suite of rights granted under
+applicable copyright law and Database Rights in the relevant
+jurisdiction includes additional rights not granted under this License,
+these additional rights are granted in this License in order to meet the
+terms of this License.
\ No newline at end of file
diff --git a/README.md b/README.md
index a28a260..cc1bdc3 100644
--- a/README.md
+++ b/README.md
@@ -1,15 +1,9 @@
# Servo
-Servo is a experimental re-implementation of SimAntics using ML.NET based on [Under the hood of The Sims](https://users.cs.northwestern.edu/~forbus/c95-gd/lectures/The_Sims_Under_the_Hood_files/v3_document.htm). I have wanted to write my own version of SimAntics for a while but the process of rewriting the engine from scratch pr even maintaining an existing re-implementation, such as FreeSO's, has proven to be tedious. Current machine learning technologies, such as ML.NET, can streamline the process.
+[](https://www.gnu.org/licenses/gpl-3.0) [](https://opendatacommons.org/licenses/odbl/)
-That being said, Servo is not intended to be used to rewrite The Sims itself. The models are intended for building new games based on it's design.
-
-## Motive Engine
-
-SimAntics is based on opposing weights. An object signals it's presence if the Sims' 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.
-
-The sum of all the Sims' needs is it's mood. A Sim will only choose the fridge if it increases it's overall mood. The individual needs is the classification while the mood is the prediction.
+Servo is a experimental re-implementation of SimAntics using ML.NET based on [Under the Hood of The Sims](https://users.cs.northwestern.edu/~forbus/c95-gd/lectures/The_Sims_Under_the_Hood_files/v3_document.htm). I have wanted to write my own version of SimAntics for a while but the process of rewriting the engine from scratch or even maintaining an existing re-implementation, such as FreeSO's, has proven to be tedious. Current machine learning technologies, such as ML.NET, can streamline the process. That being said, Servo is not intended to be used to rewrite The Sims itself. The models are intended for building new games based on it's design.
## License
-I license this project under the GNU GPL v3 - see the [LICENSE](LICENSE) file for details.
+I license the source code for this project under the GNU GPL v3, see [LICENSE](LICENSE), and data sets under the Open Database License, see [DATA-LICENSE](DATA-LICENSE).
diff --git a/dataset/motives.csv b/dataset/motives.csv
new file mode 100644
index 0000000..b4ab89a
--- /dev/null
+++ b/dataset/motives.csv
@@ -0,0 +1,80 @@
+Need,Motive,Mood
+1,-1
+-56,56
+-5,5,
+50,-50
+64,-64
+-39,39
+-24,24
+-12,12
+39,-39
+-25,25
+-44,44
+-61,61
+46,-46
+-49,49
+53,-53
+-32,32
+38,-38
+52,-52
+83,-83
+27,-27
+-54,-54
+-23,23
+-68,68
+58,-58
+22,-22
+-46,46
+1,-1
+-26,26
+37,-35
+17,-17
+-34,34
+-1,1
+-16,16
+-13,13
+-71,71
+55,-55
+59,-59
+-52,52
+-76,76
+-33,33
+-37,37
+-50,50
+-65,65
+74,-74
+76,76
+-51,51
+-42,42
+80,-80
+-59,59
+100,-100
+96,-96
+37,-37
+-100,100
+-55,55
+4,-4
+65,-65
+63,-63
+-48,48
+-18,18
+-75,75
+43,-43
+51,-51
+30,30
+33,-33
+-81,81
+-30,30
+29,-29
+28,-28
+79,-79
+61,-61
+-40,40
+91,-91
+41,-41
+20,-20
+-98,98
+-93,93
+68,-68
+35,-35
+-82,82
\ No newline at end of file
diff --git a/dataset/needs-dev.csv b/dataset/needs-dev.csv
deleted file mode 100644
index 3698f8b..0000000
--- a/dataset/needs-dev.csv
+++ /dev/null
@@ -1,43 +0,0 @@
-Need,Percentage,Weight
-Bladder,-24,+24
-Bladder,+58,-58
-Bladder,-24,+24
-Bladder,-54,-54
-Bladder,+55,-55
-Bladder,-42,+42
-Bladder,-30,+30
-Hunger,-34,+34
-Hunger,-25,+25
-Hunger,+37,-35
-Hunger,+27,-27
-Hunger,-50,+50
-Hunger,+64,-64
-Hunger,-59,+59
-Social,+29,-29
-Social,-52,+52
-Social,+38,-38
-Social,+50,-50
-Social,-44,+44
-Social,+20,-20
-Social,-55,+55
-Fun,-52,+52
-Fun,+35,-35
-Fun,-26,+26
-Fun,+46,-46
-Fun,-40,+40
-Fun,+51,-51
-Fun,-24,+24
-Energy,-32,+32
-Energy,+43,-43
-Energy,-40,+40
-Energy,+59,-59
-Energy,-30,+30
-Energy,+46,-46
-Energy,-68,+68
-Hygiene,+33,-33
-Hygiene,-68,+68
-Hygiene,-61,+61
-Hygiene,+68,-68
-Hygiene,+22,-22
-Hygiene,-39,+39
-Hygiene,+53,-53
diff --git a/dataset/needs.csv b/dataset/needs.csv
deleted file mode 100644
index 78c4317..0000000
--- a/dataset/needs.csv
+++ /dev/null
@@ -1,43 +0,0 @@
-Need,Percentage,Weight
-Energy,-30,+30
-Hygiene,-39,+39
-Hunger,+27,-27
-Social,+29,-29
-Fun,-26,+26
-Energy,-32,+32
-Bladder,+55,-55
-Social,-55,+55
-Fun,-24,+24
-Bladder,-30,+30
-Social,-44,+44
-Fun,-52,+52
-Energy,-68,+68
-Hunger,-59,+59
-Bladder,-42,+42
-Energy,+43,-43
-Social,+20,-20
-Energy,-40,+40
-Bladder,+58,-58
-Hygiene,+33,-33
-Social,+38,-38
-Social,+50,-50
-Hygiene,+53,-53
-Bladder,-24,+24
-Hygiene,+68,-68
-Fun,+46,-46
-Hunger,+64,-64
-Hunger,+37,-35
-Hunger,-50,+50
-Energy,+46,-46
-Bladder,-24,+24
-Hygiene,-61,+61
-Social,-52,+52
-Fun,+51,-51
-Hygiene,+22,-22
-Hunger,-25,+25
-Bladder,-54,-54
-Fun,-40,+40
-Energy,+59,-59
-Hunger,-34,+34
-Hygiene,-68,+68
-Fun,+35,-35
\ No newline at end of file
diff --git a/dataset/objects.csv b/dataset/objects.csv
new file mode 100644
index 0000000..2cd0d09
--- /dev/null
+++ b/dataset/objects.csv
@@ -0,0 +1,20 @@
+Computer,Fun
+Video Game,Fun
+Phone,Social
+Food Processor,Hunger
+Coffeemaker,Hunger
+Shower,Hygiene
+Sim,Social
+Dishwasher,Environment
+Microwave,Hunger
+TV,Fun
+Computer,Social
+Garbage Can,Environment
+Trash Compactor,Environment
+Stereo,Fun
+Chair,Comfort
+Bed,Comfort
+Stool,Comfort
+Toilet,Bladder
+Toy,Fun
+Plant,Environment
\ No newline at end of file
diff --git a/images/v3_slide0094_image039.gif b/images/v3_slide0094_image039.gif
new file mode 100644
index 0000000..84eb4d4
Binary files /dev/null and b/images/v3_slide0094_image039.gif differ
diff --git a/motives.ipynb b/motives.ipynb
new file mode 100644
index 0000000..b30d702
--- /dev/null
+++ b/motives.ipynb
@@ -0,0 +1,211 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Motive Engine\n",
+ "\n",
+ "\n",
+ "\n",
+ "From [Under the Hood of The Sims](https://users.cs.northwestern.edu/~forbus/c95-gd/lectures/The_Sims_Under_the_Hood_files/v3_document.htm)\n",
+ "\n",
+ "The Motive Engine is based on opposing weights. An object signals it's presence if the Sims' 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. The sum of all the Sims' needs is it's mood. A Sim will only choose the fridge if it increases it's overall mood. The sum of all the Sims' needs is it's mood. A Sim will only choose the fridge if it increases it's overall mood. The ML portion comes in deciding which has the priority."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "source": [
+ "using System;\n",
+ "using System.Linq;"
+ ],
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "source": [
+ "public static int LimitToRange(this int val, int min, int max)\n",
+ "{\n",
+ " if (val < min) { return min; }\n",
+ " if (val > max) { return max; }\n",
+ " return val;\n",
+ "}"
+ ],
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "source": [
+ "class Motives\n",
+ "{\n",
+ " public Motives(int hunger, int bladder, int fun, int energy, \n",
+ " int environment, int social)\n",
+ " {\n",
+ " Hunger = hunger;\n",
+ " Bladder = bladder;\n",
+ " Fun = fun;\n",
+ " Energy = energy;\n",
+ " Environment = environment;\n",
+ " Social = social;\n",
+ " }\n",
+ "\n",
+ " public int Hunger { get; set; }\n",
+ " public int Bladder { get; set; }\n",
+ " public int Fun { get; set; }\n",
+ " public int Energy { get; set; }\n",
+ " public int Environment { get; set; }\n",
+ " public int Social { get; set; }\n",
+ "\n",
+ " int MaxMood = 60;\n",
+ "\n",
+ " /// \n",
+ " /// The mood is the sum of all the motives.\n",
+ " /// It deteremines the best course of action.\n",
+ " /// \n",
+ " public int Mood\n",
+ " {\n",
+ " get\n",
+ " {\n",
+ " var curMood = new[] { Hunger, Bladder, Fun,\n",
+ " Social, Environment, Energy };\n",
+ "\n",
+ " return curMood.Sum();\n",
+ " }\n",
+ " }\n",
+ "\n",
+ " // In the game, this would increament gradually\n",
+ " // until it reaches it's max motive.\n",
+ " int CalcuateMotiveChange(int motive, int input)\n",
+ " {\n",
+ " var maxMotive = 10;\n",
+ " var curMotive = motive;\n",
+ " var curMood = Mood;\n",
+ " // New motive equals the current motive plus the input\n",
+ " var newMotive = curMotive + input;\n",
+ " // New mood equals the new motive plus the current mood\n",
+ " var newMood = newMotive + curMood;\n",
+ " // Changed motive is the new motive with the limit\n",
+ " var changedMotive = newMotive.LimitToRange(0, maxMotive);\n",
+ "\n",
+ " // Does the new motive increase my current motive?\n",
+ " // Does the new motive increase my overall mood?\n",
+ " if (changedMotive >= curMotive && curMood <= newMood \n",
+ " && changedMotive <= maxMotive && curMood <= MaxMood)\n",
+ " return changedMotive;\n",
+ " \n",
+ " // Fall back to the current movement\n",
+ " return curMotive;\n",
+ " }\n",
+ "\n",
+ " public void ChangeHunger(int input)\n",
+ " {\n",
+ " Hunger = CalcuateMotiveChange(Hunger, input);\n",
+ " }\n",
+ "\n",
+ " public void ChangeFun(int input)\n",
+ " {\n",
+ " Fun = CalcuateMotiveChange(Fun, input);\n",
+ " }\n",
+ "}"
+ ],
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "source": [
+ "var rng = new Random();"
+ ],
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "source": [
+ "// Max a motive can be is 10. With all motives combined, the\n",
+ "// the max can be about 60. In-game, this is always going down\n",
+ "// to whatever degree.\n",
+ "var motives = new Motives(hunger: rng.Next(10), bladder: rng.Next(10),\n",
+ "fun: rng.Next(10), energy: rng.Next(10), \n",
+ "environment: 10, social: rng.Next(10));\n",
+ "Console.WriteLine($\"Hunger: {motives.Hunger}{Environment.NewLine}\" +\n",
+ " $\"Fun: {motives.Fun}{Environment.NewLine}\" +\n",
+ " $\"Bladder: {motives.Bladder}{Environment.NewLine}\" +\n",
+ " $\"Environment: {motives.Environment}\");\n",
+ "Console.WriteLine($\"Mood: {motives.Mood}\");"
+ ],
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": "Hunger: 0\r\nFun: 6\r\nBladder: 3\r\nEnvironment: 10\r\n"
+ },
+ "execution_count": 1,
+ "metadata": {}
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": "Mood: 33\r\n"
+ },
+ "execution_count": 1,
+ "metadata": {}
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "source": [
+ "motives.ChangeHunger(rng.Next(10));\n",
+ "motives.ChangeFun(rng.Next(10));\n",
+ "Console.WriteLine($\"Hunger: {motives.Hunger}{Environment.NewLine}\" +\n",
+ " $\"Fun: {motives.Fun}\");\n",
+ "Console.WriteLine($\"Mood: {motives.Mood}\");"
+ ],
+ "outputs": [
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": "Hunger: 2\r\nFun: 10\r\n"
+ },
+ "execution_count": 1,
+ "metadata": {}
+ },
+ {
+ "output_type": "execute_result",
+ "data": {
+ "text/plain": "Mood: 39\r\n"
+ },
+ "execution_count": 1,
+ "metadata": {}
+ }
+ ]
+ }
+ ],
+ "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
+}
\ No newline at end of file
diff --git a/servo.ipynb b/servo.ipynb
deleted file mode 100644
index 1e9cb32..0000000
--- a/servo.ipynb
+++ /dev/null
@@ -1,231 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "source": [
- "#r \"nuget:Microsoft.ML,1.5.1\"\n",
- "#r \"nuget:Microsoft.ML.FastTree,0.17.1\""
- ],
- "outputs": []
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "source": [
- "using System;\n",
- "using System.Collections.Generic;\n",
- "using System.IO;\n",
- "using System.Linq;\n",
- "using Microsoft.ML;\n",
- "using Microsoft.ML.Data;"
- ],
- "outputs": []
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "source": [
- "class ModelInput\n",
- "{\n",
- " [ColumnName(\"Need\"), LoadColumn(0)]\n",
- " public string Need { get; set; }\n",
- "\n",
- "\n",
- " [ColumnName(\"Percentage\"), LoadColumn(1)]\n",
- " public float Percentage { get; set; }\n",
- "\n",
- "\n",
- " [ColumnName(\"Priority\"), LoadColumn(2)]\n",
- " public string Priority { get; set; }\n",
- "}\n",
- "\n",
- "public class ModelOutput\n",
- "{\n",
- " // ColumnName attribute is used to change the column name from\n",
- " // its default value, which is the name of the field.\n",
- " [ColumnName(\"PredictedLabel\")]\n",
- " public String Prediction { get; set; }\n",
- " public float[] Score { get; set; }\n",
- "}"
- ],
- "outputs": []
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "source": [
- "IEstimator BuildTrainingPipeline(MLContext context)\n",
- "{\n",
- " // Data process configuration with pipeline data transformations \n",
- " var dataProcessPipeline = context.Transforms.Conversion.MapValueToKey(\"Priority\", \"Priority\")\n",
- " .Append(context.Transforms.Categorical.OneHotEncoding(new[] { new InputOutputColumnPair(\"Need\", \"Need\") }))\n",
- " .Append(context.Transforms.Concatenate(\"Features\", new[] { \"Need\", \"Percentage\" }))\n",
- " .AppendCacheCheckpoint(context);\n",
- " // Set the training algorithm \n",
- " var trainer = context.MulticlassClassification.Trainers.OneVersusAll(context.BinaryClassification.Trainers.FastTree(labelColumnName: \"Priority\", featureColumnName: \"Features\"), labelColumnName: \"Priority\")\n",
- " .Append(context.Transforms.Conversion.MapKeyToValue(\"PredictedLabel\", \"PredictedLabel\"));\n",
- "\n",
- " var trainingPipeline = dataProcessPipeline.Append(trainer);\n",
- "\n",
- " return trainingPipeline;\n",
- "}"
- ],
- "outputs": []
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "source": [
- "ITransformer TrainModel(MLContext context, IDataView trainingDataView, IEstimator trainingPipeline)\n",
- "{\n",
- " Console.WriteLine(\"=============== Training model ===============\");\n",
- "\n",
- " var model = trainingPipeline.Fit(trainingDataView);\n",
- "\n",
- " Console.WriteLine(\"=============== End of training process ===============\");\n",
- " return model;\n",
- "}"
- ],
- "outputs": []
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "source": [
- "void SaveModel(MLContext mlContext, ITransformer mlModel, string modelRelativePath, DataViewSchema modelInputSchema)\n",
- "{\n",
- " var modelPath = Path.Combine(\"models\", modelRelativePath);\n",
- " var path = Path.GetFullPath(modelPath);\n",
- " // Save/persist the trained model to a .ZIP file\n",
- " Console.WriteLine($\"=============== Saving the model ===============\");\n",
- " mlContext.Model.Save(mlModel, modelInputSchema, path);\n",
- " Console.WriteLine(\"The model is saved to {0}\", path);\n",
- "}"
- ],
- "outputs": []
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "source": [
- "PredictionEngine CreatePredictionEngine()\n",
- "{\n",
- " var modelPath = Path.Combine(\"models\", \"Servo.zip\");\n",
- " var MLNetModelPath = Path.GetFullPath(modelPath);\n",
- "\n",
- " // Create new MLContext\n",
- " MLContext mlContext = new MLContext();\n",
- "\n",
- " // Load model & create prediction engine\n",
- " var mlModel = mlContext.Model.Load(MLNetModelPath, out var modelInputSchema);\n",
- " var predEngine = mlContext.Model.CreatePredictionEngine(mlModel);\n",
- "\n",
- " return predEngine;\n",
- "}"
- ],
- "outputs": []
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "source": [
- "void Predictions(ModelInput[] inputs)\n",
- "{\n",
- " foreach (var input in inputs)\n",
- " {\n",
- " var engine = new Lazy>(CreatePredictionEngine);\n",
- " var result = engine.Value.Predict(input);\n",
- " var priority = false;\n",
- " \n",
- " switch (result.Prediction)\n",
- " {\n",
- " default:\n",
- " case \"FALSE\":\n",
- " priority = false;\n",
- " break;\n",
- " case \"TRUE\":\n",
- " priority = true;\n",
- " break;\n",
- " }\n",
- " \n",
- " Console.WriteLine($\"Need: {input.Need}{Environment.NewLine}\" + \n",
- " $\"Percentage: {input.Percentage}{Environment.NewLine}\" + \n",
- " $\"Predicted Priority value {priority}{Environment.NewLine}\" + \n",
- " $\"Predicted Priority scores: [{string.Join(\",\", result.Score)}]\");\n",
- " }\n",
- "}"
- ],
- "outputs": []
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "source": [
- "var sampleData = new ModelInput[]\n",
- "{\n",
- " new ModelInput\n",
- " {\n",
- " Need = \"Social\",\n",
- " Percentage = 27F,\n",
- " },\n",
- " new ModelInput\n",
- " {\n",
- " Need = \"Bladder\",\n",
- " Percentage = 76F,\n",
- " },\n",
- " new ModelInput\n",
- " {\n",
- " Need = \"Energy\",\n",
- " Percentage = 55F,\n",
- " },\n",
- " new ModelInput\n",
- " {\n",
- " Need = \"Social\",\n",
- " Percentage = 20F,\n",
- " },\n",
- " new ModelInput\n",
- " {\n",
- " Need = \"Fun\",\n",
- " Percentage = 14F,\n",
- " }\n",
- "};"
- ],
- "outputs": []
- },
- {
- "cell_type": "code",
- "execution_count": 1,
- "metadata": {},
- "source": [
- "Predictions(sampleData);"
- ],
- "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
-}
\ No newline at end of file