featurehub.evaluation package¶
Submodules¶
featurehub.evaluation.client module¶
-
class
featurehub.evaluation.client.
EvaluatorClient
(problem_id, username, orm, dataset={}, target=None, entities_featurized=None)[source]¶ Bases:
object
-
check_if_registered
(feature, verbose=False)[source]¶ Check if feature is registered.
Extracts source code, then looks for the identical source code in the feature database.
feature : function verbose : bool
Whether to print output.
-
evaluate
(feature)[source]¶ Evaluate feature on training dataset and return key performance metrics.
Runs the feature in an isolated environment to extract the feature values. Validates the feature values. Then, builds a model on that one feature and computes key cross-validated metrics. Prints results and returns a dictionary with (metric => value) entries. If the feature is invalid, prints reason and returns empty dictionary.
- feature : function
- Feature to evaluate
-
submit
(feature, description)[source]¶ Submit feature to server for evaluation on test data.
If successful, registers feature in feature database and returns key performance metrics.
Runs the feature in an isolated environment to extract the feature values. Validates the feature values. Then, builds a model on that one feature, performs cross validation, and returns key performance metrics.
- feature : function
- Feature to evaluate
- description : str
- Feature description
-
-
class
featurehub.evaluation.client.
EvaluatorServer
(problem_id, username, orm)[source]¶ Bases:
featurehub.evaluation.client.EvaluatorClient
-
check_if_registered
(code, verbose=False)[source]¶ Check if feature is registered.
Overwrites client method by expecting code to be passed directly. This is because on the server, we are limited to be unable to do code -> function -> code.
code : str verbose : bool, optional (default=False)
Whether to print output.
-
featurehub.evaluation.discourse module¶
featurehub.evaluation.future module¶
-
class
featurehub.evaluation.future.
HubAuth
(**kwargs)[source]¶ Bases:
jupyterhub.services.auth.HubAuth
-
cache
¶ A trait whose value must be an instance of a specified class.
The value can also be an instance of a subclass of the specified class.
Subclasses can declare default classes by overriding the klass attribute
-
cache_max_age
¶ An int trait.
-
user_for_token
(token, use_cache=True)[source]¶ Ask the Hub to identify the user for a given token. Args:
token (str): the token use_cache (bool): Specify use_cache=False to skip cached cookie values (default: True)- Returns:
- user_model (dict): The user model, if a user is identified, None if authentication fails. The ‘name’ field contains the user’s name.
-
featurehub.evaluation.response module¶
-
class
featurehub.evaluation.response.
EvaluationResponse
(status_code='okay', metrics=None, topic_url='')[source]¶ Bases:
flask.wrappers.Response
Wrapper class for response from evaluation server.
- status_code : string, optional (default=EvaluationResponse.STATUS_CODE_OKAY)
- Possible values are EvaluationResponse static members.
- metrics : list of Metric, optional (default=None)
- List of Metric objects, which each encode metric name, metric scoring method, and value.
topic_url : str
>>> EvaluationResponse(status_code=EvaluationResponse.STATUS_CODE_SERVER_ERROR)
-
STATUS_CODE_BAD_AUTH
= 'bad_auth'¶
-
STATUS_CODE_BAD_FEATURE
= 'bad_feature'¶
-
STATUS_CODE_BAD_REQUEST
= 'bad_request'¶
-
STATUS_CODE_DB_ERROR
= 'db_error'¶
-
STATUS_CODE_DUPLICATE_FEATURE
= 'duplicate_feature'¶
-
STATUS_CODE_OKAY
= 'okay'¶
-
STATUS_CODE_SERVER_ERROR
= 'server_error'¶