Промышленный лизинг Промышленный лизинг  Методички 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 [ 80 ] 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222

Table 7.1 Common Features Describing a House

FEATURE

DESCRIPTION

RANGE

OF VALUES

Num Apartments

Number of dwelling units

Integer:

Year Built

Year built

Integer:

1850-1986

Plumbing Fixtures

Number of plumbing fixtures

Integer:

5-17

Heating Type

Heating system type

coded as A or B

Basement Garage

Basement garage (number of cars)

Integer:

Attached Garage

Attached frame garage area

Integer:

0-228

(in square feet)

Living Area

Total living area (square feet)

Integer:

714-4185

Deck Area

Deck / open porch area (square feet)

Integer:

0-738

Porch Area

Enclosed porch area (square feet)

Integer:

0-452

Recroom Area

Recreation room area (square feet)

Integer:

0-672

Basement Area

Finished basement area (square feet)

Integer:

0-810

Training the network builds a model which can then be used to estimate the target value for unknown examples. Training presents known examples (data from previous sales) to the network so that it can learn how to calculate the sales price. The training examples need two more additional features: the sales price of the home and the sales date. The sales price is needed as the target variable. The date is used to separate the examples into a training, validation, and test set. Table 7.2 shows an example from the training set.

The process of training the network is actually the process of adjusting weights inside it to arrive at the best combination of weights for making the desired predictions. The network starts with a random set of weights, so it initially performs very poorly. However, by reprocessing the training set over and over and adjusting the internal weights each time to reduce the overall error, the network gradually does a better and better job of approximating the target values in the training set. When the appoximations no longer improve, the network stops training.



Table 7.2 Sample Record from Training Set with Values Scaled to Range -1 to 1

FEATURE

RANGE OF VALUES

ORIGINAL

VALUE

SCALED

VALUE

Sales Price

$103,000-5250,000

$171,000

-0.0748

Months Ago

0-23

-0.6522

Num Apartments

-1.0000

Year Built

1850-1986

1923

+0.0730

Plumbing Fixtures

5-17

-0.3077

Heating Type

coded as A or B

+ 1.0000

Basement Garage

-1.0000

Attached Garage

0-228

+0.0524

Living Area

714-4185

1,614

-0.4813

Deck Area

0-738

-1.0000

Porch Area

0-452

-0.0706

Recroom Area

0-672

-1.0000

Basement Area

0-810

-0.5672

This process of adjusting weights is sensitive to the representation of the data going in. For instance, consider a field in the data that measures lot size. If lot size is measured in acres, then the values might reasonably go from about Vs to 1 acre. If measured in square feet, the same values would be 5,445 square feet to 43,560 square feet. However, for technical reasons, neural networks restrict their inputs to small numbers, say between -1 and 1. For instance, when an input variable takes on very large values relative to other inputs, then this variable dominates the calculation of the target. The neural network wastes valuable iterations by reducing the weights on this input to lessen its effect on the output. That is, the first pattern that the network will find is that the lot size variable has much larger values than other variables. Since this is not particularly interesting, it would be better to use the lot size as measured in acres rather than square feet.

This idea generalizes. Usually, the inputs in the neural network should be smallish numbers. It is a good idea to limit them to some small range, such as -1 to 1, which requires mapping all the values, both continuous and categorical prior to training the network.

One way to map continuous values is to turn them into fractions by subtracting the middle value of the range from the value, dividing the result by the size of the range, and multiplying by 2. For instance, to get a mapped value for



Year Built (1923), subtract (1850 + 1986)/2 = 1918 (the middle value) from 1923 (the year the oldest house was built) and get 7. Dividing by the number of years in the range (1986 - 1850 + 1 = 137) yields a scaled value and multiplying by 2 yields a value of 0.0730. This basic procedure can be applied to any continuous feature to get a value between -1 and 1. One way to map categorical features is to assign fractions between -1 and 1 to each of the categories. The only categorical variable in this data is Heating Type, so we can arbitrarily map B 1 and A to -1. If we had three values, we could assign one to -1, another to 0, and the third to 1, although this approach does have the drawback that the three heating types will seem to have an order. Type -1 will appear closer to type 0 than to type 1. Chapter 17 contains further discussion of ways to convert categorical variables to numeric variables without adding spurious information.

With these simple techniques, it is possible to map all the fields for the sample house record shown earlier (see Table 7.2) and train the network. Training is a process of iterating through the training set to adjust the weights. Each iteration is sometimes called a generation.

Once the network has been trained, the performance of each generation must be measured on the validation set. Typically, earlier generations of the network perform better on the validation set than the final network (which was optimized for the training set). This is due to overfitting, (which was discussed in Chapter 3) and is a consequence of neural networks being so powerful. In fact, neural networks are an example of a universal approximator. That is, any function can be approximated by an appropriately complex neural network. Neural networks and decision trees have this property; linear and logistic regression do not, since they assume particular shapes for the underlying function.

As with other modeling approaches, neural networks can learn patterns that exist only in the training set, resulting in overfitting. To find the best network for unseen data, the training process remembers each set of weights calculated during each generation. The final network comes from the generation that works best on the validation set, rather than the one that works best on the training set.

When the models performance on the validation set is satisfactory, the neural network model is ready for use. It has learned from the training examples and figured out how to calculate the sales price from all the inputs. The model takes descriptive information about a house, suitably mapped, and produces an output. There is one caveat. The output is itself a number between 0 and 1 (for a logistic activation function) or -1 and 1 (for the hyperbolic tangent), which needs to be remapped to the range of sale prices. For example, the value 0.75 could be multiplied by the size of the range ($147,000) and then added to the base number in the range ($103,000) to get an appraisal value of $213,250.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 [ 80 ] 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 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 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222