コード例 #1
0
 def setUpClass(cls):
     cls.client = craftai.Client(settings.CRAFT_CFG)
     cls.n_agents = 5
     cls.agents_id = [
         "{}_{}_{}".format(valid_data.VALID_ID, i, settings.RUN_ID)
         for i in range(cls.n_agents)
     ]
コード例 #2
0
 def setUpClass(cls):
     cls.client = craftai.Client(settings.CRAFT_CFG)
     cls.agent_id = valid_data.VALID_ID + "_" + settings.RUN_ID
コード例 #3
0
import craftai
import json
import os

## 1) Connect to craftai api
client = craftai.Client({"token": os.environ.get("CRAFT_TOKEN")})

## 2) Create the agent
agent_id = "Wellness"
configuration = {
    "context": {
        "day_off": {                        # day is off or not
            "type": "enum"
        },
        "next_day_off": {                   # next day is off or not
            "type": "enum"
        },
        "sleep_at_home": {                  # sleep at home or not
            "type" : "enum"
        },
        "sleep_start": {                    # hour at which he started to sleep
            "type": "time_of_day",
            "is_generated" : False,
        },
        "timezone": {                       # timezone for sleep_start hour
            "type" : "timezone"
        },
        "sleep": {                          # sleep time during the night
            "type": "continuous"
        }
    },
コード例 #4
0
import random
import semver

from nose.tools import assert_equal, assert_is_instance, assert_not_equal, assert_raises, with_setup
import craftai

from . import settings
from .data import valid_data
from .data import invalid_data

CLIENT = craftai.Client(settings.CRAFT_CFG)
AGENT_ID = "test_get_decision_tree_" + settings.RUN_ID

VALID_L_CFG = valid_data.VALID_LARGE_CONFIGURATION
VALID_L_BATCH_DURATION = VALID_L_CFG["learning_period"] * 4
VALID_L_ENUM_VALUES = ["CYAN", "MAGENTA", "YELLOW", "BLACK"]


def random_enum_value():
    return random.choice(VALID_L_ENUM_VALUES)


def random_continuous_value():
    return random.uniform(-12, 12)


VALID_L_OPERATIONS = [[{
    "timestamp": batch_offset * VALID_L_BATCH_DURATION + operation_offset,
    "context": {
        "e1": random_enum_value(),
        "e2": random_enum_value(),
コード例 #5
0
import craftai
import json
import settings

## 1) Connect to craftai api
config = settings.CRAFT_CFG
client = craftai.Client(config)

## 2) Create the agent
agent_id = "Wellness"
configuration = {
    "context": {
        "day_off": {                        # day is off or not
            "type": "enum"
        },
        "next_day_off": {                   # next day is off or not
            "type": "enum"
        },
        "sleep_at_home": {                  # sleep at home or not
            "type" : "enum"
        },
        "sleep_start": {                    # hour at which he started to sleep
            "type": "time_of_day",
            "is_generated" : False,
        },
        "timezone": {                       # timezone for sleep_start hour
            "type" : "timezone"
        },
        "sleep": {                          # sleep time during the night
            "type": "continuous"
        }
コード例 #6
0
 def setUp(self):
   self.client = craftai.Client(settings.CRAFT_CFG)
コード例 #7
0
 def setUpClass(cls):
   cls.client = craftai.Client(settings.CRAFT_CFG)