aepsych.server¶
Submodules¶
aepsych.server.server module¶
- class aepsych.server.server.AEPsychServer(socket=None, database_path=None, thrift=False)[source]¶
Bases:
object
Server for doing black box optimization using gaussian processes. :keyword socket – socket object that implements send and receive for json: :keyword messages (default: DummySocket()). :keyword TODO actually make an abstract interface to subclass from here:
- serve()[source]¶
Run the server. Note that all configuration outside of socket type and port happens via messages from the client. The server simply forwards messages from the client to its setup, ask and tell methods, and responds with either acknowledgment or other response as needed. To understand the server API, see the docs on the methods in this class. :raises RuntimeError: if a request from a client has no request type :raises RuntimeError: if a request from a client has no known request type :raises TODO make things a little more robust to bad messages from client; this: requires resetting the req/rep queue status.
- replay(uuid_to_replay, skip_computations=False)[source]¶
Run a replay against the server. The UUID will be looked up in the database. if skip_computations is true, skip all the asks and queries, which should make the replay much faster.
- generate_experiment_table(experiment_id, table_name='experiment_table', return_df=False)[source]¶
Generate a table of a given experiment with all the raw data.
This table is generated from the database, and is added to the experiment’s database.
- Parameters
experiment_id (str) – The experiment ID to generate the table for.
table_name (str) – The name of the table. Defaults to “experiment_table”.
return_df (bool) – If True, also return the dataframe.
- Returns
- The dataframe of the experiment table, if
return_df is True.
- Return type
pd.DataFrame
- handle_ask_v01(request)[source]¶
Returns dictionary with two entries: “config” – dictionary with config (keys are strings, values are floats) “is_finished” – bool, true if the strat is finished
- property strat¶
- property config¶
- property parnames¶
- property n_strats¶
- ask()[source]¶
get the next point to query from the model :returns: dict – new config dict (keys are strings, values are floats)
- tell(outcome, config, model_data=True)[source]¶
tell the model which input was run and what the outcome was :param inputs {dict} – dictionary: :param keys are strings: :param values are floats or int.: :param keys should inclde all of the parameters we are tuning over: :param plus ‘outcome’: :param which would be in {0: :param 1}.: :param TODO better types:
aepsych.server.sockets module¶
- class aepsych.server.sockets.ZMQSocket(port, ip='*')[source]¶
Bases:
object
sends/receives json-formated messages over ZMQ
- Parameters
over (port {int} -- port to listen) –
Module contents¶
- class aepsych.server.AEPsychServer(socket=None, database_path=None, thrift=False)[source]¶
Bases:
object
Server for doing black box optimization using gaussian processes. :keyword socket – socket object that implements send and receive for json: :keyword messages (default: DummySocket()). :keyword TODO actually make an abstract interface to subclass from here:
- serve()[source]¶
Run the server. Note that all configuration outside of socket type and port happens via messages from the client. The server simply forwards messages from the client to its setup, ask and tell methods, and responds with either acknowledgment or other response as needed. To understand the server API, see the docs on the methods in this class. :raises RuntimeError: if a request from a client has no request type :raises RuntimeError: if a request from a client has no known request type :raises TODO make things a little more robust to bad messages from client; this: requires resetting the req/rep queue status.
- replay(uuid_to_replay, skip_computations=False)[source]¶
Run a replay against the server. The UUID will be looked up in the database. if skip_computations is true, skip all the asks and queries, which should make the replay much faster.
- generate_experiment_table(experiment_id, table_name='experiment_table', return_df=False)[source]¶
Generate a table of a given experiment with all the raw data.
This table is generated from the database, and is added to the experiment’s database.
- Parameters
experiment_id (str) – The experiment ID to generate the table for.
table_name (str) – The name of the table. Defaults to “experiment_table”.
return_df (bool) – If True, also return the dataframe.
- Returns
- The dataframe of the experiment table, if
return_df is True.
- Return type
pd.DataFrame
- handle_ask_v01(request)[source]¶
Returns dictionary with two entries: “config” – dictionary with config (keys are strings, values are floats) “is_finished” – bool, true if the strat is finished
- property strat¶
- property config¶
- property parnames¶
- property n_strats¶
- ask()[source]¶
get the next point to query from the model :returns: dict – new config dict (keys are strings, values are floats)
- tell(outcome, config, model_data=True)[source]¶
tell the model which input was run and what the outcome was :param inputs {dict} – dictionary: :param keys are strings: :param values are floats or int.: :param keys should inclde all of the parameters we are tuning over: :param plus ‘outcome’: :param which would be in {0: :param 1}.: :param TODO better types: