Beispiel #1
0
# In an attempt to better predict the number of "tree debris" 311 calls in 
# Chicago, this experiment incorporates data from local weather stations.

from datetime import datetime

from menorah import Menorah

sources =  [
  ["chicago-311", "Tree Debris", "aggregate=1 day"],
  ["chicago-beach-weather", "Foster Weather Station", "humidity"],
  ["chicago-beach-weather", "Foster Weather Station", "interval_rain"],
  ["chicago-beach-water-quality", "Osterman Beach", "wave_height"],
]

menorah = Menorah(
  sources,
  "work/example5-multifield-aggregated", 
  since=datetime(2015, 5, 20)
)

menorah.swarm(swarmParams={"swarmSize":"large"})
menorah.runModel(plot=True)
Beispiel #2
0
# Gets aggregated data for Portland OR 911 calls and attempts to predict the 
# number of calls every 15 minutes.

from datetime import datetime

from menorah import Menorah

sources =  [
  ["portland-911", "portland-911", "aggregate=15 minutes"],
]

menorah = Menorah(sources, "work/example3-aggregated", since=datetime(2015, 7, 10))
menorah.swarm()
menorah.runModel(plot=True)
# Tree Debris vs weather.

sources =  [
  ["chicago-311", "Tree Debris", "aggregate=1 day"],
  ["chicago-beach-weather", "Foster Weather Station", "humidity"],
  ["chicago-beach-weather", "Foster Weather Station", "interval_rain"],
  ["chicago-beach-weather", "Foster Weather Station", "barometric_pressure"],
  ["chicago-beach-weather", "Foster Weather Station", "wind_speed"],
  ["chicago-beach-weather", "Foster Weather Station", "maximum_wind_speed"],
  ["chicago-beach-weather", "Foster Weather Station", "air_temperature"],
  ["chicago-beach-water-quality", "Osterman Beach", "wave_height"],
]

menorah = Menorah(
  sources,
  "work/debris", 
  since=datetime(2015, 5, 20)
)

menorah.swarm()
menorah.runModel()

# Graffiti Removal vs weather.

sources =  [
  ["chicago-311", "Graffiti Removal", "aggregate=1 day"],
  ["chicago-beach-weather", "Foster Weather Station", "humidity"],
  ["chicago-beach-weather", "Foster Weather Station", "interval_rain"],
  ["chicago-beach-weather", "Foster Weather Station", "barometric_pressure"],
  ["chicago-beach-weather", "Foster Weather Station", "wind_speed"],
  ["chicago-beach-weather", "Foster Weather Station", "maximum_wind_speed"],
Beispiel #4
0
# This example shows how to stream River View data into a NuPIC swarm in an 
# attempt to prediction energy consumption in Texas. Once the swarm is complete,
# the resulting model parameters are used for running the data once again 
# through a newly created NuPIC model.

from menorah import Menorah

dataIds =  [
  # http://data.numenta.org/ercot-demand/system_wide_demand/data.html
  ["ercot-demand", "system_wide_demand", "Demand"],
]

menorah = Menorah(dataIds, "work/example1-one-field")
# menorah.swarm()
menorah.runModel(plot=True)

# Find your predictions in "work/example1-one-field/predictions.csv"

Beispiel #5
0
# Just an example of how to fetch River View data into a CSV so you can process
# it yourself. 

from menorah import Menorah

sources =  [
  ["mn-traffic-sensors", "T4013", "speed"],
  ["mn-traffic-sensors", "1036", "speed"],
  ["mn-traffic-sensors", "1187", "speed"],
]

menorah = Menorah(sources, "work/example4-data-only")
menorah.populateCsv()

# Find CSV at "work/example4-data-only/data.csv".