From dev-return-15702-apmail-spark-dev-archive=spark.apache.org@spark.apache.org Mon Nov 2 03:12:37 2015 Return-Path: X-Original-To: apmail-spark-dev-archive@minotaur.apache.org Delivered-To: apmail-spark-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 B674C18CB2 for ; Mon, 2 Nov 2015 03:12:37 +0000 (UTC) Received: (qmail 54113 invoked by uid 500); 2 Nov 2015 03:12:32 -0000 Delivered-To: apmail-spark-dev-archive@spark.apache.org Received: (qmail 53969 invoked by uid 500); 2 Nov 2015 03:12:32 -0000 Mailing-List: contact dev-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@spark.apache.org Received: (qmail 53394 invoked by uid 99); 2 Nov 2015 03:12:32 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Nov 2015 03:12:32 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id C11A918097A for ; Mon, 2 Nov 2015 03:12:31 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.001 X-Spam-Level: X-Spam-Status: No, score=0.001 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=dbtsai_com.20150623.gappssmtp.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 70bMdZmVVgmt for ; Mon, 2 Nov 2015 03:12:21 +0000 (UTC) Received: from mail-ig0-f177.google.com (mail-ig0-f177.google.com [209.85.213.177]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 1A4302316E for ; Mon, 2 Nov 2015 03:12:21 +0000 (UTC) Received: by igpw7 with SMTP id w7so40984794igp.1 for ; Sun, 01 Nov 2015 19:12:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dbtsai_com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=D0yTaVo4thFfMfMG+5qWRwJkhX6foB3EC5X7VTUUXCI=; b=wfnJysay7qgfA+NMi9ag1IZA6GGdgNWFYIF0W+R03/R+eF4lXMZMBIYZrtUvKZF1dO 7il4ns+G4fx3iJxDOf2gJ8130eUJgQKiIkELB34g7ObHjO6MLcaBld+y5UzlxEQo6xnI jcq8CNIl3SpKj0EcODa2uamtyF/FOgMy8wT6LKZXxsQdJ++qOw1IU+UEAziRRcTOK/XT 26+XVwDPN5QPIbGBAyaXkbSm/qCAc+dreeYkYiSZCrYE4/6C+l44pynWbgjmMYF8DsCg fTbtNYEDQETy2eMXS/DeFqRE3US6mpsRlr1h+bH/veqMH7u/ovrt5eFSaD4blVVQpvye oT1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=D0yTaVo4thFfMfMG+5qWRwJkhX6foB3EC5X7VTUUXCI=; b=DbMVKFBnIf1QiClRT4FHI3A4LzItl2KSIik9bgI4TGcmUheGI/LH8IJ/ihnunDoleW F7F8UoigniCOTlDlnaw4UNgXgQkp5olyWN3murYXzA0jbXnYqBXbt4G0K84cv3hWSLma 16ylyAsiXWdCaXngv8vFCitAa0TcUlwj3hIH9F2jHwM65ar6zHfgJas0eIf0N7bfIrpS ohdY1xb+0WBXafg6yjl8jqGFE1EMg+R+3B/tkEMoAnP5ISOaDwErgIPHOXVC/FZ7dUnJ I37NTAi+ShoT4ZGMk+owmNbRYL2B33gbIP0xyOwtayNblt4G0Wn31WLAEKLCYE2UFBMf Okhg== X-Gm-Message-State: ALoCoQn1erhzUeM50xe+vfGDYlCaVVYn+TbLbLmJ/b8rLt0QRoaP379/l3B1SY/acD/wCSFYJlWm MIME-Version: 1.0 X-Received: by 10.50.155.74 with SMTP id vu10mr8459408igb.50.1446433934129; Sun, 01 Nov 2015 19:12:14 -0800 (PST) Received: by 10.36.210.195 with HTTP; Sun, 1 Nov 2015 19:12:14 -0800 (PST) In-Reply-To: <1947290817.498953.1446398548368.JavaMail.yahoo@mail.yahoo.com> References: <1947290817.498953.1446398548368.JavaMail.yahoo@mail.yahoo.com> <1947290817.498953.1446398548368.JavaMail.yahoo@mail.yahoo.com> Date: Sun, 1 Nov 2015 19:12:14 -0800 Message-ID: Subject: Re: [Spark MLlib] about linear regression issue From: DB Tsai To: Zhiliang Zhu Cc: User , "user-subscribe@spark.apache.org" , Spark Dev List , Meihua Wu , Sean Owen , Sujit Pal Content-Type: text/plain; charset=UTF-8 For the constrains like all weights >=0, people do LBFGS-B which is supported in our optimization library, Breeze. https://github.com/scalanlp/breeze/issues/323 However, in Spark's LiR, our implementation doesn't have constrain implementation. I do see this is useful given we're experimenting SLIM: Sparse Linear Methods for recommendation, http://www-users.cs.umn.edu/~xning/papers/Ning2011c.pdf which requires all the weights to be positive (Eq. 3) to represent positive relations between items. In summary, it's possible and not difficult to add this constrain to our current linear regression, but currently, there is no open source implementation in Spark. Sincerely, DB Tsai ---------------------------------------------------------- Web: https://www.dbtsai.com PGP Key ID: 0xAF08DF8D On Sun, Nov 1, 2015 at 9:22 AM, Zhiliang Zhu wrote: > Dear All, > > As for N dimension linear regression, while the labeled training points > number (or the rank of the labeled point space) is less than N, > then from perspective of math, the weight of the trained linear model may be > not unique. > > However, the output of model.weight() by spark may be with some wi < 0. My > issue is, is there some proper way only to get > some specific output weight with all wi >= 0 ... > > Yes, the above goes same with the issue about solving linear system of > equations, Aw = b, and r(A, b) = r(A) < columnNo(A), then w is > with infinite solutions, but here only needs one solution with all wi >= 0. > When there is only unique solution, both LR and SVD will work perfect. > > I will appreciate your all kind help very much~~ > Best Regards, > Zhiliang > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@spark.apache.org For additional commands, e-mail: dev-help@spark.apache.org