looking for "optimal weighting" algorithm

Stephan Diehl stephan.diehl at gmx.net
Thu Apr 10 16:41:15 CEST 2003

You are probably looking for "linear regression".


Alex Martelli wrote:

> I _know_ there's a decent algorithm to solve the following problem,
> but I don't recall its name and thus can't rapidly google for the
> details... can somebody help?
> The problem: I need to design a "decision criterion" to classify
> "observations".  For each observation I measure the values of a
> number N of features, x1, x2, ... xN; the desired design criterion
> is a set of weights w1, w2, ... wN such that for any observation I
> will then just compute a weighted sum
>   S = w1*x1 + w2*x2 + ... + wN*xN
> and classify the observation as Black if S<=1, White if S>1.  To
> train my classifier I have a large corpus of observations already
> made and annotated with "ground-truth" data about whether each
> given observation should have been classified as B or W, and an
> error-cost value for each kind of classification (Ebw is the cost
> of erroneously classifying a feature as W when it should be B,
> Ewb is that of classifying it as B when it should be W).  So,
> what's the algorithm to estimate the weights given the corpus of
> observation and ground-truth data, and the error-costs?
> Responses welcome either here or directly to my mailbox -- if I
> do get responses to my mailbox, I'll eventually summarize here --
> as a bonus, I promise to make available a Python implementation of
> whatever algorithm I end up with, if one's not already around...;-).
> TIA,
> Alex

More information about the Python-list mailing list