Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active May 29, 2018 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/9c8396d17457a4a493f75aabd3c49414 to your computer and use it in GitHub Desktop.
Save kenwebb/9c8396d17457a4a493f75aabd3c49414 to your computer and use it in GitHub Desktop.
Learnathon 2018
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Tue May 29 2018 07:47:26 GMT-0400 (EDT)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Learnathon 2018
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 9c8396d17457a4a493f75aabd3c49414
Keywords:
My Notes
--------
May 28, 2018
Create an agent based model (ABM)[6] from the kaggle data.
TODO parse the kaggle .csv data to construct the actual Xholon nodes
References
----------
(1) https://github.com/OttawaLearnathon2018/
(2) https://github.com/OttawaLearnathon2018/notes/blob/master/restaurantdata-systemmodel.pdf
(3) https://www.kaggle.com/c/recruit-restaurant-visitor-forecasting/data
(4) http://www.primordion.com/Xholon/gwt/wb/editwb.html?app=b0bee55457fcc763ceb5&src=gist
) http://www.primordion.com/Xholon/gwt/XholonLeaflet.html?app=b0bee55457fcc763ceb5&src=gist&gui=none
example of using Leaflet in Xholon
(5) http://leafletjs.com
Leaflet
(6) https://en.wikipedia.org/wiki/Agent-based_model
"An agent-based model (ABM) is a class of computational models for simulating the actions and interactions of autonomous agents"
"Agent-based models are a kind of microscale model that simulate the simultaneous operations and interactions of multiple agents in an attempt to re-create and predict the appearance of complex phenomena."
]]></Notes>
<_-.XholonClass>
<PhysicalSystem/>
<Customer/>
<Restaurant/> <!-- Stores-Restaurants -->
<Location/>
<Genre/>
<Customers/>
<Restaurants/>
<Locations/>
<Genres/>
<RadioStation/>
<Orange/>
<StoreInfoReader/>
</_-.XholonClass>
<xholonClassDetails>
<Customer><Color>blue</Color></Customer>
<Orange><Color>orange</Color></Orange>
<Avatar><Color>red</Color></Avatar>
</xholonClassDetails>
<PhysicalSystem>
<Genres>
<!-- air_store_info.csv create a Genre node for ech of these -->
<Attribute_String>
Italian/French
Dining bar
Yakiniku/Korean food
Cafe/Sweets
Izakaya
Okonomiyaki/Monja/Teppanyaki
Bar/Cocktail
Japanese food
Creative cuisine
Other
Western food
International cuisine
Asian
Karaoke/Party
</Attribute_String>
<!--<Genre roleName="Abc"/>-->
</Genres>
<!-- air_store_info.csv, hpg_store_info -->
<Restaurants>
<!-- perhaps each restaurant is inside a Location; TODO have a port called "genre" that references a <Genre/> -->
</Restaurants>
<Customers>
<Customer roleName="Generic" multiplicity="20"/>
</Customers>
<!-- air_store_info.csv, hpg_store_info latitude, longitude A location is an area; in the kaggle data, every restaurant in an area has the same lat/long -->
<Locations>
<!-- "Note: latitude and longitude are the latitude and longitude of the area to which the store belongs"[3] -->
<Location area_name="Hyōgo-ken Kōbe-shi Kumoidōri"><Geo>[34.6951242,135.1978525]</Geo></Location> <!-- latitude 34.6951242 longitude 135.1978525 -->
<Location area_name="Tōkyō-to Minato-ku Shibakōen"><Geo>[34.6951242,135.1978525]</Geo></Location>
<Location area_name="Fukuoka-ken Fukuoka-shi Daimyō"><Geo>[34.6951242,135.1978525]</Geo></Location>
<Location area_name="Tōkyō-to Setagaya-ku Setagaya"><Geo>[34.6951242,135.1978525]</Geo></Location>
<Location area_name="Ōsaka-fu Ōsaka-shi Ōgimachi">
<!--<Geo>[34.6951242,135.1978525]</Geo>-->
<Geo>{"type":"Feature","properties":{"width":20,"height":20},"geometry":{"type":"Point","coordinates":[135.1978525,34.6951242]}}</Geo>
</Location>
</Locations>
<!--
air_store_info.csv (first 10 records):
air_store_id,air_genre_name,air_area_name,latitude,longitude
Use this data to create Restaurant and Location nodes.
-->
<StoreInfoReader>
<Attribute_String>
air_0f0cdeee6c9bf3d7,Italian/French,Hyōgo-ken Kōbe-shi Kumoidōri,34.6951242,135.1978525
air_7cc17a324ae5c7dc,Italian/French,Hyōgo-ken Kōbe-shi Kumoidōri,34.6951242,135.1978525
air_fee8dcf4d619598e,Italian/French,Hyōgo-ken Kōbe-shi Kumoidōri,34.6951242,135.1978525
air_a17f0778617c76e2,Italian/French,Hyōgo-ken Kōbe-shi Kumoidōri,34.6951242,135.1978525
air_83db5aff8f50478e,Italian/French,Tōkyō-to Minato-ku Shibakōen,35.6580681,139.7515992
air_99c3eae84130c1cb,Italian/French,Tōkyō-to Minato-ku Shibakōen,35.6580681,139.7515992
air_f183a514cb8ff4fa,Italian/French,Tōkyō-to Minato-ku Shibakōen,35.6580681,139.7515992
air_6b9fa44a9cf504a1,Italian/French,Tōkyō-to Minato-ku Shibakōen,35.6580681,139.7515992
air_0919d54f0c9a24b8,Italian/French,Tōkyō-to Minato-ku Shibakōen,35.6580681,139.7515992
air_2c6c79d597e48096,Italian/French,Tōkyō-to Minato-ku Shibakōen,35.6580681,139.7515992
</Attribute_String>
</StoreInfoReader>
<RadioStation roleName="DefCon Radio - Music for Hacking."><Anno>https://somafm.com/defcon/</Anno></RadioStation>
<Orange roleName="Orange Python library"><Anno>https://orange.biolab.si/</Anno></Orange>
<Animate selection="#xhgraph"/>
</PhysicalSystem>
<Genresbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var me, beh = {
postConfigure: function() {
me = this.cnode.parent();
var str = me.first().text();
var garr = str.split("\n");
me.first().remove();
for (var i = 0; i < garr.length; i++) {
var genre = garr[i].trim();
var gstr = '<Genre roleName="' + genre + '"></Genre>';
me.append(gstr);
}
this.cnode.remove();
}
}
//# sourceURL=Genresbehavior.js
]]></Genresbehavior>
<Customerbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
const numRestaurants = 10;
var me, restaurants, beh = {
postConfigure: function() {
me = this.cnode.parent();
restaurants = me.xpath("ancestor::PhysicalSystem/Restaurants");
me.xpath("ancestor::Chameleon").append(this.cnode.remove());
},
act: function() {
var rest = restaurants.xpath("Restaurant[" + ($wnd.Math.floor($wnd.Math.random() * numRestaurants) + 1) + "]");
rest.append(me.remove());
}
}
//# sourceURL=Customerbehavior.js
]]></Customerbehavior>
<StoreInfoReaderbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var me, restaurants, locations, beh = {
postConfigure: function() {
me = this.cnode.parent();
this.cnode.remove();
restaurants = me.xpath("ancestor::PhysicalSystem/Restaurants");
locations = me.xpath("ancestor::PhysicalSystem/Locations");
var str = me.first().text();
var rowarr = str.split("\n");
me.first().remove();
for (var i = 0; i < rowarr.length; i++) {
var row = rowarr[i].trim();
var colarr = row.split(",");
// <Restaurant store_id="air_0f0cdeee6c9bf3d7" genre_name="Italian/French"></Restaurant>
var rstr = '<Restaurant store_id="' + colarr[0] + '" genre_name="' + colarr[1] + '"></Restaurant>';
restaurants.append(rstr);
}
me.remove();
}
}
//# sourceURL=StoreInfoReaderbehavior.js
]]></StoreInfoReaderbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Block</title>
<rect id="PhysicalSystem/Restaurants" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Height</title>
<rect id="PhysicalSystem/Restaurants/Restaurant" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment