Return-Path: X-Original-To: apmail-mahout-user-archive@www.apache.org Delivered-To: apmail-mahout-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AAE0E83C7 for ; Sun, 28 Aug 2011 16:03:01 +0000 (UTC) Received: (qmail 12359 invoked by uid 500); 28 Aug 2011 16:03:00 -0000 Delivered-To: apmail-mahout-user-archive@mahout.apache.org Received: (qmail 12271 invoked by uid 500); 28 Aug 2011 16:02:59 -0000 Mailing-List: contact user-help@mahout.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@mahout.apache.org Delivered-To: mailing list user@mahout.apache.org Received: (qmail 12263 invoked by uid 99); 28 Aug 2011 16:02:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Aug 2011 16:02:59 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of ted.dunning@gmail.com designates 209.85.216.170 as permitted sender) Received: from [209.85.216.170] (HELO mail-qy0-f170.google.com) (209.85.216.170) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Aug 2011 16:02:53 +0000 Received: by qyl38 with SMTP id 38so1963807qyl.1 for ; Sun, 28 Aug 2011 09:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=NbxzGz2o1PRjcJGDGLcc+mpC2WUVGEsCoTyVmHf6jek=; b=keecZvZl8+/NhZQp2YSj9l3nPsbFTTI9xmYWBQXS1uz8oHCTr2ii3o2sZkUSt+CMaP 4VrPZEro2pEm00Cu4HYHMBUACF9KrPtVGSirjeumrwRDp5JLHL6i/7XMtq6pQ0seOYhu flns2FAtHS8LngrNbwQBXNgaEYihutpCguJ5A= MIME-Version: 1.0 Received: by 10.224.183.17 with SMTP id ce17mr473189qab.123.1314547352060; Sun, 28 Aug 2011 09:02:32 -0700 (PDT) Received: by 10.224.89.7 with HTTP; Sun, 28 Aug 2011 09:02:32 -0700 (PDT) In-Reply-To: <3be90d3b.73ed.1321114aa7f.Coremail.myn@163.com> References: <3be90d3b.73ed.1321114aa7f.Coremail.myn@163.com> Date: Sun, 28 Aug 2011 09:02:32 -0700 Message-ID: Subject: Re: why limit the num of numCategories in AbstractOnlineLogisticRegression From: Ted Dunning To: "user@mahout.apache.org" Content-Type: multipart/alternative; boundary=20cf303a2c0ff5c10904ab92e779 --20cf303a2c0ff5c10904ab92e779 Content-Type: text/plain; charset=UTF-8 That limit is only for that one classifier call. The idea is that if you have two categories then getting just one score eliminates the construction of a vector. Use classify() In the general case. On Sunday, August 28, 2011, myn wrote: > I was read the AbstractOnlineLogisticRegression(SGD) sorce code ,but > it limit the number of numCategories to 2,why? why not 3 or more? > > @Override > public double classifyScalar(Vector instance) { > Preconditions.checkArgument(numCategories() == 2, "Can only call classifyScalar with two categories"); > > // apply pending regularization to whichever coefficients matter > regularize(instance); > > // result is a vector with one element so we can just use dot product > return link(classifyScalarNoLink(instance)); > } > --20cf303a2c0ff5c10904ab92e779--