Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Aug 2010 12:58:34 -0700
From:      Chip Camden <sterling@camdensoftware.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: how to parse output of application?
Message-ID:  <20100803195834.GA2753@libertas.local.camdensoftware.com>
In-Reply-To: <988913.74048.qm@web51104.mail.re2.yahoo.com>
References:  <988913.74048.qm@web51104.mail.re2.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
> 
> Can you help me with this task I have? I have a lot of files in a subdirectory containing the following text:
> 
> Correctly Classified Instances     3018117               56.6808 %
> Incorrectly Classified Instances   2306643               43.3192 %
> Kappa statistic                          0.2443
> Mean absolute error                      0.4304
> Root mean squared
>  error                  0.4586
> Relative absolute error                124.1251 %
> Root relative squared error            110.1308 %
> Total Number of Instances          5324760     
> 
> 
> === Detailed Accuracy By Class ===
> 
> TP Rate   FP Rate   Precision   Recall  F-Measure   ROC Area  Class
>   0.618     0.343      0.681     0.618     0.648      0.697    1
>   0.519     0.244      0.617    
>  0.519     0.564      0.693    2
>   0.296     0.141      0.056     0.296     0.094      0.66     3
> 
> 
> === Confusion Matrix ===
> 
>        a       b       c   <-- classified as
>  1784321  684983  416649 |       a = 1
>   787342 1190428  314537 |       b = 2
>    49255   53877   43368 |       c = 3
> 
> I need to parse this file to get in a csv file the following information:
> 
> Correctly Classified Instances, Kappa statistic, Total Number of Instances, Precision {1}, Recall {1}, F-Measure
>  {1},Precision {2}, Recall {2}, F-Measure {2},Precision {3}, Recall {3}, F-Measure {3},a,b,c,a,b,c,a,b,c
> 56.6808,
>  0.2443, 5324760, 0.681,0.618,0.648,0.617,0.519,0.564, 
> 0.056,0.296,0.094,1784321,684983,416649,787342,1190428,314537,49255,53877,43368
> 
> Does anyone have an idea how this could be accomplished?
> 
> I not that great in programming so writing a ruby or shell script do do this would take me weeks:-(
> 
> Thanks
> Dino
> 
> 
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"

Well, I'd use Ruby.  Read the whole file into a string and find the
relevant bits with Regexp.

-- 
Sterling (Chip) Camden    | sterling@camdensoftware.com | 2048D/3A978E4F
http://camdensoftware.com | http://chipstips.com        | http://chipsquips.com

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iQEcBAEBAgAGBQJMWHTqAAoJEIpckszW26+RzeQH/ilZYsG3YJGvPWSH9gxQHyhg
OaOTobWDe4LM4vXas7EU1j3oXXPjFTReGTA0Y/mFpVSrkfUty8xIH8+MBl1vFjpK
QsMHiXAdiRvwE/eNy0R+8WKxpYPDEQ0x8UIG+nxoA9GxsMikiSL+VsbRSdQUhWzi
m7v1TnnECLRcqb+iWe8JXPE7ARF1PUbavxpNqhnrZ0Yr/koxHk4cp3f32+n8IaXl
3ohzpQ81DetUOAe8BgyT6szGn+44l8Vml1AALUHOkHhhdKCQjDvhwUfXjUL5w4Ws
NwZMS6ceM7Dk30C78AqG1erl20SBtgXGOqL/E0TdGmJaFW5vmf2nfa3Z42Jb9mU=
=TMu0
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100803195834.GA2753>