Posts

Plot A Confusion Matrix with Color and Frequency in R -

Image
i want plot confusion matrix, but, don't want use heatmap, because think give poor numerical resolution. instead, want plot frequency in middle of square. instance, output of this: library(mlearning); data("glass", package = "mlbench") glass$type <- as.factor(paste("glass", glass$type)) summary(glasslvq <- mllvq(type ~ ., data = glass)); (glassconf <- confusion(predict(glasslvq, glass, type = "class"), glass$type)) plot(glassconf) # image default however, 1.) don't understand "01, 02, etc" means along each axis. how can rid of that? 2.) 'predicted' label of 'y' dimension, , 'actual' label 'x' dimension 3.) replace absolute counts frequency / probability. alternatively, there package this? in essence, want in r: http://www.mathworks.com/help/releases/r2013b/nnet/gs/gettingstarted_nprtool_07.gif or: http://c431376.r76.cf2.rackcdn.com/8805/fnhum-05-0018...

java - AutowireCapableBeanFactory.autowireBeanProperties() seems not to work for xml configured contexts -

i trying manually inject beans autowired dependency using autowirecapablebeanfactory.autowirebeanproperties(). seems work if bean should injected configured in java class. if configured in xml context file not work. test cases: public class injectortest { @test public void testannotationinjector() { annotationconfigapplicationcontext context = null; try { testbean testbean = new testbean(); context = new annotationconfigapplicationcontext(someserviceconfig.class);; autowirecapablebeanfactory beanfactory = context.getautowirecapablebeanfactory(); beanfactory.autowirebeanproperties(testbean, autowirecapablebeanfactory.autowire_by_type, false); asserttrue(testbean.getsomeservice() != null); } { if (context != null) { context.close(); } } } @test public void testxmlinjector() { classpathxmlapplicationcontext context = null; try { testbean testbean = new testbean(); context...

text - Writing to txt in python -

i'm writing lines of numbers text file text file. numbers print while running good, when open output file nothing has been written it. can't figure out why. min1=open(output1,"w") oh_reader = open(filename, 'r') countmin = 0 while countmin <=300000: line in oh_reader: #min1 if countmin <=60000: hrvalue= int(line) ibihr = line print(line) print(countmin) min1.write(ibihr) min1.write("\n") countmin = countmin + hrvalue min1.close() you should use python's with statement open files. handles closing , safer: with open(filename, 'r') oh_reader: if way program indented min1=open(output1,"w") oh_reader = open(filename, 'r') countmin = 0 while countmin <=300000: line in oh_reader: # same having pass here #min1 if countmin <=60000: ...

lua - How do I add a config list am I doing it wrongly? -

the issue recieving making txt files contents readable in listed format such as: word1 word2 word3 if user have said of words/or phrases response otherwise program wait valid reply blacklisted word file. local valid; repeat local reply = io.read() file = io.open('blacklist.txt', "r+") file:read() file:close() -- list equal contents within blacklist.txt if reply == list valid = reply print("kicking user game") --game.kick.saiduser else --do nothing , wait valid response end until valid; file:read() reads 1 line file , discards it. i think want read whole contents of file list with list = file:read("*a") then want check whether reply in list with if list:match("\n"..reply.."\n") you may want read list outside loop , prepend \n list make pattern matching simpler.

Boost Xcode C++ command line Undefined symbols for architecture x86_64 -

Image
i have gotten boost work in test application following instructions here . need create command-line application generate licenses. i've inherited code , uses boost. think i've set correctly when try build receive undefined symbols architecture x86_64 error using boost. i created command-line application: i added path boost: i tried change c++ standard library compiler: here code referencing boost library: #include <boost/date_time/posix_time/posix_time_io.hpp> namespace bg = boost::gregorian; namespace bp = boost::posix_time; here errors: undefined symbols architecture x86_64: "boost::program_options::to_internal(std::string const&)", referenced from: std::vector<std::string, std::allocator<std::string> > boost::program_options::to_internal<std::string>(std::vector<std::string, std::allocator<std::string> > const&) in main.o "boost::program_options::variables_map::variables_map()...

oracle - Java persistence - getSingleResult() did not retrieve any entities -

i testing jpa project follows: try { emfactory = persistence.createentitymanagerfactory(persistence_unit_name); entitymanager em = emfactory.createentitymanager(); query qry = em.createquery("select t testcon t"); system.out.println(qry); testcon tcon = (testcon) qry.getsingleresult(); //qry.getsingleresult(); rslt = tcon.getb(); if (rslt == null || rslt.equals("")) rslt = "could not result"; system.out.println(rslt); //new showmsg(rslt); } catch (exception ex) { system.out.println(ex); //new showmsg("exception occured"); } the output is: javax.persistence.noresultexception: getsingleresult() did not retrieve entities. the qry string is: ejbqueryimpl(readallquery(referenceclass=testcon sql="select a, b c##test.testcon")) when test directly in sqlplus: select a, b c##test.testcon ...

html - Does it matter which ASP.NET Project type I use for a super-simple site? -

i'm going create super-simple, one-page, site. have text , images , links on it, that's all. no code, either c# or jquery or else - html (and minimal css). i created mockups of site (page) using vs 2013 selecting new > project > web site > asp.net , each of following, in turn: empty page spa web forms for first two, added html page , copied html , css , ran it. works fine. for last option (web forms), difference there page (default.aspx). replaced existing html in there mine (and css). works fine. i plan on publishing to/with/as azure web site. assume can of these project types. the web forms adds bunch of stuff don't need or use, imagine 1 of other 2 best bet. there reason why select 1 project type on others simple page this? if it's static site , know html/css want use, best bet visual studio use empty page template.