Ejemplo n.º 1
0
Archivo: api.py Proyecto: ml4ai/delphi
def getModelStatus(modelID):
    query_result = DelphiModel.query.filter_by(id=modelID).first()

    if not query_result:
        return jsonify(json.loads('{"status": "invalid model id"}'))

    model = query_result.model
    G = AnalysisGraph.deserialize_from_json_string(model, verbose=False)

    response = json.loads(G.generate_create_model_response())
    return jsonify(response)
Ejemplo n.º 2
0
Archivo: api.py Proyecto: ml4ai/delphi
def runExperiment(request, experiment_id, experiment_type, model, app):
    G = AnalysisGraph.deserialize_from_json_string(model, verbose=False)

    if experiment_type == "PROJECTION":
        runProjectionExperiment(request, experiment_id, G, app)
    elif experiment_type == "GOAL_OPTIMIZATION":
        # Not yet implemented
        pass
    elif experiment_type == "SENSITIVITY_ANALYSIS":
        # Not yet implemented
        pass
    elif experiment_type == "MODEL_VALIDATION":
        # Not yet implemented
        pass
    elif experiment_type == "BACKCASTING":
        # Not yet implemented
        pass
    else:
        # Unknown experiment type
        pass
Ejemplo n.º 3
0
def runExperiment(request, modelID, experiment_id):
    request_body = request.get_json()
    experiment_type = request_body["experimentType"]

    query_result = DelphiModel.query.filter_by(id=modelID).first()

    if not query_result:
        # Model ID not in database. Should be an incorrect model ID
        result = CauseMosAsyncExperimentResult.query.filter_by(
            id=experiment_id).first()
        result.status = "failed"
        db.session.merge(result)
        db.session.commit()
        return

    model = query_result.model
    trained = json.loads(model)["trained"]
    G = AnalysisGraph.deserialize_from_json_string(model, verbose=False)

    if experiment_type == "PROJECTION":
        runProjectionExperiment(request, modelID, experiment_id, G, trained)
    elif experiment_type == "GOAL_OPTIMIZATION":
        # Not yet implemented
        pass
    elif experiment_type == "SENSITIVITY_ANALYSIS":
        # Not yet implemented
        pass
    elif experiment_type == "MODEL_VALIDATION":
        # Not yet implemented
        pass
    elif experiment_type == "BACKCASTING":
        # Not yet implemented
        pass
    else:
        # Unknown experiment type
        pass