py2/h2o_ray.py
def compute_model_metrics(self, model, frame, timeoutSecs=60, **kwargs):
    '''
    Score a model on the h2o cluster on the given Frame and return only the model metrics. 
    '''
    assert model is not None, '"model" parameter is null'
    assert frame is not None, '"frame" parameter is null'

    models = self.models(key=model, timeoutSecs=timeoutSecs)
    assert models is not None, "/Models REST call failed"
    assert models['models'][0]['model_id']['name'] == model, "/Models/{0} returned Model {1} rather than Model {2}".format(model, models['models'][0]['key']['name'], model)

    # TODO: test this assert, I don't think this is working. . .
    frames = self.frames(key=frame)
    assert frames is not None, "/Frames/{0} REST call failed".format(frame)
    
    print "frames:", dump_json(frames)
    # is the name not there?
    # assert frames['frames'][0]['model_id']['name'] == frame, "/Frames/{0} returned Frame {1} rather than Frame {2}".format(frame, models['models'][0]['key']['name'], frame)

    result = self.do_json_request('/3/ModelMetrics.json/models/' + model + '/frames/' + frame, cmd='post', timeout=timeoutSecs)

    mm = result['model_metrics'][0]
    verboseprint("model metrics: " + repr(mm))
    h2o_sandbox.check_sandbox_for_errors()
    return mm
def compute_model_metrics(self, model, frame, timeoutSecs=60, **kwargs):
    '''
    Score a model on the h2o cluster on the given Frame and return only the model metrics. 
    '''
    assert model is not None, '"model" parameter is null'
    assert frame is not None, '"frame" parameter is null'

    models = self.models(key=model, timeoutSecs=timeoutSecs)
    assert models is not None, "/Models REST call failed"
    assert models['models'][0]['model_id']['name'] == model, "/Models/{0} returned Model {1} rather than Model {2}".format(model, models['models'][0]['key']['name'], model)

    # TODO: test this assert, I don't think this is working. . .
    frames = self.frames(key=frame)
    assert frames is not None, "/Frames/{0} REST call failed".format(frame)
    
    print "frames:", dump_json(frames)
    # is the name not there?
    # assert frames['frames'][0]['model_id']['name'] == frame, "/Frames/{0} returned Frame {1} rather than Frame {2}".format(frame, models['models'][0]['key']['name'], frame)

    result = self.do_json_request('/3/ModelMetrics.json/models/' + model + '/frames/' + frame, cmd='post', timeout=timeoutSecs)

    mm = result['model_metrics'][0]
    verboseprint("model metrics: " + repr(mm))
    h2o_sandbox.check_sandbox_for_errors()
    return mm
def compute_model_metrics ( self , model , frame , timeoutSecs = 60 , * * kwargs ) : assert model is not None , '"model" parameter is null' assert frame is not None , '"frame" parameter is null' models = self . models ( key = model , timeoutSecs = timeoutSecs ) assert models is not None , "/Models REST call failed" assert models [ 'models' ] [ 0 ] [ 'model_id' ] [ 'name' ] == model , "/Models/{0} returned Model {1} rather than Model {2}" . format ( model , models [ 'models' ] [ 0 ] [ 'key' ] [ 'name' ] , model ) # TODO: test this assert, I don't think this is working. . . frames = self . frames ( key = frame ) assert frames is not None , "/Frames/{0} REST call failed" . format ( frame ) print "frames:" , dump_json ( frames ) # is the name not there? # assert frames['frames'][0]['model_id']['name'] == frame, "/Frames/{0} returned Frame {1} rather than Frame {2}".format(frame, models['models'][0]['key']['name'], frame) result = self . do_json_request ( '/3/ModelMetrics.json/models/' + model + '/frames/' + frame , cmd = 'post' , timeout = timeoutSecs ) mm = result [ 'model_metrics' ] [ 0 ] verboseprint ( "model metrics: " + repr ( mm ) ) h2o_sandbox . check_sandbox_for_errors ( ) return mm
Score a model on the h2o cluster on the given Frame and return only the model metrics.
Score a model on the h2o cluster on the given Frame and return only the model metrics .