Search code examples
pythongraphlab

Importing module in Python doesn't work(Graphlab)


I am trying to use graphlab.evaluation.log_loss function though I can't import it. I try to use log_loss function :

evaluation.log_loss(..)

but I get the following error: " AttributeError: 'module' object has no attribute 'log_loss'" though other metrics such as confusion_matrix, rmse and others are working. Any ideas?


Solution

  • The log_loss evaluation function was added in GraphLab Create version 1.7, so upgrading should do the trick.

    >>> import graphlab
    >>> graphlab.version
    '1.7.1'
    
    >>> from graphlab import evaluation
    >>> evaluation.log_loss(graphlab.SArray([1, 0, 1]), 
                            graphlab.SArray([0.7, 0.4, 0.8]))
    0.3635480396729776