wolfe-pack / wolfe

Wolfe Language and Engine
https://wolfe-pack.github.io/wolfe
Apache License 2.0
135 stars 17 forks source link

Consistent naming scheme for method and variable names in examples #75

Open riedelcastro opened 10 years ago

riedelcastro commented 10 years ago

It would be great if there was a consistent naming scheme in examples, for things like the feature function, the model function, the arguments to the model function, the weight vector etc. Also, for case classes for which it isn't clear what the name should be, we currently use Data. Is there something better?

One short-form proposal is

def f(d:Data):Vector
def s(w:Vector)(d:Data):Double = w dot f(d)
def h(w:Vector)(d:Data):Data = argmax(...) 

A more verbose and explicit form:

def features(data:Data):Vector
def model(w:Vector)(data:Data):Double = w dot features(d)
def predictor(w:Vector)(instance:Data):Data = argmax(...) 

The short form is a bit closer to math in a paper, the longer form probably easier to understand...

I was thinking of replacing the class name Data with XY to indicate that the class holds both the x and y component. I figure that for many people x and y are easy to understand as input & output of their task.

rockt commented 10 years ago

I'd definitely vote for the verbose scheme for the tutorials. f, s, h look a bit cryptic. XYsounds good.

sameersingh commented 10 years ago

I'd vote for the more verbose form for the tutorials too, however not sure if XY is better than Data, since people don't really name their variables x and y when writing code. Data seems incorrect too, I would call it Instance or Example or something like that. It's up to you, not strong thoughts either way.

On Sat, Apr 26, 2014 at 1:39 PM, Tim Rocktäschel notifications@github.comwrote:

I'd definitely vote for the verbose scheme for the tutorials. f, s, hlook a bit cryptic. XYsounds good.

— Reply to this email directly or view it on GitHubhttps://github.com/wolfe-pack/wolfe/issues/75#issuecomment-41480185 .

Sameer Singh

riedelcastro commented 10 years ago

I don't like Instance or Example that much because it sounds so specific to training. Data becomes examples when given to a training algorithm, but before that it's just what I model the world with. Another name I have been using is World, how about that?

It's true nobody names their variables XY in their code, but in papers you often found this naming scheme. It makes it clear that you put both observed and unobserved attributes into this class (this kind of joint modelling is actually often a little confusing for people who know ML but not NLP---it took me ages to explain why joint feature maps are useful because people had learnt keep x and y separate.

sameersingh commented 10 years ago

Ok then, Data or XY is fine. World is quite vague, and can mean very different things to different people.

On Sun, Apr 27, 2014 at 10:16 AM, Sebastian Riedel <notifications@github.com

wrote:

I don't like Instance or Example that much because it sounds so specific to training. Data becomes examples when given to a training algorithm, but before that it's just what I model the world with. Another name I have been using is World, how about that?

It's true nobody names their variables XY in their code, but in papers you often found this naming scheme. It makes it clear that you put both observed and unobserved attributes into this class (this kind of joint modelling is actually often a little confusing for people who know ML but not NLP---it took me ages to explain why joint feature maps are useful because people had learnt keep x and y separate.

— Reply to this email directly or view it on GitHubhttps://github.com/wolfe-pack/wolfe/issues/75#issuecomment-41502505 .

Sameer Singh

riedelcastro commented 10 years ago

Hmm, I find Data more vague than World. I guess the World would make sense in context of the tutorial when we talk about possible worlds. Okay, +1 to XY, but let's see what others say.