[mlpack-svn] [MLPACK] #164: Standardized concept for class output to Log

MLPACK Trac trac at coffeetalk-1.cc.gatech.edu
Sun Sep 9 21:17:32 EDT 2012


#164: Standardized concept for class output to Log
------------------------------------------------------+---------------------
  Reporter:  rcurtin                                  |        Owner:  trironk3    
      Type:  wishlist                                 |       Status:  accepted    
  Priority:  major                                    |    Milestone:  mlpack 1.1.0
 Component:  mlpack                                   |   Resolution:              
  Keywords:  mlpack output model type consistent api  |     Blocking:              
Blocked By:                                           |  
------------------------------------------------------+---------------------

Comment (by rcurtin):

 Okay, I've put some thought into this and I think I have a couple rules
 which should keep things consistent.

  * The output for each class should be preceded by the class's name and
 then a colon, and maybe its address in parenthesis (I'd like comments on
 that idea if anyone has any), like so:

 [INFO ] GaussianDistribution [0xdeadbeef]:

  * If the number of members are few and the output will not be long, fit
 it on one line (I don't have a good empirical rule for this... maybe that
 will be developed later, but for now "use judgment" applies).

 [INFO ] Range [0xbeefdead]: low 0.34573, high 0.47274

  * In general (and where necessary), use a descriptive name for a member
 instead of its actual code name; for math::Range for instance, use 'low'
 for 'lo' and 'high' for 'hi'.  Again, judgment reigns supreme in this one.

 I have not thought completely about how multiple-line objects will work.
 I'd like to have things nested, i.e.

 [INFO ] BinarySpaceTree [0xtribbles]:
 [INFO ]   Split dimension: 5
 [INFO ]   Split value: 3.743
 [INFO ]   Left child: BinarySpaceTree [0xsomething]:
 [INFO ]     Split Dimension: 4
 ...
 and so forth.

 But I don't think there is a good way to find out how much indentation is
 already being used.  Unless we adapt the ToString() API to have a const
 size_t which represents the level of indentation to start at.  Then
 PrefixedOutStream::BaseLogic() (or whatever the actual function is, I
 forget right now) can call obj.ToString(0) or even obj.ToString() if a
 default is given for the indentation parameter.  Any indentation rules
 should be two spaces, just like the MLPACK code.

 Let me know if there are any differing ideas over this; this is just what
 I came up with after some thought, and it is by no means "the final word".

-- 
Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/164#comment:11>
MLPACK <www.fast-lab.org>
MLPACK is an intuitive, fast, and scalable C++ machine learning library developed by the FASTLAB at Georgia Tech under Dr. Alex Gray.


More information about the mlpack-svn mailing list