Return-Path: X-Original-To: apmail-systemml-dev-archive@minotaur.apache.org Delivered-To: apmail-systemml-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E4B9218882 for ; Thu, 17 Dec 2015 08:55:46 +0000 (UTC) Received: (qmail 81693 invoked by uid 500); 17 Dec 2015 08:55:41 -0000 Delivered-To: apmail-systemml-dev-archive@systemml.apache.org Received: (qmail 81641 invoked by uid 500); 17 Dec 2015 08:55:41 -0000 Mailing-List: contact dev-help@systemml.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@systemml.incubator.apache.org Delivered-To: mailing list dev@systemml.incubator.apache.org Received: (qmail 81630 invoked by uid 99); 17 Dec 2015 08:55:41 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Dec 2015 08:55:41 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id F126CC064D for ; Thu, 17 Dec 2015 08:55:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.445 X-Spam-Level: ** X-Spam-Status: No, score=2.445 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, RP_MATCHES_RCVD=-0.554, SPF_PASS=-0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id YYKhJUGe792d for ; Thu, 17 Dec 2015 08:55:32 +0000 (UTC) Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 914A742A72 for ; Thu, 17 Dec 2015 08:55:32 +0000 (UTC) Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 17 Dec 2015 03:55:32 -0500 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 17 Dec 2015 03:55:31 -0500 X-IBM-Helo: b01cxnp22033.gho.pok.ibm.com X-IBM-MailFrom: reinwald@us.ibm.com X-IBM-RcptTo: dev@systemml.incubator.apache.org Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id tBH8tUBF26607708 for ; Thu, 17 Dec 2015 08:55:30 GMT Received: from d01av02.pok.ibm.com (localhost [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id tBH8tUMr001732 for ; Thu, 17 Dec 2015 03:55:30 -0500 Received: from d01ml604.pok.ibm.com (d01ml604.pok.ibm.com [9.63.8.151]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id tBH8tUVx001711 for ; Thu, 17 Dec 2015 03:55:30 -0500 In-Reply-To: References: To: dev@systemml.incubator.apache.org MIME-Version: 1.0 Subject: Re: DML example on main SystemML website X-KeepSent: 9FA34859:0B889645-88257F1E:002D9555; type=4; name=$KeepSent X-Mailer: IBM Notes Release 9.0.1SHF211 December 19, 2013 From: Berthold Reinwald Message-ID: Date: Thu, 17 Dec 2015 00:55:29 -0800 X-MIMETrack: Serialize by Router on D01ML604/01/M/IBM(Release 9.0.1FP4HF643 | November 3, 2015) at 12/17/2015 03:55:29, Serialize complete at 12/17/2015 03:55:29 Content-Type: multipart/alternative; boundary="=_alternative 002DE2EA88257F1E_=" X-TM-AS-MML: disable x-cbid: 15121708-0053-0000-0000-000005D138E2 --=_alternative 002DE2EA88257F1E_= Content-Type: text/plain; charset="US-ASCII" Creating a DML cookbook sounds very useful ... especially for new data scientists starting to pick up DML. It shows vectorization avoiding loops, and people are familiar with the semantics. There may be more nuggets like that through-out the DML algorithms. And the list will grow in the course of time. Regards, Berthold Reinwald IBM Almaden Research Center office: (408) 927 2208; T/L: 457 2208 e-mail: reinwald@us.ibm.com From: Shirish Tatikonda To: dev@systemml.incubator.apache.org Date: 12/16/2015 10:03 PM Subject: Re: DML example on main SystemML website Deron, Along with such a complete algorithm, we could also include one/two common and useful DML snippets. We could also create a "DML Cookbook" with such snippets and keep adding more over time. Some example snippets are below -- note that I created them quite a while back, and they may need revision and testing. *Classifier Performance* # Confusion matrix cm = table(truthLabels, predictedLabels) TP = as.scalar(cm[1,1]) TN = as.scalar(cm[2,2]) FP = as.scalar(cm[1,2]) FN = as.scalar(cm[2,1]) accuracy = (TP+TN)/nrow(truthLabels) precision = TP / (TP+FP) recall = TP / (TP+FN) print("Accuracy = " + accuracy + ", Precision = " + precision + ", Recall = " + recall); *Covariance matrix* A = read("input.mtx"); N = nrow(A); # column means mu = colSums(A)/N; # Covarianace matrix C = (t(A) %*% A)/(N-1) - (N/(N-1))*t(mu) %*% mu; *Select rows satisfying a predicate* ind = diag(ppred(A[,1], thresh, ">")); ind = removeEmpty(target=ind, margin="rows"); result = ind %*% A; *Center and Scale columns* A = read("input.mtx"); cm = colMeans(A); cvars = (colSums (A^2)); cvars = (cvars - N*(cm^2))/(N-1); Ascaled = (A-cm)/sqrt(cvars); *Random shuffling of rows* N = nrow(A); s = sample(N, N, replace=FALSE); tab = table(seq(1:N), s); result = tab %*% A; On Wed, Dec 16, 2015 at 5:59 PM, Deron Eriksson wrote: > That example is perfect. Concise and powerful. Thank you Fred. > > Deron > > > On Wed, Dec 16, 2015 at 4:16 PM, Frederick R Reiss > wrote: > > > We can use the Poisson nonnegative matrix factorization example from last > > week's webcast: > > > > i = 0 > > while(i < max_iterations) { > > H = (H * (t(W) %*% (V/(W%*%H + epsilon)))) / t(colSums(W)) > > W = (W * ((V/(W%*%H) + epsilon) %*% t(H))) / t(rowSums(H)) > > i = i + 1; > > } > > > > > > Sound ok to everyone? > > > > Fred > > > > > > [image: Inactive hide details for Deron Eriksson ---12/16/2015 04:02:26 > > PM---Hi, I think the main SystemML website at http://systemml.i]Deron > > Eriksson ---12/16/2015 04:02:26 PM---Hi, I think the main SystemML > website > > at http://systemml.incubator.apache.org/ > > > > From: Deron Eriksson > > To: dev@systemml.incubator.apache.org > > Date: 12/16/2015 04:02 PM > > Subject: DML example on main SystemML website > > ------------------------------ > > > > > > > > Hi, > > > > I think the main SystemML website at > http://systemml.incubator.apache.org/ > > needs to be updated so that the DML example is an actual algorithm or at > > least a fragment of an algorithm. > > > > Does anyone have a recommendation for a short, concise example that shows > > the power of DML? > > > > Thanks! > > Deron > > > > > > > --=_alternative 002DE2EA88257F1E_=--