Live data from Hacker News

A word for a value between 0 and 1 (inclusive)

english.stackexchange.com

261–270 of 325 posts

Re: A word for a value between 0 and 1 (inclusive)

#261
post #75

As the logic dealing with {0, 1} is named after its founder George Boole, a boolean or bool for short. I'd suggest we call a fuzzy truth value in the interval of [0,1] after its founder Lotfi A. Zadeh, a zadehan or zade for short. Edit: Fixed Bool to Boole thanks to globular-toast, my internal syntax checker must have auto corrected that one ;)

I'd only use Zadehan if it not only was a value on the interval [0, 1] but a fuzzy membership value on that interval to which the Zadeh fuzzy logic operators apply. If it was a probability value to which Bayesian operators apply, Zadehan would be a singularly inappropriate name for the type. Types aren't just ranges but they also define the valid operations (whether syntactically functions, methods, or operators) on…

Sure, we can have both a zadeh, and a bayes ;)

I'm not sure if I find Koskos argument convincing, however one could also argue that a bayes is a subtype of a zadeh ;) http://sipi.usc.edu/~kosko/Fuzziness_Vs_Probability.pdf

Re: A word for a value between 0 and 1 (inclusive)

#263
In my code, rather than use a generic term to describe the number, I try to name what it actually represents in context. For example, if I'm scoring items so I can rank them, and I need to normalize some number to do that, I'll call it a "score" or a "rank".

Calling it a "proportion" or "ratio" or "normalized" is like calling a variable "myinteger" or "myfloat". Your naming convention should be related to a variable's purpose, not its data type.

Re: A word for a value between 0 and 1 (inclusive)

#264

Weird that it's been flagged as off-topic with no explanation. "I'm looking for a word" seems very on-topic for an stack exchange about a human language.

Among the comments:

> Naming variables is expressly off-topic here. This question, and the answers to it, are the perfect showcase of why. – RegDwigнt

The link "off-topic" in the notice eventually takes you to the help center which states:

> But please, don’t ask any questions about the following topics. They are out of scope for this site.

> * Naming, including naming programming variables/classes

The question was edited, but the original version was about how to name a variable.

That said, the reason why they're not allowed is not as apparent to me as it is to the mod that made the comment quoted above.

Re: A word for a value between 0 and 1 (inclusive)

#265
post #185

Earlier quoted context omitted.

So, then the user calling the library with foo(3.5) will get a runtime error (or, ok, maybe even a compile time error). To avoid that, you need to document that the value should be between 0 and 1, and you could do that with a comment line (which the OP wanted to avoid), or by naming the variable or type appropriately: And that takes us back to the original question. (Whether the concept is expressed in the parameter…

> So, then the user calling the library with foo(3.5) will get a runtime error (or, ok, maybe even a compile time error). I'm not sure I understand this. See below, but the larger point here is that the type can never lie -- names can and often do because there's no checking on names. I think what is being proposed is something similar to newtype Accuracy = Accuracy Float and then to have the only(!) way to construct…

You're solution is the ideal one and safest, although in the interest of maximum flexibility since the goal here seems more documentative than prescriptive, it could also be as simple as creating a type alias. In C for example a simple `#define UnitInterval float`, and then actual usage would be `function FuncName(UnitInterval accuracy)`. That accomplishes conveying both the meaning of the value (it represents accuracy) and the valid value range (assuming of course that UnitInterval is understood to be a float in the range of 0 to 1).

Having proper compile time (or runtime if compile time isn't feasible) checks is of course the better solution, but not always practical either because of lack of support in the desired language, or rarely because of performance considerations.

Re: A word for a value between 0 and 1 (inclusive)

#266
post #261

Earlier quoted context omitted.

I'd only use Zadehan if it not only was a value on the interval [0, 1] but a fuzzy membership value on that interval to which the Zadeh fuzzy logic operators apply. If it was a probability value to which Bayesian operators apply, Zadehan would be a singularly inappropriate name for the type. Types aren't just ranges but they also define the valid operations (whether syntactically functions, methods, or operators) on…

Sure, we can have both a zadeh, and a bayes ;) I'm not sure if I find Koskos argument convincing, however one could also argue that a bayes is a subtype of a zadeh ;) http://sipi.usc.edu/~kosko/Fuzziness_Vs_Probability.pdf

Bayesian probability is, from a certain perspective, a fuzzy logic but the operators of Bayesian logic are not the operators Zadeh’s fuzzy logic. Since types define operators as well as values, I'd argue that a “bayes(ian)” type should be distinct from a “zadeh(an)” type, even if they might usefully have a common “fuzzy_membership” supertype.

Re: A word for a value between 0 and 1 (inclusive)

#267

Earlier quoted context omitted.

> Booleans have the same problem that we lack a plain English short word for "yes or no answer". "Binary" is the term I use. E.g., "It's not a binary proposition" to call out a false dichotomy.

Binary means that there are exactly two choices, not that the choices are yes or no.

I understand, but context typically gets you the rest of the way. We're talking about natural languages after all; this is about as good as you can hope for.

Re: A word for a value between 0 and 1 (inclusive)

#268
post #121
post #90

I don't think this is a naming issue at all. In the provided example, 'Accuracy' is the correct name for the parameter, as that's what the parameter represents, accuracy. The fact that accuracy should be given as a value in an interval from 0 to 1 should be a property of parameter type . In other words, the parameter should not be a float, but a more constrained type that allows floats only in [0,1]. EDIT: Some of yo…

While true, if your language doesn’t support such a type, then the burden for such a name goes to the parameter, does it not?

Or you could approach it another way, store the data using the full range of the system float type and normalize it to [0,1] through accessor methods.

Can float types even support 0, 1 inclusive? You just can't represent natural numbers like that with floats...

Re: A word for a value between 0 and 1 (inclusive)

#269
post #90

I don't think this is a naming issue at all. In the provided example, 'Accuracy' is the correct name for the parameter, as that's what the parameter represents, accuracy. The fact that accuracy should be given as a value in an interval from 0 to 1 should be a property of parameter type . In other words, the parameter should not be a float, but a more constrained type that allows floats only in [0,1]. EDIT: Some of yo…

I don’t understand why having the ability to describe such a type removes the need to be able to name it.

Re: A word for a value between 0 and 1 (inclusive)

#270
post #245

Earlier quoted context omitted.

Unfortunately, creating a constrained type like this isn't easy (or even doable) in all programming languages. Fortunately, my preferred programming language, Raku, makes creating this sort of subset trivially easy[0]: subset UnitInterval of Real where 0 ≤ * ≤ 1 [0]: https://docs.raku.org/language/typesystem#index-entry-subset...

In C, I wonder if you could do something with functions and macros? Say you need to represent velocity in a transportation simulation. You could have a function, velocity, that looks like this: double velocity(double v, char * of_what) You use it to wrap constrained values. E.g., double v_jogger = velocity(8.0, "human"); double v_car = velocity(65.0, "city car"); velocity() simply returns the first argument, after do…

The problem you'd have is that doing any operations on such a value could take it outside the bounds of the "type".
Post reply on HN