Posts

machine learning - generating vector from text data for KMeans using spark -

i new spark , machine learning. trying cluster using kmeans data like 1::hi how 2::i fine, how in data, separator :: , actual text cluster second column has text data. after reading on spark official page , numerous articles have written following code not able generate vector provide input kmeans.train step. import org.apache.spark.sparkconf import org.apache.spark.sparkcontext import org.apache.spark.mllib.clustering.{kmeans, kmeansmodel} import org.apache.spark.mllib.linalg.vectors val sc = new sparkcontext("local", "test") val sqlcontext= new org.apache.spark.sql.sqlcontext(sc) import sqlcontext.implicits._ import org.apache.spark.ml.feature.{hashingtf, idf, tokenizer} val rawdata = sc.textfile("data/mllib/km.txt").map(line => line.split("::")(1)) val sentencedata = rawdata.todf("sentence") val tokenizer = new tokenizer().setinputcol("sentence").setoutputcol("words") val wordsdata = tokenizer...

c++ - Integrating google protocol buffers in ns3 -

i'm using google protocol buffers in ns3 , seem getting errors: ./libns3-dev-internet-debug.so: undefined reference google::protobuf::message::checktypeandmergefrom(google::protobuf::messagelite const&)' ./libns3-dev-internet-debug.so: undefined reference to vtable google::protobuf::message' ./libns3-dev-internet-debug.so: undefined reference google::protobuf::internal::logmessage::logmessage(google::protobuf::loglevel, char const*, int)' ./libns3-dev-internet-debug.so: undefined reference to google::protobuf::message::gettypenameabi:cxx11 const' ./libns3-dev-internet-debug.so: undefined reference google::protobuf::message::initializationerrorstring[abi:cxx11]() const' ./libns3-dev-internet-debug.so: undefined reference to google::protobuf::unknownfieldset::clearfallback()' ./libns3-dev-internet-debug.so: undefined reference google::protobuf::message::spaceused() const' ./libns3-dev-internet-debug.so: undefined reference to google::protobuf::in...

c# - Enable multiple BLE Characteristic notifications in UWP -

i have tried enable 2 notification in uwp application, every time first characteristic notify user. accessconfigurationcharacteristic(); configurationselectedcharacteristic = selectedcharacteristic; characteristicnotifyenableforconfig(); await task.delay(5000); accessdiagnosticcharacteristic(); diagnosticselectedcharacteristic = selectedcharacteristic; characteristicnotifyenable(); private async void characteristicnotifyenable() { try { // bt_code: must write cccd in order server send notifications. // receive them in valuechanged event handler. // note sample configures either indicate or notify, not both. var result = await diagnosticselectedcharacteristic.writeclientcharacteristicconfigurationdescriptorasync( gattclientcharacter...

c++ - Implicitly deleted default constructor works in C++14 -

i doing tests code did not compile, , discovered code: struct { a(int) {}; virtual void foo() = 0; }; struct b : public virtual { virtual void bar() = 0; }; struct c : public b { c() : a(1) {} virtual void foo() override {} virtual void bar() override {} }; int main() { c c; return 0; } in c++11 fails compile (on g++ 7.0.1) ‘b::b()’ implicitly deleted because default definition ill-formed , while in c++14 compiles successfully. i've tried find out new feature of c++14 allowed work, no avail. description in cppreference not mention of sort seems. why can code compile in c++14 not in c++11? definitively it's bug in gcc 7 because when have checked out code in online compiler gcc 7+, has worked without kind of problem. so here give ide online can set favorite compiler , try tests, if want. https://godbolt.org/ sorry can't better couldn't reproduce error.

android - The json from ibm watson for conversation api does not triggering the negatives -

i trying watson conversation api on android phone. had made model on watson , completed app. works fine when giving irrelevant inputs gives 1 of intent instead of giving negative response. had created separate conversation triggering on else. when try conversation on watson works perfect, out put json phone doesn't contains 'anything else' responses every flow, watson tries recognize intent, can see level confidence every input user in 1 payload window inside project ibm developers here . or can did debugging data return in app. one idea create 1 flow conditions confidence, entities, regex, context variable or true condition. true condition flow did watson talk user if 1 intent less confidence inside condition, or according flow, return want if use conditions entities or regex. simon did 1 example conditions entities , context variables , regex , check link: simon example . and can did conditions confidence level make sure if user type correctly intents...

c# - How to update selected rows in ListView -

i have listview in asp.net web form . want select rows , update selected after button click. want use checkbox/checkboxlist . don't understand how send information row or column in selected row checkbox/checkboxlist item . how can select rows, , update them , using checkbox/checkboxlist ? use asp.net linq entity framework. code <asp:button id="buttontest" runat ="server" onclick="buttontest_click" /> <asp:listview id="listview2" itemtype="doccat.models.reqinf" selectmethod="getreqf" onitemdatabound="listview2_itemdatabound" datakeynames="requestn" enableviewstate="true" runat="server" updatemethod="listview2_updateitem" deletemethod="listview2_deleteitem" insertmethod="listview2_insertitem"> <layouttemplate> <div class="outercontainer" style="overflow: scro...

swift3 - Can't push from programmatically created UINavigationController -

in swift 3 project using xcode 8.3 , ios 10.3, navigation controller push. app runs navigation controller until try use push. works until last line cause app crash, fatal error: unexpectedly found nil while unwrapping optional value . don't want use storyboard, point of question how accomplish task without storyboard. app delegate code class appdelegate: uiresponder, uiapplicationdelegate { var window: uiwindow? func application(_ application: uiapplication, didfinishlaunchingwithoptions launchoptions: [uiapplicationlaunchoptionskey: any]?) -> bool { window = uiwindow(frame: uiscreen.main.bounds) window?.makekeyandvisible() window?.rootviewcontroller = uinavigationcontroller(rootviewcontroller: mainviewcontroller()) } view controller: import uikit class mainviewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() view.backgroundcolor = .white let navcontroller = navigationco...