我發誓我使用正確的日期格式,但我一直加載到WEKA時得到一個分析錯誤。Java SimpleDateFormat解析問題到WEKA
"MonFeb2116:00:00+0000"
"EEEMMMddHH:mm:ssZ"
下面是一個例子數據集:
@RELATION example
@ATTRIBUTE tweetid STRING
@ATTRIBUTE timestamp DATE "EEEMMMddhh:mm:ssZ"
@ATTRIBUTE I NUMERIC
@ATTRIBUTE a NUMERIC
@ATTRIBUTE cool NUMERIC
@ATTRIBUTE foo NUMERIC
@ATTRIBUTE bar NUMERIC
@ATTRIBUTE temp NUMERIC
@ATTRIBUTE class {POS,NEG}
@DATA
39715973388828673,"MonFeb2116:00:00+0000",0,0,0,0,2,2,?
39716148329197568,"MonFeb2116:00:42+0000",0,1,0,0,0,1,?
39715973388828673,"MonFeb2116:00:51+0000",1,0,0,0,0,0,?
39723030380941312,"MonFeb2116:28:03+0000",0,0,0,0,0,0,?
39723030531944448,"MonFeb2116:28:03+0000",0,0,0,0,0,0,?
39723031433707520,"MonFeb2116:28:03+0000",0,0,0,0,0,0,?
WEKA錯誤:
unparseable date "MonFeb2116:00:00+0000, read Token[MonFeb2116:00:00+0000], line 21
是否使用了API文檔,仔細檢查 - 失去了一些東西?
http://download.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html
EDIT -----------
@RELATION example
@ATTRIBUTE tweetid STRING
@ATTRIBUTE timestamp DATE "EEE MMM dd hh:mm:ss Z"
@ATTRIBUTE I NUMERIC
@ATTRIBUTE a NUMERIC
@ATTRIBUTE cool NUMERIC
@ATTRIBUTE foo NUMERIC
@ATTRIBUTE love NUMERIC
@ATTRIBUTE temp NUMERIC
@ATTRIBUTE class {POS,NEG}
@DATA
39715973388828673,"Mon Feb 21 16:00:00 +0000",0,0,0,0,2,2,?
39716148329197568,"Mon Feb 21 16:00:42 +0000",0,1,0,0,0,1,?
39715973388828673,"Mon Feb 21 16:00:51 +0000",1,0,0,0,0,0,?
39723030380941312,"Mon Feb 21 16:28:03 +0000",0,0,0,0,0,0,?
39723030531944448,"Mon Feb 21 16:28:03 +0000",0,0,0,0,0,0,?
39723031433707520,"Mon Feb 21 16:28:03 +0000",0,0,0,0,0,0,?
格式化的日期與空間分隔標記。仍然沒有在WEKA玩球...
我已修改時間戳以再次包括年份並在每個令牌之間放置一些空格: 「EEE MMM dd HH :mm:ss Z yyyy「現在完全解析時間戳,如: Mon Feb 21 16:00:00 +0000 2011 感謝您的幫助! – bhalsall 2011-04-18 14:57:03