Skip to content

Implement Query Method for Python Client #265

Closed
@crasanders

Description

@crasanders

The Python client can currently only send setup, ask, tell, and resume messages to the server. We would also like a query method that sends "query" messages to the server. This method would take in query_type, probability_space, and other arguments that get passed to the server's query method. See server.query, server.handle_query, and test_server.test_strat_query to see examples of "query" messages and what types of arguments can be sent.

Examples of use:

client.query(type="max") # return the x value with the highest y value in the form of a d-length vector, where d is the dimensionality. See the output of AEPsychModel.get_max.

client.query(type="min", locked_dims={0: [0, 1]}) # return the x value with the lowest y value in the form of a d-length vector; the first element must be between 0 and 1. See the output of AEPsychModel.get_min.

client.query(type="prediction", x=torch.tensor([[0, 1], [2,3]])) # return the model predictions at x=[0,1] and x=[2,3], in the form of a 2 n-length vectors, where n is the number of x values given. The first vector is the means, the second is the variances. See the output of BinaryClassificationGP.predict.

client.query(type="inverse", y=0.0) # # return the x value where y=0.0. Returns the actual y value of this point as a float as well as x in the form of a d-length vector, where d is the dimensionality. See the output of AEPsychModel.inv_query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions