Repository navigation
Method to add original competition metrics
Still WIP
Class diagram related to the definition of competition metrics is as follows.
Define the value of original metrics_type at Competition model You can define arbitrary name which exhibits the meaning of your metrics.
In order to add original competition metrics, developer should define service class called by MetricServiceFactoryClass
The name of service class should be <metrics_type> + Service.
First Character of <metrics_type> should be uppercase and the second and subsequent characters should be lowercase.
For example, in case metric type is auc, Service class name become AucService.
In case of mAP, Service class name become MapService.
Each service class should own common interface methods because it is called from various controllers or models via MetricServiceFactoryClass
To implement the actual content of these interface, it is recommended for developer to create original service class by copying he default service class (such as AUC or mAP).
Common methods which should be defined at each service class is as follows
-
request_data(answer_json, prediction_json)- method to create the request data sent to API server for metrics calculation.
- This method is called at here
-
metric_keys()- Method to define keys to retrieve metric values from returned JSON from Flask API server.
- The keys defined at this method should be also defined at JSON data returned from API server.
- For example, in case of mAP metrics type,
metric_keys()returns%w[mAP allAP allAR](code). And the corresponding JSON values at Flask API is defined like this. There are the same keys asmetric_keys()in return value dictionary.
-
metric_for_sota()- Method to define a key of metrics to determine ranking of prediction result.
- This method is called at here.
- If a new record can achieve highest score according to metrics defined by this key, slack notification is sent to the arbitrary channel specified at
SLACK_WEBHOOK_URLenvironment variable.
-
unique_key- Define the unique key to judge whether the records between submitted predictions and answer data are matched.
- This method is called at here
-
prediction_json_schema- Define the JSON shema of prediction result submitted by user.
- According to this definition, JSON format of submitted result is validated.
-
answer_json_schema- Define the JSON schema of answer data of each competition.
- According to this definition, JSON format of answer data is validated.
- Endpoint(URI) to calculate in API Server should be defined at Flask API Server
- The endpoint of default metrics is defined at here
- Name of API endpoint should be
/metrics/<metrics_type> - For example, in case
metrics_typeismAP, the name of API endpoint become/metrics/mAP