Пример #1
0
    def execute(self, argv):

        s = "Available active learning algorithms for ASReview. \n\n"

        # classifiers
        s += _format_algorithm(values=list_classifiers(),
                               name="classifiers",
                               description="classification algorithms")

        # query_strategies
        s += _format_algorithm(values=list_query_strategies(),
                               name="query_strategies",
                               description="query strategies")

        # balance_strategies
        s += _format_algorithm(values=list_balance_strategies(),
                               name="balance_strategies",
                               description="balance strategies")

        # feature_extraction
        s += _format_algorithm(values=list_feature_extraction(),
                               name="feature_extraction",
                               description="feature extraction algorithms")

        print(s)
Пример #2
0
def api_list_algorithms():
    """List the names and labels of available algorithms"""

    try:
        classes = [
            list_balance_strategies(),
            list_classifiers(),
            list_feature_extraction(),
            list_query_strategies()
        ]

        payload = {
            "balance_strategy": [],
            "classifier": [],
            "feature_extraction": [],
            "query_strategy": [],
        }

        for c, key in zip(classes, payload.keys()):
            for method in c:
                if hasattr(method, "label"):
                    payload[key].append({
                        "name": method.name,
                        "label": method.label
                    })
                else:
                    payload[key].append({
                        "name": method.name,
                        "label": method.name
                    })

    except Exception as err:
        logging.error(err)
        return jsonify(message="Failed to retrieve algorithms."), 500

    response = jsonify(payload)
    response.headers.add('Access-Control-Allow-Origin', '*')
    return response
Пример #3
0
def test_classifiers():
    assert len(list_classifiers()) >= 7