openavmkit.utilities.modeling
AverageModel
AverageModel(type, sales_chase)
An intentionally bad predictive model, to use as a sort of control. Produces predictions equal to the average of observed sale prices.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
str
|
The type of average to use |
sales_chase |
float
|
Simulates sales chasing. If 0.0, no sales chasing will occur. For any other value, predictions against sold
parcels will chase (copy) the observed sale price, with a bit of random noise equal to the value of
|
Initialize an AverageModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
type
|
str
|
The type of average to use |
required |
sales_chase
|
float
|
Simulates sales chasing. If 0.0, no sales chasing will occur. For any other value, predictions against sold
parcels will chase (copy) the observed sale price, with a bit of random noise equal to the value of
|
required |
Source code in openavmkit/utilities/modeling.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
GWRModel
GWRModel(coords_train, X_train, y_train, gwr_bw)
Geographic Weighted Regression Model
Attributes:
| Name | Type | Description |
|---|---|---|
coords_train |
list[tuple[float, float]]
|
list of geospatial coordinates corresponding to each observation in the training set |
X_train |
ndarray
|
2D array of independent variables' values from the training set |
y_train |
ndarray
|
1D array of dependent variable's values from the training set |
gwr_bw |
float
|
Bandwidth for GWR calculation |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords_train
|
list[tuple[float, float]]
|
list of geospatial coordinates corresponding to each observation in the training set |
required |
X_train
|
ndarray
|
2D array of independent variables' values from the training set |
required |
y_train
|
ndarray
|
1D array of dependent variable's values from the training set |
required |
gwr_bw
|
float
|
Bandwidth for GWR calculation |
required |
Source code in openavmkit/utilities/modeling.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
GarbageModel
GarbageModel(min_value, max_value, sales_chase, normal)
An intentionally bad predictive model, to use as a sort of control. Produces random predictions.
Attributes:
| Name | Type | Description |
|---|---|---|
min_value |
float
|
The minimum value of to "predict" |
max_value |
float
|
The maximum value of to "predict" |
sales_chase |
float
|
Simulates sales chasing. If 0.0, no sales chasing will occur. For any other value, predictions against sold
parcels will chase (copy) the observed sale price, with a bit of random noise equal to the value of
|
normal |
bool
|
If True, the randomly generated predictions follow a normal distribution based on the observed sale price's standard deviation. If False, randomly generated predictions follow a uniform distribution between min and max. |
Initialize a GarbageModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_value
|
float
|
The minimum value of to "predict" |
required |
max_value
|
float
|
The maximum value of to "predict" |
required |
sales_chase
|
float
|
Simulates sales chasing. If 0.0, no sales chasing will occur. For any other value, predictions against sold
parcels will chase (copy) the observed sale price, with a bit of random noise equal to the value of
|
required |
normal
|
bool
|
If True, the randomly generated predictions follow a normal distribution based on the observed sale price's standard deviation. If False, randomly generated predictions follow a uniform distribution between min and max. |
required |
Source code in openavmkit/utilities/modeling.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
GroundTruthModel
GroundTruthModel(observed_field, ground_truth_field)
Mostly only used in Synthetic models, where you want to compare against simulation ground_truth instead of
observed sale price, which you can never do in real life.
Attributes:
| Name | Type | Description |
|---|---|---|
observed_field |
str
|
The field that represents observed sale prices |
ground_truth_field |
str
|
The field that represents platonic ground truth |
Initialize a GroundTruthModel object
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observed_field
|
str
|
The field that represents observed sale prices |
required |
ground_truth_field
|
str
|
The field that represents platonic ground truth |
required |
Source code in openavmkit/utilities/modeling.py
214 215 216 217 218 219 220 221 222 223 224 225 | |
LandSLICEModel
LandSLICEModel(alpha, beta, gam_L, med_size, size_field)
SLICE stands for "Smooth Location w/ Increasing-Concavity Equation."
Attributes:
| Name | Type | Description |
|---|---|---|
alpha |
float
|
|
beta |
float
|
|
gam_L |
LinearGAM
|
|
med_size |
float
|
|
size_field |
str
|
|
...
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
|
required |
beta
|
float
|
|
required |
gam_L
|
LinearGAM
|
|
required |
med_size
|
float
|
|
required |
size_field
|
str
|
|
required |
Source code in openavmkit/utilities/modeling.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | |
LocalAreaModel
LocalAreaModel(loc_map, location_fields, overall_per_impr_area, overall_per_land_area, sales_chase)
Produces predictions equal to the localized average price/area of land or building, multiplied by the observed size of the parcel's land or building, depending on whether it's vacant or improved.
Unlike NaiveAreaModel, this model is sensitive to location, based on user-specified locations, and might
actually result in decent predictions.
Attributes:
| Name | Type | Description |
|---|---|---|
loc_map |
dict[str : tuple[DataFrame, DataFrame]
|
A dictionary that maps location field names to localized per-area values. The dictionary itself is keyed by the names of the location fields themselves (e.g. "neighborhood", "market_region", "census_tract", etc.) or whatever the user specifies. Each entry is a tuple containing two DataFrames:
Each DataFrame is keyed by the unique values for the given location. (e.g. "River heights", "Meadowbrook",
etc., if the location field in question is "neighborhood") The other field in each DataFrame will be
|
location_fields |
list
|
List of location fields used (e.g. "neighborhood", "market_region", "census_tract", etc.) |
overall_per_impr_area |
float
|
Fallback value per improved square foot, to use for parcels of unspecified location. Based on the overall average value for the dataset. |
overall_per_land_area |
float
|
Fallback value per land square foot, to use for parcels of unspecified location. Based on the overall average value for the dataset. |
sales_chase |
float
|
Simulates sales chasing. If 0.0, no sales chasing will occur. For any other value, predictions against sold
parcels will chase (copy) the observed sale price, with a bit of random noise equal to the value of
|
Initialize a LocalAreaModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loc_map
|
dict[str : tuple[DataFrame, DataFrame]
|
A dictionary that maps location field names to localized per-area values. The dictionary itself is keyed by the names of the location fields themselves (e.g. "neighborhood", "market_region", "census_tract", etc.) or whatever the user specifies. Each entry is a tuple containing two DataFrames:
Each DataFrame is keyed by the unique values for the given location. (e.g. "River heights", "Meadowbrook",
etc., if the location field in question is "neighborhood") The other field in each DataFrame will be
|
required |
location_fields
|
list
|
List of location fields used (e.g. "neighborhood", "market_region", "census_tract", etc.) |
required |
overall_per_impr_area
|
float
|
Fallback value per improved square foot, to use for parcels of unspecified location. Based on the overall average value for the dataset. |
required |
overall_per_land_area
|
float
|
Fallback value per land square foot, to use for parcels of unspecified location. Based on the overall average value for the dataset. |
required |
sales_chase
|
float
|
Simulates sales chasing. If 0.0, no sales chasing will occur. For any other value, predictions against sold
parcels will chase (copy) the observed sale price, with a bit of random noise equal to the value of
|
required |
Source code in openavmkit/utilities/modeling.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
MRAModel
MRAModel(fitted_model, intercept)
Multiple Regression Analysis Model
Plain 'ol (multiple) linear regression
Attributes:
| Name | Type | Description |
|---|---|---|
fitted_model |
RegressionResults
|
Fitted model from running the regression |
intercept |
bool
|
Whether the model was fit with an intercept or not. |
Source code in openavmkit/utilities/modeling.py
415 416 417 | |
NaiveAreaModel
NaiveAreaModel(dep_per_built_area, dep_per_land_area, sales_chase)
An intentionally bad predictive model, to use as a sort of control. Produces predictions equal to the prevailing average price/area of land or building, multiplied by the observed size of the parcel's land or building, depending on whether it's vacant or improved.
Attributes:
| Name | Type | Description |
|---|---|---|
dep_per_built_area |
float
|
Dependent variable value divided by improved square footage |
dep_per_land_area |
float
|
Dependent variable value divided by land square footage |
sales_chase |
float
|
Simulates sales chasing. If 0.0, no sales chasing will occur. For any other value, predictions against sold
parcels will chase (copy) the observed sale price, with a bit of random noise equal to the value of
|
Initialize a NaiveAreaModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dep_per_built_area
|
float
|
Dependent variable value divided by improved square footage |
required |
dep_per_land_area
|
float
|
Dependent variable value divided by land square footage |
required |
sales_chase
|
float
|
Simulates sales chasing. If 0.0, no sales chasing will occur. For any other value, predictions against sold
parcels will chase (copy) the observed sale price, with a bit of random noise equal to the value of
|
required |
Source code in openavmkit/utilities/modeling.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | |
PassThroughModel
PassThroughModel(field)
Mostly used for representing existing valuations to compare against, such as the Assessor's values
Attributes:
| Name | Type | Description |
|---|---|---|
field |
str
|
The field that holds the values you want to pass through as predictions |
Initialize a PassThroughModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
field
|
str
|
The field that holds the values you want to pass through as predictions |
required |
Source code in openavmkit/utilities/modeling.py
257 258 259 260 261 262 263 264 265 266 267 268 | |
SpatialLagModel
SpatialLagModel(per_area)
Use a spatial lag field as your prediction
Attributes:
| Name | Type | Description |
|---|---|---|
per_area |
bool
|
If True, normalize by area unit. If False, use the direct value of the spatial lag field. |
Initialize a SpatialLagModel
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
per_area
|
bool
|
If True, normalize by square foot. If False, use the direct value of the spatial lag field. |
required |
Source code in openavmkit/utilities/modeling.py
237 238 239 240 241 242 243 244 245 | |