func (lr *LogisticRegression) SetupNumbericPredictorMap() {
	for i, rt := range lr.RegressionTable {
		m := make(map[string]float64)
		for _, np := range rt.NumericPredictor {
			m[np.Name] = np.Coefficient
		}
		lr.RegressionTable[i].NumericPredictorMap = &m
	}
}
create map for containing numeric predictor
package goscore
import (
	"encoding/xml"
	"errors"
	"math"
)
type PMMLLR struct {
	LogisticRegression LogisticRegression `xml:"RegressionModel"`
}
type LogisticRegression struct {
	NormalizationMethod string            `xml:"normalizationMethod,attr"`
	Fields              []MiningField     `xml:"MiningSchema>MiningField"`
	RegressionTable     []RegressionTable `xml:"RegressionTable"`
}
type RegressionTable struct {
	Intercept           float64            `xml:"intercept,attr"`
	TargetCategory      string             `xml:"targetCategory,attr"`
	NumericPredictor    []NumericPredictor `xml:"NumericPredictor"`
	NumericPredictorMap *map[string]float64
}
type NumericPredictor struct {
	Name        string  `xml:"name,attr"`
	Coefficient float64 `xml:"coefficient,attr"`
}
type NormalizationMethodMap func(map[string]float64) (map[string]float64, error)
var NormalizationMethodMaps map[string]NormalizationMethodMap
func init() {
	NormalizationMethodMaps = map[string]NormalizationMethodMap{}
	NormalizationMethodMaps["softmax"] = SoftmaxNormalizationMethods
}
func SoftmaxNormalizationMethods(confidence map[string]float64) (map[string]float64, error) {
	if confidence != nil {
		result := map[string]float64{}
		tempExp := []float64{}
		for _, v := range confidence {
			tempExp = append(tempExp, math.Exp(v))
		}
		sum := 0.0
		for _, j := range tempExp {
			sum += j
		}
		i := 0
		for k, _ := range confidence {
			result[k] = tempExp[i]
			i += 1
		}
		return result, nil
	}
	return nil, errors.New("feature is empty")
}
func NewLogisticRegression(source []byte) (*LogisticRegression, error) {
	pmml := PMMLLR{}
	err := xml.Unmarshal(source, &pmml)
	if err != nil {
		return nil, err
	}
	return &pmml.LogisticRegression, nil
}
func (lr *LogisticRegression) Score(args ...interface{}) (string, map[string]float64, error) {
	features := map[string]float64{}
	voting := true
	for _, arg := range args {
		switch t := arg.(type) {
		case map[string]float64:
			features = t
		case bool:
			voting = t
		default:
			return "", nil, errors.New("Unknown argument")
		}
	}
	confident := lr.RegressionFunctionContinuous(features)
	if !voting {
		return getMaxMap(confident), confident, nil
	}
	var normMethod NormalizationMethodMap
	if lr.NormalizationMethod != "" {
		if _, ok := NormalizationMethods[lr.NormalizationMethod]; !ok {
			return "", nil, NormalizationMethodNotImplemented
		} else {
			normMethod = NormalizationMethodMaps[lr.NormalizationMethod]
		}
	}
	prob, err := normMethod(confident)
	if err != nil {
		return "", nil, err
	}
	return getMaxMap(prob), prob, nil
}