|
1 | 1 | module ScientificTypesBase |
2 | 2 |
|
| 3 | +using InteractiveUtils # needed for displaying the type hierarchy with `scitype()` |
| 4 | + |
3 | 5 | # Type exports |
4 | 6 | export Convention |
5 | 7 |
|
@@ -31,28 +33,184 @@ abstract type Multiset{S} <: Known end |
31 | 33 | # AbstractVector scitype: |
32 | 34 | abstract type Iterator{Ω} end |
33 | 35 |
|
| 36 | +""" |
| 37 | + Infinite{N} |
| 38 | +
|
| 39 | +Scientific type for scalar data with an intrinsic order, but of unbounded nature, either |
| 40 | +discrete or continuous. |
| 41 | +
|
| 42 | +Subtypes: [`Continuous`](@ref), [`Count`](@ref) |
| 43 | +
|
| 44 | +See also `scitype`. |
| 45 | +
|
| 46 | +""" |
34 | 47 | abstract type Infinite <: Known end |
| 48 | +""" |
| 49 | + Finite{N} |
| 50 | +
|
| 51 | +Scientific type for scalar, categorical data taking on one of `N` possible discrete values, |
| 52 | +which may or may not have a natural ordering. |
| 53 | +
|
| 54 | +Subtypes: [`Multiclass{N}`](@ref), [`OrderedFactor{N}`](@ref) |
| 55 | +
|
| 56 | +Aliases: `Binary==Finite{2}`. Binary data can be unordered (`Multiclass{2}`) or ordered |
| 57 | +(`OrderedFactor{2}`). |
| 58 | +
|
| 59 | +See also `scitype`. |
| 60 | +
|
| 61 | +""" |
35 | 62 | abstract type Finite{N} <: Known end |
| 63 | +""" |
| 64 | + Image{W,H} |
| 65 | +
|
| 66 | +Scientific type for image data, where `W` is the width and `H` the height. |
| 67 | +
|
| 68 | +Subtypes: [`GrayImage{W,H}`](@ref), [`ColorImage{W,H}`](@ref) |
| 69 | +
|
| 70 | +See also `scitype`. |
| 71 | +
|
| 72 | +""" |
36 | 73 | abstract type Image{W,H} <: Known end |
37 | 74 | abstract type ScientificTimeType <: Known end |
| 75 | +""" |
| 76 | + Textual |
| 77 | +
|
| 78 | +Scientific type for text data playing some linguistic role, for example in sentiment |
| 79 | +analysis. This is to be contrasted with text used simply to label classes of a categorical |
| 80 | +variable; see instead [`Finite`](@ref). |
| 81 | +
|
| 82 | +Examples: survey questions with discursive answers, text to be translated into a new |
| 83 | +language, vocabularies, email messages. |
| 84 | +
|
| 85 | +See also `scitype`. |
| 86 | +
|
| 87 | +""" |
38 | 88 | abstract type Textual <: Known end |
| 89 | +""" |
| 90 | + Table{K} |
| 91 | +
|
| 92 | +Scientific type for tabular data. Here `K` will be a union of the scitypes of the columns |
| 93 | +(not the union of the *element* scitype of the columns). |
| 94 | +
|
| 95 | +See also `scitype`. |
| 96 | +
|
| 97 | +""" |
39 | 98 | abstract type Table{K} <: Known end |
| 99 | +""" |
| 100 | + Continuous |
| 101 | +
|
| 102 | +Scientific type for continuous scalar data. |
| 103 | +
|
| 104 | +Examples: height, age, blood-pressure, weight, temperature. |
| 105 | +
|
| 106 | +Supertype: [`Infinite`](@ref) |
40 | 107 |
|
| 108 | +See also `scitype`. |
| 109 | +
|
| 110 | +""" |
41 | 111 | abstract type Continuous <: Infinite end |
| 112 | +""" |
| 113 | + Count |
| 114 | +
|
| 115 | +Scientific type for discrete, ordered data, of unbounded nature. |
| 116 | +
|
| 117 | +Examples: number of phone calls per hour, number of building occupants, number of |
| 118 | +earthquakes per year over 6 on the Richter scale, number of unsaturated carbon-carbon |
| 119 | +bonds in a molecule. |
| 120 | +
|
| 121 | +Supertype: [`Infinite`](@ref) |
| 122 | +
|
| 123 | +See also `scitype`. |
| 124 | +
|
| 125 | +""" |
42 | 126 | abstract type Count <: Infinite end |
| 127 | +""" |
| 128 | + Multiclass{N} |
43 | 129 |
|
| 130 | +Scientific type for scalar, categorical data with `N` possible values but no natural |
| 131 | +ordering for those classes (nominal data). |
| 132 | +
|
| 133 | +Examples: gender, team member, model number, product color, ethnicity, zipcode |
| 134 | +
|
| 135 | +Supertype: [`Finite{N}`](@ref) |
| 136 | +
|
| 137 | +See also `scitype`. |
| 138 | +
|
| 139 | +""" |
44 | 140 | abstract type Multiclass{N} <: Finite{N} end |
| 141 | +""" |
| 142 | + OrderedFactor{N} |
| 143 | +
|
| 144 | +Scientific type for scalar, categorical data with `N` possible values with a natural |
| 145 | +ordering (ordinal data). |
| 146 | +
|
| 147 | +Includes the binary data scientific type `OrderedFactor{2}`, applying whenever it is |
| 148 | +natural to assign a "positive" class, for example, by a standard convention (e.g, "is |
| 149 | +toxic", "is an anomaly", "has the disease"). The "positive" class is the maximal class |
| 150 | +under the ordering. The distinction is important to disambiguate statistical metrics such |
| 151 | +as "number of true positives", "recall", etc. |
| 152 | +
|
| 153 | +Examples: letter grade in an exam, education level, number of stars in a review, |
| 154 | +safe/toxic, inlier/outlier, rejected/accepted. |
| 155 | +
|
| 156 | +Supertype: [`Finite{N}`](@ref) |
| 157 | +
|
| 158 | +See also `scitype`. |
| 159 | +
|
| 160 | +""" |
45 | 161 | abstract type OrderedFactor{N} <: Finite{N} end |
46 | 162 |
|
47 | 163 | abstract type ScientificDate <: ScientificTimeType end |
48 | 164 | abstract type ScientificTime <: ScientificTimeType end |
49 | 165 | abstract type ScientificDateTime <: ScientificTimeType end |
| 166 | +""" |
| 167 | + GrayImage{W,H} |
| 168 | +
|
| 169 | +Scientific type for a grey-scale image, where `W` is the width and `H` the height. |
50 | 170 |
|
| 171 | +Supertype: [`Image{W,H}`](@ref) |
| 172 | +
|
| 173 | +See also `scitype`. |
| 174 | +
|
| 175 | +""" |
51 | 176 | abstract type GrayImage{W,H} <: Image{W,H} end |
| 177 | +""" |
| 178 | + ColorImage{W,H} |
| 179 | +
|
| 180 | +Scientific type for a color image, where `W` is the width and `H` the height. |
| 181 | +
|
| 182 | +Supertype: [`Image{W,H}`](@ref) |
| 183 | +
|
| 184 | +See also `scitype`. |
| 185 | +
|
| 186 | +""" |
52 | 187 | abstract type ColorImage{W,H} <: Image{W,H} end |
| 188 | +""" |
| 189 | + Sampleable{Ω} |
53 | 190 |
|
54 | | -# when sampled, objects with these scitypes return objects of scitype Ω: |
| 191 | +Scientific type for an object, such a probability distribution, that can be sampled. Each |
| 192 | +individual sample `x` will satisfy `scitype(x) isa Ω`. |
| 193 | +
|
| 194 | +Subtype: [`Density{Ω}`](@ref) |
| 195 | +
|
| 196 | +See also `scitype`. |
| 197 | +
|
| 198 | +""" |
55 | 199 | abstract type Sampleable{Ω} end |
| 200 | +""" |
| 201 | + Density{Ω} |
| 202 | +
|
| 203 | +Scientific type for an object representing a probability density function or probability |
| 204 | +mass function, and more generally, for any probability measure that is absolutely |
| 205 | +continuous with respect to some standard measure on the sample space. Elements `x` of the |
| 206 | +sample space will satisfy `scitype(x) isa Ω`. Objects of this type can, at least in |
| 207 | +principle, be sampled. |
| 208 | +
|
| 209 | +Supertype: [`Sampleable{Ω}`](@ref) |
| 210 | +
|
| 211 | +See also `scitype`. |
| 212 | +
|
| 213 | +""" |
56 | 214 | abstract type Density{Ω} <: Sampleable{Ω} end |
57 | 215 |
|
58 | 216 | abstract type ManifoldPoint{M} <: Known end |
|
0 commit comments