ELKI CSV parser problems - parsing

I have changed an .arff file to a .csv file in a tool in Weka.
But now I can't use the arffparser as parser in ELKI.
What parser should I then use? The default is NumberVectorLabelParser. But it gives me a ArrayIndexOutOfBoundsException:
Running: -verbose -verbose -dbc.in /home/db/lisbet/Datasets/without ids/try 2/calling them .txt using another parser/Lymphography_withoutdupl_norm_1ofn.csv -dbc.parser NumberVectorLabelParser -algorithm outlier.lof.LOF -lof.k 2 -evaluator outlier.OutlierROCCurve -rocauc.positive yes
Task failed
java.lang.ArrayIndexOutOfBoundsException: 47
at de.lmu.ifi.dbs.elki.datasource.parser.NumberVectorLabelParser.getTypeInformation(NumberVectorLabelParser.java:337)
at de.lmu.ifi.dbs.elki.datasource.parser.NumberVectorLabelParser.buildMeta(NumberVectorLabelParser.java:242)
at de.lmu.ifi.dbs.elki.datasource.parser.NumberVectorLabelParser.nextEvent(NumberVectorLabelParser.java:211)
at de.lmu.ifi.dbs.elki.datasource.bundle.MultipleObjectsBundle.fromStream(MultipleObjectsBundle.java:242)
at de.lmu.ifi.dbs.elki.datasource.parser.AbstractStreamingParser.asMultipleObjectsBundle(AbstractStreamingParser.java:89)
at de.lmu.ifi.dbs.elki.datasource.InputStreamDatabaseConnection.loadData(InputStreamDatabaseConnection.java:91)
at de.lmu.ifi.dbs.elki.database.StaticArrayDatabase.initialize(StaticArrayDatabase.java:119)
at de.lmu.ifi.dbs.elki.workflow.InputStep.getDatabase(InputStep.java:62)
at de.lmu.ifi.dbs.elki.KDDTask.run(KDDTask.java:108)
at de.lmu.ifi.dbs.elki.application.KDDCLIApplication.run(KDDCLIApplication.java:60)
at [...]
My .csv file looks like this:
'Lymphatics = deformed','Lymphatics = displaced','Lymphatics = arched','Lymphatics = normal','Block_of_affere = yes','Block_of_affere = no','Bl_of_lymph_c = no','Bl_of_lymph_c = yes','Bl_of_lymph_s = no','Bl_of_lymph_s = yes','By_pass = no','By_pass = yes','Extravasates = yes','Extravasates = no','Regeneration_of = no','Regeneration_of = yes','Early_uptake_in = yes','Early_uptake_in = no','Changes_in_lym = oval','Changes_in_lym = round','Changes_in_lym = bean','Defect_in_node = lacunar','Defect_in_node = lac_central','Defect_in_node = lac_margin','Defect_in_node = no','Changes_in_node = lac_central','Changes_in_node = lacunar','Changes_in_node = no','Changes_in_node = lac_margin','Changes_in_stru = faint','Changes_in_stru = drop_like','Changes_in_stru = stripped','Changes_in_stru = coarse','Changes_in_stru = diluted','Changes_in_stru = grainy','Changes_in_stru = no','Changes_in_stru = reticular','Special_forms = vesicles','Special_forms = no','Special_forms = chalices','Dislocation_of = no','Dislocation_of = yes','Exclusion_of_no = yes','Exclusion_of_no = no',Lym_nodes_dimin,Lym_nodes_enlar,No_of_nodes_in,Outlier
1,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0.333333,0.285714,no
0,1,0,0,1,0,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0.333333,0.142857,no
There are 11 parsers available. But maybe it is my data, that is to large for the parser.

Thank you, this is a bug in the ELKI CSV parser.
It did not expect the class column to have a label.
So if your remove the ,Outlier part of your first line (or the first line completely), it should read this file just fine.
I will push a change that makes it more robust here (it will still lose the label though, because ELKI currently has support column labels for numerical columns but not for string label columns).

Related

HTML output of Google Assistant SDK is truncated

I'm trying out the android things example app and have set the Screen Output to use HTML.
The output seems to be truncated and not terminated by the end html tag. Here is the actual output. Do you have any suggestions?
I'm using the grpc project/library from the android things example using the com.google.assistant.embedded.v1alpha2
# com.google.assistant.embedded.v1alpha2.AssistResponse#e3565447
screen_out {
data: "<html> <head><meta charset=\"UTF-8\"> <link href=\"https://fonts.googleapis.com/css?family=Roboto:400,700\" rel=\"stylesheet\"></head> <style>html,body{background:transparent;margin:0}#popout{bottom:0;box-sizing:border-box;font-family:\"Roboto\",sans-serif;font-size:40px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-smoothing:antialiased;position:absolute;transform:translateZ(0);transition:opacity 500ms;transition-timing-function:ease-in-out;overflow:hidden;width:100%}#popout div{font-family:\'Roboto\',arial,sans-serif}.popout-shadow{background-image:linear-gradient(-180deg,rgba(0,0,0,0.0) 0%,rgba(0,0,0,0.8) 100%);height:5.4em;width:100%}.popout-overflow-shadow-down{background-image:linear-gradient(-180deg,rgba(0,0,0,0.0) 0%,rgba(0,0,0,0.8) 100%);bottom:144px;display:none;position:absolute;height:48px;width:100%;z-index:100}.popout-overflow-shadow-up{background-image:linear-gradient(-180deg,rgba(25,25,25,0.97) 50%,rgba(0,0,0,0.0) 100%);display:none;top:5.4em;height:48px;position:absolute;width:100%;z-index:100}.popout-content{background-color:rgba(25,25,25,.97);padding-right:28px;width:100%;overflow-y:scroll;overflow-x:hidden}.popout-content:hover,.popout-content:focus{outline:none}.popout-asbar:hover,.popout-asbar:focus{outline:none}.inactive{opacity:.4}#carousel-container{left:0;overflow-x:initial;transition:300ms ease-in-out;transform:translateZ(0)}</style> <script>\nwindow.Assistant = window.Assistant || {};var Assistant = window.Assistant;if (Assistant.clear)Assistant.clear();\nAssistant.clear = function(){if (Assistant.cleanup){Assistant.cleanup();}\nwindow.Assistant = {};};</script> <script>\nwindow.Assistant = window.Assistant || {};var Assistant = window.Assistant;\nAssistant.displayTimeoutMs = 20000;\nAssistant.micTimeoutMs = 0;\nAssistant.hideTimerId = undefined;\nAssistant.micTimerId = undefined;\nAssistant.isUsingRelativeIndex = false;\nAssistant.SUGGESTION_PROMPT_ID = \'suggestion_prompt\';\nAssistant.SUGGESTION_PROMPT;\nAssistant.SUGGESTION_CLASS_NAME = \'suggestion\';\nAssistant.POPOUT;\nAssistant.ICON;\nAssistant.cleanup = function(){Assistant.cleanupTimer_();};\nAssistant.updateDisplayTimeoutMs = function(displayTimeoutMs){if (displayTimeoutMs >= 0){Assistant.displayTimeoutMs = displayTimeoutMs;}\n};\nAssistant.updateMicTimeoutMs = function(micTimeoutMs){if (micTimeoutMs >= 0){Assistant.micTimeoutMs = micTimeoutMs;}\n};\nAssistant.updateIsUsingRelativeIndex = function(usingRelativeIndex){Assistant.isUsingRelativeIndex = !!usingRelativeIndex;};\nAssistant.cleanupTimer_ = function(){if (Assistant.hideTimerId){window.clearTimeout(Assistant.hideTimerId);Assistant.hideTimerId = undefined;}\nif (Assistant.micTimerId){window.clearTimeout(Assistant.micTimerId);Assistant.micTimerId = undefined;}\n};\nAssistant.getSuggestionPrompt = function(){if (!Assistant.SUGGESTION_PROMPT){Assistant.SUGGESTION_PROMPT =\ndocument.getElementById(Assistant.SUGGESTION_PROMPT_ID);}\nreturn Assistant.SUGGESTION_PROMPT;};\nAssistant.run = function(){Assistant.POPOUT = document.getElementById(\'popout\');Assistant.ICON = document.getElementsByClassName(\'assistant-icon\')[0];Assistant.keepShowing();};\nAssistant.keepShowing = function(){if (!Assistant.POPOUT){return;}\nAssistant.cleanupTimer_();Assistant.slideUpPopout();if (Assistant.displayTimeoutMs){Assistant.hideTimerId = setTimeout(function(){Assistant.hideTimerId = undefined;Assistant.slideDownPopout();if (typeof Assistant.maybePopulateNotification !== \'undefined\'){Assistant.maybePopulateNotification();}\n},Assistant.displayTimeoutMs);}\nif (Assistant.micTimeoutMs){Assistant.micStartListen();Assistant.micTimerId = setTimeout(function(){Assistant.micTimerId = undefined;Assistant.micStopListen();},Assistant.micTimeoutMs);}\n};\nAssistant.toggleElement = function(ele,display){var target = display ?\'\' :\'none\';if (ele.style.display != target){ele.style.display = target;}\n};\nAssistant.updateSuggest
2020-05-22 16:43:43.879 24567-24990/com.densoft.android I/EmbeddedAssistant: Assistant response:
Any suggestions?
The issue was Logcat in Android. I found that it is truncating the log message if size is over 4K.

How to Display a decomposition wavelet in 3 level?

I want to display a decomposition wavelet in 3 level.
so can any help me in give a Matlab function to display it?
[cA cH cV cD]=dwt2(a,waveletname);
out=[cA cH;cV cD];
figure;imshow(out,[]);
That only works for the first level.
actually, I want to representation square mode such wavemenu in Matlab.
example of the view decomposition
I am fairly new to it.
thanx.
You should use the function wavedec2(Image,numberOfLevels,'wname') with the amount of levels that you need.
For more information look at
http://www.mathworks.com/help/wavelet/ref/wavedec2.html
Code for example with db1
clear all
im = imread('cameraman.tif');
[c,s] = wavedec2(im,3,'db1');
A1 = appcoef2(c,s,'db1',1);
[H1,V1,D1] = detcoef2('all',c,s,1);
A2 = appcoef2(c,s,'db1',2);
[H2,V2,D2] = detcoef2('all',c,s,2);
A3 = appcoef2(c,s,'db1',3);
[H3,V3,D3] = detcoef2('all',c,s,3);
V1img = wcodemat(V1,255,'mat',1);
H1img = wcodemat(H1,255,'mat',1);
D1img = wcodemat(D1,255,'mat',1);
A1img = wcodemat(A1,255,'mat',1);
V2img = wcodemat(V2,255,'mat',1);
H2img = wcodemat(H2,255,'mat',1);
D2img = wcodemat(D2,255,'mat',1);
A2img = wcodemat(A2,255,'mat',1);
V3img = wcodemat(V3,255,'mat',1);
H3img = wcodemat(H3,255,'mat',1);
D3img = wcodemat(D3,255,'mat',1);
A3img = wcodemat(A3,255,'mat',1);
mat3 = [A3img,V3img;H3img,D3img];
mat2 = [mat3,V2img;H2img,D2img];
mat1 = [mat2,V1img;H1img,D1img];
imshow(uint8(mat1))
The final result

<IPython.core.display.HTML object> instead of graph

I am trying to achieve the following Twitter-Visualization project in iPython: http://www.amypeniston.com/web/visualizing-twitter-data
For the last step, my code is:
%pylab
dogs = pd.read_csv(' C:/Users/Alex/mongodb/bin/outputTweets.csv')
dogs['created_at'] = pd.to_datetime(pd.Series(dogs['created_at']))
dogs.set_index('created_at', drop=False, inplace=True)
dogs.index = dogs.index.tz_localize('GMT').tz_convert('EST')
dogs.index = dogs.index - DateOffset(hours = 12)
dogs.index
dogs1m = dogs['created_at'].resample('1t', how='count')
v.core.initialize_notebook()
area = v.Area(dogs1m)
area.colors(brew='Spectral')
area.display()
However, all I get in return is:
IPython.core.display.HTML object

OpenOffice Draw macro to find replace text

I'm looking to find replace text within multiple PDF documents using Draw. Thus far I've managed to open the PDF however
mydoc.createReplaceDescription
appears not to be a valid property / method on a Draw doc. Although oddly this is used in many examples for writer and calc.
Are there any alternatives?
Okay after some playing around with the recorder in the Writer I managed to record a macro that seems to be more general purpose than the createReplaceDiscription I was trying earlier.
It's got a lot of bumf that I guess could be cleaned up but it works...
REM ***** BASIC *****
Sub Main
End Sub
sub WriterFindReplace
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(18) as new com.sun.star.beans.PropertyValue
args1(0).Name = "SearchItem.StyleFamily"
args1(0).Value = 2
args1(1).Name = "SearchItem.CellType"
args1(1).Value = 0
args1(2).Name = "SearchItem.RowDirection"
args1(2).Value = true
args1(3).Name = "SearchItem.AllTables"
args1(3).Value = false
args1(4).Name = "SearchItem.Backward"
args1(4).Value = false
args1(5).Name = "SearchItem.Pattern"
args1(5).Value = false
args1(6).Name = "SearchItem.Content"
args1(6).Value = false
args1(7).Name = "SearchItem.AsianOptions"
args1(7).Value = false
args1(8).Name = "SearchItem.AlgorithmType"
args1(8).Value = 0
args1(9).Name = "SearchItem.SearchFlags"
args1(9).Value = 65536
args1(10).Name = "SearchItem.SearchString"
args1(10).Value = "<<THE WORD YOUR FINDING>>"
args1(11).Name = "SearchItem.ReplaceString"
args1(11).Value = "<< THE WORD YOUR USING TO REPLACE>>"
args1(12).Name = "SearchItem.Locale"
args1(12).Value = 255
args1(13).Name = "SearchItem.ChangedChars"
args1(13).Value = 2
args1(14).Name = "SearchItem.DeletedChars"
args1(14).Value = 2
args1(15).Name = "SearchItem.InsertedChars"
args1(15).Value = 2
args1(16).Name = "SearchItem.TransliterateFlags"
args1(16).Value = 1280
args1(17).Name = "SearchItem.Command"
args1(17).Value = 3
args1(18).Name = "Quiet"
args1(18).Value = true
dispatcher.executeDispatch(document, ".uno:ExecuteSearch", "", 0, args1())
end sub

Is there an easier way to modify a value in a subsubsub record field in Erlang?

So I've got a fairly deep hierarchy of record definitions:
-record(cat, {name = '_', attitude = '_',}).
-record(mat, {color = '_', fabric = '_'}).
-record(packet, {cat = '_', mat = '_'}).
-record(stamped_packet, {packet = '_', timestamp = '_'}).
-record(enchilada, {stamped_packet = '_', snarky_comment = ""}).
And now I've got an enchilada, and I want to make a new one that's
just like it except for the value of one of the subsubsubrecords.
Here's what I've been doing.
update_attitude(Ench0, NewState)
when is_record(Ench0, enchilada)->
%% Pick the old one apart.
#enchilada{stamped_packet = SP0} = Ench0,
#stamped_packet{packet = PK0} = SP0,
#packet{cat = Tag0} = PK0,
%% Build up the new one.
Tude1 = Tude0#cat{attitude = NewState},
PK1 = PK0#packet{cat = Tude1},
SP1 = SP0#stamped_packet{packet = PK1},
%% Thank God that's over.
Ench0#enchilada{stamped_packet = SP1}.
Just thinking about this is painful. Is there a better way?
As Hynek suggests, you can elide the temporary variables and do:
update_attitude(E = #enchilada{stamped_packet = (P = #packet{cat=C})},
NewAttitude) ->
E#enchilada{stamped_packet = P#packet{cat = C#cat{attitude=NewAttitude}}}.
Yariv Sadan got frustrated with the same issue and wrote Recless, a type inferring parse transform for records which would allow you to write:
-compile({parse_transform, recless}).
update_attitude(Enchilada = #enchilada{}, Attitude) ->
Enchilada.stamped_packet.packet.cat.attitude = Attitude.
Try this:
update_attitude(E = #enchilada{
stamped_packet = (SP = #stamped_packet{
packet = (P = #packet{
cat = C
})})}, NewState) ->
E#enchilada{
stamped_packet = SP#stamped_packet{
packet = P#packet{
cat = C#cat{
attitude = NewState
}}}}.
anyway, structures is not most powerful part of Erlang.

Resources