Instead, let's do what we originally set out to do: explore the CEFs of the variables. Fortunately, we already have the necessary data structures (in other words, the index), so writing the function to find the CEF is relatively easy.
The following is the code block:
func CEF(Ys []float64, col int, index []map[string][]int) map[string]float64 { retVal := make(map[string]float64) for k, v := range index[col] { var mean float64 for _, i := range v { mean += Ys[i] } mean /= float64(len(v)) retVal[k]=mean } return retVal}
This function finds the conditionally expected house price when a variable is held fixed. We can do an exploration of all the variables, but for the purpose of this chapter, I shall only ...